My plan is to make a kind of a evolution sandbox world where creatures live, evolve and multiply (and die). The idea is to have different survival strategies (predation vs herbivorism and everything in between). Plants will slowly grow food that the creatures can eat. The creatures will multiply through interaction and their offspring will have some combination of their parents traits with low chance of random mutations (not sure how I will manage who reproduces with who - different species?). The "player" will be able to move around in the world to observe the action (possibly with the ability to speed up/slow down the passing of time) but the creatures will be autonomous. If I have time, there might be some UI for the player to set up starting conditions/create creatures but at the moment this seems quite far fetched.
For the technology I will be using Unity. The initial plan is to have a flat world with top-down view, though it could become a full 3D world if things go smoothly.
I think one of the biggest difficulties will be modelling the creatures (hoping to make the appearance reflect the abilities in some way). Another difficulty might be creating a world that can sustain itself (that the creatures don't die out). Also scaling the world may become an issue performance wise.
In the end there should be a link to the final build, repo and a 10-20 sec final result video.
Milestone 1 (03.03)
- Set-up Unity developing environment (1h).
- Create a plane with moving creatures on it (simple basic shapes initially) (3h)
- Give the creatures some ability to sense their surroundings (3h)
Setting up the environment went mostly smoothly and as planned.
Getting the creatures to move on a field not so much. Initially I just drew some random boxes and tried to get the camera to move around. At first I tried using keyboard input directly for x and z coordinates, but soon realized this is a dead end and went with mouse controlled FPS style observerver view.
After creating the world and some creatures I started animating them. At first I went with just adding some random x and z position adjustments to the creatures on update. But then I realized that it would make much more sense if the creatures would randomly turn and just move in the direction they are facing. After some vector to angle and vice versa conversion hassle, I had creatures that walk around randomly (in future milestones I might change the movement randomization to randomly pick a target where they want arrive at instead of picking a direction every update - this should make their movement less fidgety).
After getting the creatures to move, I started working on "vision". The way I implemented it, is by having a circle for the distance of vison and an angle from the front of the creature for having a direction for vision. The target detection is defined through layers at the moment, but this could change. Here is a creature detecting the target egg (the red line shows that it has been detected).
Here is a picture where another creature has two eggs in it's vision range, but only one in the angle, so the red line is drawn only to the one that is actually visible.
And here is another creature almost looking at the target, but still missing it due to narrow field of vision.
Milestone 2 (17.03)
- Add creature interaction - chasing or evasion behavior (2h)
- Add some basic metabolism (2h)
- Add creature spawning. Initially most likely just random spawning but will try to get to mating behavior in the next milestone (3h)
Added very basic creature interaction. It turned out to be much more of a hassle than I initially thought - one huge headache is all the vector math and another is the physics (the creatures go into crazy spins or fall through the floor etc). But currently we have 2 types of creatures: carnivores and herbivores. Herbivores don't do much - they just run away from carnivores if they see them. Carnivores on the other hand chase herbivores and attack them (eventually killing the poor creature).
Some of them are exhibiting naughty behavior :D
For metabolism, I added stamina and stamina regeneration. Movement takes stamina and resting gives it back. When creatures run out of stamina they go into rest mode until they have reached a stamina threshold or they have rested long enough. I guess health and dying also goes under metabolism in a way.
I also added two creature spawners (one for each type of creature) - they have a timer and they spawn a creature periodically into a random spot in the environment with randomized attributes.
As you can see, the spawners are doing a pretty good job
Milestone 3 (31.03)
- Enhance creature interaction - more diverse behavior (possibly including mating) (4h)
- Extend metabolism - add food sources for herbivores (2h)
- Look into how animation works (try something simple for attack animation) (1h)
This milestone didn't really go as well as I had expected. I managed to implement attack animations and plants for herbivores to eat, but struggled a lot with improved creature intelligence and still didn't manage to get to the mating behavior. However I managed to do quite a bit of bug fixing and smoothing out other things.
For herbivores I added some trees into the environment that drop fruits around them. The herbivores can "attack" them to eat if they find them. Trees also grow over time (and eventually they will also die of age when I get to it) and don't bear fruit until they are a certain size.
The animations are currently very simple - just moving and rotating some basic shapes.
For creature behavior, I added improved pathfinding logic, also turning isn't instant anymore. Creatures also stop to turn around when they are facing the wrong way.
I was hoping to add some memory to the creatures that they don't forget what they were doing when they lose sight for a second - it sort of works, but not well enough.
I also wanted to add intelligent direction selection in case of multiple dangerous creatures around but didn't manage to finish that either.
I added some raycasting to the spectator camera so it doesn't go through walls anymore - much better handling.
Overall I spent around 11 hours on this milestone.
Here is the world with trees and fruits:
And here is the build: Attach:milestone-3-build.zip
Milestone 4 (14.04)
- Add mating behavior (so two creatures will produce offspring that are a combination of their traits) (4h)
- Add a game menu (even if it is just "quit" and "restart") (2h)
- Add walking animation (1h)
- Fix camera not being able to rotate endlessly (1h)
Sadly I did not manage to find time to work on the project for milestone 4 :(
Milestone 5 (28.04)
- Add time controls (speed up and slow down) (4h)
- Add statistics displays about what sorts of creatures are currently alive - atleast predators compared to herbivores, but will also add mean attribute values (aggression, speed etc) if I have time (3h)
I implemented basic mating behavior - creatures have a certain health threshold where they are willing to mate. When mating, each parent gives some of their health (this is a random amount that can be passed on to children) to the child. When a creature is ready to mate, they start looking for other creatures that are ready to mate. On mating, the child gets attributes randomly generate between the parents values +- 10% of the value (random mutation).
I also added a game menu - players can restart, quit and change game speed. This was a huge hassle. Initially I tried to do it with some premade menu assest, tried a few but couldn't really figure them out. Then I tried following some menu tutorials, but these were made with scene switches which meant that every time I went to menu, I had to restart the game. Eventually I just created my own canvas with a separate camera in the game world and just switch between cameras:
I fixed the bug that didn't allow camera to spin endlessly.
There are also displays about numbers of creatures and average speed and health.
Here is the build: Attach:milestone-5-build.zip
Overall it took me about 14 hours to the milestone (combined with stuff from milestone 4).
Milestone 6 (12.05)
- Add action priorities for creatures so they are less single minded and random (currently creatures only look around for a single action that they are interested in) (3h)
- Make these priorities inheritable (1h)
- Add walking animation (2h)
- Fix creatures falling through the floor (especially on higher speed) (2h)
- Bonus: Do something about the world looking ugly as hell (2h)
So I've had quite lot of struggle in my life this past month so haven't really found much time to work on this project.
However I did one final allnighter sprint to try to atleast get something done for the expo.
I hugely improved the creature's AI - now they can keep multiple goals in mind simultaneously and react accordingly while scavenging. I also created some inheritable personality traits like aggression, flee time etc. My hope was that maybe I would see some converging evolution happen to select for specific traits, however this hasn't happened :D
I also added multiplying for trees - when a creature eats fruits from two different plants, those plants combine and produce an offspring. Trees also generate energy depending on how big they are and how much shade they are in (more shade, less energy) - this energy is divided between producing fruits and growing.
I also added a mating call for the creatures - sometimes they would just never meet each other and die out, but now they do a mating call. To avoid constant spamming however, I made it cost life. So creatures try to find mates by scavenging but if they haven't seen one in a long time and they have health to spare, they let out a call (the health loss simulates territorial fighting in a way).
Another thing I added is some feedback from the creatures - when they get a plan or do something, they yell (these messages are a bit cryptic, though).
I did some refactoring - used to be one huge spaghetti script file, but now I moved different aspects into different files to make it more manageable.
The are still a lot of issues - one of the biggest being performance but also a shedload of uglyness. I wanted to make the world even bigger but it get's very slow.
So anyway, here's the build: Attach:expo-build.zip
And a small video about my world: Attach:arvutigraafika-projekt-eng.mp4
You can add development notes here, or remarks on the progress / result. Screenshots and videos are always good!