move like a brick and sting like a wasp?

Heres a problem I ran into while working on boxycraft:

A while after deciding to redo boxycraft, and after making some minor changes, the computer I was doing all the work on crashed. It just stuffed out and wouldn’t work. Luckily for me though the hard-drives were intact and I had an old crappy computer that was just collecting dust, so I put them together and started programming again.

But there was a problem, my game sometimes wouldn’t load the first level, because it ran out of memory! That was not good, and I couldn’t believe that it could play some really good games and not my simple one! What was I doing wrong?

Well, firstly, I loaded EVERYTHING into memory and didn’t free any of it up as I went along. I didn’t even stream the 2 music files, but loaded them both into memory, and they take up much more space when they’re uncompressed! And while I was developing on my old computer I didn’t even notice this because I had so much RAM! Now thats bad programming practices!

Anyway, after not being able to run my game when I thought I should be, I went and re-did my entire game-engine to free up any memory that wouldn’t be used. I did a pretty decent job, and got the game running, bit it’s also a job I’ve got to do all the time and with anything new that I add.

I learnt a valuable lesson!

Explore posts in the same categories: Boxycraft

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: