Build Supply by estimating Consumption Rate
ImpulseCloud opened this issue · 2 comments
The current implementation of building Supply has the following bugs:
- All training/construction orders queued contribute to CalcConsumption (50 marauder orders queued with 1 barracks estimates 100 supply needed and tries to build 12 depots immediately)
- All training/construction orders queued contribute to CalcSupply (10 CommandCenter orders queued estimate we currently have +150 supply available so never builds more supply even if supply-blocked)
A solution is to use a CalcConsumptionRate which estimates supply-training-rate of current production-buildings during the build-time of a new supply depot. E.g.:
// MarineTrainTime = 18*22.4 (roughly) = 403.2 , TrainRate = 1/403
// SupplyDepot = 480 framesToTrain, TrainRate = 1/480
// Marines trained while Depot builds = 480/403 = 1.191
It should be smooth and not build Supply when unneeded and not get supply-blocked for more than a few frames. After, it should not be needed to include Supply in coded ConstructionOrders anymore (except for 1st one to prevent a rare Barracks-Before-Supply if 150 minerals are gathered too quickly before 14th scv).
I left the calculation comments in, so others can see them and tweak them or add others more easily.