Friday 19 September 2014

Adding evolution to the mix

My second experiment was about using a simple evolutive algorithm to fine adjust the goal strengths in order to get the best possible set of strengths given the environment you place the players in.

I added a "magic" check box on the app so you can switch on this evolution, then add new players if desired, goals, and let the population grow and the best adapted selected over time.





A set of changes take place to the simulation when you turn this on:

-Players that get a 100% of energy automatically duplicate them selves, dividing available energy into halves so each one has 50%. The new born copy its progetinor's goals strengths and then changed those strength a given random amount, let say in the range -10/+10%.

-Rockets are not allowed to recharge its energy by landing. They can land, but energy will not fill up anymore. They need to get drops to survive, as intended.

-Karts are the hunters. They can't take energy drops, instead they can hunt the rockets to take their energies into its own battery. If rockets run out of energy they will die after crashing somewhere, and then they will get smaller and smaller until they shrink away, leaving room for newcomers. Karts will still be able to suck energy from the died rockets, so karts will jump over dead rockets as zombies.

Thats all, only this took to make things evolve over time, but it is difficult to see the evolution happend just by watching the game on the screen, so I also added a couple of graphic changes to make it clearer:

-Players get theirs colours depending on the first goals strengths (the most important ones, runing, energy and health) so green ones are different from red ones, but different tones of green makes quite similar players. Just looking the screen you see the predominant color of the population and how it change over time.

-A new graph upper left shows the "ADN" of the population: Each player draws a horizontal line on his own player color showing the strenghts of all its goals. This looks like a mountain, with peaks on the stronger goals and valleys on the weake ones.

That said, the video itself is quite long and depressingly boring, I suggest you skip to different points on the time line of the video to see how the new graphic shows different colonies of similar players evolve, dissapear over jump to another color.

Surely the rules were not fair for the rockets as eventually the last one is hunted down by a miriad of hungry karts. Well, it made the video shorter anyway!

What could this approach be good for?

Basically it is way to fine tune your goals strength before going into "production". You could think of that as a way to choose the right setup of the pilot, instead of the kart's physical setup, but it could be widened to make other params, like the kart size, power, etc. to get the best kart configuration for a given track.

In my opinion it is just a strange and slow way to do things. I wanted to make a try on it, but this kind of work of fine tunning params can be made way more efficiently and real time instead of using precalculated params, using a second layer (as I described in my last post Follow my orders!).

There is an scenario in witch this evolution approach could be quite powerfull: evolving the player design itself.

By doing so we will need to make decisions like "Add a new thruster to the rocket in that position, angle and with this power". As you can see, there are yes/no decisions involved, like adding or not a new thruster, and this is not sometinhg a second layer will be able to do easily, but an evolutive phase would.

I am not quite interested on those possibilities, but may be I will come back later to it and try to make a spider evolve into some other more adapted insect by adding or taking legs, wings, etc. I can't promisse I will finally do it. 


No comments:

Post a Comment