ZEN icon indicating copy to clipboard operation
ZEN copied to clipboard

Feature: area marker visibility by player side

Open Fusselwurm opened this issue 4 years ago • 10 comments

Add a new feature to the area marker configuration.

By default, new area markers will be visible to all players as before:

20200327122830_1

But markers can be made invisible to some or all sides, like here - marker is only visible to blufor and civilian players:

20200327122305_1

Test cases:

  • [x] visibility by side
    • Zeus Z creates marker
    • non-Zeus player A can see the marker
    • Z disables visibility for side A belongs to by clicking the side icon (in marker configuration dialog)
    • marker should disappear for A
    • Z can fiddle with other parameters of that markers without it re-appearing for A
    • Z can make the marker for A visible again by clicking their side icon (in marker configuration dialog)
  • [x] more than one Zeus
    • Zeus Z creates marker and disables visbility
    • Zeus Y should continue to see the marker

Fusselwurm avatar Mar 27 '20 11:03 Fusselwurm

I have a weird issue. The way I implemented this is by exchanging setMarkerAlpha (run by Zeus) with setMarkerAlphaLocal (run by all clients via cba global event) to hide the marker on certain clients

Works well, except for one thing:

  • given a marker that is visible to Zeus, and invisible to another client
  • when Zeus doubleclicks the marker (to open the configuration)
  • on the other client, the marker's alpha value mysteriously changes from 0 to either 1 (or to whatever the Zeus sees, not sure yet) ⚡️

From what I can see logging and looking into the profiler, neither the applyProperties nor the updateAlpha method are called, so... looks like our code is not to blame.

My suspicion: engine somehow re-broadcasts global marker when I touch it.

Tentative conclusion: having a global marker and then running *Local commands on it invites trouble. edit: ah, there is even a warning in the biki

Will refactor to exclusively use local marker, see if that works better 😬

Fusselwurm avatar Mar 29 '20 13:03 Fusselwurm

The updateAlpha event is currently only added on the server.

mharis001 avatar Mar 29 '20 18:03 mharis001

The updateAlpha event is currently only added on the server.

ah right, had forgotten to push the fix to that. 😓 the locality problem I described existed regardless.

I just refactored the whole thing to use local markers only, and tested with a buddy and it seems to work. 👍

things I still have to test :

  • [x] with more than one zeus
  • [x] dragging markers

Fusselwurm avatar Mar 29 '20 20:03 Fusselwurm

It happens because onMouseButtonUp is called when the icon is double clicked, which calls setMarkerPos and it seems that any global marker commands will re-synchronize all marker properties.

mharis001 avatar Mar 29 '20 21:03 mharis001

aaah. right. ok. - so are you okay with the "let's be safe and do local markers only" solution, or should I keep global markers and try and change the setMarkerPos to setMarkerPosLocal ? @mharis001

Fusselwurm avatar Mar 30 '20 15:03 Fusselwurm

I think the simpler solution is probably better - if the global setMarkerPos is the only issue then that can be changed. However, if there are other problems, local markers would make sense then.

mharis001 avatar Mar 30 '20 22:03 mharis001

Area marker documentation/images should be updated too.

@mharis001 Should it be handled by this PR or not?

CreepPork avatar Apr 08 '20 14:04 CreepPork

Either works, we can do it later in another PR if that is easier.

mharis001 avatar Apr 08 '20 20:04 mharis001

This should be changed to use #362's common sides control for the UI handling. Currently, the icons are white when hovered and change side instantly when clicked.

mharis001 avatar Apr 25 '20 03:04 mharis001

Some things that need to be taken care of for this:

  • playerSide does not change if the player joins a group of a different side.
  • verify that it works as expected for JIP players.
  • consider showing all markers to curators when they are in the Zeus interface only, not always.
  • fix configure display positioning.

mharis001 avatar Jul 17 '20 04:07 mharis001