Hi everyone,
I would like to get some advice on how to make a visually convincing replay for my racing game.
I am using PhysX for the physics simulation and i am pretty sure that everything is non-deterministic.
I am not sure how to verify if my time step is fixed or not ?
My first attempt at recording replay was very hilarious, and a big fail to say the least...
I tried to record user input (only input change) so every time i want to start recording i have a variable called recordedTime.
This variable is incremented with the time step like this.
if (isRecording) {
recordedTime += Time.timeStep;
}
Then i would record the user input like this
void recordAction( float time, string actionName ) {
actions.Add( time.ToString() + "_" + actionName );
}
so for example recordAction( recordedTime, "accel_on" );
etc etc.
But of course failed to reproduce the action properly.
So i decided to add some keyframes at key moments in order to repositionate the car in the good position direction velocity and everything.
So i have a function that record pretty much everything.
Car position, orientation, rigidbody velocity, rigidbody angularvelocity, same for wheels, etc...
But even after adding the keyframe system, it just does not worked as expected.
The thing, is i don't know really the tweaking i need to do in order to reproduce the same action at the same time.
Should i use Update ? FixedUpdate ? LateUpdate ? to record action ?
I just struggle to understand the most fundamental concept.
If i record acceleration input at 1.20 second, how can i play it again later with a different camera angle that is going to affect my framerate and then play the action faster or slower than 1.20 ?
So, instead of trying to reproduce everything in a physical way, i was wondering if it would be a decent solution to record the car position and orientation keyframes only, and then play a kind of linear transition between each keyframes in order to reproduce visually the movement of my car.
What would you think about this option ?
Does some professional games use it ?
Any feedback or advices would be very appreciated.
Thank you in advance.