Game Development Reference
In-Depth Information
Chapter 11
Programming: Decoupling Game Tool
GUIs from Core Editing Operations
Nicu¸or Nedelcu
Since the early days of video game development when the programmer had to write the code plus design and
create the levels without the aid of a game editor, the tools to create games have evolved into the must-have game
development software we use today. Now the level editors are built into the development kits, and the developer's job
is much easier—but still filled with potential pitfalls.
In the past few years, it has become common to decouple game level editor operations and functionality
from game-specific features, so that the editor can be reused for more games and game types. The same thing has
happened on the game engine side: engines have become more and more flexible and reusable.
But problems remain. One big issue with game level editors is complexity and manageability. Once you have
added many features to the editor, it will grow in source code size and complexity, and will become harder and harder
to maintain and extend. Another problem is that you have to choose a GUI toolkit to create your interface. That can
become a headache if you ever decide to switch to another GUI toolkit, since many editing operations are tied in with
the UI code itself.
To address the issue of changing GUI toolkits in these fast and ever-shifting times, we present a method of
decoupling the visual user interface code from the non-GUI editing operations code in the game level editor or other
tools. By separating the UI from core editing functions, you can change to another GUI toolkit in no time, leaving
the editing operations code almost untouched. The decoupling operation can be accomplished via C++ editor
core functionality code and various editor user interfaces using GUI toolkits like Qt, 1 MS WinForms, WPF, MFC,
HTML5/JavaScript, or even a command-line editor UI, all using the same editor functionality code as a common
hub. Communication between the editor functions and the visual interface is achieved through a command system
(basically the Command Pattern). We will also explore the architecture of a plug-in system using this command
communication approach.
Editor Ecosystem
The editor is split into two major logical parts:
Non-visual: Consisting of editor core, plug-ins, and their commands (no GUI).
Visual: Created using the UI toolkit of your choice, which will call the commands provided by
the plug-ins and editor core.
1 Nokia. “Qt—Cross-platform application and UI framework.” http://qt.nokia.com .
 
Search WWH ::




Custom Search