glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] Re: Full Nicowar behaviour assessment


From: Bradley Arsenault
Subject: Re: [glob2-devel] Re: Full Nicowar behaviour assessment
Date: Fri, 10 Feb 2006 13:50:56 -0800

On 2/10/06, Stéphane Magnenat <address@hidden> 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
> address@hidden
> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]