CGJ (The game is a liar): Night Mirage

CGJ (The game is a liar): Night Mirage

You can find our entry here

The game is playable in windows download only here

We made a game in one week. This time we were a team of 4: Wardl & MouevaArt as artists, NEWOOL as music designer and myself as programmer and Unity dev. The Theme was “The game is a liar”.

We bounced around a few ideas but the one that really stick was creating a desert with mirages. We had no idea how to do that kind of effect before the jam but we still went head on. Our first goal was getting a first person control on an uneven terrain. Once we had that we wanted to make the mirages. To do this we knew we needed custom shaders and that’s why we chose to use the LWRP. We tried a few things but the one that worked best was getting the texture of the camera and deforming it. This can be done in LWRP by setting the “Opaque Texture” option on the Lightweight Render Pipeline Asset and getting it in a shader using the “_CameraOpaqueTexture” property. Here is the shader graph we used:

Note that we use the screen position UV and the object UV in combination with a Noise texture to create the effect we want.

For those wondering where we added the shader, it was added on a cylinder object with its normals facing inwords towards the player. the cyclinder is parented to the character so that the distortion effect follows the players around and is at the same distance in every direction.

The other intersting thing we did was having an infinite terrain. To do this we created a tileable heightmap using blender and photoshop. We then imported it in unity and created a terrain prefab. We use 9 of them in our game. The way it works is that as soon as the character is about to leave the center tile, the tiles on the opposite side of the character direction teleport to the other side. This way the character is always on the center of the map. Adding the distort effect and some fog made the terrain teleporting not visible at all. We were very happy with the result. One thing to note is that if you use that technique you will need to redraw all the trees everytime the terrain is moved. This can be done using these lines od code:

myTerrain.terrainData.RefreshPrototypes();
myTerrain.Flush();

We had a lot of fun making this game I hope you’ll like it. Here is a little gif as a sneek peak:

Author face

Santiago Rubio (Sangemdoko)

A electronics and information engineer who works on game development in his free time. He created Sleeping Penguinz to publish the games he makes with his friends and familly.

Recent post