structure of model handling
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 ~
M A R C N E U M A N N{Graphics and general programming;Application Developer;}
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement