Timetrial Ghosts in Unity

Record your characters movement and play it back for time trial races and other cool effects. Adding ghosts to your game provides friendly competition between friends and lets players observe how the worlds best went about handling a level.
Source: github.com/Matthew-J-Spencer/...
Time-trial: tarodev.itch.io/extended-ulti...
❤️ Become a Tarobro on Patreon: / tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: / discord
✅ MORE TUTORIALS: / tarodev

Пікірлер: 73

  • @Iboshido
    @Iboshido2 жыл бұрын

    I ve come to a point where i confidently understand Unitys basics, and your channel is exactly what i ve been looking for in my current state of skills. Thank you for helping us to transcend from knowing the basics

  • @mvrcg
    @mvrcg2 жыл бұрын

    Must say, that is some INCREDIBLY smooth squash and stretch. And the ghost system is going to save me multiple hours of banging my head on the keyboard :3

  • @Wobling
    @Wobling2 жыл бұрын

    Man, you're hitting it out of the park with these highquality videos :D

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Thanks Rob :) Wasn't really too sure about this video, but hopefully the script can help some people!

  • @SFotakos
    @SFotakos2 жыл бұрын

    Thank you so much for these amazing videos. You've hit the nail on some of the aspects I've been struggling transitioning from mobile to game development. Such as architecture, best practices and workflow.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Thanks buddy 😊

  • @Tharky
    @Tharky2 жыл бұрын

    Very cool tutorial and insight, thanks man!

  • @hellhunter9478
    @hellhunter94782 жыл бұрын

    Great video and great script :) Thank you for the time and effort spent on this kind of scripts :) Once again you did an awesome job

  • @MandyLeeYT
    @MandyLeeYT2 жыл бұрын

    Another amazing video Mr Taro. Loved plying this game, keep up the amazing work! ☺

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Thank you mandy

  • @fmproductions913
    @fmproductions9132 жыл бұрын

    That was very concise coverage. When I first made something like this, I used linear interpolation between frames. Many months later I saw some code that utilzed animation curves for this to have much smoother movement. I was like "why didn''t I think of this myself". Pretty powerful. That speed trial game looks fun too, will give it a try later!

  • @ryuuguu01

    @ryuuguu01

    Жыл бұрын

    Mirror has good interpolation code that is open source. it is even a separate class and generalized so it is easy to use with outside of Mirror.

  • @neozoid7009
    @neozoid70092 жыл бұрын

    Cool . Very excited to know this kind of features in Unity.

  • @revraitah
    @revraitah2 жыл бұрын

    Thanks for this. Really cool and helpful!

  • @kinza199x
    @kinza199x2 жыл бұрын

    Great Video. Thanks for giving a new div like me a chance to learn how to code.

  • @HumbertoBytes
    @HumbertoBytes2 жыл бұрын

    This channel is a goldmine

  • @TheVisla_
    @TheVisla_2 жыл бұрын

    Awesome video 👍

  • @cubic8869
    @cubic88692 жыл бұрын

    Really helpful video!

  • @Betruet
    @Betruet2 жыл бұрын

    So generous. Great content 👌

  • @mayankbhaisora2699
    @mayankbhaisora26992 жыл бұрын

    Thank you for your help 🖤

  • @jagzhere
    @jagzhere Жыл бұрын

    This channel is perfect!

  • @MatthewAWinston
    @MatthewAWinston2 жыл бұрын

    More excellence! Thank you.

  • @bxbvxbv
    @bxbvxbv2 жыл бұрын

    there's a good free rewind asset on the asset store "ReTime" which you can use to save time expanding your asset.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Oh cool, I'll checkout how he accomplished it, thanks!

  • @henieknw
    @henieknw2 жыл бұрын

    Awesome tutorial! Chuckled a bit at nickname 0:13

  • @Talmagett
    @Talmagett2 жыл бұрын

    It's like and Ori and the will of the wisps, Cool video

  • @jean-michel.houbre
    @jean-michel.houbre2 жыл бұрын

    Very interesting!

  • @dbweb.creative
    @dbweb.creative2 жыл бұрын

    I think you could do something like: 1. record position and rotation of player every X ms (say every 200ms). 2. on playback, do position and rotation interpolation per each coordinate recorded. Basically an approach similar to how server-client relationship works...

  • @gammafoxtbg
    @gammafoxtbg2 жыл бұрын

    Cool stuff! One optimization could be to, rather than just recording position/rotation every X frames, record the input and time of input. This way you can greatly reduce the amount of data needed, while keeping the gameplay precise, as it'll essentially just handle all the physics itself exactly as the prefab would normally. You'd just need to create a variant of the original that doesn't take input.

  • @MasterDisaster64

    @MasterDisaster64

    2 жыл бұрын

    But that would cause it to desync if the player can change the environment in any way (as they can in most games).

  • @gammafoxtbg

    @gammafoxtbg

    2 жыл бұрын

    @@MasterDisaster64 Yes, but that depends on the context. In that case, you might want to also make sure you're not recording certain actions that could cause those environmental changes, but still record movement inputs. Or, if for example you have things like boxes you can push around, you could create ghosts of those as well, create ghost layers for boxes and players, and change your physics settings to only allow interactions between the relevant layers.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    I initially tried using input, but as the physics engine is not deterministic it yields unreliable results. That's also with a clean playing field, imagine now we add push able objects which cause drag on the player... This would unsync the ghost. I know track mania uses input based recording, but they've done some funky stuff with their engine to handle it. Not sure how possible it is in Unity + physics controllers.

  • @Mr_Yeah

    @Mr_Yeah

    2 жыл бұрын

    @@Tarodev Trackmania has it all: It has a fully deterministic physics engine. Although the results can change with a big update that, e.g., adds new track parts. And thus, it saves both the player's position and input in the replays. When replaying, it uses the positions because that's independent of versions. But if you also have a compatible version, you can let it check the replay for tampering. It does that by simulating the run with the inputs off-screen and comparing the calculated positions with the recorded ones.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    @@Mr_Yeah very interesting. It's a pretty fun topic I must say. I'm going to play around the interpolation between key frames and see how smooth I can make low frame rate recordings. Input recordings have a huge advantage in that they don't even need to interpolate. Certainly the go-to for anything none physics based in Unity

  • @UitzUitz
    @UitzUitz2 жыл бұрын

    Amazing video. Looking forward to checking it out. Is it possible that you make a video on how to do online Leaderboards?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Hey Seb, my (most probably) next video is about game authentication and most probably a leaderboard :)

  • @UitzUitz

    @UitzUitz

    2 жыл бұрын

    @@Tarodev Amazing. I'm so glad that I found your KZread channel last year. All your videos are just amazing. Love how you don't waste any of my time and get directly to the point every time with the best explanations. Keep up the great work.

  • @lukaspichler1264
    @lukaspichler12642 жыл бұрын

    nice video

  • @YasserSedrati
    @YasserSedrati2 жыл бұрын

    Smooth and fun .. nice video. Ps: can you share the link of the mini game you show.

  • @ragerungames
    @ragerungames2 жыл бұрын

    Greattt

  • @gabrielchukwu8106
    @gabrielchukwu81062 жыл бұрын

    Really insane!! 2:34 though.😂😂😂

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    I was no match for Nick

  • @WildfireKitsune
    @WildfireKitsune2 жыл бұрын

    Fuck, you keep making cool stuff.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    :D Making cool stuff is fun

  • @speedfastman
    @speedfastman2 жыл бұрын

    You're like the Default Cube Blender guy but for Unity. :)

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Ahh, thanks buddy

  • @bestdaddyoftheyear
    @bestdaddyoftheyear2 жыл бұрын

    Tarobro! nice, is this already available?

  • @jubinjajoria2870
    @jubinjajoria28702 жыл бұрын

    Noice

  • @LeviAckerman-xt7dx
    @LeviAckerman-xt7dx2 жыл бұрын

    Im a fan. Love you bro. No Homo 😆

  • @rusikboss5077
    @rusikboss50772 жыл бұрын

    Thanks for your videos. They are very reassuring when there is a war outside the window. Kyiv, Ukraine

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Keep safe brother 🙏

  • @Simon-yg9np
    @Simon-yg9np2 жыл бұрын

    why are u so smart

  • @Ligerff346
    @Ligerff3462 жыл бұрын

    hlo bro can u teach us about unity finite state machines plz

  • @neropatti
    @neropatti2 жыл бұрын

    Best time I got was a 13:960. Could go faster but I'm happy with that time.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    That's insane. You must be a dash master

  • @neropatti

    @neropatti

    2 жыл бұрын

    @@Tarodev Ended up grinding some more. Stole the #1 position on the leaderboard, for now :)

  • @pressplayontape2442
    @pressplayontape2442 Жыл бұрын

    I'm really struggling to achieve the upload 'somewhere' the ghost and then download from the leaderboard, I' ve a nice and functional ghost system but it works only local, I've tried to save ghosts (wich are json files) to unity cloud save, but It'seems to me that nobody can acces them , other than the player who made it.....Maybe a little hand from someone will help me!

  • @rxmfdddddddd
    @rxmfdddddddd Жыл бұрын

    is it possible to make this happen in real time?

  • @wobbier
    @wobbier2 жыл бұрын

    early gang

  • @anantgamedev
    @anantgamedev2 жыл бұрын

    Turning it for MOBILE DEVICES would be really helpful...

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Mobile will work perfectly fine :)

  • @anantgamedev

    @anantgamedev

    2 жыл бұрын

    @@Tarodev ohk!

  • @13cbt13

    @13cbt13

    2 жыл бұрын

    Why are you yelling?!?!?

  • @anantgamedev

    @anantgamedev

    2 жыл бұрын

    @@13cbt13 im not

  • @hamsterhaunter5718
    @hamsterhaunter57182 жыл бұрын

    Early

  • @AdNecrias
    @AdNecrias2 жыл бұрын

    Recording the position rather than recording the inputs?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Unfortunately unless the physics engine is deterministic, recording input isn't really an option.

  • @tudorelRo

    @tudorelRo

    2 жыл бұрын

    @@Tarodev That is a good point, but isn't your character controller not using physics (because I remember this => kzread.info/dash/bejne/ZaeLttyGo9DKqJs.html min 0:27)? And if so wouldn't it be possible to record the inputs rather then positions? Also I have another question: why use coroutines instead of async/await ? Thanks for the video as allwais it was nice.

  • @IgnacioStegmayer

    @IgnacioStegmayer

    2 жыл бұрын

    @@tudorelRo nevermind me, just warding your two great questions in case taro replies to them

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    @@tudorelRo good question. It's because async await does not have a frame-dependant wait, like coroutines do.

  • @Ace-yo8qg
    @Ace-yo8qg2 жыл бұрын

    Pᵣₒmₒˢᵐ