JME support for replay

HI Guys,
I’m in the process of writing a fighting game and one of my requirements is to enable replay for some dramatic moments such as KO.
Does JME has any support for replaying part of the scene or I have to do all of it myself?
Recording the screen is not an option. I would like to run the actual replay , change the camera angles etc.
I’m looking for the best record / replay performance wise

Thanks!

1 Like

You could record the player’s input with timestamps, and then play that back with NPCs acting out the input for the recorded players.

So if the player does a kick at 5 seconds, and moves left from the 6 second mark until the 8 second mark, then I think you should be able to replay the same results using just that input in the replay scene, since that input was the only thing the player was sending to the game to begin with.

I’m not entirely sure if that’s the best option, but that would be one way to do it so you can alter the camera angles and have a real time 3d replay. Otherwise I don’t think there would be any built in way to record a 3d scene from many custom angles, but hopefully someone will correct me if im wrong.

2 Likes

To me this is like playing animations. For example in hit effect animation you can just run effect multiple times.

Doing such things would be rather easy with JME 3.3 new tween animation system in which you can compose audio, bone animation, camera animation and particles all together and run them as a single action.

1 Like

JME doesn’t provide anything built in for this… because as you’ve seen by the two answers so far there are about as many ways to do this as there are types of game. And each type of game will prefer a different approach anyway.

How you capture the information depends largely on what information you have available? Record network state? Record game objects? Record raw spatials and somehow filter out the ones you don’t want to record?

…and then how you play that back expands from there. Should the camera follow the exact playback? Eventually snap back to playback? Only allow looking around but not moving?

Thousands of ways to do this.

Edit: and never mind the implications of particle effects and character animations if you are recording the raw scene graph. Things get pretty ugly the farther you get from ‘game state’ and the more you rely on JME’s single rigid locked ‘frame time’ tpf that makes stuff like this nearly impossible at the scene graph level.

1 Like

I know that Doom (1993 edition) supported the ability to record and play back states. They actually accomplished this through a quirk in the random number generator. The game didn’t seed the RNG, so the number sequence would always be the same. The main “randomness” was caused by different things calling the RNG at different times as the monsters continued to react to the player. As such, Doom could just record the player inputs and then play them back through the engine.


Of course, RNG in most games (including yours, likely) have more complex mechanics, so I would rather follow something like @pspeed’s suggestion and rely on recording the current state of the game (enemy positions, current actions, etc), and just inputing them through the game engine. Of course, the feasibility of this depends on your code. While this could be fairly easy on a standard client-server architecture (just redirect the client to look at the playback stream), it could be harder on others.
2 Likes

I Think I’m going to record the basic commands: move, turn, animate, the location they were triggered and the time offset.
Then disable collision detection handlers, input handlers etc. and play these records.
I believe It will yield a good enough replay of the scene. You’ll see it in one of the WIP threads hopefully :slight_smile:

3 Likes

I think saving the game commands(move , steer, hit or whatever) as a parent node & it’s child node would be the value of how much this guy or this car moves in a HashMap or json file would be the best option there rather than doing a screen recorder & playing it that would affect the fps badly so attaching a listener to a control or gamestate that collects data each frame & thereby when time comes & you need to play it just call these data , I have made something like that with firebase RealTime database but with a car & it was not replay , it was just data read/write but for a car that jumps , uses nitro etc , it was the same convention .

Yeah… screen recorder is out of the question
I’m not using Java for programming but rather a plain text script so it’s best for me to just store the commands in simple list of strings along with some extra data such as time offset

1 Like