Increase Game Speed over time with Global Time Dilation

Hello, how do I increase my game’s speed over time (making it more difficult) using global time dilation?

It sorta depends on the final result you wish to achieve, there are multiple approaches that may work, all involving the Set Global Time Dilation node as you already mentioned.


I’d personally put this behavior either under my GameMode blueprint or under the specific LevelBlueprint (probably the former).

There, what you do specifically really depends on your desired result - I’d probably do the following:

  1. Create three float variables in the selected blueprint: globalTimeDilation, timeDilationRate & dilationLoop
  2. Add a Set Timer By Event node to the event graph
  3. Set Looping to True + connect Time to the dilationLoop variable (which means, every seconds, we raise the game speed)
  4. Pull out a wire from the Event pin, then type Add Custom Event, add the node & set its name (something along ‘updateGlobalTimeDilation’)
  5. Now you perform a tiny calculation: set the globalTimeDilation variable’s value to itself + timeDilationRate; then add an actual Set Global Time Dilation node, and connect the globalTimeDilation variable to the Time Dialatiohn pin;
    globalTimeDilation’s initial value should be 1.0 (normal speed), and timeDilationRate’s value determines the increments in which the globalTimeDilation value would rise (or, in other words - every ‘dilationLoop’ seconds, you raise Global Time Dilation by ‘timeDilationRate’).


    If you wish to have non-static values for dilationLoop or timeDilationRate - then you should probably use a Timeline, instead, assuming you have a maximum Time Dilation value you don’t wish to exceed and that the change can happen over a static duration of time (which is the Timeline’s duration).


    If that’s the case - there are, as expected, multiple ways to make it happen :wink:


    You can either Play the timeline on event BeginPlay, then Pause / Play it as needed, or you can include the entire logic inside the timeline’s curve itself, without ever pausing it.

    The timeline allows you to define a Curve for a float value over time, then use it directly by connecting its exposed value to a Set Global Time Dilation node to be fired on the timeline’s Update pin.
    So, all you have to do is add a float curve to the timeline, set the desired timeline length (how long should it take to go from Time Dilation = 1.0 to Time Dilation = MaxTimeDilation?), then add points to the curve according to the way you wish for the value to change.
    You can then mess around with your points’ interpolation methods to further fine-tune the way the value’s changed.


    There’s also the Ignore Time Dilation checkbox in the timeline - haven’t got to experiment with that myself, but I’m assuming it should be True in your case.
    If you get strange results - try changing it back & forth and see what it actually does with your defined behavior.

wow, thanks so much for your time, will give it a try soon and get back to you.

Just tried it and it works great, thanks so so much.