[Home]VisitCountStats/Dynamic

Robo Home | VisitCountStats | Changes | Preferences | AllPages

Dynamic visit counts means you create a different number of visit buckets for different enemy distances. The point is that so that you shouldn't need smoothing the curve or calculate kernel densities or whatever before acting on the data in your stat buffers. It also keeps your stat files no bigger than necessary (that's my mantra, small stat files...=). Here's how it is implemented in GloomyDark. It assumes you are segmenting on distance, but that is a good segmentation in most cases:
...
    public static final double BOT_WIDTH = 36;
...

    int numFactors(double distance) {
        int n = (int)(1.25 * (distance / bulletVelocity(DEFAULT_BULLET_POWER) * MAX_VELOCITY / BOT_WIDTH));
        return n + 1 - n % 2;
    }

    int[][][][][] makeAimFactorVisits() {
        int[][][][][] factors = new int[ACCEL_SEGMENTS][AIM_VELOCITY_SEGMENTS][AIM_DISTANCE_SEGMENTS][1][];
        for (int a = 0; a < ACCEL_SEGMENTS; a++) {
            for (int v = 0; v < AIM_VELOCITY_SEGMENTS; v++) {
                for (int d = 0; d < AIM_DISTANCE_SEGMENTS; d++) {
                    factors[a][v][d][0] = new int[numFactors((d + 1) * MAX_DISTANCE / AIM_DISTANCE_SEGMENTS)];
                }
            }
        }
        return factors;
    }
As you can see I create a few extra segments, but I'm not sure that's necessary. Details like that take a long time to test... -- PEZ

Robo Home | VisitCountStats | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited October 27, 2003 18:45 EST by PEZ (diff)
Search: