Prototype icon indicating copy to clipboard operation
Prototype copied to clipboard

Fog of war when know tiles are no longer visible [Part 1]

Open QuintillusCFC opened this issue 3 years ago • 1 comments

Builds on #101 . If you no longer have a unit near a tile, it should have fog of war.

For part 1 of this, I suggest counting only tiles next to/within the 3x3 city boundaries, or adjacent to a unit, as visible. We can add improvements based on terrain type and expanding borders later; this is likely to be a sizeable enough improvement with the smaller scope.

TBD whether Babylon or Carthage.

QuintillusCFC avatar Feb 14 '22 19:02 QuintillusCFC

As alluded to in my comment in that task, tile visibility is stored in the Civ3 SAV file as a 32-bit bitmap. I called it "isVisible", and Lucien is calling it "ExploredBy". The following bitmap I called "isVisibleNow" and Lucien named "VisibleTo" and I believe is the state you mention here.

https://github.com/C7-Game/Prototype/blob/c78b9804df659b774d310f53b3bced15753a4a2d/QueryCiv3/SavSections/Tile.cs#L47

I'm not sure we need to store "isVisibleNow" in a C7 native sav file, since it's recalculated every unit move and border change, but I guess there should definitely be a getter or something to indicate if the tile should be fully lit instead of dimly lit as indicated by "ExploredBy" (or whatever its new implementation is, which is probably a getter, too).

Incidentally, there is some additional functionality as indicated by the save file. Each tile in the native Civ3 SAV has a per-civ bitmap of tile improvements in addition to the real current state. So an explored tile that is no longer directly visible has its improvements changed, the viewing civ in question only sees their last active view of the improvements.

Interestingly this does not apply to forests and marshes as there is no memory for them, so you always see the current base and overlay terrain state. I think resources are live-view only if they disappear or reappear, but I don't think I've ever tried to test that out to be sure.

JimOfLeisure avatar Feb 14 '22 21:02 JimOfLeisure

Implemented in #620

esbudylin avatar Apr 05 '25 09:04 esbudylin