Starting Java 2d game, need advice.

I’m not a newbie to programming or java but when it comes to java game programming I am truely a new born. I’ve made games in Direct3D, OpenGL, Windows GDI, blah blah blah and I’ve worked as a java programmer for about 5 years now on enterprise level apps. Ok so I got some of the basics down.

In java apps I’ve coded they were all buisness apps so there were never any issues with screen refreshes ect. But now I want to expand my knowledge a bit and experiment with some AI stuff.

I was wanting to make a simple applet/application like the Zombie Infection Simluator. The graphics would essentially be one pixel, each color representing people, zombies, werewolves, whatever. The ZIS is writting in something called Processing which is a simplified language that gets translated to java and then ran. I’m not quite sure what it uses but its bascially there to hide the java from the programmer. But since I don’t fear most of Java I figured it would be good enough to just try and figure it out on my own.

So heres what I was thinking about:
Graphics wise it would be very simple, either a pixel or a small sprite. The various Zombie Infection Simulators essentially just set pixels to the correct color and thats about it. The thought of setting individual pixels kind makes my skin crawl… but it seems to work well, some of the simulators have more than 10000 entities on the screen. Would blitting 10000 actually be as fast?

I would like to support at least 1000 enties in the game to make things interesting.

My dev system is a TBird 900mhz with a Geforce 2 MX in it.

Rendering needs to be a simple as possible since I really mainly want to play around with the AI, maybe some flocking behavior stuff, possibly genetic algorithms to breed smarter people to avoid zombies, ect. I wouldn’t mind some intereting stuff like particle effects but I think that would only be feasible with an accelerated graphics.

I want this to mainly run in an applet, but with the option of running as an application.

Naturally I’d like it to be as fast as possible but I also thought it would be interesting to see if I could control the CPU usage (so that it doesn’t just peg the CPU out to 100%). I’m not quite sure how to do this in java… maybe a System option or possible just making the thread sleep for longer periods of time… not sure.

So given all of this, especially the applet requirement, would it be good to use straight Java2D, or perhaps something like GAGE? I checked out LWJGL but it can’t run as an applet.

Try out GTGE :slight_smile:

An applet-application game engine and support LWJGL and also JOGL in one package.

Well I got a begining applet up and running using the example from gamelizard. So I’ve gotten things set up using a BufferStrategy and nothing else. Right now I have it peaking out at about 50 FPS which is pretty good, but I’m not sure if this is accelerated or just in software. I’d love to top out at 100 FPS even though I’m only getting 50 FPS with no other drawing… so I’m probably going to need help/info on what might be happening.

I’m using Java 1.5, 900mhz (<- this might be the culprit) Tbird and a geforce 2 mx card.

if you are modifying the pixels directly then you are probably not going to find a whole lot more performance, but for something like this, i dont see any other way to do it aside from going to openGL or something…