b-casey / OpenSMACX

A project to decompile SMAC/X to C++ with the long term goal of creating a full open source clone.
GNU General Public License v3.0
52 stars 4 forks source link

Bug: Goto-Suggestion ignores ZoC #30

Open pianoslum opened 3 years ago

pianoslum commented 3 years ago

bug2

If you use the goto-command (drag'n'hold), zones of control seem to be ignored. In that example, the suggestion cannot be used as it crosses the mind worm's zoc. An equivalent solution without zoc-problem is actually possible (south - west)

-> goto-suggestions should be valid at least for the move in the first round

The second example is a bit more complicated: bug1

ZoC-problems several rounds in the future shouldn't be heeded, but a fungus tower is a special case imo, as it's likely to stay there. Still, the zoc could be bypassed by moving a unit from the other side... Maybe it would be a good idea to choose a way of the same length without any zoc-problems (not possible in this case).

As you can see, I cannot come up with a perfect solution, but maybe it's worth thinking about it. I am using the latest thinker release, if this important.

I also wonder, if the AI uses the same algo for internal pathfinding...

Save games: saves.zip

b-casey commented 3 years ago

For the drag and hold issues, this might be solvable with updates to Path::Find to properly check ZoC. Then when it's moving, my guess is Path::Move would likely need to update the pathing based on visible ZoC conflicts. I've seen some pretty terrible pathing with the AI when running through test games where I automate basically everything.

Here is where it's calculating/drawing lines that calls Path::Find: 00467430 ; void __thiscall MapWin::dest_line(MapWin *__hidden this, int x1, int y1, int x2, int y2, int veh_id, int faction_id, int, int, int, int, int)

It looks like if you tell the unit to go to (G) Lubeck base, it also ignores ZoC issue with the Fungal Tower. I couldn't trace this back to Path class. There definitely are some issues where different UI elements are doing different things for the same actions that needs some clean up and unification. This is where this specific go_to calculation is handled: 004D61A0 ; void __thiscall Console::go_to(Console *__hidden this, int veh_id, int, int)

pianoslum commented 3 years ago

Thx for your reply!

One could create such a testcase with a bottleneck "guarded" by a fungal tower and a 2nd much longer way around. The question would be whether the AI is capable of maneuvering from one side to the other. Being smart enough to break the ZoC by moving a unit from the other side would be the cherry on the cake ;)