Download

PredictProjectilePath MaxSimTime Explanation?

I’m going through the VR template and I had a question about how PredictProjectilePath works. When you want to teleport this blueprint is calling the PredictProjectilePath every frame. However each call to PredictProjectilePath has a max sim time of 2s. I’m having trouble figuring out how this works. If my game is running at 100 fps I would call the PredictProjectilePath function 100 times. Each of those can take up to 2s, yet I can act on the results in a single frame. Can somebody shed some light on how this is possible? It clearly is because it works, but I’m just having trouble figuring out how the timing works in all of this. If the Max Sim Time actually gets fully utilized how is it that my results are available in a single frame? Is it just that the max sim time is never used in applications where you need the results in a single frame (so only short paths can be predicted?) I’m having trouble thinking of applications where a long sim time is viable in a game.

Thanks for any clarification on this.

I’ve been thinking more about this tonight and I may have come up with the answer to my own question. Max Sim Time must be the max amount of simulated game time for the projectile. So if you shot a projectile straight up in the air and had a low max sim time the simulation would end before the projectile would reach the ground in game. I was thinking of max sim time as being the max amount of time the game would spend on the simulation of the projectile. Maybe this is obvious to everyone else, but if not there ya go I think that’s it.

Prediction == future state. So a 2s maxsimtime is predicting the path for a 2s movement duration. This is done with math in a single frame.

Great node for lag compensation. Say a client fires a projectile locally and it takes 100ms (200ms ping) for the RPC to reach the server. You can use Predict Projectile Path on the server (100ms maxsimtime) to sync its projectile position with the clients at the current moment in time.

Thus where would this projectile be if spawned at transform and moved for 100ms.


For the lag comp approach you’ll need to use Predict Projectile Path (Advanced). This node returns the projectile velocity & time for each Path Position result.