Help With Pausing Torque 3D
by Dwayne Brown · in Torque Game Engine · 02/11/2008 (11:56 am) · 3 replies
Hi guys I have a question. I am working on an RPG with Torque3D and was wondering if there is a way to pause the engine when my characters enter combat so that my hero is in the same position when he leaves combat. Does anyone know of any resources or have any information on how to pause the engine. Thanks
About the author
#2
02/11/2008 (2:51 pm)
Thanks for the response Alex. So what I am understanding is setting that variable $timeScale to 0 on the server side I can pause the actual game completely while my battle sequence starts? So with that in mind I would just need to create a function that will handle changing that variable for a battle in the Server side as well. If I can use scripts to do this I would rather go that route than manipulate the C++ code in the engine.
#3
Unless your battles are done solely in the GUI, setting timescale to 0 would effect your battles too.
02/11/2008 (10:15 pm)
Not knowing how you game actually works, I'm inclined to suggest just recording the position and vector of the player and any other objects you want to "save", and reset their data to those values when you need to resume.Unless your battles are done solely in the GUI, setting timescale to 0 would effect your battles too.
Torque Owner Alex Stone
Pausing in Torque is a little tricky. Alot of it depends on what you want to pause. In your case, it sounds like you just want to pause the server-side simulation. In that case, try setting $timeScale = 0 in a server-side script. (You could of course set $timeScale = 0.5 to get a slow-motion effect, or $timeScale = 2 to go at 2x speed). For a quick test you can run $timeScale = 0 in the console to pause and $timeScale = 1 to resume.
If you want to pause something more specific, you would need to crack open the engine source code and look at the clientProcess and serverProcess functions game/game.cc.