Game entity and Scene nodes.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Game entity and Scene nodes.

Post by serengeor »

Ok, so I'm still having troubles with my framework, tough it got improved a bit, I'm thinking that I would make Entity hold only ISceneNode pointer, that way I wouldn't have to derive classes for all possible scene node types. I would just create lets say IAnimatedMesh, manipulate it what ever way it needs and set it to the entity class as ISceneNode pointer.
Tough now that I think about, I would need to somehow animate meshes, and I could just cast it, but maybe this all approach is wrong? Last time I just derived bunch of classes for specific types of nodes, tough that just looked like a mess.

I hope that someone will understand what I wrote and give me some tips on how could I approach this :roll:
Working on game: Marrbles (Currently stopped).
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Game entity and Scene nodes.

Post by randomMesh »

serengeor wrote:I'm thinking that I would make Entity hold only ISceneNode pointer, that way I wouldn't have to derive classes for all possible scene node types. I would just create lets say IAnimatedMesh, manipulate it what ever way it needs and set it to the entity class as ISceneNode pointer.
I use a similar approach. I have a base class IGameObject with

Code: Select all

virtual irr::scene::ISceneNode* const getNode() = 0;
so all derived classes have to have a node somehow.

I have different kinds of game object which inherit IGameObject and each can have its own type of ISceneNodes. My Flock class uses a simple ISceneNode, the static walls a IMeshSceneNode and the player an animated one.
serengeor wrote:Tough now that I think about, I would need to somehow animate meshes, and I could just cast it, but maybe this all approach is wrong? Last time I just derived bunch of classes for specific types of nodes, tough that just looked like a mess.
For me, this approach works fine so far, i didn't run into any problems (yet).
"Whoops..."
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

but what about objects that dont get renderegraphcally?

what about a data table that should be considered an entity but doesnt use the other services?

EDIT: i plan to announce my project (game resource shell) this next day as soon as i am done integrating it with irrlicht

maybe we can bounce ideas of eachother. :)
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

ChaiRuiPeng wrote:but what about objects that dont get renderegraphcally?
what about a data table that should be considered an entity but doesnt use the other services?
You could return 0 or use an empty scenenode.

In this case a proper component system would be more useful i think. I never came into the trouble to have an invisible game object.
"Whoops..."
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

The only non renderable object type I can think of is sound, I guess?
I think an empty scene node would do the job. Tough I haven't tried to implement the sounds yet so I don't really know how its going to be.
Working on game: Marrbles (Currently stopped).
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

serengeor wrote:The only non renderable object type I can think of is sound, I guess?
I think an empty scene node would do the job. Tough I haven't tried to implement the sounds yet so I don't really know how its going to be.
that is okay i guess.....
but i mean wouldnt there be a small overhead from the scene node registering with irrlicht/ whatever graphics lib?

my game i am planning has more than just a few of these cases so i am building game objects like this hierarchy

trGameObject //has an array of game properties

trGameObject3d // 3d position

trGameObject3dDynamic //velocity, orientation, position, angular velocity
// add graphical game object

the other branch of this tree...

trGameObject3dDynamic<-(child class) sound emitter.

all game objects are children of a trGameWorld instance, which in turn are children of the game device. game device initializes external resources (e.g. irrlicht) and establishes the link between trBolt class objects and trGameWorlds so trGameObjects may request services

e.g.

void drawMe();
const trTransform3d& stepMyPhysicsSimulation();
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Well I'm thinking about my system in a bit other way, and I guess I'll just have to try and see if it will work out or not :)
Such a simple game type and still so much to do, I can't imagine how newcomers, come and just say that they are making/want to make a FPS game.
Working on game: Marrbles (Currently stopped).
wahagn
Posts: 186
Joined: Sat Dec 06, 2008 5:11 pm
Location: Zundert (Netherlands)

Post by wahagn »

serengeor wrote:Well I'm thinking about my system in a bit other way, and I guess I'll just have to try and see if it will work out or not :)
Such a simple game type and still so much to do, I can't imagine how newcomers, come and just say that they are making/want to make a FPS game.
Well,... You were a newcomer ones and probably ( 90 % chance) you too had wrong ideas about programming in the beginning. :-P
“Any code of your own that you haven’t looked at for six or more months might as well have been written by someone else.”
(Eagleson’s Law)
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

serengeor wrote:I can't imagine how newcomers, come and just say that they are making/want to make a FPS game.
Haha, I know what you mean :D
I just tell myself that they'll find out that their awesome project isn't as easy as they thought it would be
Post Reply