# Genetic Algorithm Simulation inspired by Karl Sims

Hello Unreal community!

Is it feasible to create a simulation like Karl Sims “Evolving Virtual Creatures” in Unreal Engine? What issues might I consider?

I am a computer science student and I am working on my final semesters. For one of my capstone classes, I am working with a team of 3 to create a “software project”. I have been captivated by watching algorithm, data structure, and neural network simulations on youtube. I think these simulations, especially if interactive, can be a great learning resource for aspiring students. The ultimate idea for the project is a gallery of algorithms, but for this project we are focusing on the genetic algorithm. After reading https://karlsims.com/papers/siggraph94.pdf this paper by Karl Sims I was inspired to replicate this study and do further research on interactive selection and adjusting environment / population parameters to view the results on the creatures in the environment.

I have been using UE4 for 2 years now, as a hobby. I know my way around the engine well enough, and know how to use the docs - I’ve watched many videos and started several prototypes over semester breaks. I have a general idea of how to procedurally construct these creatures, but I wanted to reach out to the community here to ask for advice on how to implement a genetic creature.

So far, I’m thinking that there will be a creature pawn. This creature pawn is composed of physics actors - most likely box -held together by physics constraint actors. Granularly, a piece would simply be a box mesh (static or skeletal? considering how bones may be used here, but not sure…) with collision and a constraint actor. The creature would hold “genes” that determine how many nodes the creature has, where they are attached, constraint variables, etc. On construction those genes would be used to procedurally construct a creature that would be added to a Population class which will manage the algorithm functions like calling the fitness function on the individual creatures. The boxes can have physics thruster components, whose parameters are also controlled by genes, which will propel the creatures.

Fitness will be evaluated based on how close they get to a light source or target point and how quickly. A higher fitness gives a higher probability to reproduce at intervals managed by the population and set off by overlap events.

I’m really not sure how granular to get with this first post - I expect to produce more documents/ visuals soon, I was just hoping to get this out there and get some feedback from the community.

Anyways thanks if you read this, and any advice is greatly appreciated!