Data driven GameObject class

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
drwbns
Orc Shaman
Posts: 788
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California
x 24

Data driven GameObject class

Post by drwbns »

Hello. I've been thinking of creating a generic gameObject class that contains some data members such as - mesh, controller, rigidBody, etc but I wanted to ask if this is the best way to add objects to my game. Are there any cons to this approach? Thanks for any replies..
User avatar
Herb
Orc
Posts: 412
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI
x 38

Re: Data driven GameObject class

Post by Herb »

I'm not sure if you're looking at defining more "types" or more "instances" of objects to your game, but I'll take a stab at it.

I've used a generic game object with inheritance for more specific objects and also the entity component model, both have there pluses and minues. An important I found (regardless of component or inheritance) was to script the definitions of the objects. Then, you're not hard-coding object parameters and having to re-compile. And it's just plain easy to add additional entity types.

I have my own scripting system to do this, but really got some ideas from this simple parser on the Ogre wiki here.