java libraries

Started by
4 comments, last by N=1 11 years, 7 months ago
I'm interested in making a 2-d platformer later on in my game making career. I'm learning java right now so i was wondering what kind of libraries there are for java that are useful for platformers? and if anyone feels like sharing the pros and cons of each thatd be greatbiggrin.png

If you see a post from me, you can safely assume its C# and XNA :)

Advertisement
Disclaimer: I do not have extensive experience with any game libs. I'm working on a 2D platformer also and I'm building almost everything from scratch as a side project--for learning and for fun.

My answer is: It depends on what you want, exactly.

If you want to learn how things really work, start writing it yourself, from scratch. That's what I did (and am still doing).

To make a platform game, you don't need any special libraries. The following is what it takes to get the basic platformer mechanics in place. All of this can reasonably be written from scratch.

- Create a window with some sort of canvas you can you can draw on
- Build a game loop to make update and render calls. For simplicity in your implementation, you can synchronize the update/render cycles and fix them to a particular framerate (60 frames per second, for example).
- Figure out how to draw primitive shapes, like different colored rectangles.
- Figure out how to draw rudimentary animations. For example: Draw a background and move a rectangle back and forth across the screen, or draw it at a random location each frame. The point is, you want to see _movement_. This will show you that your render loop is working.
- Figure out how to get keyboard input from the user -- arrow keys, for example.
- Figure out how to use the arrow key input to move the rectangle around.
- Now figure out how to make it smooth.
- Next, add platforms, jumping, and gravity, and start figuring out collision detection and response. This is where things start to get interesting.

For all of this, you only need the Java standard libs, including Swing and AWT for the graphics.

Building a decent game (event a simple one) takes a lot hard work. Don't expect immediate success. I started my platformer project over 2 years ago. I would work on it for a while, then I would let it sit for several months. The first prototype was pretty cool: I had gravity, level scrolling, jumping, blocks that you could push around, level switching, parallax background scrolling, basic character animation, little projectiles that the character would throw, and I was even working on ladders. I had a basic level editor too. And you know what happened? It turned out, I had made several major fundamental errors in the core design. It got really ugly and it was nearly impossible to make changes without breaking tons of stuff. So I started over from scratch with an attempt to do things right. This also means I'm unit testing my code religiously (before, I hardly tested anything).

Anyway, sorry for the speech. Just wanted to share my experiences. I hope it helps. Just start small and be prepared to learn.

Thok
If your making a 2D platformer, you might want to check out Slick, http://slick.cokeandcode.com/. I use their utilities files myself for my 3D Apps, but havent personally used their 2D Engine, but I do hear good things from them and see really good examples. Or if you know opengl you can just use LWJGL and you will feel right at home.
Slick2d comes to mind so does struggling to install its libs.
I prefer Jmonkey sdk and it can be used for 2d with fixed camera angles but it is a 3d engine and will act like one.

i have made 2d enviroments with the standard java lib and 3d with jmonkey
http://www.strangeturtle.com/JAVA.html

also check out this opensource platformer game made with a standard java lib
http://runeneo.weebl...platformer.html

when it comes to physics and collision detection thats when the lib becomes handy and makes the game 100000 times more polished But you certainly dont NEED libs as seen from the links of working standard libs

"Oh, God, I'm nervous. Two of my three hearts are having attacks." -Zoidberg
Site: http://www.strangeturtle.com


And you know what happened? It turned out, I had made several major fundamental errors in the core design. It got really ugly and it was nearly impossible to make changes without breaking tons of stuff. So I started over from scratch with an attempt to do things right


HAHAH that is the TRUTH

"Oh, God, I'm nervous. Two of my three hearts are having attacks." -Zoidberg
Site: http://www.strangeturtle.com

Hi burnt_casadilla,

I started on java development of a 2D game late last year and did a quick look around for suitable libraries. I found JGame (http://www.13thmonke...g/~boris/jgame/) to be an excellent starting point.

The big advantage of JGame is that it is specifically targeted at starting game developers. There is a tutorial that slowly introduces the basic concepts and you get various demo games that display a wide array of games that you can make with it. There is no platform game amongst them, but since JGame supports sprites, background tiles and scrolling, it must be possible to create such a game with JGame.

The good.

- Framework that takes a lot of hassle away (you start coding your game quickly)
- Support for various Java environments (desktop, applet, Android) even a variant for Flash if you want to switch to that.
- Nice tutorial and demo games
- Performance optimized

The bad.

- It is a limited (limiting?) rigid framework. You will probably encounter its limits sooner rather than later. This is exactly the price you pay for getting started so quickly.
- Some aspects of the framework are a bit vague due to unnecessarily short variable names or unclear method names.
- The library is open source, but does not lend to being modified for the purpose of your game. In short: it's messy. (I really fell in love with the functionality, but now that I'm extending the core, I'm first rewriting the core in a way that I can understand.)

My advice.

If you know how all about collisions between sprites and background, have some idea about how to handle threading, know how to load and manage your images and animations, you don't need JGame. If not, JGame is an excellent place to learn some of the basics.

Good luck!

This topic is closed to new replies.

Advertisement