Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ecs_world.hpp File Reference

ToyMaker Engine's implementation of an ECS system. More...

#include <cstdint>
#include <typeinfo>
#include <iostream>
#include <tuple>
#include <memory>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <type_traits>
#include <nlohmann/json.hpp>
#include "../util.hpp"
#include "../registrator.hpp"

Go to the source code of this file.

Classes

class  ToyMaker::BaseComponentArray
 An abstract base class for all ECS component arrays. More...
 
struct  ToyMaker::ComponentFromJSON< TComponent, Enable >
 A struct that describes how a JSON component description is turned into a component. More...
 
struct  ToyMaker::ComponentFromJSON< std::shared_ptr< TComponent >, Enable >
 A specialization of ComponentFromJSON that applies to components that are stored as shared pointers to components (as opposed to a value of the component type itself) More...
 
class  ToyMaker::Interpolator< T >
 A template class for interpolating components between simulation frames for various purposes. More...
 
class  ToyMaker::ComponentArray< TComponent >
 A class that implements BaseComponentArray specializing it for a component of type TComponent. More...
 
class  ToyMaker::ComponentManager
 An object that stores and manages updates to all the component arrays instantiated for this ECS World. More...
 
struct  ToyMaker::ComponentManager::getComponentTypeName< TComponent >
 Helper function for retrieving the component type string defined as part of the component. More...
 
struct  ToyMaker::ComponentManager::getComponentTypeName< std::shared_ptr< TComponent > >
 A specialization of getComponentTypeName for components which are wrapped in shared pointers. More...
 
class  ToyMaker::BaseSystem
 The base class that acts as the interface between the engine's ECS system and a particular built-in or user-defined System. More...
 
class  ToyMaker::System< TSystemDerived, TListenedForComponentsTuple, TRequiredComponentsTuple >
 A system template that disables systems with this form of declaration. More...
 
class  ToyMaker::System< TSystemDerived, std::tuple< TListenedForComponents... >, std::tuple< TRequiredComponents... > >
 The base class for any built-in or user-defined system that would like to be hooked to the engine's event cycle or have access to entities and components. More...
 
class  ToyMaker::SystemManager
 Holds references to all the systems belonging to this manager's ECSWorld. More...
 
class  ToyMaker::ECSWorld
 A class that represents a set of systems, entities, and components, that are all interrelated, but isolated from other similar sets. More...
 
struct  ToyMaker::ECSWorld::SystemRegistrationArgs< TSystemDerived, TListenedForComponents, TRequiredComponents >
 Prevents the use of the unspecialized version of SystemRegistrationArgs. More...
 
struct  ToyMaker::ECSWorld::SystemRegistrationArgs< TSystemDerived, std::tuple< TListenedForComponents... >, std::tuple< TRequiredComponents... > >
 The partially specialized version of SystemRegistrationArgs, with its latter 2 template parameters being tuples of components. More...
 
class  ToyMaker::Entity
 The Entity is a wrapper on an entity ID, used as the primary interface between an application and the engine's ECS system. More...
 

Namespaces

namespace  ToyMaker
 Namespace containing all class definitions and functions related to the ToyMaker engine.
 

Typedefs

using ToyMaker::EntityID = std::uint64_t
 A single unsigned integer used as a name for an entity managed by an ECS system.
 
using ToyMaker::WorldID = std::uint64_t
 An unsigned integer representing the name of an ECS world.
 
using ToyMaker::UniversalEntityID = std::pair<WorldID, EntityID>
 An ID that uniquely identifies an entity.
 
using ToyMaker::ECSType = std::uint8_t
 A number tag used to represent components and systems.
 
using ToyMaker::ComponentType = ECSType
 An unsigned integer representing the type of a component.
 
using ToyMaker::SystemType = ECSType
 An unsigned integer representing the type of a system.
 
using ToyMaker::Signature = std::bitset<kMaxComponents>
 A 255 bit number, where each enabled bit represents a relationship between an entity and some ECS related object.
 

Variables

constexpr EntityID ToyMaker::kMaxEntities { 1000000 }
 A user-set constant which limits the number of creatable entities in a single ECS system.
 
constexpr ECSType ToyMaker::kMaxECSTypes { 255 }
 A constant used to restrict the number of definable system and component types in a project.
 
constexpr ComponentType ToyMaker::kMaxComponents { kMaxECSTypes }
 A constant that restricts the number of definable components in a project.
 
constexpr SystemType ToyMaker::kMaxSystems { kMaxECSTypes }
 A constant that restricts the number of definable systems in a project.
 

Detailed Description

ToyMaker Engine's implementation of an ECS system.

Author
Zoheb Shujauddin (zoheb.nosp@m.2424.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Version
0.3.2
Date
2025-08-28
See Austin Morlan's implementation of a simple ECS, where entities are simple indices into various component arrays, each of which are kept tightly packed: 
 https://austinmorlan.com/posts/entity_component_system/