Smart composition of game objects using dependency injection
Most game engines are based on inheritance of game objects and/or componentization of behaviors. While this approach enables clear visualization of the system architecture, good code reuse, and fast prototyping, it brings some issues, mostly related to the high dependency between game objects/compon...
Gespeichert in:
Veröffentlicht in: | Computers in Entertainment 2009-12, Vol.7 (4), p.15 |
---|---|
Hauptverfasser: | , , , , |
Format: | Artikel |
Sprache: | eng |
Schlagworte: | |
Online-Zugang: | Volltext |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | Most game engines are based on inheritance of game objects and/or componentization of behaviors. While this approach enables clear visualization of the system architecture, good code reuse, and fast prototyping, it brings some issues, mostly related to the high dependency between game objects/components instances. This dependency often leads to static casts and null pointer references that are difficult to debug. In this article we propose the use of the dependency injection design pattern to safely initialize game objects and lessen the programmer's role in handling these issues both during the prototyping and production phases. Since these dependencies are attributes of game objects and the injection occurs only at the initialization pass, there is no performance penalty at the game loop. [PUBLICATION ABSTRACT] |
---|---|
ISSN: | 1544-3574 1544-3981 |