Comments (2)
The Bag is used in Artemis to ensure high performance, but it does not have
objects ordered by the insertion order.
The EntitySystem has two methods, inserted() and removed(), which you can
override, and there you can put the entities into an ordered collection like
ArrayList inside your system. A bit of a duplication, but solves the issue.
I do this here:
http://code.google.com/p/spaceship-warrior/source/browse/src/com/gamadu/spaceshi
pwarrior/systems/SpriteRenderSystem.java
I'm looking into how to add ordered support into Artemis without sacrificing
performance. Not sure when I'll add it.
Original comment by [email protected]
on 2 Sep 2012 at 2:56
- Changed state: Started
from artemis-framework.
Why not order only systems, and only to some level?
From API point of view, for my needs something like
world.setSystem(..., false, order (int with default 0))
would be enough - and then for certain "order" value, the order of calls does
not matter, but one could place some systems (especially render ones) on higher
levels. About implementation, I'm wasn't thinking about it yet (Array of
Bag<EntitySystem> maybe? no idea), but I believe, that:
1) it is enough to solve most cases when we would want ordered processing -
including original issue (UseShaderProgramSystem updated before any other
rendering related systems), although it wouldn't solve everything (cases when
one needs ordered entities, like in SpriteRenderSystem example posted)
2) it does not break compatibility with current code (in old code all would be
in same "order" at level 0 (default), so it would be same behaviour - at the
price of maybe single check per world.process to access element of Array (or
something else) containing Bag with EntitySystems)
3) seems to be potentially faster than fully ordered approach
4) requires least work to solve the issue
what do you think?
Original comment by [email protected]
on 1 Jan 2013 at 10:10
from artemis-framework.
Related Issues (11)
- Entity getComponents bug HOT 1
- Components removed from ComponentMapper before remove() is invoked HOT 3
- Thread-safety issue in com.artemis.EntitySystem.SystemIndexManager
- String comparison in GroupManager
- Naming conventions for Aspects
- Support component mappers with @Mapper in super classes
- Bug in Bag size with set and remove HOT 2
- Bag.set always resets Bag.size to the last set item's position
- ImmutableBag should extend Iterable HOT 1
- Aspect checking for oneSet seems to be broken.
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 artemis-framework.