Game Development Community

Java 2D Game toolkit

by Quest Johnny · in General Discussion · 09/09/2004 (2:26 pm) · 39 replies

I was wondering if anybody had come across a toolkit for making simple 2D Games but using Java. Naturally, I'm waiting keenly for May to finish the Torque 2D Retro, but in the meantime..

I've seen a few out there, but apart from Java SDL, nothing really seemed to fit the bill. I'm looking for something that handles sprites, animation, sound, music and some simple networking (though of course the point of using Java is largely for networking..)
Page «Previous 1 2
#1
09/09/2004 (3:26 pm)
LWJGL has some classes for Sprite rendering, etc.
Plus, you don't need the 1.5 SDK to benefit from hw acceleration, through OpenGL.
Caveat : it's JNI package, implying different "builds" for all your deployment platforms, but since compile once, run anywhere has never been a good reason to use Java, you shouldn't see this as a problem :)
#2
09/09/2004 (6:46 pm)
www.gamedev.net/hosted/javanerd/ is an old java 2d game toolkit. It hasn't been updated in a long time and isn't anything special, so I don't bother with it.

I'm working on developing my own java toolkit, but it's moving very slowly. The issue is that I'm working on another project (not a game) simultaneously. In fact, I'm working entirely on that other project this week because I want it to get to the point where it's worth looking at.

The toolkit will have all of what you mentioned except that it may be a long time before it has useful networking support.

I'm developing the toolkit combined with a tutorial that will show how to construct a number of games in detail. The other project I'm working on is unrelated.

I'm creating the toolkit mainly from old code I've written with some stuff added from a couple books I've recently bought. I just wrote Sprite code, which is completely new (though I suspect it needs a few more features).

If you want, I can send you the new code and the old game code I have from before. The old game code includes everything except networking but is rather sloppy.

If you're willing to help out with the toolkit, that would be great. The toolkit's going to be open source and free to everyone. Everything in the toolkit will be explained within the tutorial.
#3
09/09/2004 (6:51 pm)
www.brackeen.com/javagamebook/ is the url for the best of the java game programming books I've bought. It has the source code for the book posted on the website.

His book teaches you how to do everything (it filled in a number of gaps in what I had managed to figure out on my own), but his code has too many wrappers around everything.

My website is at fletchergames.com/ so that you can see what you're getting into if you want to work on the toolkit. Just click on the "Java" button to see the tutorial - the simplest toolkit code is already included.

I should warn you though that all my projects are moving slowly because I'm dividing my time between them. I don't have nearly as much time to work on them as I want to. I need to find some other people to help out so that the projects actually get done.
#4
09/10/2004 (6:08 am)
Stephen, I'd be very interested to see your new toolkit. I'm looking for something that (hopefully) does Sprite, helps with animation and allows for music and sound.

UPDATE: WOW! Mr. Fletcher, I've only read game0 from fletcher games but you sure know how to write a tutorial. It's clear, informative, easy to follow, .. a very impressive technical writing style.

The game1 tutorial and game2 are not yet complete yes? :)
#5
09/10/2004 (8:25 pm)
Nothing is complete yet except game0. I plan to work on game1 next week, but I don't know how much I'll get done between work and that other project I'm working on.

I run into the strangest problems. For instance, in game0 I had an odd teleporting bug with the collision detection. I kept changing things, and the bug would change but not disappear. Finally, I changed something that I didn't think mattered, and the problem was eliminated. But this stupid bug took me a while to fix.

I already have old code that I can email you if you really want it. It contains code for graphics, input, and sound (including Ogg Vorbis music - thanks to the Java Zoom library).

The toolkit and tutorial are going to take a while because I'm dividing my time between them, the other project, and my job.

"Developing Games in Java" by David Brackeen is a good book that you might want to buy. It covers topics that my tutorial won't (though it also misses some topics that my tutorial will cover), and it is from a very different perspective. I'm very minimalist when it comes to defining classes and functions, whereas Brackeen has classes and functions for everything.

