Archived

This topic is now archived and is closed to further replies.

o_rugal

Game Structure

Recommended Posts

o_rugal    122
Hi all This is gonna be a bit long winded I''ve started making a 3rd person game (of some sort). At the moment I have a character walking about and have got the camera tutorial integrated(with a few adjustments). I have a windowcode.h and .cpp file to handle the windows stuff. And a main.cpp that has everything else (1100 lines!) From winmain I call an: initGL procedure then a createmodels()*, //loaded from text files Then go into a loop: while (isMessagePumpActive == TRUE) Then deal with keyboard input and its effects. Then DrawFrame. Basically I need to organise everything. Figuring out how everything to do with the character interacts is giving a headache. So I was hoping for some advice. First off, whats the best way to store the meshes, at the moment I use arrays of polygons. One array for head, another for upper arm, lower arm etc. I then have a big function with lots of pushing and popping to get the proper hierarchy. I''m planning on a character class, so I think I can get rid of the createmodels()* step and have a class constructer method instead. This is where things get tricky. Should I have a class "body part", which is called from class "character"? The whole information passing thing is giving a headache too. The one big file with globals is a real pain. (I tried modularising it but got lotsa linker errors) Any hints on this? Then there comes animation. Each body part has x,y,z variables for rotations which are updated from the keyboard procedure (pretty complex with for example updating all the variables for walking left say). Should I have a keyboard class? How do I integrate this with the character class? Maybe I could have an animation class? Or animation methods in the character class? Looking further, I''d have to integrate physics, collision detection, and then drawing the character. How to organise all this? Especially into a full game world. I know this is a very open topic but any help would be mucho appreciated Thanks

Share this post


Link to post
Share on other sites
DarkHamster    180
Two words: Object Oriented. You want to make everything about as autonomous as you can. That way creating a new enemy for instance is as easy as initializing a new instance of the given class. If you make the engine able to manage itself in a clean OO manner, it is usually a lot easier to make modifications and additions.

Share this post


Link to post
Share on other sites
rugal    122
hmmm, shoulda guessed the topic was too open ended.
Ok let''s narrow it down.
I already knew OO was the way to go. Taking a wild guess,
I think a main character class would be kinda useful.
Main char is made of polys.
So 2 points come to mind.

1: How to organise the polygons? Currently I have
arrays of polygons. One array for head, another for
upper arm, lower arm etc.Whats the best way to sort
this?
2: Would a polygon class be useful? if so how?

Share this post


Link to post
Share on other sites