MegaMek / megamek

MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight using giant robots, tanks, and/or infantry on a hex-based map.
http://www.megamek.org
GNU General Public License v2.0
299 stars 291 forks source link

Megamek via MekHQ - 0.50.0 Snapshot CI1597 Nightly: Double blind with 'fade out unseen units' option can create duplicates on the board. #5951

Closed UlyssesSockdrawer closed 2 months ago

UlyssesSockdrawer commented 3 months ago

Environment

Version: MekHQ-0.50.0-SNAPSHOT - CI1597 Nightly - Megamek launched via MekHQ OS: Win11 Java: 17

Description

image

This is the first time I've seen this bug.

When deploying double-blind units, having lost deployment initiative, I placed down my forces. The Griffin with the "Spike" callsign was placed visible to Princess.

This created two versions on the board - an unclickable 'faded out' version of the Griffin, and a 'live' actual version that is interactable.

The faded out "SPIKE" mek cannot be interacted with at all but remains on the board.

Files

Megamek game save: DoubleBlindIssue.sav.gz

MekHQ campaign save pre-battle to set it off from the start: The Nova Dragoons30000630.cpnx.gz

UlyssesSockdrawer commented 3 months ago

image To add to this one - the ghost unit definitely isn't 'there' in gameplay terms, as it can be moved through, so this seems to be a visual bug?

HoneySkull commented 3 months ago

@UlyssesSockdrawer : I wasn't able to reproduce this with the save included. I'm curious however, if you can get this to happen again... do the ghosts go away when you zoom in/out or hit escape?

Also, are you able to reproduce this with nightly CI#1600 or later?

UlyssesSockdrawer commented 3 months ago

I've not had it reproduce - but I can't load my campaign on nightly 1598 due to the unplanned disassembly of forces bug (the one from last night I think?).

The unit ghost didn't disappear when zooming in, out, or navigating around the map. However when I reload the in-battle save that had the issue, the ghost isn't there either.

I've never seen it happen before in 5 years of double-blind play - it's a strange one. It hadn't happened on any prior scenarios either.

UlyssesSockdrawer commented 3 months ago

@HoneySkull - I have been able to reproduce this on the 0.50.0 release.

It takes a very specific set of circumstances:

At that point, the duplicate 'ghost' mek seems to be created.

image

Here's two duplicates I created in one game this evening.

HoneySkull commented 3 months ago

This detail helps. Thank you!

HoneySkull commented 3 months ago

@UlyssesSockdrawer - I'm still coming up short trying to replicate this - do these ghost mech get created during the deployment, movement phase, or other? Or do they get created while playing the game on a later round etc?

UlyssesSockdrawer commented 3 months ago

Hmm - that's strange, as I can replicate it almost every battle.

They get created during the Deployment phase. I've attached my Megamek rules preset in a zip below to see if that helps with replication. Maybe there's something in there I have turned on that's triggering it?

Ulysses-NoEjectedPilots.zip

HoneySkull commented 2 months ago

Are you using a custom skin or something other than the default skin?

HoneySkull commented 2 months ago

@UlyssesSockdrawer - when you see this happen next, can you check something? Can you press Ctrl-B to cycle through the label styles and see if the ghost unit's label updates along with the non-ghost meks? I'm curious if this is a visual artifact, or if it's an internal data issue.

UlyssesSockdrawer commented 2 months ago

image

I'm using the Smoke Jaguar skin.

Next time it happens I'll try the Ctrl-B cycle and see what happens. I did notice in one game that when it flicked through Princess' units quickly during the melee phase, the labels on the ghost units would flicker between purple and blue.

This may only happen with Megamek games launched via MekHQ, as I tried to replicate it just now via stand alone MM and couldn't get it to trigger.

kuronekochomusuke commented 2 months ago

Here are some steps to reproduce it from just megamek for me with latest code

use double blind, without single blind map, 2 sheets high add one unit to your team deploy S add one for princess deploy N deploy your unit then use the next unit button deploy your unit again then on move it creates a ghost unit at deployment location

cycling the ctrl-b changes the name tag for the ghost unit and good one

the right click menu does not register with the ghost unit image

not sure if this is a different case. it seems to be something with the next unit button not clearing something completely.

save then load clears the ghost unit.

kuronekochomusuke commented 2 months ago

image

It looks to be the next unit button deploy use next unit deploy again twist and it has the ghost copy in the same tile

HoneySkull commented 2 months ago

There was an issue with field of fire and tag highlights not updating when tabbing through units (i.e. next button / tab) that was fixed - wondering if this has a similar root cause. Thanks for the detailed steps to reproduce.

HoneySkull commented 2 months ago

I was finally able to recreate this with your help!

  1. Add one unit on your team
  2. Start game
  3. Deploy
  4. click next unit button (or use tab) OR select a different unit from the unit display.

During the movement phase, the stale sprite will remain. Don't need a bot or special map setup. Do need double blind though.

[!NOTE] This isn't specific to double-blind; this can occur in any game where "next unit" is used during the deployment phase.

HoneySkull commented 2 months ago

This is where the ghost sprite was introduced - now how to fix it?!

9060f4617f4d26f5c9324d26ee49de7e86c1bb9c

UlyssesSockdrawer commented 2 months ago

Wild! Apologies for my steps to reproduce not catching - I thought I'd caught what I was doing.

HoneySkull commented 2 months ago

This is what's going on:

sequenceDiagram
    actor player
    player ->> DeploymentDisplay: actionPerformed "Next Unit"
    DeploymentDisplay ->> Entity: setPosition(null)
    DeploymentDisplay ->> +BoardView: redrawEntity()
    opt Entity position is null
        BoardView ->> +EntitySprites: remove EntitySprite
        note over BoardView, EntitySprites: Current sprite is no longer in <br/> EntitySprites collection

    end
    BoardView ->> BoardView: removeSprites(EntitySprites)
    note over BoardView: when position was null, removeSprites <br/> does nothing and sprite is orphaned.
    BoardView -->> -DeploymentDisplay: return
Sleet01 commented 2 months ago

@HoneySkull Wow!

A) I haven't seen one of these call diagrams since school, B) that is amazing, what tool are you using to produce this? C) Nice find!

HoneySkull commented 2 months ago

I used the github inline mermaid markdown.

https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams