Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4013 closed defect (fixed)

Defeating players twice

Reported by: elexis Owned by: elexis
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords:
Cc: Patch:

Description

It obviously shouldn't be possible to defeat a player twice or win a game after being defeated and the like.

However due to the fact of defeating players by broadcasting a message PlayerDefeated, there have been several bugs already that caused duplicate defeats like #3193, ticket:2976#comment:6 or #4010. That however didn't result in fixing this in the simulation.

Instead of broadcasting a message when wanting to ensure that a player is defeated, the simulation should just use a function of the Player-component to defeat a player, abort if the player is not active anymore and only then broadcast the message.

Furthermore we send a PlayerDefeated message but not a PlayerWonmessage, which is not only inconsistent but also prevents components from subscribing to this event.

That further messed up the GUI code. For example there are messages for players that were defeated but it doesn't show who won. The checkPlayerState() function which is called onTick while it should only be called when the sim actually broadcasted a PlayerDefeated or PlayerWon message.

Change History (2)

comment:1 by elexis, 8 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 18441:

Win and defeat cleanup, fixes #4013.

Add a new simulation message and chat notification for players who won.
Avoid duplicate playerstate messages in the sim and GUI by triggering changes with a function instead of a message.
Reveal the map on defeat/win exclusively in the player component (instead of having a silly GUI proxy and doing it also in the EndGameManager sometimes).
Remove the skipAlliedVictory argument from the player component, since that shouldn't contain references to the EndGameManager, refs #3970.

Show a proper message box on win/loss and add the hint for hosts disconnecting other players.
Do defeat/win procedure in the GUI when such a message arrives, instead of checking onTick for playerstate changes.
Thus don't show that confirmation again on every rejoin.
Don't show a pointless message box if IsAtlasRunning.

Explain that the session.js variable is needed to avoid an order-of-execution bug.
Select "observer" item when rejoining as a defeated player.
Remove an unneeded call to updateTopPanel.

comment:2 by elexis, 8 years ago

Milestone: BacklogAlpha 21
Note: See TracTickets for help on using tickets.