Soul to Earth

C# Unity Engine AI Simulation Shader



Walkthrough Video


Soul to Earth was individual coursework for the Advanced Programming for Games module.

This is a simulation game inspired by the Disney movie 'Soul' and 'Inside out'. The game begins in a place called sOUL land, a place where souls develop and gain emotions before being transported to a newborn child. Each soul needs to obtain a feeling of Joy, Anger, Sadness, Disgust, and Fear. When the soul gains all the emotions, they are qualified to travel to Earth.

Technology used :
- Procedural Generation using Voronoi Tesselation,
- Random Object Spawning,
- AI State Machine,
- Unity Shader Graph


UI Elements



A player can move around with the keyboard with W, S, A, and D keys and zoom in and out using a mouse wheel.

The Control panel consists of three elements. A reset button turns everything back to the first default settings and also changes the object spawn points and terrain shape. A home button allows you to go back to the menu scene.

Also, the player has the power to create a new soul, some trees, and emotion balls by clicking buttons in the control panel. They can spawn the objects in any location they want inside the map.

If the player wants to know the soul’s current state, they can just click the soul you want to know then the information updates on the 'Soul Details' panel. I made a custom red circle mouse indicator to help players know where they are selecting.

Techniques Used


1. AI State Machine

Simple Rules for Simulation

1. Souls can be in six different states: joy, anger, sadness, disgust, fear, default, and complete.

2. When the game begins, they stay in the default state. Default is a state of nothing, just like a newborn baby. It doesn't aim or do anything. They just wander around the random locations on the map.

3. Souls can change their states in two ways:
- Eating the emotion balls
- Getting caught by the other state's soul
But this can vary according to which emotional state the soul is in. There are two exceptions: the joy state and the anger state. When the soul is in a joy state, whether they get caught by the other souls or eat emotion balls, they just stay in a joy state. Also, when the soul is in an angry state, the rest of the emotions except the joy, including fear, sadness, and disgust can't change its emotional state.

4. Souls can collect the emotion balls by eating the emotion balls on the map. But also when the soul gets caught by the other emotional state soul, they not only change their states but also obtain the emotion ball.

5. The joy state soul likes other souls. So they chase the other souls and try to make them be in joy state too. When the soul is in a joy state whether they get caught by the other souls or eat other emotion balls, they stay in a joy state. It's the most powerful one.

6. The anger state is the second most powerful one. It likes to attack other souls. When the anger state attacks, it takes all the emotion balls the other soul has, and only leaves the anger emotion ball left. But as said before, it doesn't work for the joy state soul since it's the powerful one.

7. The emotion of disgust is contagious. So when the soul becomes a disgust-state, it replicates into two separate disgust-state souls. They don’t think about others, so they just wander random locations.

8. When the soul becomes in a fear state, they flee away from other souls. They are the fastest ones.

9. When the soul becomes in a sad state, they also flee away from other souls. But because they feel sad, they don't have the energy to hide from others, so they are the slowest.

10. The complete state means the soul has collected all the emotion balls(joy, anger, fear, sadness, and disgust). When the soul becomes a complete state, they fly to the earth.



2. Procedural Generation

2-1. Voronoi Tessellation


To make the movie Soul’s hills, I used Voronoi Tessellation. I took a random peak location on the map and lifted the surrounding area according to its height and how far away it is from the peak location. To do this, I calculated the distance between the peak location and the surrounding area. Then took the distance away from the actual height of the peak. Here, I used the Mathf. Pow function to make a nice curving hill.

2-2. Random Object Spawning

Since I have seven different types of objects to spawn (Tree, Joy ball, Anger ball, Sad ball, Fear ball, Disgust ball, and Soul), I needed to make them don’t overlap with each other when randomly spawning. I used the Raycast to check if there’s a collider on the spot I’m trying to spawn the object. If there’s no collider, spawn the object, and if there is, spawn at a different location. Then, I randomly spawned objects not only its position, but also in rotation, and scale value. When the game restarts, the shape of the Voronoi map and the spawned objects also randomly change.

3.Shader Graph

The thing I cared about most in terms of design aspects is to get a similar vibe to the movie 'Soul'. The soul character is made by me using Blender, trees were made with Unity ProBuilder. Shader was the key point in my game to get the movie 'Soul' vibe. A total of seven shaders were used in this project.

Shaders Used :
- Hill Shader
- Sky Shader
- Tree Shader
- Emotion Ball Shader
- Soul Shader
- Soul Complete State Shader
- Soul Dissolve Shader