Python Flappy Bird AI Tutorial (with NEAT) - Implementing NEAT/Creating Fitness Function

Поделиться
HTML-код
  • Опубликовано: 1 янв 2025

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

  • @Danielagostinho21
    @Danielagostinho21 5 лет назад +25

    my heart stop beating when the message "check out next video!"

  • @yevgeniyvovk9788
    @yevgeniyvovk9788 3 года назад +6

    for x, bird in enumerate(birds):
    birds.pop(x)
    ...
    does not do what you want it to do. it will pop every other element. the way to do this is:
    for bird in list(birds):
    nets.pop(birds.index(bird))
    ge.pop(birds.index(bird))
    birds.remove(bird)
    not hating, I actually learned a lot from your tutorials, including this. so I hope this helps if someone runs into this issue like I did.

    • @CongNguyen-og3iz
      @CongNguyen-og3iz 2 года назад

      yeah I was thinking about this too. Thanks for the suggestions

  • @NoPh-md6dp
    @NoPh-md6dp 3 года назад +4

    you did the coding super detail but it is better if you show the result after finishing each period of code by running it. it is not necessary for you but it is for the viewers.

  • @hacklordmonster8780
    @hacklordmonster8780 4 года назад +5

    I get an error says "module 'neat' has no attribute 'defaultGenome'"
    edit: i did it with lower case d instead of capital D

    • @investwithmax6345
      @investwithmax6345 4 года назад

      that's was just that ? because i have the same pb with DefaultReproduction

  • @Luis_Ramos_Grip
    @Luis_Ramos_Grip 4 года назад +2

    Can anyone explain this Error that i keep getting don't know how to fix..
    I am running on Windows not a Mac i dont know if that's why i keep getting this issue.
    NameError: name '__file__' is not defined then it doesnt load the config file at all.

  • @adamikhsannugroho
    @adamikhsannugroho 5 лет назад +3

    What would need to be changed for you to have multiple output instead of one?

    • @theguyman232323
      @theguyman232323 2 года назад +2

      2 years later, but if you are still having this problem. All you have to do is change the number of outputs in the config file

  • @sorzak_kriv8143
    @sorzak_kriv8143 2 года назад +1

    quick question! i closed my pc after saving the project, turned on the computer the next morning, ran the script and the base didnt show up. can anyone help? thanks!
    edit: nvm i was being stupid

  • @vp9041
    @vp9041 5 лет назад +1

    Growing restless for next video everytime

  • @pizza_t1me
    @pizza_t1me 5 лет назад +1

    Thank you for regular uploads!

  • @lexborodai1639
    @lexborodai1639 4 года назад +1

    I was sure I understand some python and AI topics before I bumped on these tutorials...

  • @ujjvalw2684
    @ujjvalw2684 5 лет назад

    Awesome video bud

  • @mikelee5376
    @mikelee5376 4 года назад +5

    Hello and thank you for this amazing tutorial!
    I have an error: module 'neat' has no attribute 'config'. I am using Spyder and neat-python v0.92.
    Do you know what this error is, and how to fix it?

    • @fernandazacche3216
      @fernandazacche3216 3 года назад

      me too! i dont know what to do D=
      did you manage to solve?

    • @deanbriggs2308
      @deanbriggs2308 3 года назад +2

      Hello I had the same problem as you. Answer: first uninstall neat (pip uninstall neat) next install neat-python (pip install neat-python) there problem solved.

    • @deanbriggs2308
      @deanbriggs2308 3 года назад

      Sorry I didn't see the part about you already having neat-python. My guess is probably the fact that neat and neat-python are both imported as neat. Try checking if neat is installed by uninstalling it.

  • @penneshells5448
    @penneshells5448 4 года назад +1

    When you said, running them one at a time would be inefficient, I realised that doing that would actually help with an ai project I am working on, would you mind explaining what modifications or line of code you would need to do that? Thanks!

    • @fernandostroppa7312
      @fernandostroppa7312 4 года назад +2

      Go to the last video. Change the population to 1 (in the txt file). I hope that works for you.

  • @Pepikrnw
    @Pepikrnw 3 года назад +1

    I did this project for 2 days and when I start the program, the window does not turn on and the program closes, there are no errors in the project

    • @snehpatel0359
      @snehpatel0359 4 месяца назад

      Is you call a main() function or not?

  • @bryan192
    @bryan192 2 года назад

    I don't understand the "config-feedfoward.txt" part at 1:36

  • @aryanbhatia6992
    @aryanbhatia6992 5 лет назад +2

    Can you tell in which university you are in ??

  • @tinatipton3291
    @tinatipton3291 3 года назад +1

    This is awesome thank you so much, I just had a question about determining genomes that have failed. If you were playing a game where it wasn't easy for a character or agent to die, or that the agent doesn't die, how might you get rid of that genome? Could it be something like done = False, while not done: (whatever the fitness function is) and then if done == True: remove(genome), print(genome_id, fitness)? Of course you'd have something that specifies what the genome is, and have genomes put in a list such as the ge = []. My trouble with this is I don't know if it would altogether get rid of the genome, and therefore you don't have any genomes to evolve and propagate a complex nn. Any help would be appreciated from anyone, thanks again.

    • @yosuanicolaus
      @yosuanicolaus 2 года назад

      I think you'd have to kill your agent yourself after some time. Say, every 20 seconds, you calculate their fitness and breed the next generation.

  • @FeedFall8
    @FeedFall8 5 лет назад

    Great Videooo!

  • @neuron8186
    @neuron8186 3 года назад

    how can it possible same code runs on your machine but not on mine

  • @yudatriananda3558
    @yudatriananda3558 4 года назад +1

    The pipe and the bird player is too big in ny laptop screen, how to make them smaller:(

    • @limtis
      @limtis 4 года назад +1

      Is the window too big or the sprites?
      For the sprites: I guess you should either remove "pygame.transform.scale2x" from your code or just change the resolution of sprites.
      For the window:
      from ctypes import windll
      windll.user32.SetProcessDPIAware() # Removes DPI-Scaling

    • @yudatriananda3558
      @yudatriananda3558 4 года назад

      @@limtis yes i tried it but i still cant see the lower pipe because my laptop screen is too small can you help me

    • @yudatriananda3558
      @yudatriananda3558 4 года назад

      @@limtis i cant see the ground too

    • @limtis
      @limtis 4 года назад

      @@yudatriananda3558 pygame.transform.scale()
      resize to new resolution
      scale(Surface, (width, height), DestSurface = None) -> Surface

    • @yudatriananda3558
      @yudatriananda3558 4 года назад

      @@limtis i dont get it what line should i edit😅

  • @dan0_0nad76
    @dan0_0nad76 4 года назад +1

    Hello everyone, can anybody please explain me why the main() function Tim calls, doesn't have any actual parameter and still works?
    Cause i get this error wich I don't know how to fix:
    main() missing 2 required positional arguments: 'genomes' and 'config'

    • @elenkorkmaz4075
      @elenkorkmaz4075 4 года назад

      change Defaultgenome with defaultgenome

    • @SolomonWatkins2Bars
      @SolomonWatkins2Bars 3 месяца назад

      I’m having the same issue and changing the genome did not work.

  • @aarushanshankar2075
    @aarushanshankar2075 4 года назад +1

    my code just doesn't run. Help please?

    • @sashamuller9743
      @sashamuller9743 4 года назад

      what's your issue

    • @aarushanshankar2075
      @aarushanshankar2075 4 года назад

      @@sashamuller9743 When run my code I am getting the following error. Any help is really appreciated.
      TypeError: 'FeedForwardNetwork' object is not subscriptable
      My code is this:
      for _, g in genomes:
      net = neat.nn.FeedForwardNetwork.create(g, config)
      nets.append(net)

  • @helloperson6823
    @helloperson6823 2 года назад

    what do you do if it says RuntimeError: 'NEAT' section not found in NEAT configuration file.

    • @luklucky9516
      @luklucky9516 Год назад

      press strg+s while on the config file. That were 2 hours of my life

  • @saiprabhav2664
    @saiprabhav2664 4 года назад

    i made a game of snake but i wanted to train it 1 by 1 than a bunch of it so can you plz help..

  • @mathisfun3758
    @mathisfun3758 5 лет назад +2

    Hi tim,
    im getting this error:
    Traceback (most recent call last):
    File "C:/Users/admin/PycharmProjects/Flappy-Bird/flappy-bird.py", line 5, in
    import neat
    ModuleNotFoundError: No module named 'neat'
    What do i do?
    Also, just wanna say love your teaching style!

    • @Fonn
      @Fonn 5 лет назад +2

      you have to install the neat package for python
      I'm probably too late but still..

  • @emenikeanigbogu9368
    @emenikeanigbogu9368 4 года назад +3

    14:11 lmaooooo

  • @urospocek4668
    @urospocek4668 3 года назад

    Can anyone explain to me why birds.pop(bird) while we loop through birds works fine? Thank you.

    • @redacted8188
      @redacted8188 3 года назад +1

      he only render birds in the list, so if the bird isnt in the list, once the screen is redrawn it will be gone

  • @emilostergaard8139
    @emilostergaard8139 4 года назад

    Does anyone know what font he is using?

  • @sainco3036
    @sainco3036 5 лет назад

    thanks.

  • @75hilmar
    @75hilmar 2 года назад

    Oh ge... 😂🤓

  • @pravachanpatra4012
    @pravachanpatra4012 2 года назад

    8:15

  • @kajam3404
    @kajam3404 5 лет назад +2

    I always get the same error, AttributeError: module 'neat' has no attribute 'Config', anyone who can help me?

    • @LotusP2
      @LotusP2 5 лет назад

      did you install the correct module? "neat-python", not only "neat

    • @investwithmax6345
      @investwithmax6345 4 года назад

      @@LotusP2 love you so muchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

    • @investwithmax6345
      @investwithmax6345 4 года назад

      @@LotusP2 thank youuu

  • @deniz5974
    @deniz5974 5 лет назад

    You Whicg terminal

  • @berkankucuklu377
    @berkankucuklu377 5 лет назад

    Can I do a AI which plays Flappy Bird in C#?

  • @keshavbansal5148
    @keshavbansal5148 4 года назад +2

    While i appreciate you building this project Tim, might i say the code is just really bad, extremely confusing and its just one huge file. You can honestly make your videos a lot more structured if you just use multiple files. It would also help us learners to be able to progress faster.