#6735 closed defect (fixed)

Frantic activity of AI-controlled relics

Reported by: Langbart Owned by:
Priority: Should Have Milestone: Alpha 27
Component: UI & Simulation Keywords:
Cc: Patch:

Description (last modified by Langbart)

to reproduce

  • start a map with ai controlled players and some relics (currently at [27531] there is a bug, wait till Phab:D4934 has been merged)
    # 1v1 AI match with 14 relics; small map; pay attention to the relics being captured
    pyrogenesis -autostart-size=128 -autostart="random/mainland" -autostart-ai=1:petra -autostart-ai=2:petra -autostart-victory=capture_the_relic -autostart-reliccount=14 -autostart-player=-1
    
  • move the game speed to 20x
  • wait till some captured relics reach the civic center
  • notice the frantic movement of the relic trying to find a spot

replay

reproducible

  • issue is not reproducible on A23b
  • a bit observable in A24b and A25b, but they find their position more quickly and are not trapped in an endless loop
  • issue is reproducible in A26

bisect

(none)

Attachments (5)

q_m.gif (915.3 KB ) - added by Langbart 15 months ago.
24b.gif (738.4 KB ) - added by Langbart 15 months ago.
obsRad.png (112.2 KB ) - added by Langbart 15 months ago.
over.png (515.6 KB ) - added by Langbart 15 months ago.
relics.png (194.5 KB ) - added by Langbart 15 months ago.

Change History (15)

by Langbart, 15 months ago

Attachment: q_m.gif added

comment:1 by Langbart, 15 months ago

Description: modified (diff)

comment:2 by Freagarach, 15 months ago

Looks like unit pushing in combination with the AI tasking the relic. We might need to check what the AI wants the catafalque to do. (E.g. if it tasks to a very specific spot, don't do that.)

comment:3 by Langbart, 15 months ago

The pusing changes may have made the problem even more obvious.

The problem is not present in A23b [21946] and is noticeable in A24b [24937], but not as extreme as currently in the dev version.

Below a GIF of A24b they show the same frantic behavior, but stop faster.

by Langbart, 15 months ago

Attachment: 24b.gif added

comment:4 by Langbart, 15 months ago

Turning off the CC obstruction, it shows us the position to which the AI sends the relics.

The AI orders them in the center of the CC, get the exact position.

  • binaries/data/mods/public/simulation/ai/petra/victoryManager.js

    a b PETRA.VictoryManager.prototype.pickCriticalEntRetreatLocation = function(gameSta  
    474474    if (bestBase.accessIndex == accessIndex)
    475475    {
    476476        let bestBasePos = bestBase.anchor.position();
     477        warn(uneval(['bestBasePos', bestBasePos]))
    477478        criticalEnt.move(bestBasePos[0], bestBasePos[1]);
    478479    }
    479480};


possible solutions ?

(1) Passability Class

Reducing the PassabilityClass stops the effect also, but the units are overlapping too much.

  • binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml

    a b  
    5050    <Formations disable=""/>
    5151  </UnitAI>
    5252  <UnitMotion>
    53     <PassabilityClass>large</PassabilityClass>
     53    <PassabilityClass>default</PassabilityClass>
    5454    <WalkSpeed op="mul">0.55</WalkSpeed>
    5555    <Acceleration op="mul">0.275</Acceleration>
    5656    <Weight op="mul">10.0</Weight>


(2) obstructionRadius source:ps/trunk/binaries/data/mods/public/art/textures/ui/session/auras/xp.png@27533
  • binaries/data/mods/public/simulation/ai/petra/victoryManager.js

    a b PETRA.VictoryManager.prototype.pickCriticalEntRetreatLocation = function(gameSta  
    474474    if (bestBase.accessIndex == accessIndex)
    475475    {
    476476        let bestBasePos = bestBase.anchor.position();
    477         criticalEnt.move(bestBasePos[0], bestBasePos[1]);
     477        const {max} = gameState.getEntityById(bestBase.anchorId).obstructionRadius();
     478        criticalEnt.moveToRange(bestBasePos[0], bestBasePos[1], 0, max);
    478479    }
    479480};

Last edited 15 months ago by Langbart (previous) (diff)

by Langbart, 15 months ago

Attachment: obsRad.png added

by Langbart, 15 months ago

Attachment: over.png added

by Langbart, 15 months ago

Attachment: relics.png added

comment:5 by Langbart, 15 months ago

Milestone: Alpha 27Alpha 28

The actual bug might have been introduced by one of the unit motion changes from wraitii, all the above solutions rather "hide" the actual problem.

Pushing back 1 milestone.

git log A23...A24 --author wraitii -i --grep="unit.*motion" --oneline | wc -l
# a total of 58 commits from @wraitii containing UnitMotion in the commit message    
58

comment:6 by wraitii, 15 months ago

The 'back and forth' behaviour looks a little buggy, not sure it's related to pushing or just unitmotion itself. It's a little odd that we only really see it happen to Catafalques to me, which aren't really anything special.

Investigating should determine why the unit (probs UnitAI) doesn't run into a 'stop' condition if this happens forever.

--

With that being said, I think it is a correct fix to do solution 2 above. The AI should order the unit to move in range of the entity, and not to a fixed position. This will let UnitAI make better decisions, and handles some other cases like mods that make moving CCs etc. This is independent of fixing a possible underlying issue in unit motion.

Last edited 15 months ago by wraitii (previous) (diff)

comment:7 by Freagarach, 15 months ago

The flip-flop can be reproduced with rams (task them to the center of a large CC) as well. But sometimes it is kind of hard. ^^

comment:8 by Freagarach, 15 months ago

In 27544:

Fix AI tasking catafalques to the center of the CC.

There is some unit-motion/unitAI bug that makes them not reach the center and hence idleness.

Refs. #6735 by fixing the specific PetraAI <> catafalque case.
Reported and solution by: @Langbart

comment:9 by Freagarach, 15 months ago

(One may close this ticket due to the linked commit and make a new one, or keep this open for the rest of the issue.)

comment:10 by Langbart, 15 months ago

Milestone: Alpha 28Alpha 27
Resolution: fixed
Status: newclosed

#6741 was created to keep track of the problem, which is more generally described as this ticket was.

Note: See TracTickets for help on using tickets.