2D platform game (current project)

Jun 2014

I started this project during summer 2014 with a graphic designer I met during a Unity training session. The idea is to build a kickstarter project for this nice video game and find the money we need to buy licences and finish the game!

Development

Unamed project

2D platforms

There are some tricks when creating a 2D platform game. You have to be careful for all the platform traversal and rely on a solid system to avoid being stuck between two platforms, this is especially the case for 2D stairs where you have to check the direction, if the player is jumping and if he is going down too. You also have to check all the specific cases where the character is moving alone without any inputs, like when he's falling or when he's pushed away.

Parallax background

To create a parallax background you have to move the background by a percentage of the camera movement. Background sprite will move slower and foreground sprite faster. Be sure to seperate horizontal and vertical factors so you can tweak everything.

Interaction system

There are two ways of interacting with environment in the game, either by clicking on an object or just standing nearby. So I designed an interaction manager which prioritize actions depending on various factors such as player direction, distance from object and mouse over. It also toggles the right icon and prevents the other actions to be activated.

Rain & lightning

I first wrote a simple shader to manage rain with a seamless texture, but Unity does not manage well wrapping sprites so now I'm using a particle system. For the lighting effect we use a spritesheet. The lightning pops at the top of the screen on a random horizontal value and with different scale. The blinding effect is managed with animation curves that control a color correction curve shader and a blur shader, so it is fully customizable.

2d shaders

I've written a couple of 2D shaders to create 2D lights, Blur effects, Desaturation effect and 2D masks to prevent rain inside buildings.

AI

The AI at the moment is working with state machines. Each non player character has its own states and can change from a state to another depending on triggers such as hearing a noise and go investigate.

Vision system

The vision in the game is made with a free asset that generates a 2D screen polygon by casting rays that collide with environment colliders. Then I used a couple of shaders to transform the dark area into a blurry desaturated image. This is not optimal and probably temporary. I also wrote a script to detect if the player is inside a building or outside to hide the interior sprites when exiting a building. And this is a lot easier to do if all the hierarchy of sprites is grouped by areas. Plus if we do this we can partitionate loading operations througout the level.

Saves

For saving I wrote a save manager and each object of the game can suscribe to this manager and send data to be saved when the save is launched. To optimize the process all the data to be saved are stored in a separate object.

Design

Background and props

I designed some props and my partner the background. The buildings in a 2D game do not follow any real life proportions, in fact everything has to be bigger because you only have 2 dimensions. The props have to stand out from all the rest to make the game easier to play, so I chose to make them more saturated and added a black contour.

Animations

We used spritesheet animations which is more work but provides nice results.

Unamed project

Menu