AI MapHack! - Page 2

AI MapHack!

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

User avatar
Veylon
AI Developer
Posts: 174
Joined: 21 Sep 2005, 19:45

Post by Veylon »

Sure, it's literal, and sometimes metal is wasted when a new energy storage is built (energy takes a while to climb to 50%, so no units get built). I do need to fix the factory algorithm.

I suppose the "don't build what can't be afforded" sounded like stockpile, but income/expenditure is checked by using the following logic in pseudocode:

Code: Select all

TimeToBuild = BuildTime / BuilderTime;
EnergyPerSecond = EnergyCost / TimeToBuild;
IF EnergyPerSecond > (EnergyIncome - EnergyExpense) - EnergyStockpile / BuildTime 
    TooExpensive
ELSE
    NotTooExpensive
And the same is checked for the metal.
Yes, I know that it assumes the whole stockpile is available for the project, but it usually works out OK anyway.
Post Reply

Return to “AI”