pastra98 / NEAT_for_Godot

An implementation of Kenneth O. Stanley's NEAT Algorithm for the Godot game engine, written in gdscript.
MIT License
36 stars 9 forks source link

Error when all agents die #10

Closed Erickson400 closed 2 years ago

Erickson400 commented 2 years ago

I'm getting the error break point from ga.gd line 359 when ever all agents die. New generations are created normally if i use a key press or something that's not checking if all agents are dead.

pastra98 commented 2 years ago

Hi, your issue is a little unclear, but I assume it has to do with total_adjusted_species_avg_fitness being 0. Have you checked there yet?

If all your agents have 0 fitness, the selection becomes ineffective. You can circumvent this by assigning a base-rate fitness value of e.g. 1.

Erickson400 commented 2 years ago

That did it, weird, i though it generated agents from the fitness after the simulation, not the default 0 value i set the variable to.

Erickson400 commented 2 years ago

oh, also i was not resetting the environment's settings so it was actually colliding with a kill trigger even though they had no chance of getting fitness.