Advertisement

[java] Java game server

Started by May 01, 2000 08:20 PM
9 comments, last by kill 24 years, 7 months ago
Hi. I''m developing an online game. I am still in the process of making the decision which language the server will be written on. I like java for a number of reasons, however, I am concerned with speed. Here''s my question: If Quake III Arena server was written on java, would it still be realistic to play quake? Is it realistic to write a fast paced action game server on Java? If possible, please back up your replies by some data (any links, or recalls of what u''ve read will be very usefull). Thanx
Hi Kill,

Good luck on your venture.

I think you''ll find that networking speed will be the least of your troubles (use DatagramSockets and some prediction algorithms). The question should really be "Are the Java graphics classes fast enough?" . The answer would then be NO by a long shot for Quake style or any 3D game. This has always been a niggling problem with the language as far as gamedev''s are
concerned. There is no support for decent hardware acceleration unless you would want to go proprietory (with COM) and utilise DirectX with Microsoft''s implementation of Java. If you are really serious about developing multi-player FPS games you should use Visual C++ instead and code using either the many 3D APIs available. It won''t be easy since I''m already struggling with DirectDraw alone. You could try the OpenGL support in Java but I doubt you''d get any speed on the average PC since I don''t think its accelerated.

This is all just a pity really since the Java language is so well designed and would cut down development time. I suppose you can''t have everything in life. If you want the big bucks you gotta work for it =)

At the moment I''m putting the finishing touches to a real-time multi-player graphical RPG (2D) and will be posting a link to it soonish. The java.net and ODBC classes have been a joy to work with. The only problem is that I have to work a little bit harder to solve various issues with graphics.

- iTCHY
Advertisement
iTCHY, he''s not talking about the graphics, he''s talking about the networking server, like the dedicated server in Quake. It doesn''t need to do any kind of graphics ( aside from perhaps some management/monitoring ).

I think you could get away with doing it in java, as long as you don''t need too much performance. Java isn''t too fast, but if done right not too slow either.


#pragma DWIM // Do What I Mean!
~ Mad Keith ~
**I use Software Mode**
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
Actually Java is faster(in some parts) than C++ in things without graphics... If you count in all ready made networking functions I would really recommed it. You can correct me if I''m too wrong, but I have gotten view from somewhere that Java is really partly faster than C++ when you don''t have ANYTHING to do with graphical viewing, just those console thingies.

Time comes, time goes and I only am.
Guess it depends on what you''re doing. I find in general java straight from the jdk performs worse off in all areas than c or c++ does.

For comparison, a bunch of calculations and a tiny bit of console output I just wrote took 2.63 sec in c, and 3.04 sec in java (average values of 3 trials).

I wouldn''t say it was faster...but its not much slower. Java (i''ve found) just tends to be a pain because there''s about a .3 second wait from when the program starts, to when it actually does the first part of the program.

That''s most of the time diff; once its running it compares pretty well to c or C++ (only tried on linux & win 95 tho).
If you''re really concerned about speed, then compile the server into native byte code. The clients'' speed will depend on their connection and h/w setup.
Advertisement
One thing which camed to my mind from Jim_Ross''s post is that there are many other factors that just the speed of your programming language so you can easily just tend to look after their pros&cons. Look, clients speed, lag which comes from moving packages from place to other speed. Packet size, clients connection, server speed, overloading, game''s multiplayer compatibility so how it handles the packets so that it can move smoothly.

Time comes, time goes and I only am.
Al least on server-side, non-graphical execution Java performance can be equal to that of C++ code. Because many of you probably won’t take my word for it…

http://www.ibm.com/java/education/javahipr.html

Some of the ways to increase Java performance on the server include alternative VM’s such as Oracle’s VM, IBM’s Jalapeno and Sun’s Hotspot.

IBM’s Jalapeno: http://www.research.ibm.com/journal/sj/391/alpern.html
Sun’s Hotspot: http://www.javasoft.com/products/hotspot/index.html

Java’s server side execution is only getting faster. I have even read articles that predict that Java server-side execution will exceed C++ in the future as new features such as dynamic memory optimization are implemented into next generation virtual machines.

I have run across a case study from IBM where Java was being used as the back end for a multiplayer game from Redstorm (who brought you such hits as Rainbow 6):

http://www-4.ibm.com/software/developer/casestudies/story-redstorm.html

Of course, if you are an amateur game developer, then speed is probably not your biggest concern – ease of development is. I think that there are enough references available to show that Java is sufficiently fast enough to be used in the development of a game server. You may not be able to support 2000 active players, but if you are an amateur that is probably an unreasonable goal any way.

On the subject of graphics, it is possible to develop 3D based games in Java, just don''t expect Unreal Tournament. If you are looking for accelerated OpenGL for Java check out the list of OpenGL extensions on the FAQ page. I have even had some limited positive results building my own game in Java 3D, though it’s a little too early to declare the effort a success.

http://games.cpbinc.com/faq/

I just made a plain-jane socket server in Java to test something out. First I used J++ (ick) and then whatever random Java is on the Sun (can''t figure it out).

Both servers leak memory.

Java is not as fast as C/C++ because is must be interpreted, even when it is compiled by a vm it still will not be as fast. Still, java is capable of impressive 3d graphics and like some of the other guys said, there are opengl/direct3d/glide api''s to java to use hw acceleration. I have been developing a 3d engine in java for some time now that runs at about 25 frames persecond at 400 by 300 on a pII 450 in a full quake like world purly in software. As the average processer speed continues to increase I think there will be more and more smaller yet impressive games being developed in java because of the flow of the language and instant portability.

-Kris

This topic is closed to new replies.

Advertisement