Good way of handling class instances in game development?

Posted by Bugster on Game Development See other posts from Game Development or by Bugster
Published on 2012-12-16T14:05:31Z Indexed on 2012/12/16 23:22 UTC
Read the original article Hit count: 164

Filed under:

I'm a new indie game developer, and I've made a few games, but often times when coding I wonder "Is this the way most people do it? Am I doing it wrong?" because I'd like to become a game developer some day, and I really want to get rid of bad practices in time.

The way I'm doing it right now is like this:

#include <some libraries>
#include "Some classes"

    int main()
    {
      Class1 a;
      Class2 b;
      Class3 c;

      a.init();
      b.init();
      c.init();

      // game logic;
    }

Now as I see the game grow, I have more and more classes to initialize and create instances of. This is clean but I'm not sure if this is standard practice. Is this a regular way of creating instances of your game classes or is there a cleaner and more efficient way to do it?

© Game Development or respective owner

Related posts about programming