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!
The following is a basic example extracted from the Tutorial.
#include <ecstasy/registry/Registry.hpp>
#include <ecstasy/system/ISystem.hpp>
#include <ecstasy/storages/MapStorage.hpp>
struct Position {
float x;
float y;
};
struct Velocity {
float x;
float y;
};
struct Movement : public ecstasy::ISystem {
void run(ecstasy::Registry ®istry) override final
{
for (auto [position, velocity] : registry.query<Position, const Velocity>()) {
position.x += velocity.x;
position.y += velocity.y;
}
}
};
int main() {
// Declare your registry
ecstasy::Registry 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();
}
}
Follow the building 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
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
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.
Some of ECSTASY parts use external tools. Therefore their licenses extend to your project if you use the associated options.
- Google Tests [BSD 3-Clause]: BUILD_TEST_SUITE
- Rapidjson [MIT]: ECSTASY_SERIALIZER_JSON
- Toml++ [MIT]: ECSTASY_SERIALIZER_TOML (Also induced by ECSTASY_INTEGRATIONS_USER_ACTION)
- SFML [ZLIB]: ECSTASY_INTEGRATIONS_SFML
- Andréas Leroux ([email protected])