Skip to content

A C++ ECS library (with a demo game using Raylib)

Notifications You must be signed in to change notification settings

g-lujan/cpp-ecs-raylib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A naive implementation of an ECS framework

How to build the demo Raylib game (you will need vcpkg and CMake):

Demo Project Setup

  • Get the required dependencies with VCPKG, as below:
vcpkg install raylib

Building with MSVC

for Debug

cmake -B build-msvc -S . -G "Visual Studio 17 2022"
cmake --build build-msvc

for Release (Dynamic linking)

cmake -B build-msvc -S . -G "Visual Studio 17 2022"
cmake --build build-msvc --config Release

The resultant folder "build-msvc" will contain the build and the .sln project for Visual Studio.

Performance tests

There is a performance test to see where are the hotspots of the ECS library. This test displays the time to both spawn entities and to run systems with them. The test can also be used with VTune Profiler to check more detailed information about the library in runtime.

To run the tests, do the following:

  • Build with RelWithDebInfo
cmake --build build-msvc --config RelWithDebInfo
  • The test will be generated in build-msvc\perf_test\RelWithDebInfo and can be run with perf_test.exe <#entities/3> <#iterations>

  • Example results from VTune, showing how the use of maps to manage entities and components together with a lack of parallelism impairs the performance:

Time to perform 300000 spawns: 10ms
Time to run 100 systems with 100000 entities: 310ms

image image

About

A C++ ECS library (with a demo game using Raylib)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published