Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411505 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 08:16:57 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Good book on JAVA game programming?
Pages: [1]
Print
Author Topic: Good book on JAVA game programming?  (Read 6918 times)
TeaAndBiscuits
Level 0
***


View Profile
« on: January 02, 2011, 06:57:27 AM »

Hi,

Is there an equivalent to the excellent Game Engine Architecture http://www.gameenginebook.com/ but for JAVA? I know there there are plenty of books on writing games in JAVA but I find most of them a bit fluffy as they don't go into any hard core theory on optimising. So far the best thing I have found is the presentation at Google I/O "Writing real-time games" which had lots of excellent tips.

Cheers!
Logged
Daniel Seabra
Level 1
*



View Profile WWW
« Reply #1 on: January 02, 2011, 07:46:40 AM »

I don't know why, but most people don't care about using Java to make games (probably because it's incredibly time expensive and the errors are very vague so you never know what you did wrong). However, I use it, and of course Minecraft is made in it, so it is definitely plausible to do so.

I've often found, especially because I moved from Game Maker to this, that Java is a very powerful language and hardly needs any optimization - my code right now is pretty terrible and still runs 60FPS just fine.

If you are still concerned about optimizing, I recommend you buy yourself a book on Data Structures. That should help you decide what kind of structure to use for each thing in your game, and will help a lot with your code. Here's a link to a free document: http://www.theparticle.com/javadata2.html

Additionally, keep thinking about things you program. Ask yourself: Could I have programmed that in any other, more efficient way? This is especially helpful when you go to sleep, at least for me, and I usually wak up with good ideas.
Logged

I'm just some bloke. Going to go to Pasadena, CA, for four years so if you're over there gimme a shout-out. Will be cool to get to know some people.
TeaAndBiscuits
Level 0
***


View Profile
« Reply #2 on: January 02, 2011, 07:57:31 AM »

Agreed that on a regular PC the frame rate is not really an issue (JIT is pretty good in JAVA these days). I probably should have said that I am writing a cross platform title using JAVA to run on desktop, applet and Android. It is Android that needs the hard optimisations. If I get desperate then I can write some code is C/C++ just for Android but I would rather have 1 set of code for all platforms.

I think the best tool at present is the profiler that comes with Android. On my initial quick test (very simplistic code with little consideration of speed) I was running at 25fps on my HTC Hero (OLD SLOW Android phone). Quick profiler and I realised that I was thrashing the OpenGL states (BAD!). One very small change and I now have an average 45fps. Relating to this do you know of a JAVA desktop base profiler? I haven't even googled that as it has just occurred to me :D

Thank you for the link! Though I'm well versed in the world of data structures thanks to my C++ background Wink
Logged
OneMoreGo
Level 3
***

Stop looking at my chest


View Profile
« Reply #3 on: January 02, 2011, 10:42:00 AM »

There's the O'reilly "Killer Game Programming In Java" but I couldn't recommend it as it seems old and I've never felt the need to buy it despite being aware of it for years.

I would just pick up a framework like LWJGL (the framework that Minecraft and my game use) and follow it's documentation and examples.

As for optimisation, I would avoid premature optimisation Smiley
Logged
bateleur
Level 10
*****



View Profile
« Reply #4 on: January 02, 2011, 10:57:13 AM »

most people don't care about using Java to make games (probably because it's incredibly time expensive and the errors are very vague so you never know what you did wrong).

That first comment sounds odd to me. Time expensive? Compared to what? Java's one of the most efficient development languages I've ever used.
Logged

Daniel Seabra
Level 1
*



View Profile WWW
« Reply #5 on: January 02, 2011, 11:33:08 AM »

Time expensive as in takes a longer time to do something in Java than something in, say, Flash.

I wasn't thrashing it though, it's my favorite language right now, I especially like it's compatibility and it's efficiency at running code.
Logged

I'm just some bloke. Going to go to Pasadena, CA, for four years so if you're over there gimme a shout-out. Will be cool to get to know some people.
TeaAndBiscuits
Level 0
***


View Profile
« Reply #6 on: January 02, 2011, 01:49:28 PM »

Quote
There's the O'reilly "Killer Game Programming In Java"
Thanks for the pointer. Just found a preview online. It looks a little old and still isn't what I'm after I'm afraid Sad It goes through how to make a few types of games as well as some simple systems like and animation system and a particle system etc. The particle system looked the most interesting as it had a section on performance. But the rest is just a little too beginner level for me. Not to worry, so far I have gathered enough tips from forums and a few blogs. Plus, as mentioned before, the Android profiler is EXCELLENT!

Quote
I would just pick up a framework like LWJGL
Good tip! I'm actually using a new library called libgdx http://code.google.com/p/libgdx/
It is a cross platform API that wraps Lwjgl or Jogl or Android. So the platform specific stuff like setting up the application, handling when to reload assets (i.e. textures, VBOs), input, sound etc is all handled automatically for each platform. I'm very pleased with it so far. I agree that an existing API is a very good place to start. I would add that it is even better to grab the source to the API and see how things are put together. As libgdx is written to run on low end Android phones upwards so they have done some interesting optimisations. Looking through this code I have already dived in and pointed out a bug for them :D

