Currently, when an entity leaves a moving state, it tells UM to stop. One could also argue that UnitAI should inform UM to stop when the reached state requests stopping. This is a prove of concept for that behaviour.
This means that, when e.g. acceleration is implemented subsequent move orders don't stop and reaccelerate, if I am not mistaken :)
Details
- Reviewers
- None
Find flaws in the reasoning.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
Lint OK Severity Location Code Message Warning binaries/data/mods/public/simulation/components/UnitAI.js:341 ESLintBear (consistent-return) ESLintBear (consistent-return) Warning binaries/data/mods/public/simulation/components/UnitAI.js:783 ESLintBear (no-else-return) ESLintBear (no-else-return) Warning binaries/data/mods/public/simulation/components/UnitAI.js:2110 ESLintBear (operator-linebreak) ESLintBear (operator-linebreak) Warning binaries/data/mods/public/simulation/components/UnitAI.js:2576 ESLintBear (indent) ESLintBear (indent) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3382 ESLintBear (indent) ESLintBear (indent) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3459 ESLintBear (no-unneeded-ternary) ESLintBear (no-unneeded-ternary) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3591 ESLintBear (comma-spacing) ESLintBear (comma-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3645 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3645 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3774 ESLintBear (spaced-comment) ESLintBear (spaced-comment) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3940 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:3940 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4072 ESLintBear (no-shadow) ESLintBear (no-shadow) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4158 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4158 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4244 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4244 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4249 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4249 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4264 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4264 ESLintBear (object-curly-spacing) ESLintBear (object-curly-spacing) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4267 ESLintBear (spaced-comment) ESLintBear (spaced-comment) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4966 ESLintBear (no-shadow) ESLintBear (no-shadow) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4981 ESLintBear (no-shadow) ESLintBear (no-shadow) Warning binaries/data/mods/public/simulation/components/UnitAI.js:4983 ESLintBear (operator-linebreak) ESLintBear (operator-linebreak) - Unit
No Unit Test Coverage - Build Status
Buildable 14727 Build 31555: Vulcan Build Jenkins Build 31554: Vulcan Build (macOS) Jenkins Build 31553: Vulcan Build (Windows) Jenkins Build 31552: arc lint + arc unit
Event Timeline
Build failure - The Moirai have given mortals hearts that can endure.
builderr-debug-macos.txt fatal error: file '/Users/wfg/Jenkins/workspace/macos-differential/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-debug/mozilla/StaticAnalysisFunctions.h' has been modified since the precompiled header 'obj/network_Debug/precompiled.h.gch' was built note: please rebuild precompiled header 'obj/network_Debug/precompiled.h.gch' 1 error generated. make[1]: *** [obj/network_Debug/NetMessageSim.o] Error 1 make: *** [network] Error 2
Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2673/display/redirect
Your title is wrong, this doesn't break anything :p
This shifts the burden from "states that start moving need to stop moving" to "states that need to be stopped need to ensure they are", which I think is generally fine, but e.g. on IDLE might behave slightly unexpectedly for one turn.
I am not sure it would movement much however, because we could/should implement acceleration somewhat independently of movement orders.
I kind of liked the "enter/leave" coupling, which made it harder to introduce weird bugs. I'm not sure however it's worth keeping.
Me too :)
Well, but leaving a movement state still calls StopMoving so any move order thereafter will probably need to start from zero again.