Skip to navigation

Major variable blocks

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 carSpeed(Hi Lo). 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).

NameDescription
bestLapMinutesMinutes of each driver's best lap time, in BCD
bestLapSecondsSeconds of each driver's best lap time, in BCD
bestLapTenthsTenths of seconds of each driver's best lap time, in BCD
carProgressEach car's progress through the segment it's in
carRacingLineEach car's position on the track in the x-axis (i.e. left-right)
carSectionSpeedThe 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
carSpeed(Hi Lo)Each car's forward speed
carStatusEach car's status byte (which controls accelerating, braking, cornering and whether computer-control is enabled)
carSteeringContains the steering to apply to each car
driverGridRowThe row for each driver on the starting grid (0 to 9)
driverLapNumberThe current lap number for each driver
driverSpeedThe average speed of this driver in the race (88 to 162)
driversInOrderA list of driver numbers in order
driversInOrder2Used to store a copy of the driversInOrder list
totalPoints(Top Hi Lo)Total accumulated points for each driver
totalRaceMinutesMinutes of each driver's total race time, in BCD
totalRaceSecondsSeconds of each driver's total race time, in BCD
totalRaceTenthsTenths 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).

NameDescription
objectPitchAngleEach object's pitch angle
objSectionSegmtEach object's segment number within the current track section, counting from the start of the section
objectSegment(Hi Lo)Each object's segment, i.e. its position around on the track
objectSizeThe size of each of the objects (i.e. the scaled value of scaleUp for the object)
objectStatusThe status flags for each object (visibility, type and race status)
objTrackSectionThe number of the track section * 8 for each object
objYawAngle(Hi Lo)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).

NameDescription
vergeDataLeftData (such as colour) for the verge marks on the left side of the track
vergeDataRightData (such as colour) for the verge marks on the right side of the track
yVergeLeftSegment pitch angles along the left track verge in front of the player (i.e. along the up-down y-axis)
yVergeRightSegment 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).

NameDescription
xVergeLeft(Hi Lo)Segment yaw angles along the left track verge in front of the player (i.e. along the x-axis)
xVergeRight(Hi Lo)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.

NameDescription
segmentFlagsFlags for a track segment in the track segment buffer
segmentSteeringThe carSteering value to steer round the corner for a track segment in the track segment buffer
segmentVectorThe segment vector number for a track segment in the track segment buffer
xSegmentCoordI(Hi Lo)The 3D x-coordinate for an inner track segment in the track segment buffer
xSegmentCoordO(Hi Lo)The 3D x-coordinate for an outer track segment in the track segment buffer
ySegmentCoordI(Hi Lo)The 3D y-coordinate for an inner track segment in the track segment buffer
ySegmentCoordO(Hi Lo)The 3D y-coordinate for an outer track segment in the track segment buffer
zSegmentCoordI(Hi Lo)The 3D z-coordinate for an inner track segment in the track segment buffer
zSegmentCoordO(Hi Lo)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.

NameDescription
backgroundColourThe background colour and associated verge type for each track line
leftSegmentFor each track line, the index of the segment within the track segment list for the left verge
leftTrackStartFor each track line, the block number where the track starts (i.e. the left edge of the black track)
leftVergeStartFor each track line, the block number where the left track verge starts
rightGrassStartFor each track line, the block number where the grass starts to the right of the track
rightSegmentFor each track line, the index of the segment within the track segment list for the right verge
rightVergeStartFor each track line, the block number where the right track verge starts