Results 1 to 30 of 121

Thread: Game AI stuff (1.5)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member Senior Member ReluctantSamurai's Avatar
    Join Date
    Feb 2008
    Location
    USA
    Posts
    2,483

    Default Re: Game AI stuff (1.5)

    From what I've observed, the Middle East appears to have more than it's share of path-finding problems. In looking at the RTW map in it's entirety, perhaps it's just my imagination, but there seems to be a lot more twisting and winding of roads through mountains and rough terrain than anywhere else I've never cataloged it, but just like Carthage seems to get buried under a slew of path-finding problems in the Western Med, Seleucia mirrors that problem in the Eastern Med. They rarely ever target the nearest rebel town of Palmyra (in the east), or Halicarnassus (in the west). Getting into the Lycia province is the most puzzling, as it's just a stone's throw across the river

    movement costs may matter indirectly as finding the fastest path through difficult but not impassable terrain is an obstacle also, just not as much of one as impassable terrain - so roads and difficult terrain may have an effect there
    Although it involves considerably more tinkering, increasing movement rates might be a good follow-up to map alterations in aiding path-finding problems...

    I'm thinking a better solution may be the exact opposite and give the unwanted direction a close by region with very high unrest instead. So instead of a dozen armies crawling over the desert towards a very distant settlement the AI just has one army constantly retaking the same close by settlement.
    That's just evil

    as the Persian Royal Road (in terms of RTW regions) went Babylon-Hatra-Cappadocia so Hatra as a crossroads region seems appropriate.
    Although it's a topic for a different thread, the Persian Royal Road was as advanced as anything the Romans built. I had some links somewhere covering the topic, and it makes for some fascinating reading (and caused me to give the Parthians the "Paved Road-building" capability).

    In any case, fabulous work
    High Plains Drifter

  2. #2

    Default Re: Game AI stuff (1.5)

    From what I've observed, the Middle East appears to have more than it's share of path-finding problems.
    agree - that whole quarter of the map and the bit around massilia/lugdunensis are the two worst imo

    They rarely ever target the nearest rebel town of Palmyra (in the east), or Halicarnassus (in the west). Getting into the Lycia province is the most puzzling, as it's just a stone's throw across the river
    yes, it's the strangest thing as when pontus takes sardis they usually go on to take halicarnussus with no problem so it's not a persistent clipping type problem, it's something else. there's a few places like that which i've never managed to figure out but i'm hoping they're a side effect of problems elsewhere and so will eventually clear as other problems are cleared.

    Although it involves considerably more tinkering, increasing movement rates might be a good follow-up to map alterations in aiding path-finding problems...
    Yes definitely - increasing MP fixes a lot of problems on its own. I kept them at 80 while doing this as i specifically wanted to see where the AI gets stuck so I could try and fix it but the plan was always to increase MP when i was done, Although I'll probably do it by giving movement traits to AI generals.

    Although it's a topic for a different thread, the Persian Royal Road was as advanced as anything the Romans built
    yes, knowledge getting lost after a civ collapse and then reinvented somewhere else

    In any case, fabulous work
    Thanks, I'm pretty pleased to be honest as I can finally enjoy the game again.

    In fact took a break from map editing to play a bit before moving on to the next stage - trying to ensure every settlement is within pathing range. Will be interesting to see if that fixes the remaining unexplainable problems or just creates new ones :)
    Last edited by nikolai1962; 01-09-2018 at 07:35.
    It's not a map.

  3. #3

    Default Re: Game AI stuff (1.5)

    breakthrough on the multi-region movement - kicking myself as it's obvious once you see it but I didn't have such a clear example before...

    adding some regions in parts of the vanilla map to make sure all settlements in adjacent regions are within pathing range of each other and got a situation where Hasdrubal regularly got stuck on the single blue tile by the mouse cursor in the middle of the image below (en route from Carthage via the Leptis Magna region to the desert region in the lower right corner .)

    Click image for larger version. 

