Gemma's Great Gambit

A platform puzzler in which you use your mouse to open portals to an alternate world.

Overview

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.

Downloads

Source code (requires Unity 5.503f)
Final build (Windows)

Portal Mechanic

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

Circuitry

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

Portal Visuals

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:

  • Sound effects that change with the portal's shape
  • A wavy displacement shader
  • Automatically scaling particle effects
  • A procedurally-generated pulsating border
  • Springy, elastic movement
  • A flash effect that covers up the transfer of objects, making it look less jerky
  • A "ghost" effect to clearly show which objects can't go through the portal (such as the player)

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