Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#2529 closed defect (fixed)

[PATCH] Having more than one observer crashes

Reported by: Josh Owned by: Josh
Priority: Should Have Milestone: Alpha 17
Component: UI & Simulation Keywords: patch
Cc: scythetwirler Patch:

Description

Having more than one observer in a multiplayer game can frequently crash due to incorrect initial assignment of any observer in CNetServerWorker::AddPlayer (source:ps/trunk/source/network/NetServer.cpp#L609).

Possible solutions are initially assigning all joining players the ID -1 in the network code and allowing gamesetup to correct as needed. Or the network code could try to determine if a player should be an observer or not.

Attachments (1)

fix-multiobserver.diff (4.0 KB ) - added by Josh 10 years ago.
Fix crash by assigning new player IDs in gamesetup.

Download all attachments as: .zip

Change History (9)

comment:1 by Stan, 10 years ago

maybe an enum with player types

enum {
TYPE_PLAYER;
TYPE_OBSERVER;
TYPE_AI;
TYPE_RECORDER; // This one would be nice if we want to have replays of all the games. (Could be usefull to solves fights, and to make promotionnal stuff with the best games.
}
Last edited 10 years ago by Stan (previous) (diff)

comment:2 by Josh, 10 years ago

Keywords: review patch added
Summary: Having more than one observer crashes[PATCH] Having more than one observer crashes

I've attached a patch following my first idea for a solution (assign the player ID in gamesetup) which seems to work in limited local testing.

Last edited 10 years ago by Josh (previous) (diff)

by Josh, 10 years ago

Attachment: fix-multiobserver.diff added

Fix crash by assigning new player IDs in gamesetup.

comment:3 by historic_bruno, 10 years ago

Milestone: Alpha 16Alpha 17

comment:4 by Josh, 10 years ago

Leper reviewed the patch and I've responded to his suggestions. I'll commit this tomorrow if there are no objections.

comment:5 by JoshuaJB, 10 years ago

Resolution: fixed
Status: newclosed

In 15171:

Fix multiple observers on multiplayer games to work more reliably. Fixes #2529

comment:6 by sanderd17, 8 years ago

Keywords: review removed

comment:7 by Imarok, 7 years ago

In 19215:

Reset ready state when non-observers join in gamesetup

Reviewed by: elexis

Differential Revision: https://code.wildfiregames.com/D50
Fixes #4452. Refs #2529. Refs rP15171, rP17443, rP18299.

comment:8 by elexis, 7 years ago

r15171 had two bugs: (1) It assumed that there all N clients are assigned to the first N slots, fixed in #3607 (2) It didn't reset the ready state (only coincidentally when replacing an AI, not when replacing an unassigned slot), fixed by r19215

Note: See TracTickets for help on using tickets.