Implementing 'Pause' Game
by Terence Tan · in Torque Game Engine · 01/30/2007 (3:50 am) · 6 replies
I was just playing our game, and then I realized that (when I wanted to go out for a pee)...that there isn't a pause feature for our game yet.
Did some searching on the boards, and didn't come up with anything. Would like something that pauses everything (i.e. freezes everything) except UI interaction's naturally. I went though the engine a bit poking around, my best guess would be to stop the game simulation clock from running? I would like it to pretty much freeze up all thing(i.e animation, SFX, AI monsters, projectiles in motion et all).
Did quick search for a 'pause' and didn't turn up anything except stuff that pauses animations.
Did some searching on the boards, and didn't come up with anything. Would like something that pauses everything (i.e. freezes everything) except UI interaction's naturally. I went though the engine a bit poking around, my best guess would be to stop the game simulation clock from running? I would like it to pretty much freeze up all thing(i.e animation, SFX, AI monsters, projectiles in motion et all).
Did quick search for a 'pause' and didn't turn up anything except stuff that pauses animations.
About the author
#2
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9385
Then simply add calls to alxPauseAll() and alxUnpauseAll() to the functions Michael posted above.
- Houdini
01/30/2007 (6:24 am)
Also, you can pause SFX if you add this resource to your game:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9385
Then simply add calls to alxPauseAll() and alxUnpauseAll() to the functions Michael posted above.
- Houdini
#3
02/09/2007 (2:06 am)
I haven't tested this yet. But will this, also consider schedules? I know schedules are dependent on the real time clocks. Will this become a problem?
#4
02/09/2007 (2:55 am)
Set $timeScale to 0 and try?
#5
02/09/2007 (4:31 am)
Schedules are based on simulation time. $timescale will affect the whole simulation.
#6
02/13/2007 (2:08 pm)
I know from previous work that the $timescale doesnt affect the GuiClockHud. But to make fully pause functionality its likely just a case of patching the exceptions
Employee Michael Perry
ZombieShortbus
function PauseSim() { moveMap.pop(); [b] // Stop taking user input [/b] $timeScale = 0; [b] // Stop the game clock [/b] //[b] Pause other features manually [/b] } function ResumeSim() { moveMap.push(); [b] // Resume taking user input [/b] $timeScale = 1; [b] // Resume the game clock [/b] //[b] Resume other features manually [/b] }Some things aren't affected by $timeScale, such as replicator sway. You might have to implement a check for the variable in certain objects to make sure they don't update or animate, but that's a good start.