Quote
As for optimisation, I would avoid premature optimisation
Yes of course! This was such a simple optimisation that I had no concerns adding it. I have avoided the heavy optimisations as I still have too many decisions to make. My first piece of code was simply a prototype to answer the question "Can I get X to work on my crappy Android phone within a decent frame rate?" The answer is a resounding "YES I CAN" with no real effort.



Cheers!  Coffee
Logged
st33d
Guest
« Reply #7 on: January 04, 2011, 07:19:26 AM »

Time expensive as in takes a longer time to do something in Java than something in, say, Flash.

I wasn't thrashing it though, it's my favorite language right now, I especially like it's compatibility and it's efficiency at running code.

You can build stuff much faster using Processing as a framework for your Java

http://processing.org

And as for whether it's worth it...

There's this game called Minecraft you may have heard of. It's made in Java.
Logged
OneMoreGo
Level 3
***

Stop looking at my chest


View Profile
« Reply #8 on: January 04, 2011, 11:28:22 AM »

libgdx does look good, when I get round to doing an android game I will definately look into it (hopefully LWJGL will also be working fine on android too). 
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #9 on: January 05, 2011, 12:08:52 PM »

There's this game called Minecraft you may have heard of. It's made in Java.
That's the one so slowly developed that it's only just reached beta despite millions of users? Tongue
Logged
seanw
Level 0
***



View Profile
« Reply #10 on: January 05, 2011, 07:36:08 PM »

I don't know why, but most people don't care about using Java to make games (probably because it's incredibly time expensive and the errors are very vague so you never know what you did wrong).

Why would you say the errors are vague? Java gives you stack traces with line numbers and always lets you know about problems like buffer overruns. This is a big improvement over, say, C and C++ which do neither of these things for you.
Logged

Fresco: a bitmap editor with layers and filters for Android. Testers wanted! http://forums.tigsource.com/index.php?topic=19238.0
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #11 on: January 05, 2011, 11:54:06 PM »

There's this game called Minecraft you may have heard of. It's made in Java.
That's the one so slowly developed that it's only just reached beta despite millions of users? Tongue

Most games aren't released from their 0.1 Prototype stage, though. So I don't get your point.  Huh?
Logged

TeaAndBiscuits
Level 0
***


View Profile
« Reply #12 on: January 06, 2011, 01:01:48 AM »

There's this game called Minecraft you may have heard of. It's made in Java.
That's the one so slowly developed that it's only just reached beta despite millions of users? Tongue

Not trying to "get on the hate" or the "My dads better then yours" kind of debate... but... Minecrafts development has been crazy fast! He managed to go from a static discrete sized map to an infinite world in a few weeks. That is impressive. Streaming worlds are pretty hard and he did it well. And fast!

That is all :D
Logged
st33d
Guest
« Reply #13 on: January 06, 2011, 01:37:54 AM »

There's this game called Minecraft you may have heard of. It's made in Java.
That's the one so slowly developed that it's only just reached beta despite millions of users? Tongue

Yeah, the one that's made a million quid before it's even finished.

Always makes me chuckle that it's made in Java. There's not even any need for it to be.
Logged
Eraser
Guest
« Reply #14 on: January 06, 2011, 05:59:38 AM »

There's this game called Minecraft you may have heard of. It's made in Java.
That's the one so slowly developed that it's only just reached beta despite millions of users? Tongue

Yeah, the one that's made a million quid before it's even finished.

Always makes me chuckle that it's made in Java. There's not even any need for it to be.
Unless he bothers to say why himself, it was likely because Java is easy to use and easy to deploy cross-platform.

I just don't like some of the performance drop you get in choosing Java, however.
Logged
jotapeh
Level 10
*****


View Profile
« Reply #15 on: January 06, 2011, 06:27:08 AM »

There's this game called Minecraft you may have heard of. It's made in Java.
That's the one so slowly developed that it's only just reached beta despite millions of users? Tongue

Yeah, the one that's made a million quid before it's even finished.

Always makes me chuckle that it's made in Java. There's not even any need for it to be.

7 million €, no? Anyway, Minecraft is definitely a bit of an eye-opener in terms of what is possible with Java. But Notch is extremely talented at efficient Java programming – just look at his multitudes of Java 4k entries.

To the OP:

That book is amazing regardless of which language you are using. While the examples in the book are usually specific to C++, the languages are not so far apart that you can't translate them. If you can't, you may need to brush up more on your basics first.
Logged
_glitch
Guest
« Reply #16 on: February 24, 2017, 11:55:55 AM »

How about Killer Game Programming in Java?

This was mentioned before.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic