ECSTASY
All in the name
Loading...
Searching...
No Matches
ECSTASY (Entity Component System Toward Architecture Saving Years)

If you're wondering if the name of the project has any real significance, it doesn't.

Introduction

Ecstasy is a modern C++ library that implements an Entity Component System (ECS) architecture with a strong focus on performance, flexibility, and ease of use.

Some key features include:

  • Advanced usage of templates to shift computations from runtime to compile time, resulting in faster and more efficient applications (in theory, because I don't know how to make benchmarks).
  • Support for complex queries using boolean operations (And/Or/Xor/Not) to filter and retrieve entities based on component criteria.
  • Built-in integrations for common game mechanics, such as events, user actions, and graphic libraries to simplify game development.
  • Designed with the zero-overhead principle in mind to ensure minimal runtime impact and maximum performance.
  • Provides an excellent opportunity for cooking eggs during compilation đŸ˜‰

Get started with Ecstasy today and experience a new level of performance and productivity in your ECS-based projects!

Code Example

The following is a basic example extracted from the Tutorial.

struct Position {
float x;
float y;
};
struct Velocity {
float x;
float y;
};
struct Movement : public ecstasy::ISystem {
void run(ecstasy::Registry &registry) override final
{
for (auto [position, velocity] : registry.query<Position, const Velocity>()) {
position.x += velocity.x;
position.y += velocity.y;
}
}
};
int main() {
// Declare your registry
// Register your systems
registry.addSystem<Movement>();
// Populate the registry with some entities
for (int i = 0; i < 10; i++) {
auto builder = registry.entityBuilder();
builder.with<Position>(i * 2, i * 10);
if (i % 2 == 0)
builder.with<Velocity>(i * 10, i * 2);
ecstasy::Entity entity = builder.build();
// If needed, use the entity
}
while (true) {
registry.runSystems();
}
}
int main(int argc, char **argv)
Definition main.cpp:22
System interface, base class of all systems.
Associative Map to store entity components.
Registry class definition.
Encapsulate an index to an entity.
Definition Entity.hpp:35
System interface, base class of all systems.
Definition ISystem.hpp:28
virtual void run(Registry &registry)=0
Run the system.
EntityBuilder & with(Args &&...args)
Add a component to the builder target entity.
Definition Registry.hpp:566
Base of an ECS architecture.
Definition Registry.hpp:82
EntityBuilder entityBuilder() noexcept
Create a new entity builder.
Definition Registry.cpp:33
void runSystems()
Run all systems present in the registry.
Definition Registry.cpp:92
S & addSystem(Args &&...args)
Add a new system in the registry.
Definition Registry.hpp:839

Building

Follow the building documentation

Documentation

You can see the documentation online.

You can also build it locally using Doxygen:

# Run at the root of the project
doxygen
# Open the generated pages
xdg-open doc/build/html/index.html

Contributing

ECSTASY is an open source project. If you want to get involved and suggest some additional features, file a bug report or submit a patch, create an issue or submit a pull request. Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. If you want to contribute with pull requests, look at the Contributing.md

License

The ECSTASY library is distributed under the MIT license. In short, ECSTASY is free for any use (commercial or personal, proprietary or open-source). You can use ECSTASY in your project without any restriction. You can even omit to mention that you use ECSTASY – although it would be appreciated.

External tools License

Some of ECSTASY parts use external tools. Therefore their licenses extend to your project if you use the associated options.

Authors