Skip to content
This repository was archived by the owner on Mar 12, 2021. It is now read-only.

Perform world.refresh() automatically and provide API for efficient mass changes #60

Open
LearnCocos2D opened this issue Oct 21, 2015 · 2 comments

Comments

@LearnCocos2D
Copy link

So right now if you don't call refresh() on the world after creating an entity (or presumably after changing one entiy's active status?) the new entity's components aren't processed by the systems.

Furthermore, if you happen to call refresh() without any new entities or changing their active status, then anax effectively stops processing all (!) entities. Meaning the "activated" entities list is empty. At least that second part should - at a minimum - raise an error.

But generally I don't really see the point in having to manually refresh the world except for mass changes / creation of entities. In that light I would prefer a solution that calls refresh automatically by default, and for bulk changes offer a way to do so.

Also: it took me an hour debugging anax to figure out that the world needs refreshing and that this was causing my component systems not updating. I'm sure there'll be others running into this as well.

A common pattern is to temporarily disable automatic updates of the world, only to refresh the world at the end, for instance:

world->beginMassiveWorldManipulation();
// do a lot of stuff here that would make refresh() overhead for each entity rather expensive
world->endMassiveWorldManipulation();
@LearnCocos2D LearnCocos2D changed the title Perform world.refresh() automatically Perform world.refresh() automatically and provide API for efficient mass changes Oct 21, 2015
@miguelmartin75
Copy link
Owner

This is a good idea. Not sure about that huge name though. However, this may cause more issues with #61, but if I implemented my idea I mentioned, I think it would be fine.

Furthermore, if you happen to call refresh() without any new entities or changing their active status, then anax effectively stops processing all (!) entities

I thought I fixed this bug, but apparently not. Maybe I'm confusing this for another bug.

@Shokwav
Copy link

Shokwav commented Jun 7, 2016

Any developments on this issue? I've been using this library extensively and have ran into a situation that would benefit from this sort of change. I can do a pull request for this issue if you like

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants