A platform puzzler in which you use your mouse to open portals to an alternate world.
This project was built as part of the captstone course for the University of Alberta's Certificate in Computer Game Development. With a team of six people, my code needed to be easily understandable when read and easily integratable with others' work without too much tinkering. At the same time, with only four months to build the game, we needed fast solutions for quick prototyping.
Our main mechanic involves using your mouse to open rectangular portals to another world. The player clicks and drags to choose the portal's shape, during which time is stopped. When the left mouse button is released, everything contained within the portal is swapped with the same location in the other world. Anything only partially contained in the portal will be cut along the portal's borders. See the video for a demonstration of the mechanic in action!
Slicing objects along the edges of the portal was a difficult feature to implement: plenty of code exists to slice an object along a line, but if the object is lying on the corner of the portal, meaning we need to cut a square out of it, the problem becomes more complicated. This was an exercise in tradeoffs between development time, performance, and correctness. In the end, we designed an algorithm that solved the problem reasonably well and with good performance.Object Slicing: Algorithm Breakdown
While building the game, we wanted to come up with more gameplay elements that would have interesting interactions with the portal mechanic. One idea that made it into the final game was electrical circuits that, when powered, carry electricity through to mechanical devices such as pistons. This let us design puzzles in which the player uses their portal ability to repair circuits by bringing through patches of circuitry from the other world — or to destroy circuits by cutting pieces out of them. See the video for an example of the former.
Implementing this mechanic required finding a way of determining whether arbitrarily-shaped pieces of circuitry are connected to each other, and it needed to be fast, because those shapes can change every time the player draws a new portal. This required an outside-the-box solution that leverages a shader, Unity's rendering system, and a flood-fill algorithm. The end result is quite fast and very simple to work with.Circuit System: Algorithm Breakdown
All of the gameplay in Gemma's Great Gambit revolves around the portal, so it was very important to me that it be extremely polished. I put a lot of time into tweaking the portal's visuals to feel "juicy" and satisfying, including:
See the video for a closer look at the portal effects (I recommend full screen, as there are a lot of details)!Portal Effects: Technical Overview