From 76644537e28251db78b30546afa317caf81276e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 16 Jan 2013 22:26:43 +0100 Subject: [PATCH 1/4] give the users some hints when crashing due to desync --- OpenRA.Game/Network/OrderManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index 8d16467ad1..c0b2cee81f 100755 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -140,17 +140,17 @@ namespace OpenRA.Network if (index >= orders.Count()) OutOfSync(frame); - throw new InvalidOperationException("Out of sync in frame {0}.\n {1}".F(frame, orders.ElementAt(index).Order.ToString())); + throw new InvalidOperationException("Out of sync in frame {0}.\n {1}\n Compare syncreport.log with other players.".F(frame, orders.ElementAt(index).Order.ToString())); } void OutOfSync(int frame) { - throw new InvalidOperationException("Out of sync in frame {0}.\n".F(frame)); + throw new InvalidOperationException("Out of sync in frame {0}.\n Compare syncreport.log with other players.".F(frame)); } void OutOfSync(int frame, string blame) { - throw new InvalidOperationException("Out of sync in frame {0}: Blame {1}.\n".F(frame, blame)); + throw new InvalidOperationException("Out of sync in frame {0}: Blame {1}.\n Compare syncreport.log with other players.".F(frame, blame)); } public bool IsReadyForNextFrame From ef36c446bd272524230abdc1d5e0a905f7ff7eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 3 Mar 2013 19:33:41 +0100 Subject: [PATCH 2/4] log projectile dest as it is affected by inaccuracy calc want to debug if this is the source of problems --- OpenRA.Mods.RA/Effects/Bullet.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index 19a1b87a26..17e06d132f 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -59,6 +59,7 @@ namespace OpenRA.Mods.RA.Effects { var factor = ((Args.dest - Args.src).Length / Game.CellSize) / (float)args.weapon.Range; Args.dest += (PVecInt) (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2(); + Log.Write("debug", "Bullet with Inaccuracy; factor: #{0}; Projectile dest: {1}", factor, Args.dest); } if (Info.Image != null) From 29e917ae88e2b426cb276ba51eec198c80c2c7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 3 Mar 2013 23:11:03 +0100 Subject: [PATCH 3/4] division through cell size to coarse cell coordinate vector --- OpenRA.Mods.RA/Effects/Bullet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index 17e06d132f..3677b07aef 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Effects if (info.Inaccuracy > 0) { - var factor = ((Args.dest - Args.src).Length / Game.CellSize) / (float)args.weapon.Range; + var factor = ((Args.dest - Args.src).ToCVec().Length) / args.weapon.Range; Args.dest += (PVecInt) (info.Inaccuracy * factor * args.firedBy.World.SharedRandom.Gauss2D(2)).ToInt2(); Log.Write("debug", "Bullet with Inaccuracy; factor: #{0}; Projectile dest: {1}", factor, Args.dest); } From a02fddd1a09dfea50ca03cbb65f4ed4785a2a55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Mon, 4 Mar 2013 10:25:20 +0100 Subject: [PATCH 4/4] log the nextScanTime for ChooseTarget in AutoTarget for debugging purposes to investigate desyncs --- OpenRA.Mods.RA/AutoTarget.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenRA.Mods.RA/AutoTarget.cs b/OpenRA.Mods.RA/AutoTarget.cs index 7a3f5d936a..e58c31d915 100644 --- a/OpenRA.Mods.RA/AutoTarget.cs +++ b/OpenRA.Mods.RA/AutoTarget.cs @@ -108,6 +108,7 @@ namespace OpenRA.Mods.RA var info = self.Info.Traits.Get(); nextScanTime = (int)(25 * (info.ScanTimeAverage + (self.World.SharedRandom.NextFloat() * 2 - 1) * info.ScanTimeSpread)); + Log.Write("debug", "Actor {0}; nextScanTime: {1}", self.ActorID, nextScanTime); var inRange = self.World.FindUnitsInCircle(self.CenterLocation, (int)(Game.CellSize * range));