Part-way through completing my PhD program I began to create games to use in research projects. Actually creating a game from scratch with the help of an engine allows for much more experimental control than can be achieved by either modding games, or using commercially available games. I also discovered that creating games can be a fun and more intuitive way to learn programming than the typical approach to teaching programming more often used in university Computer Science departments. Unity uses C# and Javascript for coding, and is particularly good for learning object oriented coding practices. A Unity scene is composed of "gameobjects," which can be manipulated through code but visualized in the editor and in compiled games. The visualization of the code that's been written is where I think creating games can be used to teach coding in a way that's very accessible. Unity has the advantage of being well documented and hosting hours of video tutorials online. Here are some of the game I've created for teaching, for fun, and for my research.
Endless Runner Example
An endless runner in which the character controller rotates, but doesn't move. Instead, an endless road is created ahead of the character piece by piece and moved towards the player. As the player rotates, the road also rotates to simulate turning. Track pieces are added at run time in a way that prevents track pieces from overlapping.
Escape Room Example
The objective of this game is to escape a space station. The only way to escape is to gather clues and solve puzzles. The game uses a third person camera setup, basic inventory system, and seperate physics based controls for some puzzles.
Pong Example
It's possible to create a version of Pong in Unity with only a few lines of code by making use of Unity's built in Physics. This version is a great classroom example and a good introduction to the math used in games as it only uses 2 instead of the more common 3 dimensions. It has a simple script to control the vector of the ball and is useful as a first game for students to learn the basics of the Unity engine. The ball's position in space must be tracked to make sure it doesn't go off screen, and if it does, then the ball's vector must be reflected so it moves back into view.
Horror Hospital Game Video
A horror themed game based around navigating around obstacles, avoiding zombies, collecting items and fulfilling quests given by NPCs. Keeping the same environment, I manipulated the camera perspective resulting in 2.5D and 3D experimental conditions, which are shown in the video.
Happy Hospital Game Video
Based on the horror themed game above, but with all horror related elements removed.
FPS Game Video
A first person perspective shooter game. This is a mobile friendly, Unity version of the game I used in my PhD dissertation, which was initially implemented in the CryEngine. Participants are asked to defeat an alien invasion of a government building. Levels in the game are timed, with waves of aliens spawning into the game at regular intervals.
Car Racing Game Video
This was my first attempt at a game in Unity. I used lots of standard asset scripts combined with placement of billboards around a mountain race track. Participants raced an AI car, but had to stick the race course or be reset to the nearest race checkpoint. This is also the first game that I used a practice area and in-game instructions aimed at allowing participants to master controls before playing the game.