Race system overview

ingame

Above is a gameplay screenshot showing a race in progress and the new checkpoint indicator. Keep in mind this is a work in progress, especially the UI. That said the race system is coming along quite well we thought we would explain how it works.

First up there is now a races.json file in the main level folder, this is used to list the races available for that level. Below is an example of a race used for the rallycross track on Industrial.

    "rc_4": {
            "prefabs": {
                "race_rallycross_boundary":{"filename":"levels/Industrial/race_rallycross_boundary.prefab"},
                "race_rallycross_checkpoints":{"filename":"levels/Industrial/race_rallycross_checkpoints.prefab"},
                "race_rallycross_start3":{"filename":"levels/Industrial/race_rallycross_start3.prefab"},
                "race_rallycross_barriers_1a":{"filename":"levels/Industrial/race_rallycross_barriers_1a.prefab"},
                "race_rallycross_barriers_2c":{"filename":"levels/Industrial/race_rallycross_barriers_2c.prefab"},
                "race_rallycross_barriers_3c":{"filename":"levels/Industrial/race_rallycross_barriers_3c.prefab"},
                "race_rallycross_barriers_4a":{"filename":"levels/Industrial/race_rallycross_barriers_4a.prefab"}
            },
            "name": "Rallycross East (3 laps)",
            "startPosition": "114.196 104.316 42.307 141.253",
            "lapConfig": ["rc_start3", "rc_3", "rc_4", "rc_5", "rc_6", "rc_18", "rc_19", "rc_20", "rc_21", "rc_2"],
            "laps": 3,
            "endCheckpoint": "rc_start3"
        }

The system loads in prefabs when you select a race. The most important one is a series of checkpoints that are used by the race system to define the course as you can see below. For Industrial I have separated the checkpoints into areas (rallycross, offroad and race track) and created prefabs out of them which are loaded and shared for all races that use that area. For example the screenshot below shows the contents of the rallycross checkpoint prefab. These checkpoints cover all possible configurations of the rallycross area.

checkpoints

The next thing you define in the race file is the barriers, these are used to block off sections of the track that are not in use. For each intersection there are prefabs (collections of objects, in this case concrete barriers) for each road that may need to be blocked. Below is a screenshot of a road that has been blocked off. On this intersection there are two more barrier prefabs which can be loaded to block off the other two roads for different track layouts.

barriers

Below is a reference image showing the various checkpoints, start gates and barrier configs. This makes creating races much easier.

race_rallycross_barriers_reference

Leave a Reply