3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Pausing a Game!  (Read 289 times)

« on: May 18, 2014, 08:48:46 AM »
Here's a script to pause the game
//Link a EventOnInput to this script
Code: [Select]
   if(iInitializing())
   a=0;

   if(IN_0==1) //Event on input - input state
   {
      a++;
      iSimulationFrqSet(0.000666f);
      if(a>0)
         iSimulationFrqSet(0);

     //Make sure you stop some objects like particles, timers, etc.
     
   }
   


   else
   {
      iSimulationFrqSet(0.016666f);
      //Make sure you start the stopped objects

   }
--Sam
« Reply #1 on: May 19, 2014, 01:13:42 AM »
Thanks very much. This script can be helpful for pausing the games.
If we don't give up we can achieve the unthinkable!
« Reply #2 on: May 19, 2014, 10:37:27 AM »
I use a similar pause game script... the greatest flaw with this is that when you press the pause button multiple times in a row, cars and other things tend to... fly away at high velocities  ::)

Also, particles and other 2D objects don't really just freeze, which doesn't give the feel of a paused game.

Maybe this is just a personal problem though.
« Reply #3 on: May 19, 2014, 11:10:56 AM »
site:http://www.3drad.com/forum/ pause

You're not the first.


A way of avoiding some of the weird glitches attached to changing the simulation fequency is not just instantly changing the value, but gradually increasing or decreasing it. Also, try using a very low value instead of just zero.

And no, particles aren't paused, as they are technically not part of the physics simulation.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #4 on: May 20, 2014, 10:25:23 AM »
I have used this and it does not have any glitches.

You should stop the particles, timers, etc. coz they arent stopped when using this script.

In the EventOnInput object 'Continous' & 'Toggle Mode' should be checked.
--Sam
« Reply #5 on: May 20, 2014, 10:41:14 AM »
This is new version of my code.

Code: [Select]
//
//Link a EventOnInput to this script and keep 'Continuous' and 'Toggle Mode' checked.
//

int a = 0;
void Main()
{
   //Your script goes here...
   if(iInitializing())
   {
      iSimulationFrqSet(0.016666f);
   }

   if(IN_0 == 1)
   {
      a++;
      iSimulationFrqSet(0.000666f);
      if(a>0)
         iSimulationFrqSet(0.01/a);
   }
   


   else
   {
      iSimulationFrqSet(0.016666f);
   }


   if(iDeinitializing())
      iSimulationFrqSet(0.016666f);
}

--Sam
« Reply #6 on: May 22, 2014, 12:03:50 PM »
site:http://www.3drad.com/forum/ pause

And no, particles aren't paused, as they are technically not part of the physics simulation.

I knew that, I was just pointing that out.

And Sam, the problem with particles and that stuff is... well... fire doesn't just stop because someone paused the game. Because of all the 2D effects and animations that would have to be paused (via script), I kinda gave up on the idea of actually utilizing a pause button :P
« Reply #7 on: May 22, 2014, 12:45:56 PM »
an interesting discussion guys...  pausing a game, especially one where a physics simulation is an integral part of the game, presents several challenges...

i took a few minutes and came up with this alternative to slowing and stopping the frequency of the physics simulation would be to apply logic that would constantly log the location, orientation, and velocity of each pausable object, and then "freeze" them in place when the game is paused...

see the attached project below...  it's simple and commented...
(the only fault is the rotational mementum of the paused object appears to get lost)

for particles maybe a still image can be used to give the impression of a paused emitter...


« Reply #8 on: May 23, 2014, 01:54:10 AM »
Just had an idea about this, probably nothing though, if im playing a 3d rad game and i click outside the window the game pauses perfectly lol maybe this can be utilized? probably not but worth a thought
Pages: [1]