HungerGamesBoardGame

I know for a certain that a Java version below 7 will not open the game. To get the music to load, you need Java 7 Update 7 or higher. If there is some different error going on, I do not know about it. If you could run the game through the command line, I would really appreciate it, and while you’re at it, check your Java version and make sure it’s up to date.

I get the java.lang.OutOfMemoryError: Java heap space exception but with more heap space it works [tested with -xmx512m].

Oh, I have Java 6 (I think ;D) or, its not the latest update :emo:.

How much memory was allocated before you added more heap space? I’ve done some testing for my game’s memory usage and it is quite high. I’m putting in an efficient garbage collection system for V1.0.1 and after lots of testing I should finish that soon, which will hopefully cause the game to use less memory.

Yeah you need to fix that. If big games like BF3 and MW3 don’t run out of memory neither should a small game like this.

So as I was working on lowering memory usage, I thought that changing lots of int to byte when necessary would reduce memory usage (heap space). Is this true? I looked on Google but didn’t get a definitive answer.

A byte is 1 byte and an integer is 4 bytes. 1 byte can go up to 255 value. So yes.

Won’t make much of a difference, honestly. Fixing the biggest memory leak in your game will probably be more efficient than fixing tons of small ones.

Alright, thank you. I’ll worry about that later then.

I got the memory usage down to about a max value of 343 MB where before it was upwards of 600 MB. I think this is still a bit high, so I will probably make some more Integers into Bytes when necessary to see if I can lower it more.

Its not all about Integers. Basically any object consumes memory and you should watch out on how many objects you are creating. Even though java has a internal garbage collector(it checks if that object is out of scope), sometimes it doesn’t work.

That makes sense. I assume an array doesn’t reduce memory, as it’s just like making as many objects as the elements you have in terms of memory usage?

Also, without music my game’s memory usage is down to a max of 30MB. So I’m not sure exactly if there’s much more I can do from here, the music seems to be using 313 MB of memory.

Hey, it doesn’t work (its stuck at 0%) and I have

from java -version command (windows here)

Most likely you are using javaw 32-bit, which gets stuck as well. I’ll probably look into a different music library to see if a different one can actually load on all versions and all bits. For now, though, just turn music to false if you’d like to play or run via command line (I’m not sure if that works, but I believe it does).

I am going to keep the same library, update it, and use a new method for loading music. Instead of loading music upon start-up, I will load the new song when the previous song ends. It doesn’t slow down the game at all, and the mix of what I’m doing may allow the game to load with 32-bit javaw.

Alright before I put the link to 1.0.1 in the main post, I am having a few people bug test it. The link is http://www.mediafire.com/?dp67t7g88lw84t2 though.

V1.0.2 reduces memory usage even more and it will be released when I get back from vacation (Monday).

1.0.2 is now out. Memory usage is way down from before, and now I extremely doubt that any memory errors will occur, but let me know if any do. Hopefully this will be the last update unless I look back at the game and want to add some major features in the future.

Can I ask how you learned Java? To be able to learn Java from scratch and create something like this by the end of the year is pretty impressive…

@packet Usually you can get right into making games in a year with a good teacher, because all those days that is spent googling/thinking over a problem a teacher can bring you right up-to-date

@OP Could you wrap the change log in code tags or something similar that can be hidden?

@Tj Doesn’t really answer my question, but okay. I went to college and graduated last year, and even now I just started working on my first real game only a little over a month ago. Until now, it has just been non-practical practice problems and random programs for my portfolio.

@packetpirate Unlike what Tjstretchalot suggested, I did learn Java just by googling and wondering why things didn’t work. It isn’t really as bad as you make it seem, the longest time I was angry because I had no idea why something wasn’t working was just about 2.5 to 3 hours. I honestly don’t really suggest this to you however - if you have a teacher it’s better. Still, though, if you don’t have a teacher it might be a good method. But honestly, I have no idea what the “best” way to learn Java is. I did not learn via any teacher, though.

@Tjstretchalot As far as I know on these forums there is no way to do that. If you know of one, however, please let me know, as I’d like to do that as well.

I have added a GitHub link if you would like to look at the code. I warn you though, it is extremely ugly! Soon I will update this game to use Slick2d for graphics. I just need to finish the basic outline of the current game that I am working on.