WOW! Just hours after that last "thanks" post ...
... MiniRL 2.0 is finished! (Architecture practice/test program)
See here:
http://www.mediafire.com/download/uv6paykwdy2qrgr/minirl-2.0.tar.gz(edit: made a last-minute correction to the program)
Is this better now? I'm now wondering about:
1. Time management -- If one "turn" is counted as one loop through all the entities, then how do you handle, say, monsters that can act more than once per turn ("fast" monsters that get multiple attacks per turn, etc.)? Can the usual time-management techniques be combined with the ECS architecture? For example, would it be "OK" to, for example, employ some traditional roguelike time-management technique like the "speed queue" mentioned here:
http://forums.roguetemple.com/index.php?topic=3206.msg26406#msg26406with ECS? Namely, when something has a zeroed timer, you then call all the system updates for that entity, or something along these lines.
2. Collisions -- how do we handle them? Namely, the difficulty arises with stuff like this:
...@..@...
--> <--
....@@....
--><--
*COLLISION!*
This is OK. BUT...
-->
....@@....
-->
Both entities are to move 1 step in the indicated direction this turn, simultaneously. So they shouldn't collide. Yet suppose that the left entity comes before the right one in the update order (since the updates are done in a sequence, one has to come before the other). Then it gets its movement and collision system calls first and they register a collision with the right entity, then the right entity gets updated and moves to the right as well. Since both were supposed to be moving simultaneously, this collision is spurious (a bug). How should one do the collision detection so as to avoid this? Also, another problem: it seems the movement system must not try to move the entities in scenario 1 on top of each other, but must stop for the collision, which means the movement system "knows about" the collision in some sense. Would it be "proper" for the movement system to then raise the collision flag itself? If not, then how is the collision system supposed to know that an entity "right next to" another on the map has actually collided and not just "brushed by"?
Also, for efficiency reasons, there needs to be some way to quickly know whether or not an entity is in a given tile on the map. Yet entity positions are not stored as markers on the map, but as coordinates in position components (and if we did store markers on the map, then we'd have to somehow guarantee they are updated every time the position component is modified. Though that may not be so much of a problem -- the movement system knows of the map anyways, so if it's the only thing that changes entity positions (it should be, I'd think -- movement should be the responsibility of that particular system, no?), then it can also tell the map to update its markers). What should one do to make the check-for-entity process involved in collisions efficient?