A summary of the major variable blocks in Revs, of which there are quite a few
Revs stores an awfully large amount of data, whether it's the status of each of the 20 computer-controlled cars, or the intricate details of the verge marks along the edge of the track. To keep track of it all, Geoff Crammond used a lot of data tables.
Here's a list of the main ones, split into broad categories. The number of entries in each table is shown in the heading, so each driver-related table contains 20 entries, for example - one for each of the drivers in the race. An entry can be a single byte like carProgress, or a multi-byte value like (carSpeedHi carSpeedLo). Sometimes multiple tables are interleaved; for example, in the track segment buffer, the segmentVector, segmentSteering and segmentFlags bytes are stored in blocks of three, effectively giving a 120-entry table with three bytes per entry. That's an implementation detail, however; the following just talks about the individual blocks, rather than their storage.
Drivers (20)
------------
These tables contain data for each of the 20 drivers in the race (or, if you prefer, each of the 20 cars in the race, as drivers and cars are synonymous).
Name | Description |
---|---|
bestLapMinutes | Minutes of each driver's best lap time, in BCD |
bestLapSeconds | Seconds of each driver's best lap time, in BCD |
bestLapTenths | Tenths of seconds of each driver's best lap time, in BCD |
carProgress | Each car's progress through the segment it's in |
carRacingLine | Each car's position on the track in the x-axis (i.e. left-right) |
carSectionSpeed | The driver speed for the next track section, which is taken from the track data and used to set the section's maximum speed for non-player drivers |
(carSpeedHi carSpeedLo) | Each car's forward speed |
carStatus | Each car's status byte (which controls accelerating, braking, cornering and whether computer-control is enabled) |
carSteering | Contains the steering to apply to each car |
driverGridRow | The row for each driver on the starting grid (0 to 9) |
driverLapNumber | The current lap number for each driver |
driverSpeed | The average speed of this driver in the race (88 to 162) |
driversInOrder | A list of driver numbers in order |
driversInOrder | Used to store a copy of the driversInOrder list |
(totalPointsTop totalPointsHi totalPointsLo) | Total accumulated points for each driver |
totalRaceMinutes | Minutes of each driver's total race time, in BCD |
totalRaceSeconds | Seconds of each driver's total race time, in BCD |
totalRaceTenths | Tenths of seconds of each driver's total race time, in BCD |
Objects (24)
------------
These tables contain data for each of the 3D objects. There are 24 of them: objects 0 to 19 are the car objects, objects 20 to 22 are the other three objects in the three-object car, and object 23 is the front segment of the track segment buffer (though this gets reused as the object for the road sign at the end of each driving loop).
Name | Description |
---|---|
objectPitchAngle | Each object's pitch angle |
objSectionSegmt | Each object's segment number within the current track section, counting from the start of the section |
(objectSegmentHi objectSegmentLo) | Each object's segment, i.e. its position around on the track |
objectSize | The size of each of the objects (i.e. the scaled value of scaleUp for the object) |
objectStatus | The status flags for each object (visibility, type and race status) |
objTrackSection | The number of the track section * 8 for each object |
(objYawAngleHi objYawAngleLo) | Each object's yaw angle |
Track verge buffer (24)
-----------------------
These tables contain data for the track verge buffer, as described in the deep dive on data structures for the track calculations. Tables in the buffer either contain 24 or 40 entries (see the next section for the latter). The 24-entry tables contain the track section list (6 bytes) and the track segment list for the inner edge of the verge mark (16 bytes).
Name | Description |
---|---|
vergeDataLeft | Data (such as colour) for the verge marks on the left side of the track |
vergeDataRight | Data (such as colour) for the verge marks on the right side of the track |
yVergeLeft | Segment pitch angles along the left track verge in front of the player (i.e. along the up-down y-axis) |
yVergeRight | Segment pitch angles along the right track verge in front of the player (i.e. along the up-down y-axis) |
Track verge buffer (40)
-----------------------
These tables contain data for the track verge buffer, as described in the deep dive on data structures for the track calculations. Tables in the buffer either contain 24 or 40 entries (see the next section for the latter). The 40-entry tables contain the track section list (6 bytes) and the track segment list for the inner edge of the verge mark (16 bytes), plus the track segment list for the outer edge of the verge mark (another 16 bytes).
Name | Description |
---|---|
(xVergeLeftHi xVergeLeftLo) | Segment yaw angles along the left track verge in front of the player (i.e. along the x-axis) |
(xVergeRightHi xVergeRightLo) | Segment yaw angles along the right track verge in front of the player (i.e. along the x-axis) |
Track segment buffer (40)
-------------------------
These tables contain data for the track segment buffer, as described in the deep dive on data structures for the track calculations. The track segment buffer contains 40 entries, one for each segment in the buffer, using a wraparound list.
Name | Description |
---|---|
segmentFlags | Flags for a track segment in the track segment buffer |
segmentSteering | The carSteering value to steer round the corner for a track segment in the track segment buffer |
segmentVector | The segment vector number for a track segment in the track segment buffer |
(xSegmentCoordIHi xSegmentCoordILo) | The 3D x-coordinate for an inner track segment in the track segment buffer |
(xSegmentCoordOHi xSegmentCoordOLo) | The 3D x-coordinate for an outer track segment in the track segment buffer |
(ySegmentCoordIHi ySegmentCoordILo) | The 3D y-coordinate for an inner track segment in the track segment buffer |
(ySegmentCoordOHi ySegmentCoordOLo) | The 3D y-coordinate for an outer track segment in the track segment buffer |
(zSegmentCoordIHi zSegmentCoordILo) | The 3D z-coordinate for an inner track segment in the track segment buffer |
(zSegmentCoordOHi zSegmentCoordOLo) | The 3D z-coordinate for an outer track segment in the track segment buffer |
Track lines (80)
----------------
The track view that we see when driving in Revs consists of 80 horizontal pixel lines. These tables contain data for each of these track lines, as described in the deep dive on drawing the track view.
Name | Description |
---|---|
backgroundColour | The background colour and associated verge type for each track line |
leftSegment | For each track line, the index of the segment within the track segment list for the left verge |
leftTrackStart | For each track line, the block number where the track starts (i.e. the left edge of the black track) |
leftVergeStart | For each track line, the block number where the left track verge starts |
rightGrassStart | For each track line, the block number where the grass starts to the right of the track |
rightSegment | For each track line, the index of the segment within the track segment list for the right verge |
rightVergeStart | For each track line, the block number where the right track verge starts |