Recording Movement & Animation For Playback

I am wondering what the best approach for recording player movement and animation (rotation of bones for example) in Panda would be?

Specifically, I would like to be able to record everything that a character does in a game, save it to a file and allow the player to play it back and watch their game, much like the “replay” features found in a lot of console video games.

Can anyone suggest a good method for tackling this? Are there any examples out there of something similar?

Thanks!

I think the most sensible way to do this is to simply record all the commands you use to control the character. For example, if you call setPos, record the fact. If you call play(animation), record that. Later, when it’s time to play back, just perform the same actions.

I had assumed that I could use RecorderController to record user input to a bam file (is this what you are suggesting?) and then play it back, but I’m still learning Panda and I was wondering if anyone knows of any demos or examples that I could look at that make use of RecorderController or another method of doing this.

Thanks!

Interesting. I’ve never used that part of panda. Let’s wait and see what David has to say.

This is what the original intention of the RecorderController, but it’s long-untouched code, and probably crufty and manky.

If you were so bold as to want to try it, you might simply put:
record-session foo.bam

in your Config.prc. Then, to play it back, you would put:
playback-session foo.bam

instead. But these assume that all of your inputs will be through the standard trackball or drive interface; few people use these interfaces for anything more than a simple demo. If you have your own interfaces, you may need to hook them into the controller yourself.

You can look at the code inShowBase.py to see what it is doing in response to the above config variables. Then you can look at the C++ code in panda/src/recorder to get an idea of how to use it. More than that, I can’t really give you. Good luck. :slight_smile:

David