How to Put Your Game in Slow Motion
by Quentin Headen · 02/21/2009 (12:00 am) · 10 comments
Ha ha, I know you are expecting some sort of big resource with a bunch of C++ source code mods. Well, thanks to GarageGames, we only have to add 1 line of scripting code for the slow motion effect.
To put the game into slow motion, modify the global variable $timeScale.
The default value is 1, but if you bring it down to about 0.5 or 0.4, it will give the game a nice slow motion effect.
You might want to also hook this into a button press or a trigger entry. That way, it will look real cool. :)
Also, if you want to pause your game, you can set the $timeScale variable to 0. This will stop all physics processing, but will still allow things such as the GUI, and the background music to run.
Enjoy
To put the game into slow motion, modify the global variable $timeScale.
The default value is 1, but if you bring it down to about 0.5 or 0.4, it will give the game a nice slow motion effect.
You might want to also hook this into a button press or a trigger entry. That way, it will look real cool. :)
Also, if you want to pause your game, you can set the $timeScale variable to 0. This will stop all physics processing, but will still allow things such as the GUI, and the background music to run.
Enjoy
About the author
Just your average teenage programmer who tries to finish the projects he starts. :) I am currently focused on creating games with Torque engines. My website is http://phaseshiftsoftware.com
#2
Must be set server or client side? And... do you actually know how it works in a multiplayer environment? I wonder how it works with repespect with shedules also.
Anyway, dont take it bad Quentin, but I dont think an engine feature should be put as a Resource.
Edit: in fact there is already a *forum post* of about a year ago, talking exactly on the use of $timescale for slow motion.
02/21/2009 (8:20 am)
Have known of $timescale, but never really investigated about its behaviour.Must be set server or client side? And... do you actually know how it works in a multiplayer environment? I wonder how it works with repespect with shedules also.
Anyway, dont take it bad Quentin, but I dont think an engine feature should be put as a Resource.
Edit: in fact there is already a *forum post* of about a year ago, talking exactly on the use of $timescale for slow motion.
#3
I worked on this a little while back but it was for a client, hence I can't release the code. Pretty straightforward to implement though, just have a look in the sound system for stuff related to frequency of sounds etc.
02/21/2009 (9:39 am)
Sound works on a separate system to the main simulation - meaning you will still have normal-speed sound even when the timescale it set to make the game slower.I worked on this a little while back but it was for a client, hence I can't release the code. Pretty straightforward to implement though, just have a look in the sound system for stuff related to frequency of sounds etc.
#4
I kind of agree with Novack though that simply adjusting an engine feature's variable isn't really a resource. Give people TorqueDVR or give it in-game usability similar to bulletTime -- now that would be a resource -- but anything that is itended to be helpful or useful, whether it is a reminder of something that should be general knowledge, tips, guides, code, etc, is indeed a resource.
Perhaps things like this would be better if posted in a "Tips & Useful Info" section of the site.
02/21/2009 (9:52 am)
$timescale is handy for playback of recordings, ie. Torque FF and slow-mo, just never figured out a rewind feature. It even "fixes" a light editing bug for Constructor.I kind of agree with Novack though that simply adjusting an engine feature's variable isn't really a resource. Give people TorqueDVR or give it in-game usability similar to bulletTime -- now that would be a resource -- but anything that is itended to be helpful or useful, whether it is a reminder of something that should be general knowledge, tips, guides, code, etc, is indeed a resource.
Perhaps things like this would be better if posted in a "Tips & Useful Info" section of the site.
#5
02/21/2009 (11:19 am)
Call it a 'nugget of truth'. I hadn't seen the forum post last year so I like it. Could be a great way to implement slow motion combat (or perhaps there's a better word for that too) like what they have in God of War.
#6
02/21/2009 (11:30 am)
Yeah guys. I just wanted to submit something I thought would be useful. Also, it you set the value above 1 it will give a fast forward effect. Sorry about wasting a resource slot. :) I am kinda new to submitting resources. Next time I find something like this, I will post in the forums. :)
#7
02/21/2009 (11:45 am)
Sorry to rain on you parade putting timescale to 0 will actually lock the simulation. Schedules will stop working so I recommend to do no that.
#8
02/21/2009 (12:20 pm)
True. Thanks a lot for clearing that up. :)
#9
02/21/2009 (12:25 pm)
I found that schedules (at least with my AI 'cos that's what I tested) restart fine from where they left off after "pausing" with $timescale-0; and then restarting with $timescale=1;.
#10
im gonna make another tests to see if that was a bug in my code back then or what.
05/18/2009 (2:05 pm)
myaybe im using a wrong version of the engine or whatever, but in a tes i made about a year ago or so, when i triggered the "$TimeScale=0" the schedules kept workin like normal.im gonna make another tests to see if that was a bug in my code back then or what.
Associate Steve Acaster
[YorkshireRifles]