Development

This was made in only one and a half months, and was also my first time using Javascript, HTML, CSS, BabylonJS, or really anything in this project, so it was a good learning experience. I started on Febuary 24th, 2023, and finished on April 16th, 2023.

How does it work?

While I obviously cannot explain everything, as this was a multi-thousand lines of code project (you should check out the source code here if you want to learn more), but I will explain most of it as best I can.

Starting out

To start, you first pick all of the genes you need, this screen was done with these fantastic sliders, SvelteKit, and a vector image I made to cleanly merge the different genes. Once you enter the game, it will generate the amount of animals you specified, each with random genes between the ranges you set.

It also adds a GUI on top, so that you can see what your animal is doing at the current time. There were many ways I wanted to expand this, like showing it's hunger on a slider, but my computer froze when I tried to do that, so I decided against it.

Logic

Every frame, it loops through each animal. Depending on the animal, it can do different things, but most are the same. It can have the following states:

  1. Hunting: The cats hunt the snakes, which hunt the mice, that eat grass. They look for the prey with the highest food value, that gives them the most food back.
  2. Mating: Each animal will look through it's partners and pick the one that has the attractiveness that is above its standards.
  3. Resting: The animals will rest after eating prey and mating, and they sit in place, which is bad if they are being chased by a predator.
  4. Movement: The animals are just wandering aimlessly, not moving outside of the width and length bounds of the ground.