How do we want Monolith's to work for players and VCAI?

One more problem with putting more things there is saves compatibility. I’m wish to avoid future save format breakage while I’ll implement other pathfinding improvements.

Though if you think it’s will be okay to break saves with next merge too then I may stop at this point and leave some duplicated code in VCAI for now. E.g don’t remove knownSubterraneanGates, leave knownTeleportChannels in VCAI.

Then I can probably cleanup it and sent pull request in day or two.

So I started to get code ready to pull/merge.
Hope pull request will be ready tomorrow.

Pull request is up: #93

Want to say huge thanks to @AVS as this code wouldn’t be done without tons of time he spent helping me. Would be fair to say it’s for 50% his code. :wink:

@Warmonger @Ivan also really appreciate your comments and help!

There is one more important issue. While pathfinder can access portals and gates, there is also SectorMap class in VCAI. Its purpose is to find way to objects blocked by removable treasures or monsters - very important thing. Also, SectorMap handles Boat construction, which is very important in some scenarios (possibly bugs.vcmi.eu/view.php?id=2151 ).

It eventually nees to be merged (unified?) with Pathfinder, or at least make excessive use of it. There are several cases not handled last time I tried, such as accessing guarded tiles on the other side of Subterranean Gate (bug bugs.vcmi.eu/view.php?id=2119 ) and similiar.

I was busy for about two weeks, but not have free time again. I doubt that #2119 related to that, but I’ll look into it. Did some experiments to improve movement code internally, but it’s will likely break saves so that clearly won’t go into 0.98.

Though I’m really want to fix this one before 0.98:
bugs.vcmi.eu/view.php?id=2134

Time to bump that old topic.

@Warmonger what do you think do we really need subterranean gate code in SectorMap atm? Any reason to not disable it for now?

I just start to dig around #2119 issue and it’s not the only problem that code cause.
It’s will take a while before I learn how to design AI-related code properly so may be it’s good idea to comment it out as I not sure it’s doing anything helpful at all.

Also I’m like concept of SectorMap overall and think it’s would be right tool to use in situation when it’s not worth to check every possible movement type performance-wise (e.g using Town Portal spell or Dimension Door).

The SectorMap is here to check if a movement would be possible over removable objects (monsters or treasures). Otherwise it should duplicate Pathfinder and is superflouous in this role. If we could handle Subterranean Gates with Pathfinder instead of SectorMap, it would be great.

Also, don’t forget that SectorMap also handles Shipyards. This piece of code looks a bit off (causes AI action instead of returning path/tile info).

Yeah I’m seen shipyard code and SectorMap is looks good location for it. Though for me it’s looks like VCAI can do just fine without Subterranean gates code and I’m currently running AI with that code commented out:
gist.github.com/ArseniyShestako … c54ebf7961

It’s looks like VCAI is doing okay without it so I feel we may want to comment it out in develop at least before it’s fixed. I think like unexpected loop is far worse issue to keep it in develop.

I just run several games with AI simultaneously at moment and it’s looks like bug with subterranean gate loop is the only serious game-breaking issue remaining.

So I working around that code today for several hours and I don’t think there easy or fast fix for this. Appropriate support would take several weeks to implement and test. :frowning:

For now I disabled it until I at least drop all legacy code and rewrite it to use teleport channels. And probably at least some guards handling have to be done in pathfinder.
github.com/vcmi/vcmi/commit/975 … a58bd7e270

I’ll definitely work on this in future, but at moment it’s just make it harder to test AI and find other important bugs. Considering it’s only worked for subterranean gate anyway I don’t think this will make AI any worse.