A downloadable Simulation

Download NowName your own price

Using genetic algorithms to create a population of bots that evolve over time! ๐Ÿค–โœจ

It's just a simple (ugly) simulation project to show how the algorithm works, so don't expect an artistic piece.

๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—ฎ ๐—š๐—ฒ๐—ป๐—ฒ๐˜๐—ถ๐—ฐ ๐—”๐—น๐—ด๐—ผ๐—ฟ๐—ถ๐˜๐—ต๐—บ?

A genetic algorithm mimics the process of natural selection. It starts with an initial population of random solutions and evolves them through generations by selecting, breeding, and mutating the best-performing individuals. They are often employed to develop effective solutions for complex optimization and search-related challenges. 

So I made this project (not a game, but you can interact with it) where you can see that in action and better understand it.

๐—›๐—ผ๐˜„ ๐——๐—ผ๐—ฒ๐˜€ ๐—ถ๐˜ ๐—ช๐—ผ๐—ฟ๐—ธ?

โ€ข ๐—™๐—น๐—ผ๐—ผ๐—ฟ ๐—ถ๐˜€ ๐—น๐—ฎ๐˜ƒ๐—ฎ: If a bot touches the red ground they die and won't pass their genes.

โ€ข ๐—ฆ๐—ผ๐—น๐—ผ ๐˜๐—ฟ๐—ถ๐—ฎ๐—น๐˜€: They donโ€™t see or touch each other, only the ground.

โ€ข ๐—œ๐—ป๐—ถ๐˜๐—ถ๐—ฎ๐—น๐—ถ๐˜‡๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Each bot is equipped with a unique DNA that defines its traits (e.g., speed, color).

โ€ข ๐—˜๐˜ƒ๐—ฎ๐—น๐˜‚๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Bots are evaluated based on how long they survive and how far they travel.

โ€ข ๐—ฆ๐—ฒ๐—น๐—ฒ๐—ฐ๐˜๐—ถ๐—ผ๐—ป & ๐—•๐—ฟ๐—ฒ๐—ฒ๐—ฑ๐—ถ๐—ป๐—ด: Top-performing bots breed to create the next generation, passing on their favorable traits.

โ€ข ๐— ๐˜‚๐˜๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Occasionally, random mutations occur to introduce new variations.

โ€ข ๐—˜๐˜ƒ๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป: See at what generation your bots will all have acquired the necessary skills to survive. 

๐—ง๐—ต๐—ฒ ๐—–๐—ผ๐—ฑ๐—ฒ ๐—•๐—ฒ๐—ต๐—ถ๐—ป๐—ฑ ๐—œ๐˜:

โ€ข ๐—•๐—ฟ๐—ฎ๐—ถ๐—ป: Manages bot behavior based on its DNA.

โ€ข ๐——๐—ก๐—”: Handles genetic operations like initialization, crossover, and mutation.

โ€ข ๐—ฃ๐—ผ๐—ฝ๐˜‚๐—น๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐— ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ๐—ฟ: Oversees the entire population lifecycle, from creation to evolution.

๐—š๐—ฒ๐—ป๐—ฒ๐˜€:

- ๐—ฆ๐—ฝ๐—ฒ๐—ฒ๐—ฑ: bots that are too slow or doesn't move are punished. They can be too fast as well (there's physics involved).

- ๐—–๐—ผ๐—น๐—ผ๐—ฟ: itโ€™s their camouflage, if they die they wonโ€™t pass their color genes.

- ๐—ฆ๐˜‚๐—ฟ๐˜ƒ๐—ถ๐˜ƒ๐—ฎ๐—น ๐˜€๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป: They see if the ground in front of them is lava, they can either run, turn left or right.

๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐—ฎ๐—ฐ๐˜ ๐˜„๐—ถ๐˜๐—ต ๐˜๐—ต๐—ฒ๐—บ! (๐—ฎ๐—ป๐—ฑ ๐˜€๐—ฒ๐—ฒ ๐—ต๐—ผ๐˜„ ๐˜๐—ต๐—ฎ๐˜ ๐—ฎ๐—ณ๐—ณ๐—ฒ๐—ฐ๐˜ ๐˜๐—ต๐—ฒ ๐˜€๐—ถ๐—บ๐˜‚๐—น๐—ฎ๐˜๐—ถ๐—ผ๐—ป)

- Click on them to โ€œkillโ€.

- Press the pause button and modify the mutation rate value.

#MachineLearning #Unity #Simulation #GeneticAlgorithm

Download

Download NowName your own price

Click download now to get access to the following files:

GeneticAlgorithmSimulation.zip 33 MB

Leave a comment

Log in with itch.io to leave a comment.