Jump to content
  • Advertisement
Sign in to follow this  
walle

Need help with game code design

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I really need help with my game code design, but I've been thinking so I'll write down some of my ideas and then hopefully someone has any comments and suggestions for me =) My thought is to make a "game class" that I can reuse in my games, it's getting boring to do the same thing every time I start something new. This game class should have all game objects and some game states, but they aren't the same every time so I thought about having a vector of a virtual base class that the objects inherit, one for objects and one for states. (This is possible? Think I've seen this somewhere.) I'm not sure how to manage the game states yet, read the discussion on stack based game states here, but as I said, I'm not sure on how to do this. The game class should of course keep track of timing, SDL initialization, the gui and input too. Does this sound like an good implementation? Is this how you manage your code? Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
First, IMHO you shouldn't call your main class "Game" class, since that will be totally misleading when you will write general applications and/or editors. Second, what do you mean by "game objects" and "some game states"? You know, every game is different and you simply can't predict what objects / states / entities etc. you may need in your future games.

I would suggest to create general purpose, flexible engine that will be independant from the type of projects that you will be writing. As a begginning, read all Enginuity articles and after that you should get a good grasp of how to structure your engine. Good luck :-)


Quote:

Does this sound like an good implementation? Is this how you manage your code? Any suggestions?


I've written small article about my engine - maybe you will find it useful.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!