Python Flappy Bird AI Tutorial (with NEAT) - Moving Birds

preview_player
Показать описание
In this video we continue to work on our flappy bird game by finishing coding the bird class and testing our game by drawing some of the aspects to the screen. In later videos we will implement the AI using the neat python algorithm to play this game.

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

Tags:
- Tech With Tim
- Python Tutorials
- Flappy Bird AI Tutorial
- Neat Python Tutorial
- AI Plays Flapyy Bird
- Neat Python
- Genetic Algorithm
- Machine Learning

#python #NEATPython #GeneticAlgorithm
Рекомендации по теме
Комментарии
Автор

Tim in the first video of the series: "My goal of this series is for you to understand every line of code"
Tim in the 2nd video of the series: "I'm gonna be honest, i just took this code from stack overflow. I'm not even really sure how it works tbh."

Tim, if you see this, don't be offended, this tutorial series has been amazing so far!

noahf
Автор

12:22 " *I don't know how this works I just copied this from stack overflow and know what it should do* " its so deep

zza
Автор

Hi Tim. Another outstanding tutorial. I really appreciate your detailed explanations of what you are doing and why you are doing it. That really helps me better understand each individual function. You are an amazing instructor. As before, I can't wait for the next in the series. Please keep them coming. Thanks.

novicetech
Автор

Would love to see more things like this with AI! Loving the series so far

arvid
Автор

Don't know how I didn't find this series sooner. Fantastic tutorial especially for beginners like myself.

sublimecg
Автор

For those who didn't understand the formula for displacement, here are the displacement values using that formula with respect to the frame going on (that is with respect to the self.tick_count) :-
Current Frame: 1
Current Velocity -9.0
Current Frame: 2
Current Velocity -15.0
Current Frame: 3
Current Velocity -18.0
Current Frame: 4
Current Velocity -18.0
Current Frame: 5
Current Velocity -15.0
Current Frame: 6
Current Velocity -9.0
Current Frame: 7
Current Velocity 0.0
Current Frame: 8
Current Velocity 12.0
Current Frame: 9
Current Velocity 27.0

suryanshsinha
Автор

If anyone is watching this late and gets the
"TypeError: argument 1 must be pygame.Surface, not list" error.
You just need to delete the square brackets at the top.

yabbieo
Автор

Java and any normal language: image.getRectangle(){...}
Python: img.get_rect()
I mean, what has the image done to you? Do you really hate it that much? Poor image!

robbeandredstone
Автор

idk why but "get_rect" had me laughing

jxcob
Автор

This series is amazing. I am a bigginer and you made me understand! Thanks so much!

rmp
Автор

11:42 tf when you're just trying to watch a tutorial, but then you get rekt :(

wizard-csst
Автор

I am watching the playlist the second time and every thing makes way more sense now.

shridumanish
Автор

Excellent video/series.

Just for correctness, not a major criticism: your physics engine is wrong (sort of pointed out before): y = v0*t + 0.5a*t^2 is correct, but y is the actual position, not the displacement. Also - you have no need for self.vel in your current code.

What you probably wanted was (using dt=1):
self.y += self.vel
self.vel += (self.vel < self.VMAX) * self.ACCEL
if self.vel<0:
self.tilt = self.MAX_ROTATION
elif self.tilt>self.MIN_ROTATION:
self.tilt -= self.ROT_VEL

You then need to change the constants, I find something like:
JUMP_VEL = -4
VMAX = 3
ACCEL = .6

Note: y_max = height - JUMP_VEL^2/(2*ACCEL)

However, the (Euler) formulae I present are mathematically unstable (approximate result diverges from analytic result). One could use a better approximation, but this is often not required for game engines (and certainly not this game). The terminal velocity is a simplification since acceleration would decrease slowly until terminal velocity is reached, rather than suddenly, but again this makes little difference in such a game.

Because the idea of the game is to force the user to maintain steady flight via fairly rapid jumps in steady succession with a limited margin for error, both the "correct" and "incorrect" engines will appear similar to the end user if suitable constants are chosen.

wybird
Автор

I wonder if this movement is actually what you want. The d in the calculation is not really the velocity but the relative position from the height at which point you jumped. Adding this to the position every tick is maybe not really what you want, since then the gravity gets in as a factor time^3 instead of time^2.

Edit: But a great series! thank you

henrik
Автор

Though the errors may be my human error, is it possible for you to put the code up so I could see where I went wrong? Thanks.

tarioyou
Автор

I been out the game programming game for like a decade LOL, But hey Im getting back in and this is my first python tutorial im watching. I learn coding fast so i wanted to learn python from picking something that look challenging to begin learning from. Man im so excited to get back in the scene you new guys have no idea how good I am, I have the power of ancient coding senses. Today I dont know how to even say hello world in python, but before you know it I will revolutionize the industry.

emperorscotty
Автор

When I start program, i get pygame hello message, but windows wont open? anyone encountered similar?

highlander
Автор

i get Bird() takes no arguments

help plz

kronborg
Автор

What happened to the last line of code from the first video? Im refering to the While statement that was supposed to give the FPS, did you remove it?

kristianlynes
Автор

Update: Ive run the code again and with the FIRST Generation, 3 birds are doing the level with no problem. I just passed the score 100 with 3 birds, gen 0. your code is fantastic!

MrWadeBarrett