Game Development Community

Gamespeed ?

by Billy L · in Torque Game Engine · 06/01/2004 (5:56 am) · 3 replies

Hi all

Is there anyway global functions to change game speed.
want slomotion to test things.

#1
06/10/2004 (8:10 am)
In console:

$timescale = ;

You can also make functions to do it, however ONLY do this when you are playing with a LOCAL SERVER (IE, non dedicated) with no one else in the game! They will lag VERY badly if you do!


Here is the function I made to do "slowmo" effects, just for fun.
%min = speed you want game to slow down to
%fadeTime = time it should take to slow down and speed up
%duration = time after fading down to speed back up. notice that time will slow down, so slowing for 4 normal speed seconds at 0.5 speed will slow for, I assume, 8 seconds.
I havn't used this in a while, but it works pretty well if I remember.
function SloMo(%min,%fadeTime,%duration)
{
   if($SloMoInProgress)
      return;

   $SloMoInProgress = true;
   for(%i = 0; %i < %fadeTime; %i+=32)
   {
      schedule(%i,0,"SetGameSpeed",1 - ((1 - %min) * (%i / %fadeTime)));
      schedule(%i + %duration + %fadeTime,0,"SetGameSpeed",1 - ((1 - %min) * ((%fadeTime - %i) / %fadeTime)));
   }
   schedule(%duration + %fadeTime * 2 + 32,0,"EndSlowMo",1.0);
}

function SetGameSpeed(%sp)
{
   $timescale = %sp;
}

function EndSlowMo()
{
   $SloMoInProgress = false;
   SetGameSpeed(1.0);
}
#2
06/10/2004 (12:19 pm)
Thanks Max
I try this out ,i need the slomotion for testing my melee combat moves.
So i really need this.
#3
06/11/2004 (5:09 am)
I regularly use the console $timescale = thing to make sure my particle effects and explosions are solid-looking.