PC [BUG] Local death animations not propagating for monsters

kdau

Tiller
Based on lack of sounds and temporary sprites, Monster.localDeathAnimation does not appear to be called for any player other than the one who slays a monster. This was detected in a modding context, but we reconfirmed it against the base game on both Linux and Windows.

Example steps to reproduce: With two players in multiplayer, travel to a mine level with a Ghost. Mute the audio for one player and have that player slay the Ghost. The other player's audio will not have the Ghost's death sound, nor will the extra temporary sprites be rendered for that player.
 

kdau

Tiller
From creating a workaround for my mod's purposes, I think the problematic ordering is:
  1. The slaying player updates Health and fires deathAnimEvent in Monster.takeDamage.
  2. An update cycle occurs for the slaying player, in which GameLocation.updateCharacters detects the (sub)zero Health and removes the monster from the characters list.
  3. Changes propagates to Monster.Health, Monster.deathAnimEvent's internal counter and GameLocation.characters simultaneously.
  4. Since the monster is no longer listed for any location, it does not Monster.update again for other players, so the event is never Polled for them.
Edit: Reworked the list based on what I realized from further testing.
 
Last edited:

kdau

Tiller
Further discovery: The health change isn't actually propagating at all, presumably because the removal from the character list propagates first and prevents the monster's portion of the NetFields tree from being handled. So non-slayer players wind up with a still-healthy monster that will never be updated or drawn again. Not sure if it is GCed, since in my mod context I'm holding an extra reference to it.
 
Top