MantisBT - VCMI
View Issue Details
0002051VCMIAI - Adventure Mappublic2015-01-20 19:312018-01-15 14:21
Povelitel 
Warmonger 
highmajoralways
closedfixed 
0.97b 
1.next 
0002051: AI loop when hero try to visit same standing on
What a bad luck. As soon as I start playing with the computer, make sure there are such nasty things.
EndTurn
has duplicate 0002212closed SXX Loop detected while calculating AI move (visiting same tile) 
rar freeze.rar (1,150,883) 2015-01-20 19:31
https://bugs.vcmi.eu/file_download.php?file_id=2089&type=bug
Issue History
2015-01-20 19:31PovelitelNew Issue
2015-01-20 19:31PovelitelStatusnew => assigned
2015-01-20 19:31PovelitelAssigned To => Warmonger
2015-01-20 19:31PovelitelFile Added: freeze.rar
2015-01-20 19:31PovelitelTag Attached: EndTurn
2015-02-14 23:32SXXNote Added: 0005492
2015-02-14 23:33SXXNote Added: 0005493
2015-02-14 23:45SXXNote Added: 0005494
2015-02-14 23:57PovelitelNote Added: 0005495
2015-02-15 00:32SXXNote Added: 0005496
2015-02-15 01:28SXXNote Added: 0005497
2015-03-01 23:21SXXNote Added: 0005589
2015-12-09 14:48SXXRelationship addedhas duplicate 0002212
2015-12-09 14:51SXXSummaryFREEZE AI => AI loop when hero try to visit same standing on
2015-12-09 14:52SXXNote Added: 0006170
2017-07-16 08:44PovelitelStatusassigned => resolved
2017-07-16 08:44PovelitelFixed in Version => 1.next
2017-07-16 08:44PovelitelResolutionopen => fixed
2018-01-15 14:21PovelitelNote Added: 0007372
2018-01-15 14:21PovelitelStatusresolved => closed

Notes
(0005492)
SXX   
2015-02-14 23:32   
This one still reproducible with latest git:
Player 6 starting turn
Striving to goal of type WIN
Considering goal WIN
Considering goal CONQUER
Considering goal EXPLORE
Choosing abstract goal EXPLORE (Styg)
Striving to goal of type EXPLORE (Styg)
Considering goal EXPLORE (Styg)
Considering goal VISIT TILE (59 8 1) (Styg)
Trying to realize VISIT TILE (59 8 1) (Styg) (value 3.994)
Why do I want to move hero Styg to tile 59 8 1? Already standing on that tile! 
Hero Styg visited tile (59 8 1)
Striving to goal of type EXPLORE (Styg)
Considering goal EXPLORE (Styg)
Considering goal VISIT TILE (59 8 1) (Styg)
Trying to realize VISIT TILE (59 8 1) (Styg) (value 3.998)
Why do I want to move hero Styg to tile 59 8 1? Already standing on that tile!

And this repeated till client freezes.

Styg is teal player hero that stand on nothing interesting.
If killed freeze doesn't occur to other player.
(0005493)
SXX   
2015-02-14 23:33   
Can you please clarify while you played this map did you ever saved/loaded the game before this problem occur?
(0005494)
SXX   
2015-02-14 23:45   
So first visible problem is: Explore::getAllPossibleSubgoals only return one possible goal for "Explore" that is visit tile under hero.
(0005495)
Povelitel   
2015-02-14 23:57   
I do not remember exactly. But in my opinion there were no glitches so far.
If I understand the question

Я уже точно не помню. Но по моему не было глюков до этого момента.
Если я правильно понял вопрос
(0005496)
SXX   
2015-02-15 00:32   
Не, вопрос был не в этом. Мне интересно, до того как этот глюк случился ты хоть раз до этого загрузил игру или нет?

Это важно, потому, что после загрузки что-то связанное с ИИ может быть поломано.
(0005497)
SXX   
2015-02-15 01:28   
Anyway for other interested developers. There is clearly problem with exploration affect this hero and this is need to be investigated, but freeze occur for different reason.

There is special check in function:
void VCAI::tryRealize(Goals::VisitTile & g)
...
    if(g.tile == g.hero->visitablePos()  &&  cb->getVisitableObjs(g.hero->visitablePos()).size() 
< 2)

Basically that check if previous functions that suggest tile for exploration ask hero to visit his own tile. As far as I get this case is threatened as unexpected behaviour so it's should never ever happen.

Though in your case Styg isn't suggested to move to his own tile, but one on the left where other hero standing. So basically there two idea what need to be fixed:
1 - Possible AI functions that choose tile explore shouldn't choose one that already have hero on it.
2 - Also possible this exception shouldn't occur if it's not really same hero stay on this tile.
(0005589)
SXX   
2015-03-01 23:21   
Also just accidentally bethink about this bug while coding AI. This problem may be also related to missing CGHeroInstance::convertPosition somewhere where it's needed.
(0006170)
SXX   
2015-12-09 14:52   
So I'm not remember when this happen, but both this and 0002212 fixed in current git.
(0007372)
Povelitel   
2018-01-15 14:21   
Very old saves, can't recheck them