This bachelor thesis examines practices of Data-Oriented Design (DOD) and elements of the Entity-Component-System (ECS) in terms of game development. Furthermore, practices of DOD will be applied to elements of the ECS to enhance the performance of an ECS concerning a cache-friendly design.
Due to the component-based architecture (CBA) of the ECS, which uses the object-orientated programming principle composition over inheritance, the code base is well structured, reusable and extendible. That is mandatory when building large and complex games. The ECS consists of three principle elements: entities, components and systems. An entity represents an element in the game world. Components represent task-specific data and have no or few dependencies. Task-specific systems host and process its components. The behaviour of an entity is determined by the components it is composed of. Complex entities just hold more components than simple ones. The reusability of the code base is granted by the components. They can be reused in other projects with no or little change. During a game memory becomes fragmented due to the incoherently creation and deconstruction of game objects. That slows the processing speed of a CPU down.
To prevent the fragmentation of memory practices of DOD are applied. Basics of a CPU’s cache architecture will be specified to provide a better understanding of DOD. Through DOD practices like contiguous arrays, packed data and hot/cold splitting a significant performance boost is achieved. These practices organize data in a cache-friendly way and will be applied to elements of the ECS.