Dear Game Developers, Stop Messing This Up!

Dear Game Developers, Stop Messing This Up!

Jonas Tyroller

1 год назад

868,421 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@quiteliterallyahumandev
@quiteliterallyahumandev - 08.02.2025 19:18

also man your very odd

Ответить
@daveyhu
@daveyhu - 09.02.2025 22:47

FUCKING TLDR?!

Ответить
@antonyspine23
@antonyspine23 - 10.02.2025 00:22

a C is not that bad right?

Ответить
@jacobcombrink8689
@jacobcombrink8689 - 10.02.2025 10:12

I love your videos Jonas. I'm making a pokemon style gatcha game where you collect homeless people and stream their fights.
It's a love letter to everything that's wrong with humanity. Your videos inspire me to bring my ideas to life <3 thank you for sharing your brain with us.

Ответить
@AustinBaird-lq9pz
@AustinBaird-lq9pz - 12.02.2025 22:24

no

Ответить
@silversilk8438
@silversilk8438 - 15.02.2025 05:29

I saw this video from
blargis who made a speedrunning game.

And this video was so awesome I wanted to subscribe…

So I did, of course.

Ответить
@alderoth01
@alderoth01 - 16.02.2025 14:52

I just found this channel and I was annoyed at first, but that's because my power went put. As I sat here and watched, I slowly started to sink in 😂. You are a good teacher.

Ответить
@MrKrock164
@MrKrock164 - 16.02.2025 23:00

The formula shown in the video can also be written as follows:
position += ((0.5 * acceleration * deltaTime) + velocity) * deltaTime
velocity += acceleration * deltaTime

That notation originates from integrating the equation of motion along time (x = position, v = speed, _0 = previous value, a = acceleration, t = time)
∫ 1 * dv = ∫ a * dt
--> v = a * t + v0 (acceleration assumed to be constant during deltaTime)
∫ 1 * dx = ∫ (a * t + v0) * dt
--> x = 1/2 * a * t² + v0 * t + x0 (same as shown above)

For physics I would generally recommend to have deltaTime dependent on the minimal allowed movement distance. Calculating these step sizes can be rather complicated but avoids wall glitches at high velocities.

Ответить
@alternatecheems8145
@alternatecheems8145 - 18.02.2025 13:43

transform.position += Vector3.Right*(PreviousSpeed*deltaTime+0.5f*acceleration*deltaTime*deltaTime)

Ответить
@ManaMouseYT
@ManaMouseYT - 21.02.2025 12:02

C grade, glad i'm not the worst 😊

Ответить
@lmlimpoism
@lmlimpoism - 21.02.2025 23:40

although I know delta time (change/difference in time between one frame and another) this video is useful

Ответить
@Amber-n9x
@Amber-n9x - 22.02.2025 10:06

Hi. Do you know why this solution isn't accurate on turbowarp? (scratch alternative).
I'm programming a track and field game but theres a small margin of error between running test times.
I used delatime x speed each frame, but when the fps is high, the movement is slower, and vice versa

How do sport games, that need to be fair, usually deal with that? Is it turbowarp fault (running at average at 35fps when i set framerate to 60...)? is it because of my pc ? I tried to make my game in another engine but it's so hard and i'm more familiar to turbowarp, wish it was faster.

Ответить
@lorenzove
@lorenzove - 22.02.2025 13:00

so what should i use?

Ответить
@marshmellow33
@marshmellow33 - 23.02.2025 12:22

I learned that I should multiply everything by deltaTime. If not, I am committing a crime.

Ответить
@ChannelSho
@ChannelSho - 24.02.2025 21:52

deltaTime is not only useful for animations, but in physics too, since pretty much every practical function in physics has a "per second" attached to it.

I didn't work on a game, but I worked on a flight simulation tool and we ran into an issue where our deltaTime wasn't appropriate for a certain part of the simulation, which caused the plane to be extra bouncy.

Ответить
@elevatorup7740
@elevatorup7740 - 01.03.2025 21:01

what about fixedDeltaTime and calculate position in fixedUpdate, then move in update but with compensation for fps drop?

Ответить
@godgames8433
@godgames8433 - 04.03.2025 08:41

This is a great video Ideea this should be a entire series.Cheers!!

Ответить
@_gherry
@_gherry - 04.03.2025 19:01

deltatime sucks
i spent one and a half hour for one single line of code

Ответить
@Limekys
@Limekys - 07.03.2025 21:39

Thanks a lot, i have fixed my lerp functions finally!

Ответить
@Johnny-Wayfinder
@Johnny-Wayfinder - 10.03.2025 11:11

I missed the first question, but got the second question right how the heck does that work?

Ответить
@nite_owl_was_here
@nite_owl_was_here - 11.03.2025 13:37

its been a year since you dropped this, but ive come back multiple times specifically for the final chapter. i always forget it and then end up needing it. maybe i should write it down lol.

Ответить
@thebrickccentric3728
@thebrickccentric3728 - 12.03.2025 02:21

Doing this kind of destroys your game's determinism...
Maybe you don't care about that, but it can be important sometimes, like if a player can cross a certain gap, make through a certain obstacle, etc...

Ответить
@Plo1154
@Plo1154 - 14.03.2025 13:46

This is a bit of an old video but the lerp section confused me a little bit because I got a similar answer, but different, and I couldn't figure out why it would be different, or what's even going on in the video's version, so I did some testing. Made a scene in godot specifically to test this, setting target framerate and moving an object with lerp in different ways.

