Java 2D Racer

I want to try to implement a 2d racer in pure java. top down view. I have been looking for some examples to get started but am having trouble. Anyone got any ideas? I would also like to find an editor that would be well suitedfor the task, and not be hard to setup and use.

Check out the Post Your Games here forum, you might find what you’re looking for.

Also, there’s a bunch of cool games over here:
http://grexengine.com/sections/externalgames/
some of them are with source code, and there are some excellent articles there, too.

As for the editon, do you mean a Java IDE? Take a look at www.netbeans.org, or www.eclipse.org, or ask on Dev Tools forum…

No, I use netbeans everyday, I meant an editor for the racing maps/tracks i.e. a generic (java-based) tile editor. Thanks for your reply.

I found this little multiplayer racing game :

http://website.lineone.net/~john.montgomery/RacingGame

Maybe that can help you.

There’s a 2D racing game in the “your games here” forum but it’s not a good example. There are none on the java games factory at the moment (nb: now has an easier to remember URL :slight_smile: see below) apart from a very simple but fun one (Driving Ambition) where you are always racing forwards (which is probably not what you want). There will be at least one coming in the next 6 months, because I’m writing one for my book. But, publishing being what it is, that means it will be at least 9 months, maybe much longer, before the book appears with the source etc.

You could have a look at the spaceship and asteroids games for some ideas - they solve a lot of similar problems, bar the “staying on the track” problem.

For the editor, you could try Mappy (google for it). If they ever get out a full java version we’ll add it to the JGF tech section, but for now it seems there’s only partial java support :(.

If we start up the 4K games contest again, i’m sure there will be atleast 1 4K top down racer entered in it. :wink:

I created a 2D car game a few ages ago. You can have a look at it: http://valhallawebdesign.com/Bumper/ . Maybe you can get some inspiration/ideas from it. One of these days I should bring it into this century and make it fullscreen and bigger tracks…

very nice game! is the source code avaiable?

[quote]If we start up the 4K games contest again, i’m sure there will be atleast 1 4K top down racer entered in it. :wink:
[/quote]
I’m thinking of starting a competition like that in around a month or so (once JGFv3 is up and running). I’m not sure what competition to go for though. Hmm.

New thread:

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=Announcements;action=display;num=1097763765

[quote]I created a 2D car game a few ages ago. You can have a look at it: http://valhallawebdesign.com/Bumper/ . Maybe you can get some inspiration/ideas from it. One of these days I should bring it into this century and make it fullscreen and bigger tracks…
[/quote]


Adjustable view size to accommodate different CPU-speeds and workloads. If you think the scrolling window is too small, the only thing you have to do is to buy a faster computer. This game is made to cram all the CPU-power out of your machine, so if you got things running in the background you might want to shut them down.

Uh, I don’t think so. Or else the CPU just dropped out of my 1Ghz PC and left behind some random 1Mhz chip on the motherboard to do all the work ;D. The render window shrunk down to about 200x200 :frowning: making th game unplayable. I wasn’t given much confidence by the fact that your repaint routine was broken (the panel with the timer in doesn’t repaint any more if you drag/resize the applet window) nor by the fact that your gui controls on the bottom left are black text on almost-black background.

All that aside…it feels like it would be great fun if you fixed it up - the controls felt good and the tracks were funky. Making a racing game “feel” right is one of the hardest parts, so if you just fixed up the “easy” bits (i.e. corrected the rendering, got rid of whatever is stealing most of the CPU, etc) then I reckon it would be a cool game :).

Howabout…

  1. you get rid of all the GUI, and just render numbers etc directly onto the main window (i.e. a HUD - very easy to do)
  2. you replace the gui controls with an “options menu” so that you don’t have to worry whether they’re screwing up the rendering for the main game
  3. you profile it to see where the CPU time is going
  4. you use GIFs or BMPs as your level-file format (e.g. "color(0,255,0) == track; color(255,255,255) == wall, etc)
  5. webstart it

Then…you’ll have a game that is VERY easy for people to make their own tracks, and takes very little effort for you to get running. Then you can put it up here and on JGF, and see if people like it (I think they will) - and you’ll probably get enough positive momentum that you then end up spending much more effort to make a really nice version with OpenGL and a real map-editor etc, plus (eventually) multiplayer mode etc?

Just a thought ::slight_smile: