Request for CSB map generation

For Coders Strike Back could we have the part of the referee program that creates the maps? This would help run local games.

1 Like
    Random r = new Random(this.seed);
    List<Point[]> maps = new ArrayList<>();

    maps.add(new Point[] { new Point(12460, 1350), new Point(10540, 5980), new Point(3580, 5180), new Point(13580, 7600) });
    maps.add(new Point[] { new Point(3600, 5280), new Point(13840, 5080), new Point(10680, 2280), new Point(8700, 7460), new Point(7200, 2160) });
    maps.add(new Point[] { new Point(4560, 2180), new Point(7350, 4940), new Point(3320, 7230), new Point(14580, 7700), new Point(10560, 5060), new Point(13100, 2320) });
    maps.add(new Point[] { new Point(5010, 5260), new Point(11480, 6080), new Point(9100, 1840) });
    maps.add(new Point[] { new Point(14660, 1410), new Point(3450, 7220), new Point(9420, 7240), new Point(5970, 4240) });
    maps.add(new Point[] { new Point(3640, 4420), new Point(8000, 7900), new Point(13300, 5540), new Point(9560, 1400) });
    maps.add(new Point[] { new Point(4100, 7420), new Point(13500, 2340), new Point(12940, 7220), new Point(5640, 2580) });
    maps.add(new Point[] { new Point(14520, 7780), new Point(6320, 4290), new Point(7800, 860), new Point(7660, 5970), new Point(3140, 7540), new Point(9520, 4380) });
    maps.add(new Point[] { new Point(10040, 5970), new Point(13920, 1940), new Point(8020, 3260), new Point(2670, 7020) });
    maps.add(new Point[] { new Point(7500, 6940), new Point(6000, 5360), new Point(11300, 2820) });
    maps.add(new Point[] { new Point(4060, 4660), new Point(13040, 1900), new Point(6560, 7840), new Point(7480, 1360), new Point(12700, 7100) });
    maps.add(new Point[] { new Point(3020, 5190), new Point(6280, 7760), new Point(14100, 7760), new Point(13880, 1220), new Point(10240, 4920), new Point(6100, 2200) });
    maps.add(new Point[] { new Point(10323, 3366), new Point(11203, 5425), new Point(7259, 6656), new Point(5425, 2838) });

private void generateMap(Random r, Point[] map) {
    List<CheckPoint> checkPoints = new ArrayList<>();
    List<Point> points = Arrays.asList(map);
    Collections.rotate(points, r.nextInt(points.size()));
    for (Point p : points) {
        checkPoints.add(new CheckPoint(p.x + r.nextInt(CHECKPOINT_GENERATION_MAX_GAP * 2 + 1) - CHECKPOINT_GENERATION_MAX_GAP, p.y + r.nextInt(CHECKPOINT_GENERATION_MAX_GAP * 2 - 1) - CHECKPOINT_GENERATION_MAX_GAP));
    }

    this.checkPoints = checkPoints.toArray(new CheckPoint[checkPoints.size()]);

}
6 Likes

For anyone wondering, Saiksy said CHECKPOINT_GENERATION_MAX_GAP is 30 in the chat.

What about pod placement and number of laps ?

Number of laps is always 3 in the arena.

Pod placement (from what I can tell): imagine a line between checkpoint 0 and 1 and add a line at 90 degrees to that passing through checkpoint 0. Player 1’s pods are 500 distance along that line at either side of checkpoint 0 and player 2’s pods are 1500 distance along that line either side.