Return to Earth is a Match 3 style game that was developed by myself and 3 other students at the University of Central Florida for our Casual Game Production class. We were tasked with making an endless single-player mode and a multi-player mode that could be controlled with either a keyboard or an XBOX controller. I was lead programmer on this project, and spent most of my time working on the grid and matching mechanics. Along with the endless single-player mode, I also was tasked with creating the multiplayer mode, a first for me in any game yet.
Key Programming Tasks Completed:
The original grid was a 5 x 5 board (adjustable via inspector) that spawned random game pieces in each place. Each piece on the board would be identified using its color and coordinate location on the grid. Each piece is spawned in above where it needs to be, then LERPs into place in lieu of an animation. When future matches are to be made, pieces will drop if necessary into the empty slots, then new pieces will be instantiated and LERPed into position at the top of the board.
Switching / Matching
When learning how to make a Match 3 game, I was originally shown a click and drag method with the mouse. This wasn’t going to work with our game, as it needed to support the controller. Instead of building a custom cursor for the controller like I did in The Spirit of Adventure, we opted to have a box shaped cursor that could be manipulated in the x and y directions with the left joystick on the controller, or the arrow keys / WASD on the keyboard. First, the player presses A to highlight the original piece, then taps in any direction to switch the original piece with the piece that was in the direction pressed.
After switching, the two pieces will check to see if any adjacent pieces are the same color. If a piece is the same color, then the two be added to a new list, and the new piece will check once more in that same direction for another piece of the same color. If three or more pieces of the same color match in a line, tee, or cross shape, then they disappear, and an action based on the color happens. Existing pieces fall, new pieces fall in, and the game continues.
In multiplayer, the players collect ammo to fire at each other, plasma to heal themselves, fuel to stay airborne, shield cells to block incoming attacks, and special beam particles to unleash a potential combination of damage. It was just a matter of balancing after the mechanics worked! For a while, the two controllers would occasionally control the opposite board than intended, though this was fixed after learning more about Unity’s controller settings.