Synchronous `apply_rule` on agents with `Update::manual` states does not correctly update agent position
Afais, our apply_rule
implementation with manually managed update modes has buggy behaviour when used with Agent
entities and sync apply_rule
calls:
-
Agent
entities have two relevant members: theirstate
and theirposition
- In
apply_rule
, we only cache the agent's state, not their position - Subsequently, when updating an agent's position via
AgentManager::move_to
, the position update is not cached but applied directly❗ , leading to wrong update order
Ideas how to fix this
BaseAgentState
1 -- Require agent state to be inherited from The BaseAgentState
could then include a position
and position_new
member which is updated by AgentManager::move_to
(instead of the Agent::position_new
) member.
Downside: breaking change ... and not sure whether this works nicely with Update::sync
apply_rule
to handle Agent
-like entities
2 -- Add special case to ... but this would break the universality of the current implementation, which is
Workaround
In the meantime, using Update::sync
for agent states instead of Update::manual
works fine.