What could I do to link game objects?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

What could I do to link game objects?

Post by serengeor »

What could I do to link game objects?
By link I mean I want my objects to act like in some sort of chain mode where for example: Object1 jumps, when he lands he makes Object2 move right, when Object2 is done moving he makes Object3 rotate, and when Object3 is done he makes the Object1 do the same jump, and this goes on forever(or until my computer crashes :D).

I had already done this using command approach, where when object finishes doing something it posts a command with another objects name to object manager, and the manager sends out those commands in the update loop. But the commands were way too slow, the more commands were sent the more performance decreased.

Here's what it looked like when I tested it with rotations:
http://www.youtube.com/watch?v=mxLOc5va ... er&list=UL
In this test the performance issues were hard to spot, but when I tested it with 3 character controllers the fps decreased by 600-700 FPS.

I have one idea in mind that should speed it up, but I'd like to hear what you would do :)
Working on game: Marrbles (Currently stopped).
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

I would do it with events.
The object can fire the event just in time when it is designed. The object has some events (like OnStart, OnFinish) and resposible to fire them. Other objects can subscribe for the interested in events. This seems like you described, but i do not see a reason why this would add any slowdowns.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Post by mongoose7 »

The messaging would be trivial no matter how it is done. I'd look alsewhere for the cause of a slowdown.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

I think I had it done right with commands, though I'm not sure :(
I'll to do this the other way and see if it goes any faster.
Working on game: Marrbles (Currently stopped).
Post Reply