31
Projects / Raven's projects
« on: November 17, 2005, 07:26:20 pm »
Thank you both, Helge and rolz -- I combined both of your ideas keeping the object3D seperate in a GameObject class wich emplements a GameEventListener. It worked like a charm, and gave me much clearer view of how to puzzle all my smaller bits together that I've been experimenting with since I starting working with jPCT.
I have another question though that is perhapse not justifyable on these forums due to the fact that it derives from my inexperience working with full scale applications and especially 3d rendering.
But well, here it goes: I'm trying to get a grip on how I'll manage the animations that follow triggering, for example, a door object. I implemented the door triggering event where the Door(Object3D) was an md2 file with an "Opening" animation. Of course, the opening animation itself was carried out in the Door object and was therefore not in consistency with the frames in the main game. To explain: initiating the door opening animation caused the animation itself too be drawn too fast for the player to see.
In the official jPCT examples, this is solved by calling doMovement() once every loop in the main gameloop, hence the animations are always consisent with the main thread.
So what I'm currently thinking is to have a GameEventManager, which would keep a listing of all GameObjects as well as an AnimationQueue: a Hashlist that contains all the objects that require animating in the next iteration of the main game loop.
The main gameloop would therefore look something like this, with the addition of soundManager:
So, to sum up, my question basically is: is this the way to go? Or is there some other method that's better when making 3D games? For example, should I be looking into threading each type of manager so it runs independantly?
Thanks for reading and helping
-Raven
I have another question though that is perhapse not justifyable on these forums due to the fact that it derives from my inexperience working with full scale applications and especially 3d rendering.
But well, here it goes: I'm trying to get a grip on how I'll manage the animations that follow triggering, for example, a door object. I implemented the door triggering event where the Door(Object3D) was an md2 file with an "Opening" animation. Of course, the opening animation itself was carried out in the Door object and was therefore not in consistency with the frames in the main game. To explain: initiating the door opening animation caused the animation itself too be drawn too fast for the player to see.
In the official jPCT examples, this is solved by calling doMovement() once every loop in the main gameloop, hence the animations are always consisent with the main thread.
So what I'm currently thinking is to have a GameEventManager, which would keep a listing of all GameObjects as well as an AnimationQueue: a Hashlist that contains all the objects that require animating in the next iteration of the main game loop.
The main gameloop would therefore look something like this, with the addition of soundManager:
Code: [Select]
gameloop {
while (!quit) {
player.doMovement();
GameEventManager.animationQueue(); // If there is something that requires animation
SoundManager.playSounds(GameEventManager.soundQueue()); // Play any sounds that the gameEvents emit
}
}
So, to sum up, my question basically is: is this the way to go? Or is there some other method that's better when making 3D games? For example, should I be looking into threading each type of manager so it runs independantly?
Thanks for reading and helping
-Raven