Curiosity of game camera recording

I have a question about how game recording works, where the player can play a replay of the game after it finishes, they can replay the game, move around and watch. Just for curiosity, how does this work? How do you make recordings with unity? And how can the person move the camera around of something prerecorded?

There’s no real general way, but most games won’t actually be “Recording the screen” in the general sense, because that would simply require too much RAM to store the sequence of frames.

Traditionally one just records the positions / rotations or other state of GameObjects that you want to “play back.” Then you simply reload all the original content and instead of accepting input and playing the game, you simply jam the recorded sequence of positions into the original GameObjects and let them go through their dance replicating what happened before.

I have a ground track recorder on my Jetpack Kurt Space Flight game, and here is the data that I record each frame for your ship:

using UnityEngine;

// @kurtdekker - a single flight datapoint in time, part of Jetpack Kurt Space Flight

public struct FlightDataDatapoint
{
    // We are NOT storing timeStamp. We are inferring this
    // from using Time.fixedDeltaTime and the index number.

    public FlightDataEventFlags flags;

    public Vector3 position;

    //public Quaternion rotation;

    // control inputs, not orientation:
    public float power, pitch, yaw, roll;

    // radar altimeter readout; this is not simply position.y!
    public float altitude;
}

I just have an ever-growing array of those and record all the data each frame. The flags are just bitfields for interesting things that happen each frame, such as landed, refueled, impacted, died, etc.

1 Like