Page 1 of 1

Amount of randomness on destination

Posted: Thu Apr 10, 2008 7:42 pm
by MerickOWA
How much randomness is added to the destination when a move order is given?

I'm seeing anywhere between 0.3 to 0.6 calculated as:

if ( !moving ) {
double dist = Math.sqrt( sqr(destX-x) + sqr(destY-y) );
}

that seems like quite a bit. Is this usual? Is it gaussian error or uniform within a circle or square?

Seems reasonable

Posted: Thu Apr 24, 2008 11:54 am
by gorzak
I don't doubt your numbers, although I haven't checked them (I don't know how :( ). I see no reason to allow or account for the randomness when it can be virtually eliminated. Yes, it can be eliminated, or at least vastly reduced, with a few instructions and a couple extra variables. I am sure you noticed the precisity of my encircling pirrahnas around your defended cities. They do sometimes get close enough to get whacked, but that is only after I exceed the instruction cap. If you eliminate the randomness when preciseness matters, the distribution wont matter either.

As I said, I am newb enough that I can't debug, and my tests are limited to observing behavior. I can't prove my observations, they are anectodal. My guess would be square. There are 2 other distribution patterns that I am pretty sure are square, and if they are, why would this be different. The artillery splash specifically seems to reach farther when going a negative direction vs a positive, that wouldnt happen with circular distribution. Likewise, the cities seem to spawn more frequently in positive direction. It may not be square, but I know its not circular.

I have a pretty nasty artillery seigebot in hiding, it encircles a defended city much more actively than my pirahnnas do, it actually spreads out into a circle if not threatened. It doesn't ever close in the way my pirahana do, it pegs the spawns and lets the splash do the work. The positive/positive quadrant of the siegebots seem to do more work than the other 3 quadrants combined. They not only get the majority of the spawns, but when the other quadrants get spawns thier splash is much less likely to reach the city & defenders. The neg/neg quadrant is essentially worthless due to this. That is the source of my observation that the distribution seems to be not circular.

Posted: Thu Apr 24, 2008 9:02 pm
by adum
the randomness is computed like this:

Code: Select all

// randomize dest slightly
        double x = destX + terra.r.nextDouble() - 0.5;
        double y = destY + terra.r.nextDouble() - 0.5;
so it's up to 1.0 away. i did this partly so units wouldn't stack precisely on top of eachother, and partly so the game isn't quite deterministic.

probably a gaussian distribution would have been better...

adum