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

Game freezes when creating a new GA #9

Closed Erickson400 closed 2 years ago

Erickson400 commented 2 years ago

I'm following the documentation and i'm at the part where i have to populate the game with agents. But it freezes when i call the function (as in var ga = GeneticAlgorithm.new(2, 1, AGENT_BODY_PATH, false, "dino_params")

Erickson400 commented 2 years ago

It seems to be an infinite loop on line 129 of ga.gd

Erickson400 commented 2 years ago

ok i found out i cant have less than 2 outputs. if i put 1 output only then its going to freeze

pastra98 commented 2 years ago

Hi, that's interesting. I don't see why 1 output should cause issues... Check out the GA constructor in the XOR demo, it has pretty much the same setup as your Dino game.

My guess would be that your number of initial links is > 2. In the Xor config, it is set to 2.

It will try to create at least as many links as you specify in the config, but each link can only connect 2 unique nodes. In a setup with 2 inputs and 1 output, there's just two possibilities.

Let me know if thats your issue, I should add that to the wiki, or implement a check for this in the GA constructor.

Erickson400 commented 2 years ago

yup that worked, i se the num_initial_links param to 2 and its not freezing. thanks