Automatically batch similar commands together to improve performance and robustness
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Commands are currently applied one at a time, in system graph order, and within that in the order they were sent within systems (FIFO). This causes some problems:
- #5074
- Confusing interactions between despawning entities and other operations like in #10122 or #2004.
- Suboptimal performance, as we are violating the basic principles of data-oriented design
## What solution would you like?
Automatically batch adjacent similar commands together.
## What alternative(s) have you considered?
We could also reorder commands to reduce surprising errors and confusing interactions. A sample ordering might be:
- Spawn
- Insert
- Remove
- Despawn
This would avoid a large number of spurious failures without needing explicit command error handling or system ordering. I'm unsure if that should be done as part of this work, or even at all however.
## Additional context
@maniwani has been investigating this, and thinks we should remove the general purpose `Deferred` system parameter to reduce the risk of unbatchable operations. I'm personally less convinced: wouldn't those arguments similarly apply to any custom commands?
Contributor guide
Research direction
Start by tracing how commands are currently applied in system graph order and review the interactions described in #5074, #10122, and #2004. Compare adjacent-command batching with the proposed Spawn/Insert/Remove/Despawn ordering and assess the effect on Deferred and custom commands. Done means the design and expected handling of batching, ordering, and failures are agreed and covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100