.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Space Empires: IV & V (http://forum.shrapnelgames.com/forumdisplay.php?f=20)
-   -   AI Construction Vehicles (http://forum.shrapnelgames.com/showthread.php?t=27154)

Fyron December 28th, 2005 04:13 PM

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?

<font class="small">Code:</font><hr /><pre>
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; # &lt;= 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 &lt; (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 &lt; Entry # Must Have At Least)
{
construct Entry # Type;
}
}
}
}
</pre><hr />

geoschmo December 28th, 2005 04:39 PM

Re: AI Construction Vehicles
 
You probably need some sort of check in the loop for resources being spent and a break if it exceeds a certain threshold. I don't believe the AI will keep putting items in the queue if it doesn't have the available resources to spend.

Fyron December 28th, 2005 05:05 PM

Re: AI Construction Vehicles
 
Well yeah, but I don't care about that at the moment, just trying to understand how this file works. And besides, that would make the code very, very messy. Assume they have infinite resources available for the time being. http://forum.shrapnelgames.com/images/smilies/happy.gif


All times are GMT -4. The time now is 02:16 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.