Graphics2D

Hey. I’m still a bit new, I’ve been programming in Java since summer of last year. Anyway, I got into tile-maps and such, and now I’m using pre-rendered maps for what I need done and some tile collision maps for simplicity sake.

Anyway, would graphics2D work for a simple dungeon crawling game? All you do in my so far is go between your characters apartment/town/ and the dungeon. The battles are a lot like The World Ends With You’s engine. I mean, I’m not terribly far in, and I’d like to know if I should implement that OpenGL or whatever seeing as this is my first relatively big game in java. It’s been simple stuff like Space Invaders and classic Final Fantasy rip offs.

I’d vote yes to Java2D. If it’s your first relatively big game it will cut down dev time so more likely be completed, and keep the rendering simple so you can focus on the game.

However probably going to want to learn openGL sometime and no time like the present… but java2d :slight_smile:

If you’re working on a 2D game and would like to get hardware accelleration support, Slick2D is a good place to start. It wraps all the nasty OpenGL stuff and is quite easy to use. I’d argue that using accelleration such as Slick2D offers is actually easier, since you have to worry less about performance. I believe it’s also got some built-in support for tiles, though I have never used that.

You can get it here: http://slick.cokeandcode.com/

Java2D works well when not much load into it.

FTFY.

Lol ;D

LoL Java2D is not that bad. Just say it’s good enough when the game isn’t on bloody render.

Just to clarify to dear SkyAphid: Java2D is a great starting place, and I’ve used it a lot in the past. OpenGL is a lot more hassle for the same result (but with better performance of course). Java2D is very sufficient in your case. Just in my experience stay away from scaling and rotating images in real-time…

PS: Why did you name yourself after a bug? Obviously, everyone’s gonna hate bugs on a programming forum! xD

hate, or gonna be afraid to him :smiley:

Haha. My name is came from some guys from school and it stuck. lol.

Anyway, I’m rewriting the game with Slick, seeing as slick obliterates 90% of the problems I have using normal libraries. The only question I have is, does using this destroy the whole “Java works everywhere” thing? That’s kind of why I learned the language in the first place so my buddies could play with their macs. lol.

Your friends will still be able to play your games, but you’ll have a little more work to deploy different versions (windows, mac, windows 64, linux, etc). But no code changes at all, only replacing libs and command lines .

Also, I’m now getting an error from Java.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
	at java.lang.ClassLoader.loadLibrary(Unknown Source)
	at java.lang.Runtime.loadLibrary0(Unknown Source)
	at java.lang.System.loadLibrary(Unknown Source)
	at org.lwjgl.Sys$1.run(Sys.java:75)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
	at org.lwjgl.Sys.loadLibrary(Sys.java:84)
	at org.lwjgl.Sys.<clinit>(Sys.java:101)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
	at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
	at edu.bgp.global.Game.main(Game.java:31)

It’s kind of making me mad because it was working like 5 seconds ago.
But even then I got an error related to SlickException.

This is making me relatively angry.

http://lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL

I’m sitting here looking at the tutorial at their website.
I’ve set it up just as directed.
My VM argument has this:
-Djava.library.path=…\lib\natives

The natives folder being where the DLLs are.

If this is inside Eclipse, how are you using that java.library.path parameter? You should be setting the natives path from inside the build path by expanding the lwjgl.jar entry and double clicking the “natives” property.

-Djava.library.path="C:\Users\Mokyu\lib\lwjgl-2.8.2\native\windows"

That’s how mine is. Note the ", they might help… xD

Well, it’s loading them in, now it’s doing this.

Exception in thread "main" java.lang.NoSuchMethodError: getPointer
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(Unknown Source)
	at java.lang.ClassLoader.loadLibrary(Unknown Source)
	at java.lang.Runtime.loadLibrary0(Unknown Source)
	at java.lang.System.loadLibrary(Unknown Source)
	at org.lwjgl.Sys$1.run(Sys.java:75)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
	at org.lwjgl.Sys.loadLibrary(Sys.java:84)
	at org.lwjgl.Sys.<clinit>(Sys.java:101)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
	at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
	at edu.bgp.global.Game.main(Game.java:32)

Alright! Fixed it.

I looked over the error and figured it must be related to one of the files being older than another, and then I realized that I was using the lwjgl jar that came with slick. I replaced it with the one from the website, and it fixed my problem.
As related to the missing lwjgl error from earlier, I went to build paths, found lwjgl, lowered the tree, and added the locations of the natives to Natives property. (As ra4king suggested) That’s for anyone who may have the same problem, as the VM argument didn’t work out for me!

Thanks for the help guys.

If you wanna konw ow to deploy your game to ensure you don’t have to put all the natives into the same folder as the jar (or use reflection) just say it, there is a really easy way, at least I think it is easy :smiley: