Creating A Replay System In Unity

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 29

  • @dreamisover9813
    @dreamisover9813 10 дней назад +14

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

  • @neonmarblerust
    @neonmarblerust 8 дней назад +1

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

  • @captainnoyaux
    @captainnoyaux 10 дней назад +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

  • @Draxi_1
    @Draxi_1 9 дней назад

    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 10 дней назад +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.

  • @AnEmortalKid
    @AnEmortalKid 10 дней назад +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 10 дней назад

    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 10 дней назад +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  10 дней назад +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 10 дней назад

      @@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.

  • @feyakut
    @feyakut 8 дней назад

    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.

  • @alexleonardkrea
    @alexleonardkrea 9 дней назад

    Very cool!

  • @lounic8221
    @lounic8221 9 дней назад +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 8 дней назад

      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

  • @Galaxy_World
    @Galaxy_World 10 дней назад +4

    insane

  • @k0cc425
    @k0cc425 9 дней назад

    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 8 дней назад

    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)

  • @expired___milk
    @expired___milk 9 дней назад

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

    • @GameDevGuide
      @GameDevGuide  9 дней назад +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 9 дней назад

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

    • @twinjuke
      @twinjuke 8 дней назад +2

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

  • @BlueJDev
    @BlueJDev 10 дней назад

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

  • @jankrajewski6170
    @jankrajewski6170 9 дней назад

    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

  • @trecmthw
    @trecmthw 2 дня назад

    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.

  • @LoneLuminaryDev
    @LoneLuminaryDev 10 дней назад

    gotchu man i think i was close tho

  • @Meowzors
    @Meowzors 10 дней назад

    I wonder how this would work for instantiated objects

    • @GameDevGuide
      @GameDevGuide  10 дней назад +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.

  • @amrsaied8696
    @amrsaied8696 9 дней назад +2

    Someone mention riot games