Jump to content
  • Advertisement
Sign in to follow this  
Anddos

recording movement

This topic is 2140 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how would i record transforms and then play them back , sort of like how call of duty records the last kill for the round, thanks 

Share this post


Link to post
Share on other sites
Advertisement
Hi.
I did it for a demo as straight forward as possible:

- get and save camera position andnyaw/pitch/roll each frame
- save them in an ascii file (or whatever you prefer)
- run the engine again and update the camera position and pitch/yaw/roll each frame based on the saved index/file

Note that you have to think of something how to keep fps independent movements

Share this post


Link to post
Share on other sites

I would use a fixed timestep (30 or 60 FPS) for storing the state and current actor inputs. When playing again, interpolate forward using physics and game logic.

Share this post


Link to post
Share on other sites
I did it as you said, with fstream just writing a file.
Pseudo code:

Ofstream somefile...

Game loop
{
Handle input
Handle logics
Render frame

Somefile << camera.getpos().x << ... Etc
Somefile << camera.getyaw, pitch, roll etc
}

and when you play the demo, simple replace saving the pos/rot, set the pos and rotations for your camera

Note that this is extremely simplified, but more or less how I did it

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!