Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2119 closed defect (fixed)

[PATCH] out of sync error when building civic center with shift-key

Reported by: Tom Brewe Owned by: sanderd17
Priority: Must Have Milestone: Alpha 15
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by Tom Brewe)

Hi,
I noticed some strange behavior. I have been playing some multiplayer games in a LAN. All players have the same version. Previously A13, now it happens with Alpha 14.

At some point in the game, we will get an out of sync error. We can continue playing. But some unit movements and actions won't be seen by the other anymore and vice versa: e.g. ship movements might still be identical, but the other side does not see the units that were unloaded from the ship.Besides unit movements also build actions will become increasingly out of sync. But surprisingly the last time, ship movements didnt get that much out of sync.

The last two times I noticed this happening when I (accidentally) pressed Shift-key while clicking the mouse button to place a new civic center. In exactly this moment (in both games I observed it), the error-message of being out of snyc appeared. So i guess it was not a coincidence.

I attach all the logs, that might be of interest.

Systems: OS X 10.7.5, arch/gentoo (dunno which kernel).

Attachments (5)

commands.txt.zip (374.2 KB ) - added by Tom Brewe 11 years ago.
oos_dump.txt.zip (284.0 KB ) - added by Tom Brewe 11 years ago.
system_info.txt (3.7 KB ) - added by Tom Brewe 11 years ago.
mainlog.html (14.7 KB ) - added by Tom Brewe 11 years ago.
no_local_entities.diff (687 bytes ) - added by sanderd17 11 years ago.

Download all attachments as: .zip

Change History (16)

by Tom Brewe, 11 years ago

Attachment: commands.txt.zip added

by Tom Brewe, 11 years ago

Attachment: oos_dump.txt.zip added

by Tom Brewe, 11 years ago

Attachment: system_info.txt added

by Tom Brewe, 11 years ago

Attachment: mainlog.html added

comment:1 by Tom Brewe, 11 years ago

Description: modified (diff)

comment:2 by sanderd17, 11 years ago

There are bugs concerning the shift-click with civil centres, that's for sure. When it's used in single player, the building doesn't come through (it's blocked because of the distance check for some reason).

Does it come through for the other player maybe?

in reply to:  2 comment:3 by Tom Brewe, 11 years ago

You are right, the Civic Center did not come through/was not build for me when shift clicking. (might be worth a separate bug report). I can't report on the other player though, as he probably didn't see the area where it was build, and I build one without clicking shift directly afterwards, which was of course succesful.

I'll try to reproduce the bug again, and see if the civic center will be build and seen in the other players view.

Replying to sanderd17:

There are bugs concerning the shift-click with civil centres, that's for sure. When it's used in single player, the building doesn't come through (it's blocked because of the distance check for some reason). Does it come through for the other player maybe?

Last edited 11 years ago by Tom Brewe (previous) (diff)

comment:4 by historic_bruno, 11 years ago

Keywords: sync, multiplayer, network → sync multiplayer network

Hi, we will need the oos_dump.txt for both players to compare them.

Once the game goes OOS, the behavior is unpredictable, because players will still be sending orders, but the game states they're based on will differ. So the orders from one player may be invalid and ignored or only partially valid in the other player's game. For that reason, even though the game continues, it's best not to keep playing after an OOS error.

in reply to:  description comment:5 by historic_bruno, 11 years ago

Replying to nylki:

The last two times I noticed this happening when I (accidentally) pressed Shift-key while clicking the mouse button to place a new civic center. In exactly this moment (in both games I observed it), the error-message of being out of snyc appeared. So i guess it was not a coincidence.

This is reproducible for me, it also causes the serialization test mode to fail in single player.

comment:6 by historic_bruno, 11 years ago

The problem is Engine.GetEntitiesWithInterface includes local entities, which BuildRestrictions doesn't expect. The building preview entity is local and shouldn't affect the synchronized simulation state, but in this case it does, causing the placement to fail locally, and the OOS error.

I think we could safely modify GetEntitiesWithInterface to only return non-local entities (there's a TODO about it), it's only used in BuildRestrictions. In the unlikely event that scripts ever want a list of local entities with a given interface we could add GetLocalEntitiesWithInterface.

by sanderd17, 11 years ago

Attachment: no_local_entities.diff added

comment:7 by sanderd17, 11 years ago

Keywords: patch review added; sync multiplayer network removed
Summary: out of sync error when building civic center with shift-key[PATCH] out of sync error when building civic center with shift-key

Thanks for the hints historicbruno. I fixed the function you mentioned, and it seems to solve the issue.

comment:8 by Tom Brewe, 11 years ago

Good job guys for identifying the problem and fixing the bug. thanks!

in reply to:  7 comment:9 by historic_bruno, 11 years ago

Milestone: BacklogAlpha 15

Replying to sanderd17:

Thanks for the hints historicbruno. I fixed the function you mentioned, and it seems to solve the issue.

I think you should use the ENTITY_IS_LOCAL macro to be consistent with the rest of the engine.

comment:10 by sanderd17, 11 years ago

Owner: set to sanderd17
Resolution: fixed
Status: newclosed

In 13820:

disable querying of local entities with a component. Avoids OOS problems. Patch thanks to historicbruno. Fixes #2119

comment:11 by sanderd17, 11 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.