Broken Pieces is a shape building puzzle game, use the PSVita’s AR markers to move and rotate pieces of a 3D puzzle to reconstruct a broken shape.
The game features several shapes that have been broken into several parts. There is a casual mode, where the player can take their time to solve the puzzle and a challenge mode where the player races against the clock to complete the puzzle.
The game was made as part of Applied Games Technologies module in term 1.
The application is designed around composition, using game objects compromised of components. This allows for core logic and behaviour to be defined in derived components in a reusable manner. Making lots of different types of game objects can be achieved by combining different components together.
The core transform component supports parent and child transforms, this became invaluable throughout the project. It allowed for world matrices that represent the object in world space, whilst allowing local space manipulations of the object, that propagate to all child transforms.
When implementing the AR parts of the framework for the PSVita, the transform and camera class were easily extended. The framework could easily ensure all child objects followed the AR markers position and rotation.
This design was extended to add a UI system that hooks into the same behaviour of hierarchical transforms and component construction.
The world abstract class defines a default update, that only updates when the world is active, and a default rendering pipeline. This allows overriding of the world’s initialise function to add game objects and describe their behaviour. The AR world overrides the update function to add AR updates in the correct place in the core loop, without major changes, due to the modular nature of the components.
The world management class exposes functionality to allow for asynchronous loading in a separate thread, as well as thread safe deletion of the worlds. This allows the game to easily load worlds and have them be updated & rendered. Letting the system additively load and layer worlds, meaning the game can be split into separate worlds.
The asynchronous world loading is done through the async queue class that uses “std::thread” to allow for a separate thread for processing tasks passed as “std::function” pointers defined as lambda tasks in the world manager.
The project is split into a separate little lot project which contains the core functionality for any game that involves PSVita AR, with the required components, asset management, and world management. Using a separate project for the game code, means it can focus purely on gameplay, while the little lot framework handles standard behaviour.
The component system really comes into its own in this aspect, being able to build and create new worlds from existing components without needing to write lots of custom code was incredibly useful.