TIME REWIND mechanic for every objects in Godot!

  Рет қаралды 7,888

MrElipteach

MrElipteach

Күн бұрын

Пікірлер: 32
@mrelipteach
@mrelipteach 2 жыл бұрын
I hope you liked this tutorial! If you want to see it in action, checkout my latest Dashpong devlog: kzbin.info/www/bejne/bKTIn5WYgticbq8
@DayMoniakkEdits
@DayMoniakkEdits Жыл бұрын
If you're using Godot 4 "Engine.iterations_per_second" is now "Engine.physics_ticks_per_second"
@ZNTHX
@ZNTHX Жыл бұрын
Thanks bro
@maurizio9810
@maurizio9810 8 ай бұрын
my man
@_gamma.
@_gamma. 2 жыл бұрын
Nice tutorial! I can also see how it would be useful with 4.0’s movie feature for recording replays, like Towerfall
@mrelipteach
@mrelipteach 2 жыл бұрын
Yeah it could be a good solution to do offline replays saved as videos. I've tried to capture the viewport every frame to do video replay but unfortunately it's too slow for now, and it affects performance while in game...
@kevinbreen4510
@kevinbreen4510 2 жыл бұрын
Thanks for sharing! Looking forward to giving this a try in the future.
@mikielek8657
@mikielek8657 2 жыл бұрын
This was wonderful !! I will try it Also u had a really nice and fluent presentation style, keep it up!
@mrelipteach
@mrelipteach 2 жыл бұрын
Glad you found it useful! Thanks a lot :)
@kotarou8530
@kotarou8530 2 жыл бұрын
thank you, helped me a lot :)
@mrelipteach
@mrelipteach 2 жыл бұрын
Glad to hear that!
@hassangolshan3295
@hassangolshan3295 Жыл бұрын
Hi, thanks for your tutorial. How do you think runtime-instantiated objects should get handled in time rewind? Same problem for runtime-destroyed objects. In your sample demo, all the objects are in the scene from the beginning to the end. What if there are many objects being instantiated/destroyed during the game (like bullets, particles, and so on)?
@mrelipteach
@mrelipteach Жыл бұрын
I do exactly that in my game Dashpong as paddle are created by the players and destroyed after some time. These objects save their positon and rotation just like the others. To know when to create/destroy them during rewind/replay, you need to compare to a reference. For that, I save values in a global script and when it's time to rewind/replay, I compare the object's value count to this global count. If the object has less values, it means it has to be destroyed/created. To know if it's created or destroyed, I save a boolean for the fame of creation/destruction. You can probably find other ways to do it, like having a unique frame ID that is available globally so you can easily compare when objects are created/destroyed.
@this-cris
@this-cris Жыл бұрын
I appreciate that you are responding to comments a year after the video was posted. I had the same question while watching.
@chaoscifer1483
@chaoscifer1483 2 жыл бұрын
Very nice approach. Thank you. I think that we could have some issues if we use the same replay files across in different machines, since Godot's physics is not deterministic.
@mrelipteach
@mrelipteach 2 жыл бұрын
How would that be a problem? The idea with this technique is that you save all the values and move every object manually, deactivating physics and thus not being affected by the non determinisc nature of Godot's physics
@chaoscifer1483
@chaoscifer1483 2 жыл бұрын
@@mrelipteach I believe (not affirming) that without a fixed point math for the amount that we're moving objects we'll have a high probability of generate slightly different floats in different hardwares and operational systems. edit here: I think that the probability is even bigger when we multiply floats and use deltatime within _process()
@mrelipteach
@mrelipteach 2 жыл бұрын
@@chaoscifer1483 It's possible yes but if you care about having exactly the same result, you should use fixed point. Most people won't care about that, because the potential difference is ultra tiny
@SnakeEngine
@SnakeEngine Жыл бұрын
@@mrelipteach The difference can be life or death. The bullet either hits you or not in an edge case. I think you don't understand what an instable system is.
@The_RevieW34712
@The_RevieW34712 11 күн бұрын
thanks for tutorial
@christiankoch9516
@christiankoch9516 2 жыл бұрын
Hello, I did something similar in Unity some time ago, but when trying to rewind Animations in Unity I realised that the Animator component of unity was not fit for this kind of implementation. I was wondering if you know if the Animation components of Godot are a bit more cooperative in resepect to rewinding animations (3D), particularly repeated rewinding while recording new data between rewinds. Unitys Animator simply deletes the old animator states once new data is stored
@mrelipteach
@mrelipteach 2 жыл бұрын
I don't know if this is exactly what you want but you can play any animation backwards using play_backwards() docs.godotengine.org/en/stable/classes/class_animationplayer.html#class-animationplayer-method-play-backwards
@christiankoch9516
@christiankoch9516 2 жыл бұрын
@@mrelipteach Thanks for the reply, I will have a look once I get home from work, but it looks promising
@ro-ce8vg
@ro-ce8vg 2 жыл бұрын
I am new to Godot, but are you not preallocating the array of positions/vel/rotations? I would think that for multiple physics objects, preallocating the array could have serious performance implications. edit: realized that you still only have to allocate the array once regardless, so maybe not as important. i guess if i was concerned about performance, this would be a good place to use GDNative
@mrelipteach
@mrelipteach 2 жыл бұрын
You should optimize only if there's a need for it. In this case, I didn't see any performance hit.
@SnakeEngine
@SnakeEngine Жыл бұрын
Yeah that's the easy part everyone knows about since you assume a static life-time of objects. But how would you handle a time rewind in a dynamic scene where objects get created and destroyed?
@mrelipteach
@mrelipteach Жыл бұрын
It's a 6 mins tutorial, I can't go into great details. I've done a more complex implementation in my game Dashpong because it has to support dynamically created objects (paddles). The idea is to have something to comapre to, so I added a global rewind counter. Then it's about comparing the amount of values a paddle has in its rewind array and you know it needs to be created or deleted.
@GoggleMan1
@GoggleMan1 6 ай бұрын
where is the code? 😭😭😭😭
@mrelipteach
@mrelipteach 6 ай бұрын
In the 3.x branch on Github github.com/MrEliptik/godot_experiments/tree/3.x/2D/rewind_mechanic
@GoggleMan1
@GoggleMan1 6 ай бұрын
@@mrelipteach thank you
@vikramthewrench
@vikramthewrench 2 жыл бұрын
Engine.rewind(0.5,0,0)
@mrelipteach
@mrelipteach 2 жыл бұрын
That would be nice!
10+1 MUST HAVE addons for Godot 4
11:18
MrElipteach
Рет қаралды 18 М.
The Implementation of Rewind in Braid
26:56
GDC 2025
Рет қаралды 131 М.
How Do Game Devs NOT Overscope??
9:04
Green Light Dev
Рет қаралды 10 М.
Using Composition to Make More Scalable Games in Godot
10:13
Firebelley Games
Рет қаралды 254 М.
Stop "learning" gamedev right now
17:00
MrElipteach
Рет қаралды 10 М.
BETTER 2D visuals in 7 EASY TIPS
10:38
MrEliptik
Рет қаралды 76 М.
My FAVORITE new features in Godot 4.2 (+ other cool features!)
8:57
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 467 М.
10+2 AWESOME ADDONS for GODOT 4
8:36
MrElipteach
Рет қаралды 154 М.