Index

Game Captures / Replays

Trial includes an automated way to create game captures, or "replays". The way this works is by capturing all input events that are issued between physics steps, and then recreating them when replaying. This means that, as long as your game only relies on input events to drive its simulation, the replay system should work completely automatically.

You can create a replay by calling start-capture. It will create a binary replay file. Once the replay should end, you can call stop-capture. A completed replay file can then be replayed using start-replay, and stopped with stop-replay.

Note that while replaying, the system will still process input as normal, meaning you can potentially inject additional inputs that could interfere with the replay. It's up to you to ensure this doesn't meaningfully happen.

Please also note that due to the agnostic nature of the capturing system the capture files may not be the most efficient and robust way to store a replay. For instance, it may be more compact to just store the position of the player character over time, if that is enough to make your game work.

Finally, if you would like to extend the capture system to also support capturing other event types that might be required for accurate replay, you can make them known to the system via define-event-type-serializer and define-type-serializer if new data types are required. The resulting storage will be compact and efficient binary, such that the replay should have close to zero overhead.