Components of a scene

A game is an interactive application that requires a medium to receive user-inputs, a way to provide feedback, such as a view, and a mechanism to make decisions.

In game development, user-inputs, view, and game logic are implemented through the use of a Design Pattern known as the Model-View-Controller (MVC) pattern.

The MVC pattern implements the logic of a game through the Model Component. It implements what you see in a game through the View Component. And it implements user-inputs through the Controller Component.

The image below illustrates the components of the MVC pattern.

A game engine interacts with the MVC pattern through the components specified. For example, all game characters are submitted to the engine's scenegraph through the View Component.

User-inputs are directed to the engine through the Controller Component. And if desired, the state of a character is updated through the Model Component.

An overview of the MVC architecture is illustrated in the image below:

Each of these components is loosely-coupled. Meaning that they can communicate among themselves, yet don't depend, nor do they know about each other. Furthermore, each component can extract information about the state of the game.

For example, the Model Component can ask the View Component how many characters are in the engine's scenegraph. Similarly, the Model Component can ask the Controller Component which button was pressed. This interaction between the engine and the MVC allows for the development of modular, clean games.

Untold Engine MVC Implementation

The Untold Engine represents each of the MVC Components as Objects. For example:

  • The U4DEngine::U4DGameModel object represents the Model Component.

  • The U4DEngine::U4DWorld object represents the View Component.

  • The U4DEngine::U4DControllerInterface object represents the Controller Component.

The image below illustrates the MVC representation in the Untold Engine:

To make use of the Untold Engine MVC architecture, you must create subclasses for each of the MVC components.

A scene in the Untold Engine is composed of the MVC design pattern. It declares and defines the View, Model and Controller component for the current scene in a game. A game can have multiple scenes. For example, it can have a Start Scene, Level 1 Scene, etc. Again, for each scene, you must define the View, Model and Controller.

Last updated