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