View Single Post
  #1  
Old December 28th, 2005, 04:13 PM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default AI Construction Vehicles

Is this a correct (psuedo-c code) algorithm for how the AI evaluates what to build when parsing AI_Construction_Vehicles.txt?

Code:

while(we need to add things to build queues) {
// Case is just saying, go to the state we are currently in.
case (state) {
STATENAME:
// Parse every type in the list for this state.
for (int # = 1; # <= Num Queue Entries; ++#) {
PPI = Entry 1 Planet Per Item;
Num Planets = count up all of our colonies;
Num Ships of Type = number of the ships we own of type Entry # Type;

// Build one item based on the PPI condition per iteration of the
// main loop.
if (PPI < (Num Planets / Num Ships of Type))
{
construct Entry # Type;
}

// Build as many as are needed to satisfy Must Have At Least on every
// iteration of the main loop.
while (Num Ships of Type < Entry # Must Have At Least)
{
construct Entry # Type;
}
}
}
}

__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote