Comments (5)
My take on Aspects (proven quite efficient for me in the past, though this mock-up is still being optimized so ignore the couple of highly inefficient loops that can be fairly easily fixed...): https://github.com/OvermindDL1/OverECS/blob/master/main.cpp
from specs.
@OvermindDL1 Could you please explain how you're using the information provided by aspects in order to gain performance benefits? More specifically, even though we can know which systems are compatible to run in parallel, we don't exactly know when we may run the next system (we had to wait for a whole set of systems to finish if we want to be sure).
from specs.
@OvermindDL1 Could you please explain how you're using the information provided by aspects in order to gain performance benefits? More specifically, even though we can know which systems are compatible to run in parallel, we don't exactly know when we may run the next system (we had to wait for a whole set of systems to finish if we want to be sure).
Internally at world startup (I required all systems to be registered ahead of time, though could be enabled/disabled) I built up a tree of run order and just greedily grabbed systems from the tree to run their update calls. Branches in a tree could not go 'up' until the previous layer of those nodes were done, but other nodes could go up fine if they completed first. It was pretty simple but it worked well for me. I did not show off the 'optional' components that a system might access in my example above but those were used in the tree so optional's counted as full access, even though they were not touched for the family/cache registration.
from specs.
So you store a topological sort of the systems in order to estimate which system is likely to be executed next? And additionally a graph for actually checking this?
EDIT: I just read you're only talking about a tree. So you're actually doing most of this stuff at runtime? That's actually what I have so far, because I couldn't find a clever way of precomputing anything... Seems to be a NP-complete problem.
from specs.
@torkleyy It is generated at runtime on load since I may not know the systems I'll be loading in to the world at compile-time, but I do know what I will be loading in by the time I instance the world. It is a topological sort though, with an 'end-node' to handle special events (my systems can be set to read only from a components so they can run concurrently with others that read only, but I have a lot of mine do that but instead send 'changesets' to another system that is processed at the end of all the other to run a callback to to make actual changes after checking that the preconditions are met, this is a pretty complex part of mine that you have to be careful to get right so it is only used for certain kind of trivially parallizable areas).
And yes, it is NP-complete, just cache it on world/ecs load and only read it from then-on out. It does not always generate the 'best' tree, but I have not really cared enough to fix that.
from specs.
Related Issues (20)
- DispatcherBuilder::contains HOT 1
- This is a HUGE issue! HOT 2
- Thank you! HOT 1
- How do I access all entities with a certain component? HOT 5
- How do I get the Entity that a Component belongs to? HOT 1
- How to get an entt like view of entities within a system? HOT 2
- How do I create a system that also has the capacity to remove entities? HOT 1
- Migrate to Rust 2021
- [Question] Is it possible to group components together (to all be accessed by 1 system) HOT 3
- `EntityResBuilder` does not implement `Builder` HOT 1
- Specs vs legion HOT 2
- Best practice for borrowed resources in systems? HOT 4
- ecs_bench_suite fragmented_iter unexpectedly slow
- Add necessity of feature flag serde to api documentation for saveload HOT 2
- LazyUpdate::exec uses a &mut ref? HOT 1
- specs uses shred 0.13.0, which depends on mopa HOT 1
- Re-add support for dynamic components (for scripting) HOT 1
- 0.19.0 Release? HOT 1
- ahash 7.5 dep yanked HOT 2
- Compilation fails due to outdated depencendy on ahash 0.7.7 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specs.