Ticket #958 (closed enhancement: fixed)
[PATCH] Allow building in fog of war, within player's territory
| Reported by: | historic_bruno | Owned by: | historic_bruno |
|---|---|---|---|
| Priority: | Must Have | Milestone: | Alpha 8 |
| Component: | Core engine | Keywords: | |
| Cc: |
Description
A player's territory will always be explored (either visible or in FoW), so they should be allowed to build anywhere in that territory. CmpRangeManager::GetLosVisibility() can't be used to check FoW because it uses rendering concepts like RetainInFog that would break preview entities. The attached patch adds CmpRangeManager::GetLosState() which checks the internal LOS state and reveal all players flag, returning a value corresponding to explored, unexplored or visible. It also moves the visibility check into BuildRestrictions for consistency.
Attachments
Change History
comment:1 Changed 21 months ago by historic_bruno
- Keywords review added
- Summary changed from Allow building in fog of war, within player's territory to [PATCH] Allow building in fog of war, within player's territory
comment:2 in reply to: ↑ description Changed 19 months ago by historic_bruno
Replying to historic_bruno:
It also moves the visibility check into BuildRestrictions for consistency.
Hmm this would break AIs, since they don't have LOS data, maybe it's best to keep it separate from the other build restrictions.
comment:4 follow-up: ↓ 5 Changed 18 months ago by Philip
CmpRangeManager::GetLosVisibility() can't be used to check FoW because it uses rendering concepts like RetainInFog that would break preview entities.
Preview entities shouldn't use RetainInFog. They ought to be rendered in a special way that ignores the LOS texture entirely, so they don't look invisible if you try building in SoD (because that's confusing - they should be fully-bright with the red shading). Probably should add a flag like IgnoreLOS into VisualActor for that. If we added that flag, is there any need for the new GetLosState (which involves an unhappy amount of code duplication)?
comment:5 in reply to: ↑ 4 Changed 18 months ago by historic_bruno
Replying to Philip:
Preview entities shouldn't use RetainInFog. They ought to be rendered in a special way that ignores the LOS texture entirely, so they don't look invisible if you try building in SoD (because that's confusing - they should be fully-bright with the red shading). Probably should add a flag like IgnoreLOS into VisualActor for that. If we added that flag, is there any need for the new GetLosState (which involves an unhappy amount of code duplication)?
I agree with that suggestion, as a rendering fix, because preview entities should always be visible. A new ticket can be made for rendering preview entities regardless of LOS. However we still need a way to check if the entity is visible (not whether it's rendered as visible). I've updated my patch with a simpler implementation per our discussed yesterday in IRC :)
comment:6 Changed 18 months ago by historic_bruno
I meant to say "check if the entity is on a visible tile".
comment:7 Changed 18 months ago by historic_bruno
Some additional background on RetainInFog from IRC:
22:05 <@Philip`> Eventually RetainInFog will trigger the weird behaviour where you see a kind of ghost of enemy buildings in FoW 22:06 <@Philip`> which isn't what's wanted here 22:06 <@Philip`> I guess the problem is that the rendering and the gameplay are using the same flags for visibility behaviour 22:07 <@Philip`> which is fine in all cases except for placement previews (which are weird anyway since they should ignore the LOS texture when rendering)
