The following is a post-mortem for my game, Reflections. You can find the game here.
Reflections is a game based off of an artwork that I saw on my trip to GOMA (Gallery of Modern Art) called Lightning For Neda, by Monir Shahroudy Farmanfarmaian (further info on another post here).
In Reflections, the player can bounce colourful lines off of the mirrors that they are surrounded by. The longer the player charges the line, the further the line travels. There is no specific goal or objective in the game, just expression. The player can shoot lines of various lengths and various colours in order to make abstract art.
The most challenging, and most rewarding, part of this project was making sure the lines bounced correctly. The way that the game works out where to reflect the line is by Raycasts and RaycastHits. A Raycast travels in the direction that the player is looking, until it hits an object tagged ‘Mirror’. When it hits, the ‘normal’ (a Raycast that travels perpendicular to the object) is recorded. The code then figures out the angle difference between the incoming Raycast and the normal, then shoots an outgoing Raycast on the opposite side of the normal at the opposite angle.
I’m quite happy with how the mirrors turned out. Using a Render Texture on a Plane and a Camera behind the plane has given the effect of a mirror. An important thing to note is that each plane needed its own Camera and its own Render Texture assigned to it.
There are actually a few things that I would like to improve, if I had more time. Most importantly, I would have liked to change the lighting. As it stands, the mirrors only reflect well when they are set to emit a blaring white. I would of liked to have a setting, that the player could change, that could make the background lighter/darker. For now, the player must shoot lines in a white space.
The next thing I would fix in the game is a small bug in the controls that I wasn’t able to fix. When the player charges a line, there is a small chance that, when the player releases the button, no line shoots. It isn’t gamebreaking, but it is a little frustrating when charging a line.
Finally, the Colour Randomiser that I put in place, which randomises the colour of the entire line when the player shoots a line, has a tendency to select white over all the other colours. While removing white from the list of colours is the easiest solution, I would prefer to implement some sort of weighting on the Randomizer. That way I can keep white, which would be a very powerful colour if I was able to change the lighting.