hi, welcome to mix and jam a channel about game development. Experimentation today’s. Project is inspired by Monument Valley. Monument Valley is a gorgeous puzzle; game that consists of levels that use impossible geometry and optical illusions: to guide the players path.
I always wondered how this effect was achieved and wanted to give it a try using unity. So here are the steps I needed to follow for this recreation. Implement the path finding system to guide the player through the level, create the perspective illusion present in the game and add some assets, particles and effects.
I started by importing the pro builder and pro grits packages to my project with pro builder it’s. Simple to build shapes like boxes and stairs and progress makes it easy to move those objects around snapping them on a grid in order to get the isometric look, I’ve changed the cameras projection from perspective to orthographic, and I also change the angle Of the camera to be of this value, then I created another cube to represent the player.
In order to start working on the pathfinding system, I created a script that would be attached to every block that the player could walk to. I created a function to determine the walk point by following some offsets variables: [, Music ].
I wanted to create a system where I could determine the possible directions. The player could go from a certain object for that. I created a class called game paths that has a transform variable and a boolean to check.
If the path is activated, then I created a new list of the type game path called possible paths. That way I can manually set the path possibilities for each object. I did a script for the player that would detect the current block.
The player was positioned by casting array cast and calling the result current cube. I also did a camera ray cast to detect, which blocked was clicked. Then I started working on the logic for the path finding system on the find path function.
I created a list of next cubes and passed cubes by looking at the possible paths of the current cube, reject the active ones and add them into the next cubes list. I also add the current cube to the pass cubes list in the Explorer cube function.
I check on every element on the next huge list if the walkable caps were already visited. If so, there’s, no need to keep building the paths, but if it hasn’t been visited, it adds it to the next cubes list and keep doing that until it reaches the clicked cube.
With that, I was able to trace everything back and build the final path for the movement. With the final path created, I made a do two in sequence: by moving the player to each block using linear easing to make the movement have a seamless transition.
Now I started working on the layout of the level similar to this stage on the game. I had to create pivots for the objects that could rotate in order to enable new paths. This is when I started working on the optical illusion part on the original level.
This connection of blocks is made seamless to replicate that I created a new layer called top apply the layer to some of the blocks. Then I duplicated the camera made the culling mask of that new camera to only check.
For the later I created and change the clear flags property from skybox to death. Only that way the objects on the top layer render in front of everything. The problem is, is that they also render in front of this pillar object.
The one way I found to solve this is to use planes that only render on one side, I added some planes on the pillared and change their layer to top layer. In that way, it’s possible to hide the connection, and it is still fine to rotate the center object, because the planes only render from one side with the illusion ready.
I was able to use the patch system to connect the blocks by testing. It we can see that the perspective makes it seem like there’s, a seamless transition between positions and in order to make the level playable, I created a condition system that would activate and deactivate paths depending on the rotation of certain objects.
For this project I collaborated with Max Turnbull for some 3d art Max is a super talented, 3d artist and I personally love his art style. So I was super excited to work with him check out his work on his Twitter.
He did an awesome character and some props for the level i implemented 3d arts in a level with the character, animation and change things like the lightning and background. I also added a few particle effects to make the level look a little bit more organic and after a bit of adjustments, this is how it turned out.
As always, the link for the project’s. Repository is on description. Below mixing Jam is really only possible because of everyone helping out on patreon, including these top-tier supporters, and if you want to see more videos like this, please subscribe and share it with friends.
Thank you so much for watching [, Music, ], [, Music, ]