Java people, don't waste your time!

The other thing to point out when comparing Swing apps to native ones in terms of speed and memory, is you are not comparing like for like. The native components and events, etc, etc have allready been loaded by the operating system when that starts up. I personally think Windows is a massive memory hog strangely requiring double the memory each release from the last release, yet you don’t here people bitching about it all the time.
Actually, you do…
The point is, if Windows loaded all the Swing classes into memory when it loaded and the JVM just used the memory versions, many more would not complain about startup speed or memory hogging.

I have recently been converted to IntelliJ for my IDE and I dare say its at least as fast as Eclipse - it certainly starts a hell of a lot faster than Eclipse does and I never find myself waiting for the IDE to catch up with me. I’m running all this on a 900Mhz Duron with 512MB Ram and on MacOSX with 256MB Ram. Don’t even get me started on how obscenely slow SWT is on OSX, whereas IntelliJ most certainly runs as fast as any native application on the platform (running OSX 10.2.2).

I have no complaints about Swing outside of certain holes within its design. Will it chug on machines with less ram? Absolutely - but so will any game that I’m currently working on as well, so I don’t fault it for that. So long as Swing runs well on any machine that’s running modern games (most of which require 256MB ram) - I consider it more than fast enough.

Most modern Swing GUIs are finding themselves hardware accelerated (IntelliJ for one) so I don’t really see what all the fuss is about… unless you’re running on a machine that you can barely run applications on - its fine performance wise.

Note anyone using Swing to make a game is truly wandering down the wrong path… the API makes it pretty clear in its complete lack of assistance for anything even resembling a sprite that its not to be used for games. It would be like writing a game entirely with visual basic controls. Sure you could, but it would show a complete lack of … well … good sense.

Swing is indeed unusable on a p166/32MB (I tried). But with every month the average installed user machine gets faster, but Swing doesn’t seem to use more ressources from one release to the next, indeed it seems to get faster with every release. So Swing has the future. On my machine at home I have no real problem with JBuiIder6 or Swing in general.

I have never tested using Swing Components as sprites, using images seems easier, so why bother? But I have tested a JScrollPane to display a 2D playfield with some sprites and that worked very nicely. But I doubt the ScollBars would be used much to scroll in the playfield, so they possibly only waste screen space.

Actually I like a good debate on C++ and Java. I will be starting a new job in January and I will be writing C and C++ for real time systems. I have been programing in Java for quite about 3 years (still consider myself a novice) and I rather enjoy the language.

I want to learn about Massively Multiplayer Online Game development and I was wondering wether to do it in C++ (help with new job) or in Java (keep up existing skills). I want to make it fast and efficient, so performance is a must.

I have heard so many conflicting opinions. The debates are very good. I am hearing that Java is getting much faster now with newer versions of the JVM. The main thing that dissapoints me is the lack of GOOD text books around for Java game development.

Thanks trentboy for sparking a good debate.

Sefrin

Well Sefrin its really a tossup. If you have a team of C++ gurus it would make sense to do it in C++. I’ve become a Java programmer exclusively over the past 6 years so I’ve been building mine in Java. Before JDK1.4 it would have been nearly impossible to build a scalable server infrastructure in Java, but with JDK1.4 and NonBlocking Sockets - you can most assuredly give any C++ based server a run for its money easily, and with a hell of a lot less chance of crashes due to memory issues.

When your talking about a Massive Multiplayer Online Game you don’t need to limit yourself to choosing java or c++. We use Java for our client and C++ for our server. Memory leaks are not nearly as hard to control on the server end as they are for the game client itself. We do this because my expertise is with java and my partner is a c++ guru.

As far as java not being up to snuff for fast realtime gaming action this is both correct and false. It is my understanding that neither Mac or Linux support accelerate images at this time. Under Windows, upgrading to java1.4, our rts battle engine improved significantly from about 15fps, on a p3800mhz system in 1024x768-16bit mode to about 60fps. We get this frame rate while displaying 160 units, dozens of tree, building, landscape sprites, ground tiles, a game interface complete with radar, selection icons, orders panel, multiplayer communications and much more. about what you would see in the Age of Empires game. I’m even able to play the game on my old p2-350 system with a frame rate usually above 30fps, so to say that java can not be make commercial quality games is non-sense.

