All Projects → OttoX → Fomalhaut

OttoX / Fomalhaut

Licence: MIT License
A clean, simple, c++14, Entity Component System like Overwatch ECS architecture

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to Fomalhaut

UnityDOTS-Thesis
Bachelor's degree thesis on Unity DOTS architecture
Stars: ✭ 14 (-51.72%)
Mutual labels:  ecs, entity-component-system
ECSCombat
A space battle simulation, based around Unity ECS framework
Stars: ✭ 81 (+179.31%)
Mutual labels:  ecs, entity-component-system
echo
Super lightweight Entity Component System framework for Haxe
Stars: ✭ 41 (+41.38%)
Mutual labels:  ecs, entity-component-system
artemis-odb-entity-tracker
🎲 Visual Entity Tracker for ECS library: artemis-odb
Stars: ✭ 27 (-6.9%)
Mutual labels:  ecs, entity-component-system
ecs
A dependency free, lightweight, fast Entity-Component System (ECS) implementation in Swift
Stars: ✭ 79 (+172.41%)
Mutual labels:  ecs, entity-component-system
Learning-Unity-ECS
A bunch of small Unity projects where I explore and learn Unity's new ECS and Job System.
Stars: ✭ 60 (+106.9%)
Mutual labels:  ecs, entity-component-system
space
A SCI-FI community game server simulating space(ships). Built from the ground up to support moddable online action multiplayer and roleplay!
Stars: ✭ 25 (-13.79%)
Mutual labels:  ecs, entity-component-system
imgui entt entity editor
A drop-in entity editor for EnTT with Dear ImGui
Stars: ✭ 146 (+403.45%)
Mutual labels:  ecs, entity-component-system
ecs-benchmark
ECS benchmark comparison
Stars: ✭ 68 (+134.48%)
Mutual labels:  ecs, entity-component-system
Entitas-Redux
An entity-component framework for Unity with code generation and visual debugging
Stars: ✭ 84 (+189.66%)
Mutual labels:  ecs, entity-component-system
ECS-Phyllotaxis
Learning ECS - 100k Cubes in Phyllotaxis pattern
Stars: ✭ 17 (-41.38%)
Mutual labels:  ecs, entity-component-system
Usagi
A hierarchical component entity system based game engine
Stars: ✭ 44 (+51.72%)
Mutual labels:  ecs, entity-component-system
gdk-for-unity-blank-project
SpatialOS GDK for Unity Blank Project
Stars: ✭ 33 (+13.79%)
Mutual labels:  ecs, entity-component-system
IwEngine
This is an engine that I initially started building after taking a game coding class in high school. I didn't like Unity so tried to make something more code focused that was personally easier to use.
Stars: ✭ 97 (+234.48%)
Mutual labels:  ecs, entity-component-system
ecs
🐰 Entity Component System
Stars: ✭ 62 (+113.79%)
Mutual labels:  ecs, entity-component-system
apecs
A petite entity component system
Stars: ✭ 17 (-41.38%)
Mutual labels:  ecs, entity-component-system
TinyECS
Tiny ECS is an easy to use Entity-Component-System framework that's designed specially for Unity3D.
Stars: ✭ 20 (-31.03%)
Mutual labels:  ecs, entity-component-system
rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 617 (+2027.59%)
Mutual labels:  ecs, entity-component-system
harmony-ecs
A small archetypal ECS focused on compatibility and performance
Stars: ✭ 33 (+13.79%)
Mutual labels:  ecs, entity-component-system
polymorph
A fast and frugal entity-component-system library with a focus on code generation and compile time optimisation.
Stars: ✭ 74 (+155.17%)
Mutual labels:  ecs, entity-component-system

Fomalhaut

A clean, simple, c++14, Entity Component System like Overwatch ECS architecture

Overview

This is a simple entity component system library based on the Overwatch Gameplay Architecture and Netcode article. It is written in c++14 without other dependencies. You can easily add include-folder into your game project.

NOTE:

This is my thought about how the 'Overwatch' ECS should look. If you want to add it to a commercial project, you'd better read the source code and master it. Then add the features that you need.

Support(Need C++14)

  • gcc >= v5 (tested with v5.4.0)
  • clang
  • MSVC >= VS2015

Installation

  1. Git pull source code
  2. cd Fomalhaut && mkdir build
  3. Run ./run.sh

Tutorial

Create An EntityAdmin

EntityAdmin controlls all entities and systems. You can simply define it by the following code:

EntityAdmin admin; 

Create Component

Declare some components that derived from BaseComponent such as:

class MovementComponent : public BaseComponent
{
public:
    void Reset(float velocity) { this->velocity = velocity; }
    void Print() { std::cout << "MovementComponent: " << velocity << std::endl; }
    float velocity;
};
class HealthComponent : public BaseComponent
{
public:
    void Reset(float hp, float mana)
    {
        this->hp = hp;
        this->mana = mana;
    }
    void Print() { std::cout << "HealthComponent: " << hp << '\t' << mana << std::endl; }
    float hp, mana;
};
class PositionComponent : public BaseComponent
{
public:
    void Reset(float px, float py, float pz)
    {
        x = px;
        y = py;
        z = pz;
    }
    void Print() { std::cout << "PositionComponent: " << x << '\t' << y << '\t' << z << std::endl; }
    float x, y, z;
};

Create An Entity

Entity is an aggregate that consists of one or more components. It was created by An EntityAdmin.

Entity& entity = admin.CreateEntity<Entity>();

You can simply add or replace component by:

entity.Add<PositionComponent>(3.f, 7.f, 10.f);
entity.Replace<PositionComponent>(10.f, 100.f, 100.f);

To check whether entity has any components:

bool result = entity.Has<HealthComponent>();
bool result = entity.Has<PositionComponent, HealthComponent>();

Remove one or more components:

entity.Remove<PositionComponent>();
entity.Remove<PositionComponent, HealthComponent>();

Use tuple to get some componets one-time:

PositionComponent* p = entity.Get<PositionComponent>();
std::tuple<PositionComponent*, HealthComponent*> va1 = entity.Get<PositionComponent, HealthComponent>();

Create A Demosystem And Iterate Components

class DemoSystem : public BaseSystem
{
public:
    using BaseSystem::BaseSystem;
    void Update(float time_step) override
    {
        for (PositionComponent* p : ComponentItr<PositionComponent>(admin_)) {
            p->Print();
            HealthComponent* h = p->Sibling<HealthComponent>();
            if (h) { h->Print(); }
            MovementComponent* m = p->Sibling<MovementComponent>();
            if (m) { m->Print(); }
        }
    }
};
DemoSystem& sys = admin.CreateSystem<DemoSystem>();
sys.Update(0.1f);

Use tuple-iterator to iterate Entity that has specific components with specific condition:

for (std::tuple<PositionComponent*, HealthComponent*>&& t : ComponentItr<PositionComponent, HealthComponent>(
             &admin, [](const PositionComponent*p, const HealthComponent* h) -> bool { return h->hp > 60; })) 
{
    std::get<0>(t)->Print();
    std::get<1>(t)->Print();
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].