https://github.com/andreaslrx/ecstasy
Entity Component System Toward Architecture Saving Years
https://github.com/andreaslrx/ecstasy
cpp-library cpp20 ecs library
Last synced: about 1 year ago
JSON representation
Entity Component System Toward Architecture Saving Years
- Host: GitHub
- URL: https://github.com/andreaslrx/ecstasy
- Owner: AndreasLrx
- License: mit
- Created: 2022-10-14T18:03:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T08:13:12.000Z (about 1 year ago)
- Last Synced: 2025-04-11T09:47:46.451Z (about 1 year ago)
- Topics: cpp-library, cpp20, ecs, library
- Language: C++
- Homepage:
- Size: 179 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# ECSTASY (Entity Component System Toward Architecture Saving Years)
[](https://github.com/AndreasLrx/ecstasy/actions/workflows/build-tests.yml)
[](https://andreaslrx.github.io/ecstasy/)
[](https://opensource.org/licenses/MIT)
[](https://codecov.io/gh/AndreasLrx/ecstasy)
###### If you're wondering if the name of the project has any real significance, it doesn't.
# Table of Contents
- [Introduction](#introduction)
- [Code Example](#code-example)
- [Building](#building)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [License](#license)
- [Authors](#authors)
## 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](https://andreaslrx.github.io/ecstasy/md_doc_2_tutorial.html)._
```cpp
#include
#include
#include
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.x += velocity.x;
position.y += velocity.y;
}
}
};
int main() {
// Declare your registry
ecstasy::Registry registry;
// Register your systems
registry.addSystem();
// Populate the registry with some entities
for (int i = 0; i < 10; i++) {
auto builder = registry.entityBuilder();
builder.with(i * 2, i * 10);
if (i % 2 == 0)
builder.with(i * 10, i * 2);
ecstasy::Entity entity = builder.build();
// If needed, use the entity
}
while (true) {
registry.runSystems();
}
}
```
## Building
Follow the [building documentation](https://andreaslrx.github.io/ecstasy/md_doc_2_building.html)
## Documentation
You can see the documentation [online](https://andreaslrx.github.io/ecstasy/).
You can also build it locally using [Doxygen](https://www.doxygen.nl/):
```sh
# 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](/CONTRIBUTING.md)
## License
The ECSTASY library is distributed under the [MIT license](https://opensource.org/licenses/MIT).
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](https://andreaslrx.github.io/ecstasy/md_doc_2_building.html#CMakeOptions).
- [Google Tests](https://github.com/google/googletest/) [[BSD 3-Clause](https://github.com/google/googletest/blob/main/LICENSE)]: BUILD_TEST_SUITE
- [Rapidjson](https://github.com/Tencent/rapidjson/) [[MIT](https://github.com/Tencent/rapidjson/blob/master/license.txt)]: ECSTASY_SERIALIZER_JSON
- [Toml++](https://github.com/marzer/tomlplusplus/) [[MIT](https://github.com/marzer/tomlplusplus/blob/master/LICENSE)]: ECSTASY_SERIALIZER_TOML (Also induced by ECSTASY_INTEGRATIONS_USER_ACTION)
- [SFML](https://github.com/SFML/SFML/) [[ZLIB](https://github.com/SFML/SFML/blob/master/license.md)]: ECSTASY_INTEGRATIONS_SFML
## Authors
- Andréas Leroux (andreas.leroux@epitech.eu)