The formula for mine and the video can be broken down into: x^(delta * y).
Where for me x = 1 - speed and y = target framerate. End effect is "move "speed'% of the way, per frame at 60 fps, and adjust to other framerates
For Jonas here, x = 0.5 (not sure why) and y = speed. End effect is "move halfway every 2 seconds". Which, while a bit strange, does work just fine.

Both of these methods differ in speed obviously, but they're both consistent with very different framerates
The x variable determines inverse speed (closer to 1 is slower, 0 is instant), and y determines across how large of a timeframe this step x happens. So effectively they're both speed

I've also seen someone say to use "Math.Exp(-lerpSpeed * delta)", which effectively is the same formula, but with x = 1/e and y = speed. As an example with speed at 0.5 you'll end up with moving about 63% of the way in 2 seconds, regardless of framerate

I think most intuitive way to think of it would be to forget the y value entirely and just focus on x
x^delta, where x is the inverse of how much does the object need to move per second. Other than that, regardless of the values you choose and if you multiply either side by anything, as long as they're constants you're just changing the speed, but it'll stay consistent across different framerates

Ответить
@Pryme8
@Pryme8 - 20.03.2025 04:31

Im going to use that 0.5 * deltaSeconds trick that is good.

Ответить
@keiyakins
@keiyakins - 22.03.2025 07:45

The fixed update one kinda depends on the details of the platform, doesn't it?

The Flappy Snail one is kind of an issue, though, because how often the player can jump matters. At 2fps, you can only jump once or twice a second (depending on how much your underlying platform does for you, you might be unable to distinguish it being pushed, released, and pushed again), which creates a ton of problems. You need a better solution for player input if you want to handle extreme slowdown.

Also as a wrinkle, in a rhythm game you want to ignore delta time entirely and do everything based on where in the song you currently are, because staying locked to the audio is the single most important thing.

Ответить
@speedychicken831
@speedychicken831 - 23.03.2025 00:26

Math!

Ответить
@alkeryn1700
@alkeryn1700 - 27.03.2025 04:22

you know, you are right, it being mathematically perfect is *better*, but it's generally not a requirement for it to be fun which is generally what matters the most.

Ответить
@Snowy84557
@Snowy84557 - 02.04.2025 20:02

I only just started GameDev and I already know that for Rigidbodies you don't tie it to framerates or delta time. Except when checking keypresses that apply a forces to the rigidbody

Ответить
@loth3279
@loth3279 - 07.04.2025 10:56

You should slow down your speech framerate, it's unbearable

Ответить
@SergeofBIBEK
@SergeofBIBEK - 10.04.2025 18:02

So what I learned is do something. Test it, if it doesn't work then multiply be delta time. If that doesn't work go google the answer.

Ответить
@ProgrammingRainbow
@ProgrammingRainbow - 22.04.2025 10:30

Wait, do I need unity for this? What if my game is just written in C and my deltaTime/FrameDelay is just a function? I just multiply everything but single actions by DeltaTime, and I never read or heard about any of this nonsense.

Ответить
@guiltyspark-e6o
@guiltyspark-e6o - 27.04.2025 13:02

OK, i did messed up with lerp function

Ответить
@Scopiiii
@Scopiiii - 08.05.2025 00:49

haha there is actually an even better solution to this. Take the global time of the world subtract the time your application started, set an animation starting point and now you can very accurately calculate (run over) the delta time of your application

Ответить
@juacopaz
@juacopaz - 10.05.2025 01:23

you're great Jonas, keep up the good vibes brother

Ответить
@jsfofun
@jsfofun - 12.05.2025 12:19

I get right answer only in first question....well I can make open world rpg extration shooter with horror elements

Ответить
@freeT0watch
@freeT0watch - 14.05.2025 11:44

great video . fun and informative

Ответить
@NoxiusVI
@NoxiusVI - 16.05.2025 11:53

Actually, FixedUpdates aren't guaranteed to be always the same delta time, so you should still use delta time there, even if it seems redundant.

Ответить
@goodlookinouthomie1757
@goodlookinouthomie1757 - 16.05.2025 14:54

The very basic principle is you're using your computer's internal clock to anchor your game to realise life time.

Ответить
@theguywiththewhiteblanket
@theguywiththewhiteblanket - 16.05.2025 20:47

"9/10 times it gets the job done"

guess im the 10th time.

Ответить
@bearsbarebears
@bearsbarebears - 26.05.2025 22:30

"The time elapsed between the last frame and the one preceding it" , well, chatgpt says its the wrong definition and says: Delta time is the time elapsed between the current frame and the previous frame. I'm confused, if its the current frame thats being processed and the previous frame, then that's different from the previous frame - (the previous frame - 1)
[ 1 2 3 4]
Say we're currently running the start of frame 4, so is delta time the time between the start of 3 and the start of 4? Or the start of 2 and the start of 3?

Ответить
@TieberfermometerYT
@TieberfermometerYT - 27.05.2025 20:08

I love the German accent (I am german too)

Ответить
@sakul_the_one4821
@sakul_the_one4821 - 29.05.2025 15:35

you know what, Im gonna do all on the server

Ответить
@JonasTyroller
@JonasTyroller - 30.06.2023 14:51

Small corrections (I learn some things from you as well, how nice, haha):
- Using Time.deltaTime in Fixed Update is actually fine in Unity cause it automatically returns Time.fixedDeltaTime depending on where it is called from.
- Using Delta Time in fixed update still makes sense for various reasons (it keeps speed to units/second and helps when inaccuracies in the fixed update intervals occur)
That means 10 free points to you if your read this, haha. Will keep updating this in case I got anything else wrong. :P

Ответить