henricj / dunelegacy

GNU General Public License v2.0
27 stars 5 forks source link

Sand worms never move #23

Closed juj closed 2 years ago

juj commented 2 years ago

Completed the Ordos campaign yesterday, and one thing I noticed odd is that I never saw any Sand worm attacks. The sand worms are there, but they don't seem to move anywhere?

image

They are eager to eat anything that walks in the cell they are in, but otherwise do not react to anything:

image

One can dedicate some units right next to them, and at a leisurely pace the units can keep shooting at the Sand worm until it dies:

image

The AI seems to be eager to attack the sand worms. They drive their units next to the sand worms and keep shooting them until they die; and the sand worms never retaliate or escape to the AI, but will just sit there until they die off.

juj commented 2 years ago

I think this might be caused by the check on this line failing:

https://github.com/henricj/dunelegacy/blob/568c317007a82eb140bd08f8ace09bccaf6bfe90/src/units/SandWorm.cpp#L420

it seems that when I attack a sand worm with an unit, this check will stay the unit and the sand worm are on a different sand region, which causes it to not engage fighting.

If I forcibly change that line to unconditionally return true; then the sand worm begins to attack. However, the game screen rendering visually glitches, and the screen base layer begins to flicker between between these two views:

image

image

The sand worm will have an eating party with the enemy base, and after it has chomped enough of enemy units, it will vanish (iirc sand worms disappeared after having eaten enough, 3-4 units?). As part of that process, the map region where the sand worm attacked the enemy base became visible, like seen on the second screen shot.

henricj commented 2 years ago

The code to split the map into disjoint sand regions was completely broken. I'm not sure it fixes the sandworm problem, but b66573f should at least get the getSandRegion() comparison to make sense.

juj commented 2 years ago

The code to split the map into disjoint sand regions was completely broken. I'm not sure it fixes the sandworm problem, but b66573f should at least get the getSandRegion() comparison to make sense.

Great find - stepping through the flood fill code in debugger, I further revised that path - posted PR #30 about that.