Here is a proposal for another fitness score: everytime a bullet is shot, raise the score of every survivor, weighted by the distance between the survivor and the bullet. The closer the bullet the better the fitness.
Intuitively, I think this would select for better dodgers.
There’s a simple strategy that guarantees you won’t be the first to die: hide behind the back of your biggest buddy.
I think that would be my strategy, plus “if a bullet that’s going to kill your ‘shield’ is on its way, figure out whether you can find a new shield; if not, make a run for it.
The existence of such a strategy shows the result isn’t completely random.
(Of course, there also is a prisoner’s dilemma here: if everybody follows that strategy, the swarm would run away from you, and nobody would gain any fitness)
I would say just give a try at slowing down the vertical progress, remove the one bullet at a time restriction, and see how that goes.
Not trying to be negative at all, I think it's a great project and the code looks to be very clean. Nice work.
I've used GAs before in school. One example way to do even session-less evolution faster would be a distributed client/server model where the indivual survivors across all game instances who are lasting the longest are crossbred but that would take longer to code ....
> With so many invaders spawning at the same time, and the 'bullet' you shoot moving so slow, the last invader to be destroyed seems to me to be a result of random choice (which one did you get around to shooting last) rather than it being any 'healthier' than the other invaders.
I couldn't disagree more. The fitness score is correct, because the invader wins by covering distance.
What happens by chance early will happen by design late -- that is nearly the entire concept of evolutionary approaches. They always improve on their fitness function, and what matters is that you chose the right one. In this case, improving on the distance invaders travel is the point of being an invader, and the point of the game, so that distance is very obviously the correct fitness function.
The invader wins by crossing the baseline. This fitness function lets me use evolution against the invaders by letting the dumbest ones approach the baseline before killing them, making future waves easier than if I killed the easiest invaders first.
Perhaps the fitness score could include the number of projectiles that passed nearby without impacting, as a measure of difficulty to hit.
> The invader wins by crossing the baseline.
Both are true, but covering distance is a better fitness function because it is continuous and crossing the baseline is discrete (and not just discrete -- binary). Your strategy can make the difficulty rise more slowly than otherwise, but it can't make the difficulty plateau or drop.
With so many invaders spawning at the same time, and the 'bullet' you shoot moving so slow, the last invader to be destroyed seems to me to be a result of random choice (which one did you get around to shooting last) rather than it being any 'healthier' than the other invaders.
I don't really have a suggestion on how to improve it other than maybe slow down the vertical progress of the invaders and speed up the bullet so that distance made vertically is actually tied more closely to it's ability to evade your shots.