March 4, 2014
High Level Design: The Entity Component System Model
The architecture of the engine follows the entity component system (ECS) model, with some additional framework that includes functionality commonly required in games. The key element in this engine that is not defined in the ECS model is the concept of scenes, which represent game states. At any time during the game, exactly one scene is considered active. While the game is running, the engine core propagates the game loop to the active scene. Each scene is composed of entities (game objects) and systems (logic that governs the game objects), and propagates the game loop to all of its systems. Entities are lists of components, and components are lists of data; neither entities nor components should contain any logic. The figure below is a visual representation of the engine’s hierarchy.
The engine is coded entirely in Objective-C and makes use of Apple’s Cocoa and Cocoa Touch API for data structures and basic rendering. Rather than completely eliminating the need to interface with the device itself, the engine provides a strong foundation on which to build a game, while retaining the ability to add new systems that can communicate with the device directly. A simple game can be created using the engine’s built-in systems, but more complex games will require the construction of additional systems. To that end, the engine has been designed so that creating new systems is very easy.