Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#1334 closed enhancement (fixed)

[PATCH] Make allies visible on map and minimap

Reported by: rdxi Owned by: Deiz
Priority: Should Have Milestone: Alpha 11
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by Kieran P)

Each player still maintains their own LoS calculations. But when the game renders the LoS onscreen, combine Ally LoS (that is, LoS of all players on the same team) at render time to give one big LoS for same team members.

Eventually LoS techs will be implemented. So keep that in mind when implementing this (make sure any LoS tech would only affect the current players LoS - it shouldn't expand the LoS of allies).

Attachments (3)

shared-los.patch (9.2 KB ) - added by Deiz 12 years ago.
shared-los-2.patch (7.3 KB ) - added by Deiz 12 years ago.
shared-los-3.patch (7.9 KB ) - added by Deiz 12 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by historic_bruno, 12 years ago

This will probably be added as part of #7.

comment:2 by Kieran P, 12 years ago

Milestone: BacklogAlpha 10

As a temp thing though, Philip believes it would be easy to render an allys line of sight along with yours. Ally == same team until diplomacy is properly implemented. Might throw this into Alpha 10 and see if there is time.

comment:3 by Kieran P, 12 years ago

Milestone: Alpha 10Alpha 11

comment:4 by Kieran P, 12 years ago

Description: modified (diff)
Priority: Nice to HaveShould Have

comment:5 by Deiz, 12 years ago

Keywords: patch review added
Owner: set to Deiz
Status: newassigned
Summary: Make allies visible on map and minimap[PATCH] Make allies visible on map and minimap

I've done a (to my eyes) relatively clean implementation. Rather that modify all the LoS-checking call sites, I opted to make the low-level GetLosVisibility function smarter. It can now accept a mask (calculated at the call-site), or retrieves a mask that matches a player and all of its allies (generated and cached once per frame), such that visibility by any one of them can be checked for in one operation.

Rather importantly, GetLosRevealAll is deliberately checked only for the 'main' player in a query, such that the AI's cheating doesn't let human players see the whole map.

Making GetLosVisibility "smart" seems safe enough to me, because everything it does is read-only, and GetPercentMapExplored doesn't use that function, so the summary screen is unaffected by shared LoS.

by Deiz, 12 years ago

Attachment: shared-los.patch added

comment:6 by Kieran P, 12 years ago

Hey Deiz. Thanks for your work. Someone will review it soon hopefully. Meanwhile, two quick questions:

  • We eventually want to be able to have ingame diplomacy. When that happens, does your code support LoS returning to only what the player has scouted themselves, and not being stuck with allies LoS, when the allies/teams are dissolved?
  • Does this make any more rendering passes, or does it combined LoS data before rendering? We want to keep this as fast as possible.

comment:7 by Deiz, 12 years ago

Since r11935 made cmpPlayer.diplomacy sane, I've removed my redundant ally status code from the GUI (which apparently would have caused out-of-sync errors in multiplayer).

by Deiz, 12 years ago

Attachment: shared-los-2.patch added

comment:8 by Deiz, 12 years ago

Here's attempt #3. Per suggestions from Philip and historicbruno, I've avoided caching every frame, and instead extended cmpRangeManager so that the LoS masks are updated (from Javascript) whenever diplomacy changes.

LoS masks are now stored in cmpRangeManager as well.

by Deiz, 12 years ago

Attachment: shared-los-3.patch added

comment:9 by ben, 12 years ago

Resolution: fixed
Status: assignedclosed

In 11949:

Adds shared LOS for allied players, based on patch by Deiz/F00. Fixes #1334.

comment:10 by ben, 12 years ago

In 11957:

Fixes bug in percentage map explored calculation. Refs #1334

comment:11 by sanderd17, 8 years ago

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