Opened 13 years ago

Closed 12 years ago

Last modified 9 years ago

#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: Patch:

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 (2)

territory_fow_building-09122011.patch (7.5 KB ) - added by historic_bruno 13 years ago.
territory_fow_building-11222011.patch (6.3 KB ) - added by historic_bruno 12 years ago.

Download all attachments as: .zip

Change History (12)

by historic_bruno, 13 years ago

comment:1 by historic_bruno, 13 years ago

Keywords: review added
Summary: Allow building in fog of war, within player's territory[PATCH] Allow building in fog of war, within player's territory

in reply to:  description comment:2 by historic_bruno, 13 years ago

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:3 by Kieran P, 12 years ago

Priority: Should HaveMust Have

comment:4 by Philip Taylor, 12 years ago

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)?

by historic_bruno, 12 years ago

in reply to:  4 comment:5 by historic_bruno, 12 years ago

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 by historic_bruno, 12 years ago

I meant to say "check if the entity is on a visible tile".

comment:7 by historic_bruno, 12 years ago

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)

comment:8 by ben, 12 years ago

Resolution: fixed
Status: newclosed

(In [10584]) Allows building in fog of war. Fixes #958.

comment:9 by historic_bruno, 12 years ago

Keywords: review removed

comment:10 by Itms, 9 years ago

In 16248:

Move back the computation of most of the visibilities from JS to engine, to improve performance.

Also fix the remaining TODO left by #958, as a use case of the scripted Visibility component.

Refs #2913, #958.

Note: See TracTickets for help on using tickets.