People that are using java 1.4 and who are getting performace hits are likely doing something wrong. You can’t blame java because there are many java games and/or code that prove java is a commericially viable language.

Would I like to see sun come out with a static compiler? definately. Jet is not a good substitue simply because it still needs Suns jre packaged with it and it is a beast to get all the settings working 100% correctly. Plus Jet is still using byte code and if you haven’t check it is rather expensive.

I think Jet’s gotten a bit cheaper now.

Strange you’ve done the client in Java and server in C++ - most people would do it the other way round!

If you’re stuck for graphics acceleration under all platforms try the LWJGL http://java-game-lib.sourceforge.net. Yes, so it’s not pure Java, but there’s no need to be brainwashed into making things pure Java if it’s going to hurt your project…

Cas :slight_smile:

Yep everything has worked out good using java for the client and c++ for the server. We do plan to port our client to all platforms but our server is stuck on a Windows system for at least the next year or so (we used C++ builder, no linux compiler yet).

I’ll have to check out the LWJGL. but wouldn’t it be nice if Sun came out with static compilers for all the different platforms :slight_smile: (top 3 anyway). Is Sun secretely working on this…one would hope. If they did come out with a nice compiler for java I feel they would have a good arguement for “why would anyone use anything but Java”…

I certainly hope that Sun never wastes their time to make static compiler’s for multiple platforms. Their efforts are more effective if they concentrate on improving VM performance and general JRE improvements. Things like shared VM’s or sharing and possibly caching compiled classes (particularly for the JRE classes), improving startup time (which the previous ideas would help with), etc.

Statically compiling the code really doesn’t accomplish much. Essentially you bundle much of the VM’s features in the executable anyway, since the compiled code must still handle garbage collection, bounds checking, checking that casts are valid, and that references aren’t null… the language itself is tied to these features. If the program is a single .EXE file a single .JAR or a collection of .class files ultimately makes little difference. In either case the end user double clicks an icon, the program runs, and that is that. Companies that aren’t convicted monopolists are shipping the operating system so it has modern Java ready to go. (e.g. Apple and I think most Linux distributions.) Web Start is available on all of these platforms as well.
There is little incentive to compile to native code. The speedups are marginal and the other gains are few. Note that few games are built into a single .EXE file these days anyway, and they aren’t immune to decompiling or hackers by a long shot. So the only effect of static compilation is a slight performance improvement and losing platform independence, unless you can find a static compiler for all platforms that support Java and take the time to build all of the platform specific versions.

Native code is always required at some level, but the benifits in terms of reliability and development time that Java offers isn’t going to go away. The whole basis of such things as garbage collection and array bound checking are to let the computer do the work. Less mundane work for the programmer translates directly into shorter development cycles and/or more time spent on improvng the code and project in general. Games are no less likely to benefit from this than any other programming project. The focus shouldn’t be to find ways to avoid the VM, it should be concentrating on ways to improve the VM.

I have an 800 Duron. Someone else has a 2 GHz Pentium.

What I would like to see from java is that it can actually optimize the byte code that is is given to the machine it is running on. JIT compiling can give potentially give you this, why are we so unsure that Java™ cant?

I think the difference is that static compilation is within reach (through GCJ, for example) of most people here, while improving the JVM is an abstraction that has frusterated many in this community who have tried.

Yes, fundamentally when people talk about the advantages of the JIT technique the words “potentially” and “theoretically” are still being used regularly.

Sun’s server VM is quite fast but rather dissappointingly has turned out to be no faster than Jet for every application I’ve tried (and specifically, for games). And of course Jet suffers no warmup time where it runs like a dog.

