Add setting to check BotModule sync.
This commit is contained in:
@@ -96,6 +96,7 @@ namespace OpenRA
|
||||
public float LongTickThresholdMs = 1;
|
||||
|
||||
public bool SyncCheckUnsyncedCode = false;
|
||||
public bool SyncCheckBotModuleCode = false;
|
||||
public int Samples = 25;
|
||||
|
||||
public bool StrictActivityChecking = false;
|
||||
|
||||
@@ -358,13 +358,15 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
AssignRolesToIdleUnits(self);
|
||||
|
||||
// TODO: Add an option to include this in CheckSyncUnchanged.
|
||||
// Checking sync for this is too expensive to include it by default,
|
||||
// so it should be implemented as separate sub-option checkbox.
|
||||
using (new PerfSample("bot_tick"))
|
||||
foreach (var t in tickModules)
|
||||
if (t.IsTraitEnabled())
|
||||
t.BotTick(this);
|
||||
{
|
||||
Sync.RunUnsynced(Game.Settings.Debug.SyncCheckBotModuleCode, World, () =>
|
||||
{
|
||||
foreach (var t in tickModules)
|
||||
if (t.IsTraitEnabled())
|
||||
t.BotTick(this);
|
||||
});
|
||||
}
|
||||
|
||||
var ordersToIssueThisTick = Math.Min((orders.Count + Info.MinOrderQuotientPerTick - 1) / Info.MinOrderQuotientPerTick, orders.Count);
|
||||
for (var i = 0; i < ordersToIssueThisTick; i++)
|
||||
@@ -543,11 +545,14 @@ namespace OpenRA.Mods.Common.AI
|
||||
if (mcv == null)
|
||||
return;
|
||||
|
||||
foreach (var n in positionsUpdatedModules)
|
||||
Sync.RunUnsynced(Game.Settings.Debug.SyncCheckBotModuleCode, World, () =>
|
||||
{
|
||||
n.UpdatedBaseCenter(mcv.Location);
|
||||
n.UpdatedDefenseCenter(mcv.Location);
|
||||
}
|
||||
foreach (var n in positionsUpdatedModules)
|
||||
{
|
||||
n.UpdatedBaseCenter(mcv.Location);
|
||||
n.UpdatedDefenseCenter(mcv.Location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void IBotPositionsUpdated.UpdatedBaseCenter(CPos newLocation)
|
||||
@@ -650,9 +655,14 @@ namespace OpenRA.Mods.Common.AI
|
||||
// Checking sync for this is too expensive to include it by default,
|
||||
// so it should be implemented as separate sub-option checkbox.
|
||||
using (new PerfSample("bot_attack_response"))
|
||||
foreach (var t in attackResponseModules)
|
||||
if (t.IsTraitEnabled())
|
||||
t.RespondToAttack(this, self, e);
|
||||
{
|
||||
Sync.RunUnsynced(Game.Settings.Debug.SyncCheckBotModuleCode, World, () =>
|
||||
{
|
||||
foreach (var t in attackResponseModules)
|
||||
if (t.IsTraitEnabled())
|
||||
t.RespondToAttack(this, self, e);
|
||||
});
|
||||
}
|
||||
|
||||
if (e.Attacker == null || e.Attacker.Disposed)
|
||||
return;
|
||||
|
||||
@@ -484,6 +484,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
BindCheckboxPref(panel, "PERFTEXT_CHECKBOX", ds, "PerfText");
|
||||
BindCheckboxPref(panel, "PERFGRAPH_CHECKBOX", ds, "PerfGraph");
|
||||
BindCheckboxPref(panel, "CHECKUNSYNCED_CHECKBOX", ds, "SyncCheckUnsyncedCode");
|
||||
BindCheckboxPref(panel, "CHECKBOTSYNC_CHECKBOX", ds, "SyncCheckBotModuleCode");
|
||||
BindCheckboxPref(panel, "BOTDEBUG_CHECKBOX", ds, "BotDebug");
|
||||
BindCheckboxPref(panel, "FETCH_NEWS_CHECKBOX", gs, "FetchNews");
|
||||
BindCheckboxPref(panel, "LUADEBUG_CHECKBOX", ds, "LuaDebug");
|
||||
@@ -510,6 +511,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
ds.PerfText = dds.PerfText;
|
||||
ds.PerfGraph = dds.PerfGraph;
|
||||
ds.SyncCheckUnsyncedCode = dds.SyncCheckUnsyncedCode;
|
||||
ds.SyncCheckBotModuleCode = dds.SyncCheckBotModuleCode;
|
||||
ds.BotDebug = dds.BotDebug;
|
||||
ds.LuaDebug = dds.LuaDebug;
|
||||
ds.SendSystemInformation = dds.SendSystemInformation;
|
||||
|
||||
@@ -587,6 +587,13 @@ Container@SETTINGS_PANEL:
|
||||
Height: 20
|
||||
Font: Regular
|
||||
Text: Check Sync around Unsynced Code
|
||||
Checkbox@CHECKBOTSYNC_CHECKBOX:
|
||||
X: 15
|
||||
Y: 280
|
||||
Width: 300
|
||||
Height: 20
|
||||
Font: Regular
|
||||
Text: Check Sync around BotModule Code
|
||||
Checkbox@LUADEBUG_CHECKBOX:
|
||||
X: 310
|
||||
Y: 220
|
||||
|
||||
@@ -598,6 +598,13 @@ Background@SETTINGS_PANEL:
|
||||
Height: 20
|
||||
Font: Regular
|
||||
Text: Check Sync around Unsynced Code
|
||||
Checkbox@CHECKBOTSYNC_CHECKBOX:
|
||||
X: 15
|
||||
Y: 280
|
||||
Width: 300
|
||||
Height: 20
|
||||
Font: Regular
|
||||
Text: Check Sync around BotModule Code
|
||||
Checkbox@LUADEBUG_CHECKBOX:
|
||||
X: 310
|
||||
Y: 220
|
||||
|
||||
Reference in New Issue
Block a user