Name:	multiregion01a.jpg 
Views:	864 
Size:	221.2 KB 
ID:	20442

    (I knew the army started in Carthage cos it was Hasdrubal and not a randomly named captain and he hadn't moved out of Carthage yet.)

    (nb portions of the map like this where 3+ regions join at a point are prime contenders for the region clipping bug.)

    looking at the settlement to settlement path from Carthage to the settlement in the target region there are no obvious issues

    Click image for larger version. 

Name:	multiregion01.jpg 
Views:	886 
Size:	237.6 KB 
ID:	20443

    however they are not adjacent regions so if we assume the AI uses region to region movement in this situation what might that be? assuming the game knows the region to region path is Carthage region ->Leptis Magna region-> desert region then let's say it's first move is to calculate the fastest path to the closest border tile of the region adjacent to the target region (i.e. Leptis Magna region) which by eye looks like it would be this.

    Click image for larger version. 

Name:	multiregion02.jpg 
Views:	912 
Size:	255.4 KB 
ID:	20444

    the fastest path from that tile to the target settlement also seems okay

    Click image for larger version. 

Name:	multiregion03.jpg 
Views:	825 
Size:	218.1 KB 
ID:	20445

    however the path to the closest tile in the target region clips

    Click image for larger version. 

Name:	multiregion04.jpg 
Views:	827 
Size:	226.8 KB 
ID:	20446

    placing an impassable tile in the right spot should stop the path clipping and fix the problem

    Click image for larger version. 

Name:	multiregion05.jpg 
Views:	837 
Size:	243.3 KB 
ID:	20447

    which it does (at least from that direction).

    Click image for larger version. 

Name:	multiregion07.jpg 
Views:	825 
Size:	230.7 KB 
ID:	20448

    #

    this is actually a more general case of the region clipping previously mentioned in that the fastest path between two *adjacent* settlements will in most (all?) cases automatically include the fastest path from start settlement to closest passable tile in target region.

    #

    from past observation my theory was the AI used region to region movement to get to an adjacent region and then switched to finding a path to the settlement itself but this example suggests it paths to get in the actual target region first. this kind of pathing glitch happens a lot but it's usually hard to be sure what the precise cause is as unless it happens in the first few moves you generally don't know where the AI army was when it was assigned its target but in this case by lucky accident the combination of a) the odd shape of the target region in this example (a temporary thing while i juggled region borders) and b) it being Hasdrubal and very early in the game made it obvious.
    Last edited by nikolai1962; 01-11-2018 at 23:21.
    It's not a map.

    Member thankful for this post:



  4. #4

    Default Re: Game AI stuff (1.5)

    the previous post implies that in multi-region movement the key is not the overall settlement to settlement path but

    a) the armies start tile to the nearest (or fastest to reach) tile of the next region in the region-to-region path

    b) the path from that resulting tile to the fastest border tile of the next region in the chain

    and finally

    c) the path from the resulting border tile in the target region to the target settlement

    an example of where this can happen

    #

    on the vanilla map the distance from campus alanni to a border tile of the caucasus regions is beyond path finding distance

    Click image for larger version. 

Name:	steppedist01.jpg 
Views:	844 
Size:	249.3 KB 
ID:	20466

    (nb there's no way to know if the game's internal max path finding distance for AI armies is the distance allowed the player using their right-click movement but it's the only clue available)

    (nb AI armies won't always be assigned targets from a settlement tile - they could be in any tile in the source region - but they often are in the settlement or the waiting spot outside the settlement (usually the tile SW of the settlement if it's not blocked) so measuring from the settlement is a good first iteration)

    from the other direction the path from a caucasus region settlement to a steppe border tile is well within range

    Click image for larger version. 

Name:	steppedist02.jpg 
Views:	825 
Size:	291.4 KB 
ID:	20467

    and the steppe border tile to the settlement is within range also

    Click image for larger version. 

Name:	steppedist03.jpg 
Views:	854 
Size:	227.8 KB 
ID:	20468

    there are multiple ways to fix this:
    - move the campus alanni settlement down
    - push the border of the caucasus regions up
    - add an extra region
    all of which can create new pathing problems so need to check afterwards.

    I added an extra region - imaginatively titled campus_alanni02

    Click image for larger version. 

Name:	steppedist04.jpg 
Views:	861 
Size:	310.9 KB 
ID:	20469

    #

    another example

    on the vanilla map the arabia settlement is distant from some of its adjacent settlements so the borders of those regions are pushed out such that the distance for the nearest border tile to the arabia settlement is within range e.g. vanilla Palmyra region

    Click image for larger version. 

Name:	arabia01.jpg 
Views:	846 
Size:	220.8 KB 
ID:	20470

    and vanilla Bostra region

    Click image for larger version. 

Name:	arabia02.jpg 
Views:	838 
Size:	215.9 KB 
ID:	20471

    however now i'm pretty sure i can fix most pathing problems i've reactivated one of my original aims which was to make regions (or a cluster of regions) have the same shape as the roman provinces they eventually became a part of so that if you're playing Roman you can make your empire look like historical maps and as a result made the distance between the Palmyra border tile -> Arabia settlement too far.

    Click image for larger version. 

Name:	arabia03.jpg 
Views:	817 
Size:	222.2 KB 
ID:	20472

    No problem though - easily fixed as long as you know what to look for.
    Last edited by nikolai1962; 01-28-2018 at 20:30.
    It's not a map.

    Member thankful for this post:



  5. #5
    Senior Member Senior Member ReluctantSamurai's Avatar
    Join Date
    Feb 2008
    Location
    USA
    Posts
    2,483

    Default Re: Game AI stuff (1.5)

    A lot of this is much like the process of map creating in Pacific General that I did. Play-testing the map to make sure units behaved correctly was a large part of the time involved. The finished map often had many, many alterations from the beta version...
    High Plains Drifter

  6. #6

    Default Re: Game AI stuff (1.5)

    yes exactly - we can't change the AI code but we can change the map to cope better with the flaws in the existing AI code
    It's not a map.

    Member thankful for this post:



  7. #7

    Default Re: Game AI stuff (1.5)

    a type of glitch, a minor addendum and a major breakthrough

    1) a type of glitch

    generally if the AI is stuck it can be hard to spot as often it is just one stack among many but then there's the other kind

    Click image for larger version. 

