pythonmachine-learningrecurrent-neural-networkneat

NEAT multiple genomes at once in one instance of pygame


I am using neat for an RNN to train in flappy bird done with pygame.

Does anyone have a clue on how I can do that?

neat.ParallelEvaluator(4, eval_genome)

just opens four windows from pygame.

I want to do something similar to this video.

I was able to recreate some of the code here: link to GitHub , but after my whole population dies I get the following error:

Traceback (most recent call last):
  File "C:/Users/Philipp/PycharmProjects/BallBounce/Main.py", line 64, in <module>
    winner = pop.run(eval_genomes, 50)
  File "C:\Users\Philipp\PycharmProjects\BallBounce\venv\lib\site-packages\neat\population.py", line 89, in run
    fitness_function(list(iteritems(self.population)), self.config)
  File "C:/Users/Philipp/PycharmProjects/BallBounce/Main.py", line 34, in eval_genomes
    genoinf,scoreinf = Game.game(genomes,config,SCORE) #game Returns fitness
TypeError: cannot unpack non-iterable NoneType object

Solution

  • I solved the issue myself.

    Had a silly print() in my code that bascilly doubles the generations for each timeframe

    like:

    print(gen.append(bird.gen))