Even just invoking drawAll() on one scene manager isn't sufficient. All of the animators use the system timer. This timer is a shared global resource. All of the animators, regardless of which scene manager they belong to, will believe that time is moving forward when the timer is running and the will believe it has stopped if the timer is paused.
To be able to independently stop/start animation of entities in different scene graphs, you'd need to seperate the shared clock from the animators. Either giving them their own timer code and allowing them to share or not share a timer.
The other way would be to switch over to using a task engine [like the dusty engine]. Each task can be independently started and stopped, and tasks can be grouped so that if you stop one all of the tasks that are children would be stopped also.
Travis
Pausing a scene?
Yes. Well actually you would write something more like
That is basically what I described in my post when I said If you stop the timer, you stop the animators. Simple as that.. Unfortunately that doesn't solve the more general case, and the second issue that was mentioned...
Travis
Code: Select all
device->getTimer()->setSpeed(0.f)
The timer that Irrlicht provides is global. Every node could get some methods for rescaling or stopping time, but that would be crazy. It would make much more sense to apply a timer framework. That way you get fine grained control over the time for different parts of simulation/game.Another one...is there a way to isolate the Scenes and having the Device.Run() act only upon one "active" scene?
<days later>
What I need is defenitively a way to isolate scenes (or scenemanagers) from each other. So you could have a scene with guielements and scenenodes on it but the scene would not be automaticaly updated, drawn nor presented with device.Run(), Begin/EndScene().
Travis
-
- Posts: 34
- Joined: Sat Jul 30, 2005 9:45 am
- Contact:
I had something similar (if I read it correctly, though i'm in a rush).
I wanted to pause timers (to stop animators/pause the 3D scene) but still wanted timers to run on for my other parts of game (gui/menus which are animated with custom code).
I abstracted the base irrlicht code to give it another timer (subtimer) basically adding 2 timers a 3D timer and a 2D 'paused' timer, you can do this a number of ways and I certainly can't remember off the top of my head how much irrlicht code I changed and how much was just my extra timer code in my timer class but it may be something to look into. Then I just pause my subtimer which 'starves' the scenemanager of any updates (timedelta = 0 effectively) while the real timer still runs on (keeping the game reactive and allowing user interfaces to still work/animate).
ymmv
I wanted to pause timers (to stop animators/pause the 3D scene) but still wanted timers to run on for my other parts of game (gui/menus which are animated with custom code).
I abstracted the base irrlicht code to give it another timer (subtimer) basically adding 2 timers a 3D timer and a 2D 'paused' timer, you can do this a number of ways and I certainly can't remember off the top of my head how much irrlicht code I changed and how much was just my extra timer code in my timer class but it may be something to look into. Then I just pause my subtimer which 'starves' the scenemanager of any updates (timedelta = 0 effectively) while the real timer still runs on (keeping the game reactive and allowing user interfaces to still work/animate).
ymmv
How about removing animators and using `memento` design pattern?
Wouldn`t it be convinient enough?
pseudocode:
Wouldn`t it be convinient enough?
pseudocode:
Code: Select all
//save scene-state
foreach (gameObject)
{
object->save()
}
//restore
foreach (gameObject)
{
object->restore()
}
//object::save
self->memento = self->requestMemento() //memento is initalized
self->freeze() //object is removing animators
//object::restore
self->restore (self->memento) //object restoring state using memento`s information
h4ck d4 5y5t3m
-
- Posts: 219
- Joined: Fri Apr 13, 2007 8:29 pm
- Location: Illinois
- Contact:
Well, if pausing all animations causes blurs and stuff to 'disappear', and you want them paused too, I would think you could render a texture of the desired screen size from the active camera, pause anything going on in the scene, and display the texture you took.
I would think this would be ideal for game-type situations, although I can't say it would be easier or better than any other method. Just my thoughts!
FlyingIsFun1217
I would think this would be ideal for game-type situations, although I can't say it would be easier or better than any other method. Just my thoughts!
FlyingIsFun1217