A lot of Java’s supposed performance comes from garbage collection cleverness, and Jet does rather less of this than the Sun VMs because it’s now got escape analysis. And of course, if the Jet team use a very similar GC technique to the Sun VM then they’ve already clawed that whole advantage away from the JIT and it’s purely down to how well you can optimise chunks of code. Right now it looks like static optimisation with relatively unlimited time to think about it is proving to be as fast or faster than dynamic JITting hotspots, and produces code with no warmup time. The clever OO optimisations that the server VM is doing are more than clawed back by more aggressive static compilation techniques.

Especially for client-side games, where we don’t like to produce much garbage due to non-deterministic GC timing, and where we want the fastest code there is, on startup.

I conclude:

  1. Leave native compilation to another company, who are good at it, and deserve the business

  2. Leave JIT ideas to Sun, who are good at it, and will probably one day manage to get a VM out which performs better than native, but not for a good long while yet

Cas :slight_smile:

[quote]You think that a software house will ever use Java for a graphics engine? Have you seen many commercial titles bult entirely on Java 1.4? Not in a milion years.
[/quote]
Hi trent, seen this?

http://www.2nu.com/Wayne/SplattJava/SplattJava480x300.html

Add two years and another thousand gigahertz to the machina - still think no-can-do?

As nice as it looks, it technically dated. It’s a raycaster. As i mentioned in another thread, i would like to see something like the quake (even quake1 would be fine) engine to be implemented in Java.
The closest thing i could find was this:
http://www.jpct.net/download/jpctdemo.zip

…but that’s not using hardware acceleration.

Quake in Java was done a long time ago, JQuake(1997), unfortunately ID stamped on it.

This turned into Frag Island, which stopped working years ago, I presume the models and maps were removed, but I don’t know why - it might have just been the server people doing this accidentally. But I doubt the server side scripts/java are running even if the maps & models were replaced.

Frag Island was written by 2 very good coders from the ST/Amiga days, Nicolas Thisell & Andreas Suurkuusk (Or simply Nik & Jas).

However I do remember having one or two goes on it, unfortunately the multiplayer system had been broken so I just wondered around the map a few times.

Was it as good as the original ID Quake engine?

Yes although they obviously cut some corners.

The question is why has no one continued writing in Java “products” of this sort.

A lot of it stems from the fact that the (European) demo crews abandoned Java a long time ago, simply because Sun obviously had no intention of fixing the problems with it. (And still don’t.)

Technology also plays its part, you want to fuss about writing software renders or enjoy the life of 3D hardware - to which we already know the answer!

Try doing a search for “Digital Nerds” (Look out for “Flow” and “Apex”) or "Yodel"s “I”. Mostly they only work in IE with M$ JVM’s.

But again they are rather old and are DEMOS not games (they are no longer the same thing). They are also just conversion of work done on the Amiga (as anyone will know if they have seen Scoopex’s Super Auto Drome or 1000%).


Woz.

The reason why there are not a lot of big games programmed in Java is not so much performance, but lies in the fact that Microsoft pretty much owns the gaming PC industry (and in the near feature they seem to be winning yet another console war, Sega allready lost it, Nintendo will be next).

Everybody who works with linux, still has a dual boot machine just in order to play games.

So why would gaming companies worry about multiplatform games ?

Having said that, programming small games in Java can be a lot of fun, but it probably won’t make you rich …

I have enjoyed writing a small game myself and it rocks, at least if you have some friends to play it against …
(http://allserv.rug.ac.be/~jpwinne/bombman.html)

Don’t get me wrong, I AM a Java lover. But the world is allready owned by Bill.

jpwinne

Bah! Defeatist!

I’m clawing my bit of the world back from Bill. Like a nation grown fat and complacent he can’t look after his borders enough. The Sacking of Redmond will go down in history one day, and I’m one of the hairy barbarians.

hic

Cas :slight_smile:

51.de
I just read that a judge ordered M$ to ship the Sun-JVM with Windows. Sure M$ will fight that decision, but it is cool nevertheless.

Hence see my post in this forum ;D