Ticket #958 (closed enhancement: fixed)

Opened 21 months ago

Last modified 18 months ago

[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

territory_fow_building-09122011.patch (7.5 KB) - added by historic_bruno 21 months ago.
territory_fow_building-11222011.patch (6.3 KB) - added by historic_bruno 18 months ago.

Change History

Changed 21 months ago by historic_bruno

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:3 Changed 18 months ago by k776

  • Priority changed from Should Have to Must Have

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

Changed 18 months ago by historic_bruno

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)

comment:8 Changed 18 months ago by ben

  • Status changed from new to closed
  • Resolution set to fixed

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

comment:9 Changed 18 months ago by historic_bruno

  • Keywords review removed
Note: See TracTickets for help on using tickets.