Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#4266 closed defect (fixed)

[PATCH] Ex-allies units visible in fog of war after changing the diplomacy

Reported by: elexis Owned by: Itms
Priority: Must Have Milestone: Alpha 22
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by elexis)

In this alpha 21 / r18800 replay at minute 48, the blue player (me) declared war on an ally (green player, siole). Many units that were previously visible in siole's field of view were still visible in the fog of war after the diplomacy was changed to enemy (i.e. many (all?) units by the green player and some of the red players units that were seen by the green units). The bug can be reproduced by visually replaying the attached file and selecting the perspective of the blue player.

http://trac.wildfiregames.com/raw-attachment/ticket/4266/before.jpg http://trac.wildfiregames.com/raw-attachment/ticket/4266/after.jpg http://trac.wildfiregames.com/raw-attachment/ticket/4266/total.jpg

Attachments (12)

commands.txt (1.1 MB ) - added by elexis 8 years ago.
before.jpg (189.3 KB ) - added by elexis 8 years ago.
after.jpg (171.1 KB ) - added by elexis 8 years ago.
total.jpg (245.0 KB ) - added by elexis 8 years ago.
dirty-vis-mask.patch (2.0 KB ) - added by Itms 8 years ago.
invisible_foundation.jpg (161.1 KB ) - added by elexis 7 years ago.
2016-11-06_0051.7z (415.5 KB ) - added by elexis 7 years ago.
Alpha 21 replay with Uran238cz's invisible foundation at 53:50 after allying him
screenshot_uran.jpg (458.0 KB ) - added by elexis 7 years ago.
Uran238cz's city how it actually looked after mutual alliance of Uran238cz and me.
screenshot_elexis.jpg (474.5 KB ) - added by elexis 7 years ago.
Uran238cz's city as seen from my perspective, immediately after establishing mutual alliance.
screenshot_diff.jpg (487.9 KB ) - added by elexis 7 years ago.
After reestablishing the mutual alliance, I don't see a number of Uran238cz's buildings (fortress foundation, finished barracks and tower), some trees still appear while they had been gathered out of existance and none of the sheep corpses are seen. Not sure whether the 2 units at the top of the screen disappeared or just moved somewhere else in that 1 second.
commands_a21_mini.txt (13.1 KB ) - added by elexis 7 years ago.
Minimalistic alpha 21 replay showing the invisible buildings bug.
commands_a22_mini.txt (13.1 KB ) - added by elexis 7 years ago.
Same replay adapted for a22 (only market entiy id changed). Breaks with r18993 but not r18994, so it appears to be fixed.

Change History (22)

by elexis, 8 years ago

Attachment: commands.txt added

by elexis, 8 years ago

Attachment: before.jpg added

by elexis, 8 years ago

Attachment: after.jpg added

by elexis, 8 years ago

Attachment: total.jpg added

comment:1 by elexis, 8 years ago

Description: modified (diff)

comment:2 by elexis, 8 years ago

Reproduce: 1) Start with an ally or make one in the game 2) Explore some units of that ally 3) Declare war on that player

The explored entities will remain visible. This bug exists in alpha 20 too and it apparently doesn't matter whether one sets enemy or neutral.

comment:3 by wraitii, 8 years ago

Fixed here: https://github.com/wraitii/0ad/commit/0fcf3865d767c4dae0398a2545eaa3d05e512cd5

The problem is that the sharedLos function only thinks the LOS was actually modified if the current allies change the LOS. So if you no longer have any allies it doesn't properly detect it should recompute LOS visibility.

comment:4 by Itms, 8 years ago

Keywords: patch rfc added
Milestone: BacklogAlpha 22
Summary: Ex-allies units visible in fog of war after changing the diplomacy[PATCH] Ex-allies units visible in fog of war after changing the diplomacy

The fix above is wrong, even though it would solve the problem in a number of situations by triggering a global visibility update. Here is the proper fix.

Additionally, this patch will improve the performance with respect to the SVN version, by disabling some unwanted visibility dirtying.

by Itms, 8 years ago

Attachment: dirty-vis-mask.patch added

by elexis, 7 years ago

Attachment: invisible_foundation.jpg added

by elexis, 7 years ago

Attachment: 2016-11-06_0051.7z added

Alpha 21 replay with Uran238cz's invisible foundation at 53:50 after allying him

comment:5 by elexis, 7 years ago

http://trac.wildfiregames.com/raw-attachment/ticket/4266/invisible_foundation.jpg

As I couldn't reproduce the bug easily, I don't know whether the bug is solved by the patch.

comment:6 by elexis, 7 years ago

Milestone: Alpha 22Work In Progress

Moving to the new WIP milestone.

comment:7 by Itms, 7 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 18994:

Fix the update of shared dirty visibility masks when changing diplomacy.
The previous code worked in case new mutual allies were added, but, when some were removed, it was suboptimal in terms of performance and it made some units visible in the FoW.

Fixes #4266

comment:8 by Itms, 7 years ago

Keywords: rfc removed
Milestone: Work In ProgressAlpha 22

I don't think the bug you described here can be explained by the code I fixed here. If you manage to reproduce it, or if you stumble upon it again, create a new ticket :)

by elexis, 7 years ago

Attachment: screenshot_uran.jpg added

Uran238cz's city how it actually looked after mutual alliance of Uran238cz and me.

by elexis, 7 years ago

Attachment: screenshot_elexis.jpg added

Uran238cz's city as seen from my perspective, immediately after establishing mutual alliance.

by elexis, 7 years ago

Attachment: screenshot_diff.jpg added

After reestablishing the mutual alliance, I don't see a number of Uran238cz's buildings (fortress foundation, finished barracks and tower), some trees still appear while they had been gathered out of existance and none of the sheep corpses are seen. Not sure whether the 2 units at the top of the screen disappeared or just moved somewhere else in that 1 second.

comment:9 by elexis, 7 years ago

http://trac.wildfiregames.com/raw-attachment/ticket/4266/screenshot_diff.jpg

Expected state: http://trac.wildfiregames.com/raw-attachment/ticket/4266/screenshot_uran.jpg

Seen state: http://trac.wildfiregames.com/raw-attachment/ticket/4266/screenshot_elexis.jpg

In that a21 replay, I (player 7) established a mutual alliance with siole (player 1) and Uran238cz (player 2) in the first 10 seconds of the game. siole and Uran never became allies. The shared ally vision was researched in the following 10-11 minutes.

On turn 5594 (46m 37s), Uran declares war on me. On turn 5891 (49m 05s), Uran places the 3 affected barracks, tower (turn 6252) and gathers the affected trees. My ally siole didn't explore those affected entities.

On turn 6413 (53m 25s), I ally Uran. On turn 6416 (53m 28s), Uran places the fortress foundation. On turn 6424 (53m 32s), Uran allies me.

I see the building preview rising, but the foundation is invisible. Until at least min 60 those affected entities stay invisible.

Last edited 7 years ago by elexis (previous) (diff)

by elexis, 7 years ago

Attachment: commands_a21_mini.txt added

Minimalistic alpha 21 replay showing the invisible buildings bug.

by elexis, 7 years ago

Attachment: commands_a22_mini.txt added

Same replay adapted for a22 (only market entiy id changed). Breaks with r18993 but not r18994, so it appears to be fixed.

comment:10 by Itms, 7 years ago

Ok then, that's a relief - Thanks for investigating!

Note: See TracTickets for help on using tickets.