9/13/2011

When game programming books are useful

While I was working on Bombs & Penguins I ended up being quite satisfied with the visual and gameplay elements of the game, but I couldn't really say the same to the programming architecture I came up with.

With bombs and penguins I did my first attempt to create a "game engine" in C++ in which all the library I used could fit nicely, and I may say I both succeeded and failed in this intent. I succeeded because everything was actually working fine and failed because everything was slowly getting messy and difficult to mantain as I wrote new code :)

It is true that every architecture you build/use will have some trade-offs, but I needed a better base to build my game. That's why I decided I would buy the book you see in this post and after reading it, it definitely taught me how a good architecture should be made.

That's why I decided to rewrite the game code for bombs & penguins from scratch following the model proposed by this book. Of course, I didn't copy the code proposed in the book as it is, and that would be quite pointless I think, but instead I took inspiration from it and built a much better and efficient game engine than the old one. It took me about two weeks of coding, but it was worth the pain! :)

This isn't a review of game coding complete, but I do recommend reading this book to any game programmer wishing to build a solid base for their game!

I also rethought the role of Lua scripting language in my game. Before I was using it to code the gameplay elements, but now I'm using it more as a replacement for XML to load levels and elements. That is because I program alone and I do not have any scripter working with me, so why spend a lot of time trying to fully integrate scripting in my game? I realized it's quite a waste of time in cases like mine :)

2 commenti:

  1. I read the last lines of this post and i Think equal you Lua for a only developer? I prefer a little know of xml and rapidxml for charge a level in my little project. Learn Lua and c++ is more hard for a unique person.

    RispondiElimina
  2. Yes I also thought about using XML instead, but loading levels from lua is a bit faster and lua scripts are very simple and readable.

    Once you have compiled luadbind (or lua++) and lua, integrating it is a matter of minutes :)

    RispondiElimina