CAN YOU SEE THE LIGHT? : PUZZLE PROTOTYPE
This post is regarding a prototyping of one of the original concepts that we came up with given the brief.Click here to see the premise for this idea:
Our first concern was: is this even possible? It is not a standard mechanic, so will not be provided by the Unity Engine, so we would have to build our own system that enables us to create 2 dimensional light that can we traversed (collided with).
To make sure that this game was not going to be too challenging to program, before we pitched it to anyone, we decided to build a prototype. We used tutorials to help us to understand how to build a system like this in Unity. The most similar concept that we could find tutorials for were a Field-of-View (FOV) Visualisation, by Sebastian Lauge, that can be found on this playlist on youtube: Click here . His tutorial explained how to build a top-down FOV that would only display exactly where the player could see. His method used a series of Ray-Casts in a spiral that would check whether it hit an object or not, and then draw a mesh with a material of low alpha after it found all of the vertices of the mesh.
Lauge’s tutorials taught us a lot about the Mesh Rendering system within Unity, and how to use Raycasts to define an Array of points, that can be used to build a mesh. The difference between his application and ours is not huge, but there are a few differences that would mean his system needed to be adapted for our game idea:
Although we had the 2D light/ shadows prototyped, the game idea required the shadows to be walkable, so the player can use them to help navigate the character to the end of the puzzle. This would require creating dynamic colliders, that would update every frame. Not all of the rays would create a collider, and the amount of colliders wouldn’t be consistent, so this was going to require a rather complex solution. As this was a prototype that would be used to display our idea, and not need to be necessarily playable, we decided to keep it as a visualisation. If we decided to go further with this project then we could work on this in the future.