glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] Nicowar changed to gradients, requesting tips on updat


From: Bradley Arsenault
Subject: Re: [glob2-devel] Nicowar changed to gradients, requesting tips on update algorithm
Date: Mon, 30 Jan 2006 15:44:03 -0800

On 1/29/06, Nuage <address@hidden> wrote:
> Just a simple trick. Well, you can actually do it with the other system too 
> now
> that I think about it. Still here is the trick:
>
> When the gradient system (the going down one) propagation reach 2, nothing 
> more
> can be achieved and there is no more propagation. When you know you don't want
> to measure a further distance than a given constant, you just start at it. For
> instance AICastor want to know where resources can growth, and how much. So it
> creates a gradient starting at "8" at every place with water, and propagate it
> to see the most favored places for resources growing. (this is still an
> approximation).
>

Aha! So thats how castor handles food so well... my system just
buildings buildings in reference to the resource they need the most,
and other buildings (this is to be better tuned later), and I always
wondered why castor would never build any inns at the large wheat
reserves far from water.

> And as I just realized you can use it in 16 bits gradients by starting at
> 2^16-8. So there is no more point.
>
>
>
> About speed: From what I have measured on my computer, I *believe* that the
> gradients of size 128x128 are still limited by cpu, but 256x256 is limited by
> memory bandwidth from ram to CPU. If this is indeed true, computing gradients 
> on
> 16bits will be two times slower at 256x256. For this reason I think we should
> not use 16 bits gradients now.
>From what I know about CPU's, although my knowledge is not extensive,
CPU's work fastest with integers of their word size, meaning a 32 bit
gradient would be fastest for most cpus, and a 64 bit gradient would
be best on newer 64 bit cpu's, but only insane people use 64/32 bit
gradients. The speed operated by 8 or 16 bit gradients on conventional
cpus would not be very different.

If you wanted to test it, consider replacing all Uint8 with Uint16 in
Map.h and Map.cpp and reprofile, it wouldn't be hard. Might lead to
conclusive results.
>
> So the best way to try 16 bits gradients would be... put them in some AI to 
> try
> them! So it's a great idea to try it.
>
Nicowar uses 16 bit gradients, I'm not sure about the speed though. I
haven't done a profile recently, but my proccessor usage meter
suggests that Nicowar uses *allot* of resources. It updates one of its
gradients every 4 ticks, although I'll probably raise this to 8 or 16
at a later time if speed becoems a very serious issue. And aswell,
Nicowar doesn't use a heavily optimized update algorithm, its is
fairly simple. But if you want to get a ruff idea about the speed
related to 16 bit gradients, you can check out Nicowar.

> Good night... I am tired now...
>
>
> _______________________________________________
> glob2-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/glob2-devel
>




reply via email to

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