July 31, 2012

The Pains of Libgdx


For the most part, libgdx is an absolutely wonderful gaming framework. It provides a flexible, efficient, and easy to use framework. However, it is still is being actively developed and modified. I absolutely praise them for the changes they made in their massive re-factoring, but that came at a huge development cost for myself. The shear number of changes essentially broke most of my rendering/input code and forced me to rewrite large sections. I guess in a way it gave me time to review some of my original implementations.

Fortunately, I like to code in a very modular fashion so all of the game logic was unaffected. Then again, the game logic is probably the most trivial part of any game. Just because the code behind the scenes is well written and effective it really has no influence on how you display that information to the user. When I'm looking to create a game I focus on and overall architecture of MVC (Model-View-Controller). The idea is pretty simple:

- View: The GUI/Input handling/Resource loading
- Model: The game logic, game objects, interactions
- Controller: The loading and storing of data related to the model. Saving your progress, loading the missions/enemies/etc.

The big downfall to this approach is the View becomes a super massive object. I've seen people attempt to separate the input and graphics. This never works out well, as you find the input becomes highly coupled with the graphics anyways. For all the extra code you have to write, it really isn't beneficial.

Resource loading on the other hand can easily be moved out of the view and I have just been really lazy. I'll probably worry about this once I've finished integrating with the new stuff libgdx has decided to shove down my throat. :(

I can see myself writing some tutorials on libgdx once I am almost finished my game. The complete lack of information consolidated in a single place is really painful, so I'd like to help other people learn about how to use the framework.

No comments :

Post a Comment