Page MenuHomeWildfire Games

[POC] - Only stop moving on states that need to.
Needs ReviewPublic

Authored by Freagarach on Mon, Jan 4, 1:29 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

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 :)

Test Plan

Find flaws in the reasoning.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
SeverityLocationCodeMessage
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:341ESLintBear (consistent-return)ESLintBear (consistent-return)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:783ESLintBear (no-else-return)ESLintBear (no-else-return)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:2110ESLintBear (operator-linebreak)ESLintBear (operator-linebreak)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:2576ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3382ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3459ESLintBear (no-unneeded-ternary)ESLintBear (no-unneeded-ternary)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3591ESLintBear (comma-spacing)ESLintBear (comma-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3645ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3645ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3774ESLintBear (spaced-comment)ESLintBear (spaced-comment)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3940ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3940ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4072ESLintBear (no-shadow)ESLintBear (no-shadow)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4158ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4158ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4244ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4244ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4249ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4249ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4264ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4264ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4267ESLintBear (spaced-comment)ESLintBear (spaced-comment)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4966ESLintBear (no-shadow)ESLintBear (no-shadow)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4981ESLintBear (no-shadow)ESLintBear (no-shadow)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4983ESLintBear (operator-linebreak)ESLintBear (operator-linebreak)
Unit
No Unit Test Coverage
Build Status
Buildable 14727
Build 31555: Vulcan BuildJenkins
Build 31554: Vulcan Build (macOS)Jenkins
Build 31553: Vulcan Build (Windows)Jenkins
Build 31552: arc lint + arc unit

Event Timeline

Freagarach created this revision.Mon, Jan 4, 1:29 PM
Vulcan added a comment.Mon, Jan 4, 1:30 PM

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

Freagarach edited the summary of this revision. (Show Details)Mon, Jan 4, 1:30 PM
Freagarach published this revision for review.Mon, Jan 4, 2:18 PM
wraitii added a subscriber: wraitii.Mon, Jan 4, 4:58 PM

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.

Freagarach retitled this revision from [POC] - Breaking UnitAI/UM: Only stop moving on states that need to. to [POC] - Only stop moving on states that need to..Tue, Jan 5, 8:28 AM
Freagarach added a comment.EditedTue, Jan 5, 8:30 AM

I kind of liked the "enter/leave" coupling

Me too :)

I am not sure it would movement much however, because we could/should implement acceleration somewhat independently of movement orders.

Well, but leaving a movement state still calls StopMoving so any move order thereafter will probably need to start from zero again.

Well, but leaving a movement state still calls StopMoving so any move order thereafter will probably need to start from zero again.

Acceleration/previous speed shouldn't be reset, or animations will be wrong.