In all likelihood, something between our two approaches would be best.

Most importantly, the book is already complete, whereas my tutorial is just started and won't be complete for some time.

If I had someone to help out, things might move along faster. It's unclear exactly how the work would be divided up though.
#6
09/10/2004 (8:37 pm)
If you want to see the toolkit right away, I can put everything else on hold for a week or so and work really hard on the toolkit. Then I can send you the code, and you can test it out.

It would be very "alpha" release quality code though, and it wouldn't be well documented.

It might, however, contain most of the features you mentioned (not networking at this point). I already have most of the code for Sprites (notably missing is the "walking" animation), keyboard input, and the basic graphics display functions. I could just use old code for mouse input, sound, etc., but I plan to rewrite almost everything.
#7
09/10/2004 (9:27 pm)
Just a heads up Steven, the BODY part of your stylesheet isn't working when viewed in Opera, so the background is white and the text is black. The link styles are working however.
#8
09/11/2004 (8:10 pm)
Thanks for the heads up.

I'm downloading Opera now so that I can test the site out with it.

[Edit: corrected spelling]
#9
09/11/2004 (9:16 pm)
I think Flash is a better way to make simple 2d games... has everything you mentioned: sprites, animation, sound, music and some simple networking.

I made a multiplayer poker game once in Flash... great for putting together front end graphics... for the backend we used java (jsp) and jakarta.

Plus, if you go to flashkit.com you'll find lots of tuts and sample code to download...

Alot better than java based games I think... performance is better too and pretty much everyone has flash in their browser.
#10
09/12/2004 (10:51 am)
I'm doing some work for Java in Games, Stephen, and I've learned things from your code. If anything I make could be useful for your tutorial, I'll be glad to help out.
#11
09/12/2004 (11:55 am)
Again, do check out LWJGL, as well as the game library built upon it by its authors, the Shaven Puppy Game Library, aka SPGL.
This is "proven code" that has been used in shipped titles, and is being actively developed.
It's also incredilbly easy to use, and if you want to jump to 3d, you can use your codebase as a basis to do so. Or mix 2d and 3d, etc.
Did I mention it's Open Source, and not under the GPL ?
That means you can keep your own source closed if you're so inclined, as well as any bug fixes you might concoct (although contributing them back upstream would be appreciated by the authors, I'm sure ;))
#12
09/12/2004 (11:57 am)
I guess no one cares about Flash.... :(
#13
09/12/2004 (7:16 pm)
By all means, look at LWJGL. I know nothing about it - I just looked at the site briefly.

SPGL looks like it hasn't even been started yet. It doesn't have any files available. But maybe I just happened to look while they were reuploading everything (or doing something like that).

I don't know anything about Flash either. I don't like it much because it's annoyed me on a number of websites. Java applets are just as slow, but Flash is thoroughly overused on some sites..

I still plan to write my little toolkit, even though it's not as unique as I thought it was. My main goal is actually the tutorial - the toolkit is just a natural consequence of showing people how to write code to make games.

It seems like I'm learning more and writing better code because I'm working on the tutorial. Setting things up so that I can explain them to other people makes the code much clearer.

Since no one jumped up and said "drop everything so you can work on the toolkit," I guess I'll just work half on the toolkit/tutorial and half on Bot Asylum - Bot Asylum certainly needs more work.

@Andrew
What I would really like is for someone to do one or more sections for the tutorial about things aside from the core parts of a game. For instance, screen effects, title screens, etc. I plan to write the core code for a number of games to use in the tutorial, but it would take forever if I added all the possible features to every game. So someone would be basically finishing each game.

So the tutorial would be listed something like:
Game 0
Game 1
Game 1 bonus material
Game 2
Game 2 bonus material
...

Game 0 won't have any bonus material because game 1 is an extension of game 0.

All the code would have to be completely open source. My "License Agreement" isn't restrictive at all - it's basically "Do what you want but list the authors of the code you modified".

I'll also need some art and music (which should be "open source" too), but that's a seperate issue.
#14
09/12/2004 (7:30 pm)
Heh, no it's not that Will - just that I'd rather work IN Java. I know about Flash, but I have far more skills in Java than in Flash.

@Stephen - I can do the art. I would be willing to help, though how good I'd be since I'd be learning.. and I couldn't hope to do your great technical writing style :)
#15
09/13/2004 (3:35 am)
Oh, SPGL is definitely there, but you have to get it from cvs : anonymous access works just fine :)
To recap, LWJGL takes care of OpenGL (1.1, 1.2, 1.3, 1.4, 1.5, and 1.5 + GLSL iirc), OpenAL, input and a few more things.
SPGL builds on top of that.

