There is a group of us that have been sitting on a concept for the last couple of years that we're finally starting to flesh and design. Of course, we all feel that what we're proposing to create will re-shape MMORPG gameplay as we know it today.

We're wanting to develop a system that would compete with the biggest MMORPGs on the market today: Dark Age of Camelot, EverQuest II, City of Heroes.

The question is: could we use, and rely on, java technologies to write such a graphical and bandwith intensive game? I've been reading through the other posts and what I've gathered is that this new gaming architecture supplied by Sun is mostly being used for mid-scaled games (1st person shooters, single player, and classic models).

I would love to be able to Java, but I'm worried about performance issues.

Yes it is possible, but keep in mind that writing something like EverQuest II in java will be a huge jump from what currently exists.

From my understanding (I have never played DAoC but I was over at a friends house and watched him play for what seemed like 3 hours) DAoC has graphics similar to EQ1?

If I am right, then I think you should first try to develop somthing like DAoC or EQ (graphics wise, you don't have to copy the gameplay obviously) that can play on can play on a system with low requirements. EQ in its intial release ran perfectly on my 256 mb computer with a 32mb graphics cards. I think writing a graphics engine that has EQ (or a similar game) like graphics in Java that can run on a computer with 256 mb and a 32mb graphics card should be your first step.

Right now there are Java games out there with graphics like that, but they require more powerful systems to run on than would the same game if programmed in C/C++. Before you go about developing graphics like those in EQII, first try to make EQ1 graphics that can run on the recomended requirements for EQ1 in its initial release.

Sun is working on making Java better for game programming, and communities like these certainly give them an incentive. I think eventually Java will catch up to C/C++ but it will surpass it because Java is much easier to use and quicker to write with.

If you knwio what youa re doing, then modern J2SE VMs can deliver the same performance over-all as C/C++

There are techniques that are faster in C then in Java, and techniques that are faster in Java then C. It jus t a questio nof knowing the strengths of your coding environment and coding to them.

Garbage colelction used to be something yo uhad to eb careful of but, frankly, I am not seeing it as a problem in any code Ive written since late JDK1.4/JDK1.5. With justa slight repidation Im going to sugegst that that nut has finally been cracked by the VM teams.

Java does tend to require a bit more memory still, but in these days of games that require 1 gig (Matrix Online) its getting to pretty much be noise level.

The really amazing thing about Java is the time it saves you in Q&A and the srength of the prosduct released. We colelcetd so mstistics from develoerps a few years abck and crunched them and found that the average Java game team spent less then 5% of their total productio time in Q&A. COmapre that with C code...

Secondarily, with a small bit of tuning/debugging work, its more or less portable to the mac and Linux which is a nice little plus. OTOH it is nto yet portal to the game concsoles, which IS an issue for some game developers that those of us in the Game Technolgoies Grou pat Su nare (painfully) aware of.

Now the formula changes when you go down to J2ME and cell phones. If you want the state of that space, let me knwoa s its a whoel other discussion.

Java is also a good language for server development. The GTG's Sun Game Server project is more or less pure Java. However again there are tricks to getting the best server performance our of Java. Big oens are that you want to use NIO's sockets, for which there is soem learnign curve, and NIO Buffers to implement a copy-free stack.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

Any chance you can explain what you mean by a copy-free stack? Am I correct in guessing that it means that you dont parse game commands/packets out of the buffers and create object of them, but instead let your logic work directly on the buffer?

Any chance you can explain what you mean by a copy-free stack? Am I correct in guessing that it means that you dont parse game commands/packets out of the buffers and create object of them, but instead let your logic work directly on the buffer?

Thanks

Yes but it goes a bit further.

Any sufficiently compelx and well archietcetd server system is going to have multiple wrapped protocol layers in the game packets. The trick is to do all you un-wrapping and parsing so that you never have to copy the data. The same is true for data you send. NIO Buffers have the facilities to let you do this.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

The first is the slice() method. The slice() method makes a new buffer that is a subset of the old buffer and shares its data. So when you are parsing nested protocols you can read the ehader of the outermost layer, slice to get a new buffer that starts at the next-in header, and pass that to the next layer of code.

If your headers are fixed though you cna actually use something called "scatter loading" which allows you to take onebit stream and read it into a set of buffers in one op. This can automatically sep4rate thinsg for you.

Similarly, and important to the exampel I gave above, there is a "scatter send." So rather then having to wrap the exisiting data in a new buffer in order to add a heaer at the front, you cna just inster that header in the front of a list of packets and then ask NIO to send the entire list as one packet.

Look at the NIO docs for Buffers and SocketChannel for more info.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

Sometimes it feels like I'm the only person on the planet who actually uses scattering, so a warning:

Quote

If your headers are fixed though you cna actually use something called "scatter loading" which allows you to take onebit stream and read it into a set of buffers in one op. This can automatically sep4rate thinsg for you.

Doesn't really work on Sun's JVM's. Haven't retested on java 5 yet, but java 1.4.x scattering/gathering is the slowest op you can do - you can go via the CPU with a manual scatter/gather faster in all cases (and exponentially faster in increasing number of scatter/gather targets) with your own software implementation.

So, the message is: never trust Sun's NIO implementation . Always be careful to benchmark, because repeatedly these things that "should be" faster aren't, and 99.9% of people on the net talking about them have never used them (have a look at the docs and what they say about indefinite blocking, then look at what Sun's own code does!). No, really - I've caught several people out who like to teach others about them but don't publically admit they've never tried them themselves. Gah.

Quote

Similarly, and important to the exampel I gave above, there is a "scatter send." So rather then having to wrap the exisiting data in a new buffer in order to add a heaer at the front, you cna just inster that header in the front of a list of packets and then ask NIO to send the entire list as one packet.

Somewhere in the networking forums here from around a year ago is a thread with source for a test program to demonstrate how slow Sun's impl is - although there may well be a bug or two in that copy.

Still Id love to see your numbers and test backing this up as it makes very little sense to me and, if true, sounds like a major bug that shoudl be reported....

I already told you where you could find sample code and examples of test runs.

And yes, I did report this as a bug with Sun circa 12-18 months ago - but IIRC no-one @ sun picked it up (apologies if this is wrong, and they fixed it and told me it had been fixed - I log quite a lot of java bugs, and the (currently) often very slow response times (didn't used to be like this ) mean these days I often lose track of which bugs have been responded to and which have been ignored)

Um, Dude, I really don't care if you read it or not! It was an FYI - you said you didn't believe it, I pointed you in a direction you could check for yourself. I've warned the OP about the problem (and any other readers), and that's all I wanted to do.

Quote

If you want it taken seriously you need to provide the test case.

Well, if you want to be taken seriously maybe you should use search/google more often?

The first is the slice() method. The slice() method makes a new buffer that is a subset of the old buffer and shares its data. So when you are parsing nested protocols you can read the ehader of the outermost layer, slice to get a new buffer that starts at the next-in header, and pass that to the next layer of code.

I guess you always use big endian byte ordering, as otherwise bugs like 4715166 are intensely irritating.

The first is the slice() method. The slice() method makes a new buffer that is a subset of the old buffer and shares its data. So when you are parsing nested protocols you can read the ehader of the outermost layer, slice to get a new buffer that starts at the next-in header, and pass that to the next layer of code.

I guess you always use big endian byte ordering, as otherwise bugs like 4715166 are intensely irritating.

Since I am not sure about the legal implications I will not provide a link unless blah says it is ok.

Should be fine, so long as it isn't distributing other peoples copyright (e.g. so long as it doesnt have the entire lineage client + graphics + sound files available for download!). We can always remove it later if it turns out to be a problem.

Some MMOG's legal depts try to threaten people who run shards, but I'm not convinced of any illegality invovled; the only law they're really breaking is that of trademark, if they "pass off" themselves as the official servers. Short of that, its nearly always legal, despite what Sony et al would like you to believe. Sigh. Fscking lawyers

Since I am not sure about the legal implications I will not provide a link unless blah says it is ok.

Should be fine, so long as it isn't distributing other peoples copyright (e.g. so long as it doesnt have the entire lineage client + graphics + sound files available for download!). We can always remove it later if it turns out to be a problem.

Some MMOG's legal depts try to threaten people who run shards, but I'm not convinced of any illegality invovled; the only law they're really breaking is that of trademark, if they "pass off" themselves as the official servers. Short of that, its nearly always legal, despite what Sony et al would like you to believe. Sigh. Fscking lawyers

Speaking of which you better make it clear that you are NOT a lawyer or speaking as one. At least in the US it is distinctly illegal for non-lawyers to give legal advice. Never mind the moral implications of someone following non-expert opinion.

A legal theory that has been advanced here in the US is that the organization of a packet constitutes an "organization of information" protectable under copyright. So you MAY violate copyright just by copying the packets.

But again I am not a lawyer and this does not consitute legal advice. If you need legal advice in the US I suggest you call your local bar association and get a referral to a qualified attorney.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

Overkill, speaking legally, there is also a piece of law which supercedes all other law in the U.S., which states:

"Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof; or abridging the freedom of speech, or of the press; or the right of the people peaceably to assemble, and to petition the government for a redress of grievances. "

Which guarantees that it cannot be illegal for you to link to, or describe, the Lineage 2 freeshard server software that you mentioned.

I am not a lawyer and I am not giving legal advice, but if you can read the plain English above then you don't need a lawyer

BTW. illegal 'laws' are frequently enforced in the US so your mileage may vary. *Cough* DMCA *Cough*

Speaking of which you better make it clear that you are NOT a lawyer or speaking as one. At least in the US it is distinctly illegal for non-lawyers to give legal advice. Never mind the moral implications of someone following non-expert opinion.

Shrug. Thanks for the warning but I'm confident it's irrelevant here. They have a hard enough time in the US taking people to court for deliberate uncontested attempts to manipulate stock prices by giving out fake legal advice whilst passing-off as a legal firm; sueing for voicing an opinion in an anonymous online forum with people you don't even know exist let alone have ever met? I doubt it. The law enshrines and assumes various things, including to an extent the opportunity to take corrective action when in error.

Moral implications? Given that in each case someone's lawyer has to lose - i.e. statistically speaking your lawyer only has a 50% probability of knowing what they're talking about, despite the piece of paper on the wall? Ha.

**ALL, sinice I don't know the legality of this code, I have removed the links. I know you can find these if you really want to but please, if there is any question as to the legality of what you are posting, err on the side of caution and don't.

@all:Has anyone looked at the source?If so what grade would you give it for 'source code quality'?(i.e. good oop, comments, structure)Since I like to learn from examples it would really help to know.thanks!

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org