Home » MODDING HQ 1.13 » v1.13 Coding Talk » Path finding problems in 1.13
Path finding problems in 1.13[message #344501] Sun, 13 March 2016 10:11 Go to next message

Registered:December 2012
Location: Russian Federation
What I found is that there are some problems in path finding in 1.13.

First, AI cannot find path over the fence, so when AI decides in RED state to seek enemy and calls InternalGoAsFarAsPossibleTowards, it fails.
But when the same AI sees enemy, he calls FindBestPath in FindBestNearbyCover and it works, so he can jump over the fence and move towards closest enemy.
This can be easily checked in Wildfire landing sector, for example, will require AI decision tracing or manual calling of InternalGoAsFarAsPossibleTowards.

Second problem I found is that FindBestPath returns different AP cost for the same path than EstimatePlotPath.
For testing, in FindBestNearbyCover see
iPathCost = gubAIPathCosts[AI_PATHCOST_RADIUS + sXOffset][AI_PATHCOST_RADIUS + sYOffset];

and compare with
iPathCost = EstimatePlotPath( pSoldier, sGridNo, FALSE, FALSE, FALSE, usMovementMode, FALSE, FALSE, 0);

And when testing the path in UI mode (for player controlled merc), the EstimatePlotPath shows correct result while gubAIPathCosts shows incorrect result.

Note: this was tested on stable 7609 release but I haven't seen any related fixes for development trunk.

Can anyone comment/test/confirm/debug/fix?

EDIT: the part with jumping over fence was successfully fixed in Ja2+AI

[Updated on: Sat, 28 May 2016 12:22]

7609+AI (r1541) | Unofficial modpack | Win8+ fix | Experimental project | Youtube | Trunk (r8880) | 1.13 Starter Docs

Кто в Москве не бывал, красоты не видал.

Re: Path finding problems in 1.13[message #344521 is a reply to message #344501] Sun, 13 March 2016 22:57 Go to previous message

Registered:May 2009
Calculations are different. For example "PlotPath" function which is used by "EstimatePlotPath" runs function "TerrainActionPoints" to get the points needed to cross certain tiles. Function "FindBestPath" doesn't use "TerrainActionPoints". Instead it has its own code block to calculate the terrain stuff which seems redundant to me. Maybe this could be consolidated a bit which would probably make it easier to read as well. Unfortunately I don't have time to go through the code.

Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Previous Topic: [IDEA] New Magazine System
Next Topic: Roof climbing problem in 1.13
Goto Forum:

Current Time: Mon Aug 10 14:30:03 EEST 2020

Total time taken to generate the page: 0.03808 seconds