Creating A Replay System In Unity

Поділитися
Вставка
  • Опубліковано 24 гру 2024

КОМЕНТАРІ • 30

  • @dreamisover9813
    @dreamisover9813 12 днів тому +14

    it has been a while but the tutorials/topics covered here are always so high quality!

  • @captainnoyaux
    @captainnoyaux 12 днів тому +4

    Braid (Anniversary edition is gorgeous) is an incredibly sophisticated rewind system (the game is based around that) one of the best system I ever saw

  • @neonmarblerust
    @neonmarblerust 10 днів тому +1

    Cool stuff. Aiming for replays can be a good way to ensure the game-play-system is well handled and cleanly implemented.

  • @Draxi_1
    @Draxi_1 11 днів тому

    I didn't really need to know how to make this kind of stuff but I enjoyed watching the video so much and it was so well put together I might add something like that to my game :D
    Thank you so much, amazing work.

  • @evilbritishguy3581
    @evilbritishguy3581 11 днів тому +4

    What about using Animation Curves i.e. each snapshot where data changes, a new key frame is created. Once a recording has completed, you can then optimise the animation curve to only contain the key frames you need to maintain the same animation curve so playback still works.

  • @Galaxy_World
    @Galaxy_World 12 днів тому +4

    insane

  • @alexleonardkrea
    @alexleonardkrea 10 днів тому

    Very cool!

  • @feyakut
    @feyakut 10 днів тому

    What I instantly thought of was to save less frequently and fill in some of the frames by looking at the previous and next saved frames. This may look weird in some cases, but if you save frequently enough I think it can cut the save data size and the required processing power in half.

  • @lounic8221
    @lounic8221 10 днів тому +1

    Interresting choice, I would rather capture an initial state and record all inputs as event metrics as well as a used seed for randomization. Then recreate the initial state of captured scene and playback (simulate) all recorded input (events).

    • @gamesscow
      @gamesscow 10 днів тому

      to get the same behaviour every time the game engine physics would need to be deterministic though and I don't think Unities physics engine is

  • @AnEmortalKid
    @AnEmortalKid 11 днів тому +1

    For the playback, you also have to disable/ignore user input right (just so a player can't tinker with it)? I guess maybe that's what you do when you press watch replay, the gameplaycontroller turns into 'replay mode' and a user can no longer control it.

  • @libiroli
    @libiroli 11 днів тому

    Daaaamn!! Super complicated and useful feature made accessible to us plebs. Appreciate it!! Just to review at a high level:
    1) SnapshotInfo stores specific info of each snapshottable object
    2) SnapshotData stores list of all SnapshotInfos
    3) ReplayContainer stores all SnapshotDatas. But why did you make this an SO?
    Thank you again!!! Wishlisted CoC

    • @romancalderon
      @romancalderon 11 днів тому +1

      I'm thinking he went with an SO as the container as a way for the serialized data to be persisted between (editor) play sessions and so it can be viewable in the inspector. It's a good way to do it too since it's all built-in to the engine.

    • @GameDevGuide
      @GameDevGuide  11 днів тому +2

      Yep, exactly! As I mentioned in the voiceover it's basically just dealer's choice, I like it because I can see it independently in the project so it's useful for me for debugging (and for the video)
      How did you wishlist it? It doesn't have a steam page yet. Are you from the future?

    • @libiroli
      @libiroli 11 днів тому

      @@GameDevGuide Thanks for the answer! Yeah I commented and then saw it has no Steam page. I will WL when it does. I've learned a lot from your videos over the years.

  • @k0cc425
    @k0cc425 10 днів тому

    you could get extra performance by not using guids for object IDs, and instead only relying on ints,; his can be easily achieved by creating a singleton which issues these IDs - it's not the biggest optimization, but can rack up some frames when you record a large number of objects

  • @AnEmortalKid
    @AnEmortalKid 9 днів тому

    It's probably correct in your impl, but in the video i think LoadNextSnapshot was wrong, at least from the code you show here, it basically gets stuck in a loop at snapshot zero, since you have "m_hasNextSnasphot = replayContainer.GetSnapshot(snapshotIndex)" (the same index we just loaded), i think that should be snapshotIndex+1 (peek ahead 1 snapshot)

  • @trecmthw
    @trecmthw 4 дні тому

    I've been looking for something like this for the longest time. I had a solution but the algorithm to find the snapshot was too slow.

  • @BlueJDev
    @BlueJDev 11 днів тому

    I imagine this could be adjusted to add a "sands of time" function to the game for users to correct their mistakes?

  • @jankrajewski6170
    @jankrajewski6170 11 днів тому

    Giving that frame data for each object is a struct and mostly information are just prymitives, it realy asks for some parallelization using jobs and burst

  • @LoneLuminaryDev
    @LoneLuminaryDev 12 днів тому

    gotchu man i think i was close tho

  • @expired___milk
    @expired___milk 11 днів тому

    why would you need to record velocity and angular velocity? Shouldn't position and rotation suffice?

    • @GameDevGuide
      @GameDevGuide  11 днів тому +5

      We want to make sure that the physics objects continue moving correctly between frames we've captured. If we just record the position and rotation alone, it could end up with the object behaving incorrectly.

    • @expired___milk
      @expired___milk 10 днів тому

      @ So the physics kind of act as interpolation to the incomplete set of snapshots?

    • @twinjuke
      @twinjuke 10 днів тому +2

      @@expired___milk yes, just like you would do for multiplayer games as well

  • @Meowzors
    @Meowzors 12 днів тому

    I wonder how this would work for instantiated objects

    • @GameDevGuide
      @GameDevGuide  12 днів тому +4

      It's a little bit more work, but I'm actually using this for handling traffic that I instantiate at runtime.
      As long as you give your objects a unique id, you can use a manager to handle instantiating, and assigning the IDs in your saved replay to a fresh instance upon load.

  • @3xic317
    @3xic317 День тому

    preparing for the influx of valorant comments

  • @amrsaied8696
    @amrsaied8696 11 днів тому +2

    Someone mention riot games