Few questions about physics and replay possibility.

Hi guys,

I am new to posting on these forums although I’ve been lurking around as well as developing here and there with UE4 for over a year and now I have more time to delve into UE4 full time. This however is not something that I’ve found either here or on the answerhub so here are my questions.

  1. What would be the best way to slow physics down? As far as I see it there is no way to change this in the world/project settings neither it is possible through custom physics volume. I basically want to change how fast the physics is happening without changing the actual physics properties of the actors. For example achieving this in Box2D which I used quite a lot in the past is very simple. Is it possible without modifying the engine souce code or do I need to tinker with it?

  2. What would be the best way to achieve local replay, again there would be some physics simulation happening and I want to rewind and replay it. All the documentation and posts suggest this is work for replication which is networking feature I don’t really need networking at all since I want to do this replay locally for the same player actually. Should I still use networking? How? Or should I go the obvious route and basically saving positions with a custom code and then replaying it with a custom code. Or maybe there is a more elegant way I am missing.

Thanks guys, and btw this is great community I hope to contribute in the future as much as I can.

  1. For singleplayer: you need to store world state at moment of start recording replay and record all player inputs during recording, then when you play replay you should restore world state and then for every frame read stored input from replay file and apply it to your playercontroller. So you need to perform save/load game functionality(for save/load world) and modificate your playercontroller to be able to store and “play” player input to/from file.

CustomTimeDilation in AActor class.

Thank you guys, I wasn’t aware of the CustomTimeDilation still curious why there is no global time dilation like for example in Unity.

As for the recording thats what I figured as well, fortunately in my case there is no player input during the recording, player only does input at the beginning of the simulation so it simplifies things. Kind of curious why there is random seeding and can it be circumvented? I figured as much about undeterministic character of the physics simulation due to variable timestep especially if you can’t afford substepping but random seeding on top of it is strange concept to me.

TimeDilation in WorldSettings class - it’s time dilation for entire world i.e. global.

Thanks D.L.S.

UE4 uses Physx and it is designed like that, you can’t do much about it. I think the reason why people suggested using replication is because it does a lot of work for you - your physics simulation happens during the play and replication, if setup properly, will send only the end state of your objects without trying to simulate anything, which makes your replay as close as possible to what was actually happening during gameplay.

Would be possible to store world state on blueprint too? I’ve been looking for this since long time