3 ms·
Playing with Bevy and its ECS made me shocked (in a really nice way) how much like a dependency injection framework it worked. Writing a system and simply speci
by mden 6y ago
Playing with Bevy and its ECS made me shocked (in a really nice way) how much like a dependency injection framework it worked. Writing a system and simply specifying what resources and queries it needs as function arguments and it magically getting them for me makes it really quick to get to the fun part of writing game code. Are other ECSs this ergonomic?
Still struggling to really get in the flow of where what data should live, but with time it's getting easier. The realization that you don't need all data to be in components also really helps. For example for my game grid I store it as a Resource and inside I store entities I care about such that I can run a normal path search algo.
Overall very impressive and fun project and the discord community is active and friendly.
- _cart 6y agoFlagrant brag: I think we've advanced the state of the art when it comes to ECS ergonomics and (according to my taste) I think we're the most ergonomic ecs in existence. That being said, Legion (another rust ECS framework) recently added a similar approach. But they use macros instead of pure Rust, which is slightly more verbose.
- k__ 6y agoI had the impression macros are used to make code less verbose.
- _cart 6y agoIn legion the macro attributes are used as "labels" for parameters to configure resource types. Theres also the additional boilerplate of annotating the function with a `#[system]`. Bevy ECS relies solely on the type system, which means these additional annotations are not necessary.
- Buttons840 6y agoMacros or pure Rust is more verbose? I could parse your last sentence either way.
- nikki93 6y agoI'd been using entt in C++, and recently have been working on a wrapper for entt in Nim (since Nim can just generate C++ output, works fine with templates, and lets you even emit your own C++ code, this is doable), and found that Nim is quite ergonomic for ECS code: https://gist.github.com/nikki93/694524b8c007b4269c899b2e046b8025 https://gist.github.com/nikki93/694524b8c007b4269c899b2e046b... That's the entire main file for a simple demo with rectangles, some of which oscillate, and you can touch to remove (multitouch supported).