# Barcelli Entity-Component-System (BECS) A header only library implementing the data structures for an Entity-Component-System in C89 using memory arenas. ## Example 1 (Simple Particle System) ![Demo Example 1](./images/BECSdemoexample1.webp) ## Instructions on Usage Include `becs.h` and in exactly **one file** `#define BECS_IMPLEMENTATION` before the include. To setup your Maximum Entity Count and Maximum component count, define `BECS_MAX_ENTITIES` and `BECS_MAX_COMPONENTS` before including `becs.h` Example: ```c #define BECS_MAX_ENTITIES 100 #define BECS_MAX_COMPONENTS 10 #define BECS_IMPLEMENTATION #include int main(void) { /* your program goes here */ } ``` ## Systems To get best performance out of systems, you should try to iterate across the dense arrays in each component pool. Take a look at [Example 1's](./examples/example1/example1.c) implementation of systems. > [!NOTE] The renderer is a big limiting factor in this example as I didn't try to hard to optimize it past batch rendering the particles. See below **Example 1 Without Renderer:** ![Without Renderer](./images/BECSdemoexample1NoRenderer.webp) As you can see above, without the renderer at 100000 entities, the simulation is running at around 2800 FPS or 0.3ms.