diff --git a/OpenRA.Mods.Common/AI/BaseBuilder.cs b/OpenRA.Mods.Common/AI/BaseBuilder.cs index b74eddc1cb..7b3d7e63bf 100644 --- a/OpenRA.Mods.Common/AI/BaseBuilder.cs +++ b/OpenRA.Mods.Common/AI/BaseBuilder.cs @@ -101,7 +101,11 @@ namespace OpenRA.Mods.Common.AI if (TickQueue(queue)) active = true; - waitTicks = active ? ai.Info.StructureProductionActiveDelay : ai.Info.StructureProductionInactiveDelay; + // Add a random factor so not every AI produces at the same tick early in the game. + // Minimum should not be negative as delays in HackyAI could be zero. + var randomFactor = world.SharedRandom.Next(0, ai.Info.StructureProductionRandomBonusDelay); + waitTicks = active ? ai.Info.StructureProductionActiveDelay + randomFactor + : ai.Info.StructureProductionInactiveDelay + randomFactor; } bool TickQueue(ProductionQueue queue) diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 191db5831c..af5647f5ad 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -55,12 +55,15 @@ namespace OpenRA.Mods.Common.AI [Desc("Minimum excess power the AI should try to maintain.")] public readonly int MinimumExcessPower = 0; - [Desc("How long to wait (in ticks) between structure production checks when there is no active production.")] + [Desc("Minimum delay (in ticks) between structure production checks when there is no active production.")] public readonly int StructureProductionInactiveDelay = 125; - [Desc("How long to wait (in ticks) between structure production checks ticks when actively building things.")] + [Desc("Minimum delay (in ticks) between structure production checks when actively building things.")] public readonly int StructureProductionActiveDelay = 10; + [Desc("A random delay (in ticks) of up to this is added to production delays.")] + public readonly int StructureProductionRandomBonusDelay = 10; + [Desc("How long to wait (in ticks) until retrying to build structure after the last 3 consecutive attempts failed.")] public readonly int StructureProductionResumeDelay = 1500;