Pygame Framerate Independence Tutorial: Delta Time Movement

  Рет қаралды 19,105

CDcodes

CDcodes

Күн бұрын

Пікірлер: 78
@zyenapz
@zyenapz 3 жыл бұрын
Thanks for the clear explanation. I like that you show visuals and comparisons, they really help me understand why should I use it and how I can implement it!
@CDcodes
@CDcodes 3 жыл бұрын
Glad to hear!
@hardikchoudhary6845
@hardikchoudhary6845 2 күн бұрын
Holy-moly bro's content is making me jolly!
@naointendogamesbr
@naointendogamesbr 3 жыл бұрын
Hey Man! Thx so much, really helped me with my first steps.
@CDcodes
@CDcodes 3 жыл бұрын
Glad I could help!
@Froqqy54
@Froqqy54 2 жыл бұрын
Nothing short of amazing. We all needed this hero!
@CDcodes
@CDcodes 2 жыл бұрын
Appreciate it!
@lovedeepbrar5950
@lovedeepbrar5950 3 жыл бұрын
Superb bro This is the best video on frame independency
@CDcodes
@CDcodes 3 жыл бұрын
Thank you!
@NiGhTm4r389
@NiGhTm4r389 3 жыл бұрын
Thanks so much! Before I implemented this in my Adventure / RPG that I am currently working on for my Master's thesis, the velocity of my characters would shift when both were moving (one was faster when the other one was standing still and vice versa). This fixed it :)
@CDcodes
@CDcodes 3 жыл бұрын
Awesome! Looking to work on a Master's myself next year, glad I could help!
@bovfbovf
@bovfbovf 3 жыл бұрын
Thanks for the upload Chriss!
@CDcodes
@CDcodes 3 жыл бұрын
Thanks for watching : )
@ЕгорМиронов-щ3п
@ЕгорМиронов-щ3п 8 ай бұрын
First, I wanted to write code like this to calculate that stuff, but decided to search on youtube. Thanks, man., you did it for me.)
@CreativeSteve69
@CreativeSteve69 Жыл бұрын
Just found your channel. I'm working on a simple arcade shooter for my first entry to GameDev using Python and pygame. Been working on it for couple months and been stuck on a detla time error. I like how you explain things and showing visuals along the side. It's really helping me understand coding a ton. Glad to have found your channel.
@CDcodes
@CDcodes Жыл бұрын
Glad you found it helpful! Best of luck on your game!
@vinnn8694
@vinnn8694 Жыл бұрын
You almost sound exactly like SerpaDesign 😂 Anywaay very good video! Cut right to the point, appreciate it!
@CDcodes
@CDcodes Жыл бұрын
Thanks! Haven't heard of SerpaDesign, but now I'm curious to check out his channel haha
@eplusplus
@eplusplus 3 жыл бұрын
Thank you so much! This was exactly what I was looking for.
@CDcodes
@CDcodes 3 жыл бұрын
Glad it helped!
@kthegreat69420
@kthegreat69420 3 жыл бұрын
really nice video and you explain very good. Get him to 1K subs!
@fuvusion
@fuvusion Жыл бұрын
I love the trick it makes a lot of thing less complicated
@Ed-of2id
@Ed-of2id 3 жыл бұрын
thanks for the knowledge!
@CDcodes
@CDcodes 3 жыл бұрын
You're welcome sir!
@keremcd
@keremcd 2 жыл бұрын
Useful tutorial, thanks.
@computeroid6162
@computeroid6162 2 жыл бұрын
Thanks a lot, cleared up a lot of confusion!
@CDcodes
@CDcodes 2 жыл бұрын
Glad to hear that! Took me a bit to wrap my head around it too
@vinhero
@vinhero 3 жыл бұрын
This Video helped alot and i like ur demo ^^ Thank you!
@CDcodes
@CDcodes 3 жыл бұрын
Glad it helped!
@bosstareq9
@bosstareq9 10 күн бұрын
negl this was a sick video, even tho im not gonna use it in my NEA 😭
@ayayalgueewe9361
@ayayalgueewe9361 Жыл бұрын
Thanks, it was really helpful!!
@CDcodes
@CDcodes Жыл бұрын
Glad it helped!
@ryzer5528
@ryzer5528 3 жыл бұрын
hmm, its rarely to see ppl use pygame, kepp going bro
@CDcodes
@CDcodes 3 жыл бұрын
Thanks! Been a little busy with school, but I do have more videos in the works : )
@devendranegi2477
@devendranegi2477 3 жыл бұрын
Lol I am your 46'6' subscriber!!! Great tutorials.
@CDcodes
@CDcodes 3 жыл бұрын
Thanks for supporting the channel!
@mtbminibomber
@mtbminibomber 3 жыл бұрын
im his 22nd subscriber
@Ilnur-v6z
@Ilnur-v6z Жыл бұрын
I've actually been having an issue that I think might tie into this topic. Basically, after a while of running my code, my window would get these very faint white borders around it and my framerate would become very inconsistent. There would also be some noticeable screen tearing. If i set my framerate to something absurdly high, as soon as those white border appear, my character wouldn't move right at all.
@UnderArea51
@UnderArea51 3 жыл бұрын
QUESTION: Is there a way to hard code a game sprite and then have them called from a class? For instance, code - draw a character like Mario, or a simple pixel character, (of 2 or 3 frames of movement in a sprite sheet - hard coded,) VS using png files, and then be able to call the sprite from a class, and move them about on the screen using keyboard arrow keys? Is this possible?
@UnderArea51
@UnderArea51 3 жыл бұрын
In Pygame. .. Thanks!
@CDcodes
@CDcodes 3 жыл бұрын
Definitely. Checkout my video on spritesheets. You can combine that with the tile game tutorials to make the sprite move.
@DeltaNrOne
@DeltaNrOne 2 жыл бұрын
Thank you for this video, i am just learning python and i made a pong clone and guess what my pc did yup the pong ball went brrrrrrrrr
@Kokurorokuko
@Kokurorokuko 2 жыл бұрын
I don't understand the last step. Everything was working properly, wasn't it? Why would we need to add "target fps"?
@CDcodes
@CDcodes 2 жыл бұрын
Thats for people who started a game but didn't have framerate independence in mind. It can adjust their physics so that it matches what they were previously aiming for. If you started your game and implemented delta time from the beginning, no need to worry about that step.
@shadowgodthegamer5738
@shadowgodthegamer5738 2 жыл бұрын
Thx. Helped alot!
@imraptorr1066
@imraptorr1066 2 жыл бұрын
everything stops moving when i added delta time, can you help me?
@CDcodes
@CDcodes 2 жыл бұрын
Check if your delta time variable is zero. That would cause all movement to stop
@ChickenDev
@ChickenDev 3 жыл бұрын
Awesome tutorial!
@CDcodes
@CDcodes 3 жыл бұрын
Thanks!
@tordg1356
@tordg1356 2 жыл бұрын
you are a hero
@Sunamii_studios
@Sunamii_studios Жыл бұрын
Life saver🙏
@towatch
@towatch 3 ай бұрын
Thank man
@vezpro6691
@vezpro6691 2 жыл бұрын
Love it!
@mtbminibomber
@mtbminibomber 3 жыл бұрын
I joined ur discord group. I didnt know you had one lol
@CDcodes
@CDcodes 3 жыл бұрын
Just made it!
@yourlinuxguy
@yourlinuxguy Жыл бұрын
Flash banged!
@lsk21kr
@lsk21kr 5 ай бұрын
**then velocity change enters the room**
@lsk21kr
@lsk21kr 5 ай бұрын
meaning that you need to find the average value of velocity when acceleration is involved. Adding acc*dt to the velocity and vel*dt to the position does not give you the exact position at that point, but the position between that point and next point. And of course this difference can ruin your physics engine giving different output by varying framerate.
@JacobMerrill
@JacobMerrill 3 жыл бұрын
nice work! You should try UPBGE fork of blender, it's like PYGAME on steroids.
@CDcodes
@CDcodes 3 жыл бұрын
Oh wow, I'll have to check it out Thanks for the recommendation!
@jesterlw
@jesterlw 2 жыл бұрын
Thanks man!
@CDcodes
@CDcodes 2 жыл бұрын
Happy to help!
@mannb1023
@mannb1023 3 жыл бұрын
for some reason because of how I programmed my game or something, multiplying by dt just makes everything super slow
@mannb1023
@mannb1023 3 жыл бұрын
nvm i didnt watch the rest of the video lmao
@CDcodes
@CDcodes 3 жыл бұрын
Glad you figured it out!
@basicallybrand
@basicallybrand 3 жыл бұрын
thanks
@karsaimihaly
@karsaimihaly 3 жыл бұрын
Is there a chance this would work in plain python?
@karsaimihaly
@karsaimihaly 2 жыл бұрын
@Jamin I asked this 6 months ago I don't even work with python anymore...but thank you I guess.
@hillybankok
@hillybankok 2 жыл бұрын
@@karsaimihaly lol
@MykacInk
@MykacInk 3 жыл бұрын
Nice video
@CDcodes
@CDcodes 3 жыл бұрын
Thank you : )
@naomi2801
@naomi2801 2 жыл бұрын
I love u
@vaibhavpandey6640
@vaibhavpandey6640 3 жыл бұрын
hey you sounds like kidscancode
@CDcodes
@CDcodes 3 жыл бұрын
I actually started learning with some of his tutorials
@hexagonalcat8480
@hexagonalcat8480 3 жыл бұрын
Thank you for the great explanation! But I've got a question. When I tried printing out dt for each iteration, I got dt = 97683152328.39076 for the first few iterations. Its a very huge number and I'm not sure what's causing this.
@CDcodes
@CDcodes 3 жыл бұрын
Hey! Thanks for watching the video. I tried to recreate your problem but wasn't able to. If you'd like, you can share your script on discord and i'll take a look there
@sodoi2756
@sodoi2756 3 жыл бұрын
It this kind of method work for rhythm games?
@CDcodes
@CDcodes 3 жыл бұрын
It will work for all games
Understanding framerate independence and deltatime
29:22
Clear Code
Рет қаралды 41 М.
Как не носить с собой вещи
00:31
Miracle
Рет қаралды 1,2 МЛН
Não sabe esconder Comida
00:20
DUDU e CAROL
Рет қаралды 37 МЛН
Seja Gentil com os Pequenos Animais 😿
00:20
Los Wagners
Рет қаралды 43 МЛН
Pygame Tile Based Game Tutorial: Physics and Delta Time
15:23
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 690 М.
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 193 М.
Pygame Tile Based Game Tutorial: Tilemaps
11:27
CDcodes
Рет қаралды 54 М.
Just enough assembly to blow your mind
29:31
Kay Lack
Рет қаралды 105 М.
So I Made a Python Game in 48 Hours…
6:43
Barji
Рет қаралды 407 М.
Math for Game Developers - Jumping and Gravity (Time Delta, Game Loop)
9:49
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 721 М.
How Two People Created Gaming’s Most Complex Simulation System
38:54
ThatGuyGlen
Рет қаралды 1,4 МЛН
Как Я СТАЛ СИЛЬНЕЙШИМ в Роблокс
14:56
ВЛАДУС ИГРАЕТ
Рет қаралды 345 М.
Что Случится, Если РОДИТЕЛИ Станут ПОЛИЦЕЙСКИМИ в Minecraft?
15:55