CodeReclaimers / neat-python

Python implementation of the NEAT neuroevolution algorithm
BSD 3-Clause "New" or "Revised" License
1.4k stars 488 forks source link

I want to use the neat-python with one pop but seems not that good #241

Closed woshichuanqilz closed 2 years ago

woshichuanqilz commented 2 years ago

I check this video which use neat-python to play flappy bird by ai. https://www.youtube.com/watch?v=MMxFDaIOHsE&t=307s In this video the game was also made by himself. So it is easy to get the info about the game, and it is easily to make many birds as pop.

But I want to play the game on a webpage. Which means I would get the info about the game by opencv and more important I can just has one bird a time. So I have to set the pop in the config file to 1.

But I get some division zero error. So I check this link below: https://github.com/CodeReclaimers/neat-python/issues/214 And make the means related function return 0, when the length of values is 0.

But now seems the train is not working. Since I run for 50 generation, and at final the ai still do noting even failed for 49 times.

So how to fix this problem?

pro465 commented 2 years ago

GAs require a large pop, so you need to increase the pop size. also you need to simulate the game for every NN, since i assume you are not gonna open 100's of windows for the simulation, but more importantly, that you dont have a big enough screen to fit the windows.

pro465 commented 2 years ago

then when the best NN is good enough for you, you can make it play the game.