Time Distort in Super Intergalactic Gang (and in video games in general?)
Tags: gamedevelop, showdev, beginners
Published: 2019-07-19 14:08:56

When I started to develop SIG  I had only a couple of things clear: 

- It was going to be a Shoot em' up.
- It was going to have a slow motion mechanics, as if it were Neo and the famous "bullet time".

<em>Video demo</em>
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/4zkn1-7K1c0/0.jpg)](https://www.youtube.com/watch?v=4zkn1-7K1c0)

We are usually used to seeing things in slow motion as a way of repeat an event that happens at a high speed and be able to see it clear. 
In fast actions such as in a sport, a fight or a car accident, seeing things at a slower speed than normal helps to appreciate what happens best.

It is very attractive, for example, to see Messi in a slow motion play, and to notice how he seems to be affected less than his rivals by this time distortion, I.E: he moves relatively faster then rivals.  
Of course, this is not so, only his greater speed and skill in real time are the ones that achieve this effect.

So, since the mechanics of time distort was the main thing in my game, it had to feel good and be gratifying, make the player feel like a great skillful who can dodge bullets and slip between enemies and shoot them in the face.

That's why it was clear to me that I couldn't just implement it as a time slowdown, and that it had to affect different objects in particular ways in order to maximize the effect.

The first thing I did was to define a global variable in my game that would represent the speed of time:

<code>globlal TIME_SPEED = 1;</code>

![](https://thepracticaldev.s3.amazonaws.com/i/0ax8vp5yl3js3i9ly7v8.png)

That is, it is used as a multiplier, being 1 the normal value and, for example, if I wanted to make everything go at half speed the value should be 0.5.

Then, I use that multiplier in every place where there was some process that had something to do with time. 

For Example: Enemies advance and move at a given speed that is linked to time because, to travel a given distance, less time means greater speed.
Also, for the most part, they have attacks based on a timer that dictates the frequency of the shot or attack. In the case of bosses, the timers are involved in changing states, for example:

<code>passive >> attack 1 >> passive >> attack 2</code>

Speed of bullets, frames of animations, movement of the character also are linked to time.

With the global variable multiplying everywhere, the only thing left is to change its value and everything automatically goes slower in "time distort mode".

What remains is to make the player experience it as a real time distortion and use it to his benefit.

To slow everything down evenly would be intuitive but, through experimentation and a lot of playtesting what I determined was that it is perceived as a slowness and nothing else. 
It doesn't give that feeling of over power, it just moves everything slower and it doesn't even give a major advantage because although. For example: the bullets goes slower, so does the character.

Here I think there can be thousands of ways to solve this problem and I don't think there's one that's optimal but I think the one I used worked quite well and it was:

**Enemies:**
All enemies, bosses and enemies bullets are affected by slow motion equally using a value of 0.3 as multiplier, ie less than half the normal speed. 
This affects your moving speed, your animations, your firerate, and any timer that modifies behavior or reaction to an event.
That means that enemies "think" slower than in normal mode.

**The player:**
Characters are affected in their movements to a lesser extent than enemies, using a value of 0.5.
The speed of the bullets is also affected but not the firerate which remains the same as normal speed. 
The latter sounds a bit strange but with this what is achieved is that the player can continue shooting and the bullets accumulate forming a denser row and when the time distort and accelerate produce a "matrix" effect. 

In short, during a time distort, the player has more time to react, feels more agile and able to literally slip between enemy bullets. Indirectly, it's like having a boost of speed and more firerate but in a slightly more interesting and covert way.

Then, to accentuate the feeling of time distortion was generated a kind of ghost trail that follows the movements of the players with a delay and changed the pitch of the SFX and music to half.

I think this method is generic enough to use in any other game or genre, so that's why I consider that sharing this thoughts and techniques could be useful to any game developer trying to achieve something similar to this.

![](https://thepracticaldev.s3.amazonaws.com/i/ex57u99kedve5gm6jwsm.gif)