Added random factor to building production delay
Early game AI usually follows the same build order (power plant first, then refinery), which also means they all start producing them at the same tick. This adds a random factor to the production delay, so not all AIs produce on the same tick.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user