Steven, I wasn't bashing your efforts (and wouldn't ), sorry if I gave that impression. Really.
But, depending on what people want to do, etc. LWJGL and SPGL might give them a better headstart, or not.
By all means, do not stop work on your own stuff : variety and different takes on the same problem are what makes life interesting, neh ? ;)

To all : have fun making the games
#16
09/13/2004 (3:59 am)
Gl4java (sp?) is (or was) pretty sweet...
#17
09/13/2004 (5:56 am)
SPL4Java - did you manage to get it to install? I always got a run-time error about a class that was missing.. :(

Heh, at this point I'm not using any toolkit.. I'm developing with just pure Java and the help of Stephen's excellent tutorial. It's really wierd.. Before I learned Torque most of this stuff was just too hard to figure out.. but learning torque from the ground up seems to have altered the way I attack a problem.

I've got three projects on the go, a simple MP RPG in Java for which I'll use pure Java or SDL or LWJGL or similar, a game-client using Pure Java, and a 3d game I'm building using Torque (but is presently stuck due to a router problem.)
#18
09/13/2004 (2:17 pm)
Quote:Heh, no it's not that Will - just that I'd rather work IN Java. I know about Flash, but I have far more skills in Java than in Flash.

@Stephen - I can do the art. I would be willing to help, though how good I'd be since I'd be learning.. and I couldn't hope to do your great technical writing style :)


I see. Well, speaking from experience in both Flash and Java.... if you know how to program in Java, you should have no problems coding in Actionscript.... Actionscript is totally oop based. There is also the added benefit of having a solid IDE to work in... If I had to choose for myself to make a game in Flash or Java, I would dedfintely choose Flash... for performance and ease of use.
#19
09/13/2004 (2:47 pm)
I prefer the Java for the ease in networking and to be able to scale up as I get better.. HOWEVER .. I'm not closed-minded. You speak of a nice solid IDE for Flash.. is that available open-source/free? Perhaps it's something I should seriously look into... I lean towards Java you see because of the years of coding I've already done (and a nice IDE to play in)
#20
09/13/2004 (4:56 pm)
Certainly continue to use Java. I have used Java, JSPs, jakarta, and tomcat to handle back-end server code... essentially, to facilitate networking and communication between Flash-based client front-ends. And that is where Flash excels -- creating front end graphical user interfaces and graphics, perfect for 2D (and even 3D) games.

Flash Actionscript has fairly robust networking capabilities (scalability depends on the back-end). Turn-based games are no problem. Data-driven games are no problem. Real-time multiplayer games can be done as well, although, I'm not sure about performance there. As I say, you still need to code server-side stuff, but Macromedia has other tools for that too.


Re IDE, there is a 30 day trial you can try out.


Flash MX 2004

Flash Data Connectivity


This page here has lots of sample games with full source code and art/sounds:

Flashkit Games


Try some of these game sites... everything is just 2D sprites or vector art done in Flash:

www.miniclip.com/Homepage.htm
www.camperstrike.co.uk/
www.ferryhalim.com/orisinal/
Page «Previous 1 2