Inspiration
State Machines and Video Games
As computer science enthusiasts, we love learning about different computational models, and one model we’re currently learning about is the state machine. State machines are hardcoded in video games and are more predictable than typical AI neural networks, but we began to wonder if there is a more efficient way to generate conditions. Through our simulation, we’ve trained the state machine to do just that.
Evolution Simulators
Evolution simulators are cool to look at and very informative in the ecology and biology fields, but they are a pain to make yourself. Their systems are very complex and have a lot of variables to account for. We wanted to know if there was a simpler way to make this simulation, so that you can test out the environment and rules of the world in an easier way. We can do this using a state machine!
Biological Education
Everyone knows about Darwin's Theory of Evolution (or at least has heard of it). As we all know, evolution can take hundreds of years, but wouldn't it be cool to see it happen in real time? We made a simulation where you can observe natural selection and gene inheritance play in an ecosystem.
What it does
Blobolution is a 2D ecosystem simulation that is primarily an evolving system. This evolution is achieved through changing state machines! A state machine represents the states of an object and the conditions for changing that state. This is often used in video games, and examples of our states include GoToFood and AvoidEnemy.
Features
- Birth System: asexual reproduction
- Mutation System: creates new combinations of traits in offspring
- Natural Selection: organisms who can't obtain enough energy die off
- Nutrient Recycling: energy of dead organisms is redeposited in the ecosystem as food
- Food Chain: traits demonstrate categorization of herbivores/carnivores and predators/prey
- Predatory Traits: more prominent when food is scarce (pack hunting)
How we built it
The overall process was divided into 4 phases with tasks divided amongst 3 team members. We developed/trained state machine conditions rather than developing a neural network. When generating conditions, we compared values to a threshold to determine organism activity and state. This created a more predictable system compared to typical AI neural networks that tend to be too complex for small systems.
Another key foundation of our program is the genetic algorithm. We created unique genes to create various combinations of traits within our generated organisms. There is also an inherited mutation system in which traits merge and create new organisms that behave in relation to their parents. These relationships are depicted through colours and their proximity in tone. Organisms with similar traits are of similar colour!
Challenges we ran into
We found issues establishing dominant species within our ecosystem. Initially, organisms classified as herbivores (consuming only food/nutrients) were capable of retaliating against carnivores (predators of other organisms). To address this, we only allowed hunting capabilities in the GoToEnemy state, preventing herbivore attacks on carnivores. However, herbivores still thrived enough that a dominant species remained unclear. Additionally, all organisms have the same walk speed, so carnivores would chase prey out of the map, eventually losing energy and dying.
To address these issues, we introduced a system where each organism travels back to its sleep spot if they can’t find their target, whether food or prey. This heavily advantaged carnivores because prey travelled to the center of the map if they were too far from any food, which is the direction of the predators.
Our latest solution was to introduce warping at the edges of the map to create a more balanced system in which prey utilize a state machine when necessary. The results showed more evidence of the "fleeing" state now that prey can move away from carnivores infinitely because they are teleported from one edge of the map to the opposite side. This system also gives carnivores a chance by changing their targets often, since targets are set based on proximity. Additionally, all organisms are confined to the area of the map, preventing “endless” chasing that kills both predators and prey from loss of energy.
Accomplishments that we're proud of
We have accomplished so much throughout this hackathon. We are proud that:
- We finished our project efficiently and in a timely manner
- We worked together as a cohesive and effective team
- We worked through the challenges that we faced with success
- We made an evolution simulation that demonstrates how organisms interact in an ecosystem
What we learned
Having a clear plan and outlining division of labour before beginning the technical portion of the project is incredibly helpful in ensuring an efficient development process. The time constraints of a hackathon easily induce stress amongst even the strongest teams, so assigning tasks before the pressure sets in is key to level-headed and strategic thinking.
What's next for Blobolution
Modifications
Our ecosystem simulation can continue to be expanded upon, including extensions such as:
- Time lapse: to increase the speed of environment activities. This way users can analyze more complex and unique gene combinations.
- Sexual Reproduction: experimenting with fish reproduction (egg laying) to reduce grouping
- More Diverse Traits: digestion bias, weight, etc.
- A User Interface: for easy analysis of genes and an organism’s inner workings
- Increased Organism Variety: more states, traits, conditions and improving the mutation system
- Game System: potentially implementing AI boss
- Comparison: analyze the effectiveness of our state machine method in comparison to neural network training
Future Applications
- Blobolution can be applied in educational settings to demonstrate the interactions of organisms within an ecosystem. This simulation includes applicable features such as family trees, a reproductive system, and a food chain.
- Blobolution can also be used in an experimental research context to explore how genetic changes affect an organism and its mutated offspring.
- The fact that Blobolution is more generative than hardcoded is an improved way to implement state machines in game development. This method is more efficient and still preserves the quality of being more predictable that traditional AI neural networks.
Log in or sign up for Devpost to join the conversation.