What's the better option between global and custom time dilation?

Hello everyone,

I am currently working on a very basic shmup using Blueprints.
I managed doing most things with my basic knowledge and a couple Google searches but I kind of ran into a pickle.

I have a main char, an enemy and both their projectiles set-up properly.
The main gimmick of my game is the ability to slow down time for all actors when enemy bullets are close to the player.
The one and only thing I want to be immuned to time slow down is a specific enemy bullet.

I have tried two things :

  • All actors affected by the slow have their respective custom time dilation set with my formula. Immune bullet is left as it is.
    The main problem here is that I have several places where a delay is set (e.g. : enemy rate of fire) and it looks like custom time dilation is interfering with that.
    All timings are off.

  • All aformentionned calculations are applied to the global time dilation and the immune bullet is set a specific custom time dilation every tick to balance it.
    All timings work well with this strategy but the immune bullet movement is not smooth.
    I’ve done tricky calculations to set the custom time dilation and have it so : GlobalTimeDilation * CustomTimeDilation is always equal to 1 for the immune bullet.
    It looks more like a hack than a viable solution to be honest.

Am I missing something or is there a simpler solution you guys can think of ?

Thanks in advance for any help provided.

Hey,
Sorry for being late, but maybe you could try affecting all of your actors with custom time dilation, and create a new actor (the bullet) which is immuned.
If you do that :
-Your immuned bullet is smooth;
-Your delays aren’t affected

I’m not a pro, but I hope I could be useful.

Hey,

Thanks for the reply, even late.

I ended up finding the solution so I’ll post it here for anyone interested.

  • I did all my calculations to take
    into the equation the number of enemy
    bullets and their proximity to the
    player.
  • With this I set a variable
    ‘CurrentTimeDilation’ and store it on
    my Game Instance.
  • Then I bind the
    enemy bullets (and all actors
    affected by time slow) to listen to
    any change applied to
    ‘CurrentTimeDilation’.
  • When a change
    is registered, I update the current
    bullet velocity by multiplying it to
    the slow factor ‘CurrentTimeDilation’ (see screenshot)

251299-2018-08-23-00h25-18.png

Of course any actor that isn’t affected by time slow won’t listen to changes made to this variable.