Technical post #2: The Pollution System.


Hi Everyone! its guy again, back to talking about the technical aspects of Chapi's Impact!

Today we will be talkin about the Pollution System.

A major mechanic in Chapi’s Impact is the pollution system. Chapi’s Impact's main theme is healing the environment, but first, the game must convey a feeling of sickness and rot. In order to do that, we wanted to spread pollution across all levels, and the player will have to clean the air of it by doing all sorts of things. 

The initial design for the pollution system worked like this:

I placed 4 empty objects (marked with red dots)  that will be used as markers for the level boundaries.  The plan was to fill the rectangle between the 4 markers in pollution particles at random locations.  For each particle created, I generated a random 3D point for it to spawn in. But this did not behave the way I expected: 

The generated points actually created a cube like (or cuboid, if you will) shape using those four markers. But turns out it still looks pretty good in gameplay:

But this of course came with some problems. Since the volume of the shape created is much bigger than necessary, the density of the cloud was lower than expected. To achieve the required density, we needed to generate about 2 to 3 time more pollution particles. This is pretty wasteful in resources and would defiantly cause problems in the future.

Another problem is that some of the pollution is physically behind the ground. Because of how the different objects in the scene are layered, this means that the pollution in the back is still visible, and this distortion does not look good in gameplay.

The goal now was to generate the pollution inside a cuboid, but to have all of the particles located in the front of the ground and not behind it. So instead of using the markers, I added a box collider, which is basically a cuboid designed to detect collisions:

Now we only choose random positions that are inside the box collider, and we’re done:

The pollution is now much denser, so we need fewer particles for it to look good! This saves a lot of calculations which will result in a more stable frame rate in the future! In hindsight, the box collider approach was the obvious choice, god knows how I missed that.

Now, a bit about the point of this system:

The purpose of the pollution system is to provide another layer of depth to the gameplay. The pollution is a mechanic the player will have a lot of interaction with. Enemies might generate pollution as long as they live, and the amount of pollution will affect the landscape. As the pollution level drop, the level will come alive with vegetation, small animals and birds. The pollution might block potential rewards or paths, and it might make enemies stronger. While we have a ton of ideas for how the pollution will affect the gameplay, we still have a lot of work to do. 

Hope you enjoyed :)

Guy.

Get Chapi's Impact

Leave a comment

Log in with itch.io to leave a comment.