Archived

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

mastah

structure of model handling

Recommended Posts

Hi all, can you guys tell me a lil bit of your program design. I want to load my models from binary files and store the data in a member of a related class. Currently, i''m working on a RPG and i want to create one class for each monster(or something else) from which i can derive several classes for different texturing or different behavior of those characters. What do you suggest, could this be the right way or is it a better way to store all the model data for all characters in one class or a namespace. (I''m using VC++6 & OpenGL & DSound/OpenAl & DInput) Thanx for help. -= Doin it 11111000. =- ~ www.dragonwings.de ~

Share this post


Link to post
Share on other sites
This depends on how you want to store your behaviour. If it is gonna be an AI script or just a load of booleans, for instance, they can be changed on a per-instance basis, no separate subclassing needed. But if there are gonna be fundamental differences (eg. lots of different functions) you will probably want to encapsulate the common stuff in a base class and derive subclasses for major changes. Eg:

class Orc
{
// Orc graphics stuff
}

class OrcWarrior : public Orc
{
// AI dictating battle tactics
}

class OrcScholar : public Orc
{
// AI dictating library dwelling tendencies
}

And so on. I had a similar concern in whether to use instances of the above classes for individual creatures, and thus derive them all from a base Creature class, or instead to use a separate Creature class which contains a pointer to one of the above ''type'' classes. I am pretty much decided on the pointer method, as it is more flexible (run-time metamorphosis of types! Neat...), but your mileage may vary. You may pick up some ideas from my other thread in this forum, or maybe not, depending on what you need to know

Share this post


Link to post
Share on other sites