[java] Java Game Development - 2d and 3d

Started by
4 comments, last by Thygrrr 15 years, 3 months ago
Hallo, Okay, so I'm somewhat experienced with programming C/C++ and SDL/OpenGL. After a course of Java in uni, which only covered a very small amount of actual programming, I decided to learn Java for myself, online. I have downloaded the JDK and Netbeans, and have worked through the "Trails Covering the Basics" tutorials at http://java.sun.com/docs/books/tutorial/ . By "worked through", I mean that I have read the tutorials, created the demonstrations in Netbeans and written around 20 pages in my exercise book of notes on the Java Language. Now I feel that I understand Java. My experience with C/C++ was very much undirected, and the tutorials at http://java.sun.com/docs/books/tutorial/ and http://www.netbeans.org/kb/index.html have made me decide to change to Java. Whats driving this is a desire to write small games on my own mobile and PC. Several years ago, I recieved a book on writing MIDP midlets for mobile devices, "Wireless Game Development in Java with MIDP 2.0" by Ralph Barbagallo. This book explained CLDC/MIDP, and I was happy to find out that my phone has MIDP 2, and that it is somewhat of a standard. I have also worked through the setup tutorial for MIDP here http://www.netbeans.org/kb/docs/javame/quickstart.html The book being slightly outdated (in the world of computers), I have decided its best to ask here before moving on. I understand Java. I want to build 2d games for my phone, and 2d/3d games for my desktop. I was hoping you could direct me to good, current tutorials on mobile game development. From what I've gathered, MIDP has a specific set of packages that are included. So, any midlet (a MIDP applet) is on its own (as in, no 3rd party libraries, or if I do use one, I have to distribute it with my midlet). How do you (you being, generic game developer) write a game for a phone? What do I need to write a Pong/Tetris/Breakout clone for my phone? What do I derive from, what do I use to draw graphics, to handle input, to make sound? For desktop applications, what do you write a 3d game in? Again what do you use for graphics, input and sound? What do I need to make a person walking on a 3d ground, to make a first-, third- person or birds eye view? Also, what should I use to make a side on scroller (like Mario). When I was programming with SDL, which is pixel perfect, I'd load a bmp sprite, and draw it on the screen. Whilst this was fine on my screen, if I tried it on a different one, then I'd have problems, either with aspect ratio, or having the sprite too small. Latter, I learned instead to use SDL as a base code, and then use OpenGL on top of it. I'd use SDL to load a bmp, convert it to a texture, then use OpenGL to scale it, and draw it. Also, OpenGL was much faster than SDL. My point is that whilst a 2d library can work, a 3d one (in orthogonal mode) is normally much faster. So if I was writing my Mario clone, what should I use? I'm under no delusion about making the next WoW or Halo overnight. I want to get started with simply games on my phone and computer. And I don't want to start working with some library and latter find that its old, deprecated, and unused. So I'm looking for modern tutorials on game development in Java. Where's a good place to start? Where should I go next? Thank you for your time. Cheers, Daniel edit: I've heard JOGL (Java OpenGL) and Java 3d being thrown around, but before I looked into them extensively, I wanted to ask here first to make sure they are what I'm looking for and are what is currently used - I don't want to learn their APIs then find out that they are outdated now!
Advertisement
I have no experience with games for phones, and only little with openGL.
If you want to use openGL in Java, you can use Lightweight Java Game Library link.
If you just want to use 3D you can use jMonkey Engine (it's based on lwjgl) link.

But for a simple mario-like game, I think Java's awt package is just fine :)
It's nice that you decided to switch to Java from C++. :)
Anyway, here's some links you might be interested in:
Mobile 2D: MIDP game development
Desktop 2D: Slick2D is a 2D game engine that uses OpenGL for rendering.
Desktop 3D: jMonkey Engine is a 3D game engine.. suited primarily for full-screen desktop games. Nothing stopping you from making the next WoW with it. There's also jPCT which is more targeted toward applet and software rendering (for higher compatability).
for 2D and 3D on desktop il recommend using LWJGL.. its a thin wrapper for open gl, with it you can use opengl like you wuld in C++ in java (orthogonal rendering also works perfect and its very fast)

whereas jmonkey engine is a high lvl 3d engine meaning the hard part of 3d is allready implemented for you but then again u lose alot of control since ur using some1 else genereic 3d engine.
jmonkey also uses LWJGL to get to the opengl API.

so in the end it all depends how much you want to do yourself
check out the slick 2d library, its like lwjgl but made more for 2d and somewhat easier api for 3d jmonkey is the engine to use.

good luck.
I've been making Java games on cell phones for a living in the past 5 years now.

Java games for phones come in three flavors. First, there's J2ME (recently dubbed JavaME), which is the most prominent type; however, its 2D capabilities are very poor and its 3D APIs are either very akward (JSR-184 Mobile Java3D) or not widely supported (OpenGL ES).

Another flavor is DoJa (Docomo Java), which is (still?) popular in Asia, and I can't really tell you much about it.

The third "purely mobile" Java flavor is Android, which basically tramples over J2ME in the graphics department; and the APIs are much more solid and thought out from the looks of them (just getting started myself, most of my experience and everyday work involves J2ME).

Alternatively, you can also use JavaSE on a range of smart phones, usually those that support CDC.


My personal recommendation would be to try out Android, unless you're aiming to make money immediately, which means you're pretty much stuck with J2ME. There you'll have to work with limiting, crippled, or poorly designed APIs, even poorer implementations, and don't even get me started about sound.

(Yes, I'm a bit bitter, but things are looking up since the advent of Android; and J2ME is still a fun platform - it's just ridiculously limited and FUBAR in many aspects. It still remains the prevalent platform for now, however.)

This topic is closed to new replies.

Advertisement