The aim of this project was to design and develop a game application that utilises Augmented Reality (AR). The prototype application “AR Mazin” has been developed using C++ in Visual Studio 2017, while also making use of the Game Environment Framework (GEF). The connection between GEF and the PSVita’s hardware allows the rendering of 2D and 3D geometry, along with the ability to receive multiple types of inputs from the user and play audio.
“AR Mazin” makes use of Marker Based AR. In this game two markers are placed apart on a flat surface to define the play area. A maze is then generated in this area and the player must move through the maze to collect all the coins in the quickest time possible. By moving the PSVita around, the user can get a different perspective on the environment, with only the player, character and coins visible when the PSVita is closer to environment and only the maze walls visible when the camera is pulled away from the environment.
State Machine
The State Machine that has been created utilises an object-orientated design to manage the interactions between the different scenes. Both the Menu and Level State inherit from the base class “BaseGameState” which holds four purely virtual functions, each of which will need to be properly initialised by the State Managers.
The below diagram displays the applications State Machine as a whole.


Game System
“AR Mazin” has a System Class which holds pointers to foundation GEF variables that are invaluable to the applications function and performance. The advantage of storing all these variables in one class is that it allows them to be utilised anywhere throughout the application without having to be individually passed between functions and methods. The implementation of this class also means that these variables are only initialised and deleted when the application is entered and exited, instead of being re-initialised between each state transition. The System Class houses tools such as the input and audio manager, while also the 2D and 3D rendering systems.

Game Objects
The next step in the development of the application was the creation of the game objects that will be rendered in the scene. The base class ObjectBaseClass was developed, from which 2D and 3D game objects can inherit from.
Base Class
The base class holds multiple components, variables and functions in which derived classes can initialise. These components are predominately functionalities provided by the GEF Framework. The class also contains two virtual functions, one for the Initialisation and another for the Update of the object, which derived classes can override.
2D GameObject
The 2D Game Object base class initialises the gef::Texture and gef::Sprite components. Any object that is then derived from the 2D Game Object class makes use of the sprite component, as it allows the object to be easily rendered using the GEF library render class. The 2D Game Object class also holds the position of the sprite, along with getters and setters.
3D GameObject
The 3D Game Objects class initialises the gef::MeshInstance class. Additionally, it also contains multiple variables to track the position, scale and rotation of the object. These variables are used in the building of an objects transform. The class also contains functions for building the transform of the game object.
Maze Generation
Firstly, all the grid points are defined. Before the grid points are created the resolution, the amount of X and Y points, of the grid is determined. It was also decided that the side of the play space with the smallest dimension would host a lower value of grid points. For example, if the play space was of dimensions 7 on the X by 3 on the Y, and the user selected the markers 2 and 5 then there would be a greater value of grid points along the X axis than the Y. The grid points are then created, relative to the plane object they will be sitting upon.

Secondly, the grid point connections are set up. For this each grid point is iterated through and pointers are stored to their four neighbouring points: up, down, left and right. If one of these directions is out of bounds the value is set to NULL.
Thirdly, the maze is generated. For this a random position in the maze is selected and then the GridGenerator class is used. The function GenerateMaze takes in the current grid along with the starting x and y position for the character. The Depth-Frist Search algorithm for generating a maze is the implemented using a recursive method (Kano, M., 2011) the placement of coins is also facilitated in this algorithm. The pseudocode for this method can be found above.
