On 2/10/06, Bradley Arsenault <[EMAIL PROTECTED]> wrote: > On 2/10/06, Stéphane Magnenat <[EMAIL PROTECTED]> wrote: > > > Yes, i've been thinking about that too, but how? How could i > > > guestimate avaialble resources? Maybe if i kept track of chunks of > > > ressources, but then how do i decide which are mine and which are my > > > enemies? > > > > Here is an idea, it's an approximation and I don't know if it works well in > > practice. If you divide the maps in swaure of, let say 16x16. You consider a > > square "belonging to you" if there is a building in it. You then compute the > > density of food in all the square belonging to you. This is not very > > precise, > > perhaps the algorithm should be more intelligent, by taking into account > > ressources blobs connected to those squares or by taking into account every > > ressource that is up to a certain distance to a building. You can compute a > > mask of position to take into account and update the mask only on building > > creation/destruction. Furthermore, updating this information is not very > > frequent as globally ressources do not disappear in one tick. > > > > Have a nice day, > > > > Steph > > > > > > _______________________________________________ > > glob2-devel mailing list > > [email protected] > > http://lists.nongnu.org/mailman/listinfo/glob2-devel > > > > I actually just came up with not a bad idea. First, pregenerate a list > of all chunks of ressources that are close enough to water to grow, so > naturally ignored wheat that is inland and will dissapear quickly. > Keep this list updated throughout the lifetime of the ai. Then, for > each building, keep track of the nearest ressource that it is using. > For inns and swarms, this would mean the nearest block of wheat, up to > a certain distance. Then, when your deciding whether to "conserve" a > particular section of wheat, you devide how much wheat there is in > total by how many buildings are using it, and if its lower than a > certain threshhold, begin conserving, primarily by sending messages to > the modules cosntrolling those buildings to turn down usage, and by > starting ressource farming on that section. > > The method is slow but accurrate. I'm big on slow algorithms, but > sicne i'm on very fast hardware, its hard for me to determine if > nicowar is going too slow. >
Actually, I just did a profile, and even with 3 Nicowars battling it out, Nicowar never took up more than 11.3 % of total runtime. I'm now quite confused, for a while I have been thinking that it was Nicowar causing the great amount of ressource consumption late in the game, but perhaps I have been wrong. If someone else could also do a verifying profile, it would be nice. _______________________________________________ glob2-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/glob2-devel
