Fix AI queueing build orders twice at higher game speeds due to lag

Fixes #9403.
This commit is contained in:
reaperrr
2015-09-29 22:33:01 +02:00
parent 17ff3864e8
commit 3711ef8eb5
2 changed files with 8 additions and 6 deletions

View File

@@ -117,7 +117,9 @@ namespace OpenRA.Mods.Common.AI
// 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 = ai.Random.Next(0, ai.Info.StructureProductionRandomBonusDelay);
waitTicks = active ? ai.Info.StructureProductionActiveDelay + randomFactor
// Needs to be at least 4 * OrderLatency because otherwise the AI frequently duplicates build orders (i.e. makes the same build decision twice)
waitTicks = active ? 4 * world.LobbyInfo.GlobalSettings.OrderLatency + ai.Info.StructureProductionActiveDelay + randomFactor
: ai.Info.StructureProductionInactiveDelay + randomFactor;
}