Name:	glitch.jpg 
Views:	874 
Size:	384.3 KB 
ID:	20518

    this can happen when
    a) a faction has only one potential adjacent land target and the army assigned to it is stuck
    b) a faction has no potential land targets and the a naval landing has glitched
    c) a faction temporarily has no adjacent land targets cos it's at peace with all it's neighbors - this generally only happens briefly after defeating one enemy faction and before starting a new war with a neighbor

    in this case it was (c) - Macedon has just defeated Greece and was at peace with all its other neighbors

    #

    2) a minor addendum

    the fastest way to clear most path-finding glitches is to check the settlement-to-settlement path between adjacent regions looking for any clipping issues however

    vanilla Macedon: army in Larissa moves out to city "waiting spot" (usually the tile SW of settlement unless it's blocked) and waits, getting extra units from Larissa each turn and getting the Captain promoted to general (the AI will often promote a captain of a stack that has been assigned a target settlement)

    261BC

    Click image for larger version. 

Name:	stuck01.jpg 
Views:	888 
Size:	371.7 KB 
ID:	20519

    and waits 254BC

    Click image for larger version. 

Name:	stuck02.jpg 
Views:	825 
Size:	362.6 KB 
ID:	20520

    and waits 226BC

    Click image for larger version. 

Name:	stuck03.jpg 
Views:	835 
Size:	370.9 KB 
ID:	20521

    eventually (209BC) another faction takes the target settlement (Athens)

    Click image for larger version. 

Name:	stuck04.jpg 
Views:	831 
Size:	377.3 KB 
ID:	20522

    and the stack moves

    Click image for larger version. 

Name:	stuck05.jpg 
Views:	839 
Size:	385.5 KB 
ID:	20523

    but after 100+ turns of not expanding and paying the upkeep for a full stack that isn't doing anything it's a bit late

    Click image for larger version. 

Name:	stuck06.jpg 
Views:	815 
Size:	373.9 KB 
ID:	20524

    #

    Solution

    if you look at the fastest path from Larissa to Athens it seems okay

    Click image for larger version. 

Name:	stuck_sol01.jpg 
Views:	863 
Size:	366.7 KB 
ID:	20525

    and to be thorough the fastest path from Larissa's waiting spot to Athens also

    Click image for larger version. 

Name:	stuck_sol02.jpg 
Views:	902 
Size:	370.1 KB 
ID:	20526

    but if you move the mouse around the tiles adjacent to the target settlement rather than the settlement itself the path clips the Corinth region

    Click image for larger version. 

Name:	stuck_sol03.jpg 
Views:	846 
Size:	377.6 KB 
ID:	20527

    also, just to be thorough again, on the assumption the AI doesn't calc settlement to settlement but 1) start tile to fastest path to a passable tile in the target region and then 2) from that tile to the target settlement then check that too - which clips also if for whatever reason the path finding chooses to go that way around the mountain

    Click image for larger version. 

Name:	stuck_sol04.jpg 
Views:	847 
Size:	357.6 KB 
ID:	20501

    on the assumption the path-finding does go that way for some reason it is easily fixed by giving the tile it clips through to the Athens region - which seems to work

    #

    so the expanded sequence is

    1) check the fastest path settlement-to-settlement doesn't clip
    2) check the fastest path from the start settlement's waiting spot to the target settlement doesn't clip
    3) check the fastest paths to tiles adjacent to the target settlement don't clip
    4) lastly check the fastest path from the start settlement to a passable tile in the target region is not different from the fastest path overall

    #

    example of last point

    the fastest path from Narbo to Lugdunum seems okay

    Click image for larger version. 

Name:	umm01.jpg 
Views:	855 
Size:	411.2 KB 
ID:	20528

    (actually it's not as although the diagonal from Narbo region to Lug region doesn't clip, the underlying orthogonal path can only go either right and up or up and right and the latter is blocked by the mountain tile so the orthogonal path clips the Massilia region - however it can easily be fixed by removing that corner tile from Massilia)

    however the fastest path from Narbo to the nearest passable tile in Lugdunensis is like this

    Click image for larger version. 

Name:	umm02.jpg 
Views:	878 
Size:	393.8 KB 
ID:	20529

    and the fastest path from that tile within Lugdunensis region to Lugdunum clips back into Narbo region.
    Last edited by nikolai1962; 01-28-2018 at 23:35.
    It's not a map.

    Member thankful for this post:



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO