Difference between revisions of "R.C. Pro-Am II/Game Mechanics"

From SDA Knowledge Base

Jump to: navigation, search
m (RNG)
m (RAM addresses)
 
(3 intermediate revisions by the same user not shown)
Line 153: Line 153:
 
Each individual letter item (to avoid any possible confusion, it's the white boxes with a black letter) is linked to one of six letter addresses (01CD-01D2). These links are static and are described further down. Each letter address is recalculated at the start of every race, regardless of if it's going to be used or not. The letter generation process is as follows:
 
Each individual letter item (to avoid any possible confusion, it's the white boxes with a black letter) is linked to one of six letter addresses (01CD-01D2). These links are static and are described further down. Each letter address is recalculated at the start of every race, regardless of if it's going to be used or not. The letter generation process is as follows:
 
#Update RNG-addresses 0756-0759. The detailed calculation with comments is described in http://tasvideos.org/forum/viewtopic.php?t=9164
 
#Update RNG-addresses 0756-0759. The detailed calculation with comments is described in http://tasvideos.org/forum/viewtopic.php?t=9164
#Perform an XOR on the "letters collected" address of one of the cars (07A1-07A4) and $FF. Since each letter collected is a binary 1 in the corresponding byte, the result will contain 1 for the bits corresponding to letters <u>not</u> collected by that car.
+
#Perform an XOR on the "letters collected" address of one of the cars (07A1-07A4) and 0xFF. Since each letter collected is a binary 1 in the corresponding byte, the result will contain 1 for the bits corresponding to letters <u>not</u> collected by that car.
 
#Perform an AND on the result in 2 with 0756. The AND-operation is performed from left to right and stops as soon as it results in a 1.
 
#Perform an AND on the result in 2 with 0756. The AND-operation is performed from left to right and stops as soon as it results in a 1.
 
#The position of the resulting 1 determines the letter in the order P, R, O, A and M, with the rest always resulting in an I. Write the corresponding result to the letter address.
 
#The position of the resulting 1 determines the letter in the order P, R, O, A and M, with the rest always resulting in an I. Write the corresponding result to the letter address.
Line 166: Line 166:
  
 
The six letter addresses depend on the different cars in the following way:
 
The six letter addresses depend on the different cars in the following way:
* 01CD - The XOR operation will be based on car 1's letters (red, address 0741)
+
* 01CD - The XOR operation will be based on car 1's letters (red, address 07A1)
* 01CE - Car 2's letters (blue, address 0742)
+
* 01CE - Car 2's letters (blue, address 07A2)
* 01CF - Car 3's letters (green, address, 0743)
+
* 01CF - Car 3's letters (green, address, 07A3)
* 01D0 - Car 4's letters (yellow, address 0744)
+
* 01D0 - Car 4's letters (yellow, address 07A4)
 
* 01D1 - Car letters depending on the race. In race 1, it's car 1's letters, in race 2, car 2's etc. Note that the bonus stages count as well. So race 9 will depend on car 2's letters.
 
* 01D1 - Car letters depending on the race. In race 1, it's car 1's letters, in race 2, car 2's etc. Note that the bonus stages count as well. So race 9 will depend on car 2's letters.
 
* 01D2 - Random car (= depends on the RNG-addresses and therefore not predictable)
 
* 01D2 - Random car (= depends on the RNG-addresses and therefore not predictable)
Line 600: Line 600:
  
 
==RAM addresses==
 
==RAM addresses==
For player-specific stats, the neighboring addresses contain the corresponding stats of the opponents.
+
All player-specific stats are for P1. The next three addresses contain the corresponding stats of the other cars.
 
* 0596 - Car speed
 
* 0596 - Car speed
 
* 05B2 - Zipper boost
 
* 05B2 - Zipper boost
 
* 0748 - Nitros
 
* 0748 - Nitros
* 0626 - Nitro boost (see section about nitros)
+
* 0626/061E/0622 - Nitro boost/phase/counter (see section about nitros)
* 061E - Nitro phase (see section about nitros)
+
* 0622 - Nitro counter (see section about nitros)
+
 
* 043C - Frame counter giving input to the RNG (letters/line-up/traffic light)
 
* 043C - Frame counter giving input to the RNG (letters/line-up/traffic light)
 
* 0756-0759 - RNG-addresses
 
* 0756-0759 - RNG-addresses
Line 614: Line 612:
 
* 0704 - Tyre type (0-4, where 0 is the standard tires and 4 is the Scoopers tires)
 
* 0704 - Tyre type (0-4, where 0 is the standard tires and 4 is the Scoopers tires)
 
* 0710 - Car upgrade (0-2, where 0 is standard and 2 is the 2nd car upgrade)
 
* 0710 - Car upgrade (0-2, where 0 is standard and 2 is the 2nd car upgrade)
* 075B - Small money address. Value multiplied by 10.
+
* 05F2/05F6 - Big/Small money earned/collected during a race. The decimal value is multiplied by 10 for a player's earnings during the race.
* 075F - Big money address. Value multiplied by 2560.
+
* 075F/075B - Big/Small money (total). The decimal value is multiplied by 10 for the player's total cash (added up after each race).
 
* 07A1 - Letters collected. P is worth 64, R 32, O 16, A 8, M 4, the first I 2 and the second I is worth 1. This adds up to 127 (or 01111111 in binary). When you enter the shop with a value of 127, you'll get the first upgrade and the value changes to 128 (or 10000000 in binary). Once you reach 255 (128+127), you'll get the second car upgrade and the value is set to 253 for the rest of the game.
 
* 07A1 - Letters collected. P is worth 64, R 32, O 16, A 8, M 4, the first I 2 and the second I is worth 1. This adds up to 127 (or 01111111 in binary). When you enter the shop with a value of 127, you'll get the first upgrade and the value changes to 128 (or 10000000 in binary). Once you reach 255 (128+127), you'll get the second car upgrade and the value is set to 253 for the rest of the game.
 
* 0728/072C/0730/0734/0738/073C/0740/0744 - Buckshots/Missiles/Bombs/Lazers/Freezes/Mega Pulses/Shields/Slicks
 
* 0728/072C/0730/0734/0738/073C/0740/0744 - Buckshots/Missiles/Bombs/Lazers/Freezes/Mega Pulses/Shields/Slicks

Latest revision as of 04:55, 11 June 2023

Items

Rcproam2 dollar.JPG - $250. If it's blinking, any car can grab it. Otherwise, only the car with the corresponding color can collect it.

Rcproam2 dollar-bag.JPG - $100. If it's blinking, any car can grab it. Otherwise, only the car with the corresponding color can collect it.

Rcproam2 ammo.JPG - $100. If you're equipped with a bought weapon, this item will increase the ammo by 5.

Rcproam2 star.JPG - $100. If you're equipped with a bought weapon, this item will increase the ammo by 1.

Rcproam2 letter.JPG - No money. Collect the letters P, R, O, A, M and I (twice) to upgrade the car. The car can be upgraded twice.

Rcproam2 nitro.JPG - No money, one nitro. Any unused nitro is converted into $250 at the end of a race. If it's blinking, any car can grab it. Otherwise, only the car with the corresponding color can collect it.

Rcproam2 questionmark.JPG - No money, gives either missiles or bombs with unlimited ammo for that race. You can't tell from the question mark if it's one or the other, but the same question mark always contains the same weapon.

Rcproam2 rollcage.JPG - No money, prevents you from crashing after driving through an oil slick. If a car touches another car having the roll cage, it will start spinning and crash if hitting the border of the track. If both cars have the roll cage, nothing happens.

Rcproam2 1up.JPG - No money, one continue

Speed

The speed is tracked in RAM-address 0596.

Max speeds

The below table shows how the max speed increases with the upgrades. The numbers in the motor rows correspond to their additional speed boost.

Default 1st upgrade 2nd upgrade
Standard 106 114 118
Red 8 8 8
Black 12 12 12
Silver 14 14 14
Gold 16 16 15
Hyper 17 17 16
Mega 19 20 20

In addition to the boost of the speed stats, each new motor also improves the acceleration.

Test of upgrade combinations

A primitive real-time test was made by timing (in frames) one lap of track 6 with different combinations of motors and tires. The green light was used as start of timing and the screen displaying "lap 2" was used as the end point. The completions were retried until they felt "representative" for each combination. They were of course still subject to minor execution mistakes, but should give an idea of what time differences to expect.

Standard Skinny Nooblies Dynafit Scoopers
Standard 1438 1376 1361 1361 1346
Red 1336 1296 1269 1257 1265
Black 1268 1261 1248 1238 1206
Silver 1249 1208 1221 1201 1195
Gold 1245 1193 1192 1201 1173
Hyper 1227 1200 1211 1189 1180
Mega 1245 1210 1193 1179 1159

Zippers

Zippers give a speed boost of around 111 tracked in 05B2, which then starts to drop every frame as soon as you leave the zipper (by 1, 1, 1, 0 etc). The boost drop rate is not impacted by obstacles. Very roughly, a zipper saves about one second.

Boosts

The nitro and start boost effects are governed by the same game mechanics. The effect goes through 4 phases (RAM-address 061E):

  1. The counter in 0622 counts down from 32 (nitro) or 40 (start boost) by one every frame. When the counter reaches 0, phase 2 begins.
  2. RAM-address 0626 increases by 8 every frame for 8 frames (so ending at 64). 0626 is effectively what boosts the car.
  3. 0622 is reset to 32 and starts to count down yet again. When the counter reaches 0, phase 4 begins.
  4. 0626 decreases by 1 every frame until it reaches 0. This is also the point when a new nitro can be used.

It's important to note the following things:

  • The nitro boost is not affected by obstacles. That means they are extra useful when crossing water, bump sections etc.
  • By activating the nitro so you're in phase 2 while entering the obstacle, you can save additional time by not losing as much speed as you otherwise would have.
  • A boost saves roughly half a second (of course depending on which upgrades you have).
  • Nitros generate additional lag, which should be taken into account when choosing where to use them.


Tires

The tire parameters have been described by FatRatKnight in http://tasvideos.org/forum/viewtopic.php?p=468257&highlight=#468257.

RNG

The most important RNG-factors in the game are:

  • Letters
  • Traffic light timing
  • Line-up at the start line


All three are determined by a set of RNG-addresses (0756-0759) and a frame counter (043C) when pressing start in the shop. The RNG-algorithm is recursive with the frame counter acting as enthropy. It's triggered a few times during the start of a race and can also occasionally be called during a race. The frame counter is reset between every race, which in theory could provide a method for manipulating the RNG. There are ways to determine the RNG-seed in race 1 (by looking at the car order at line-up and which letter is in the letter box). One could technically learn a few neighboring RNG-seeds that follow in race 2, depending on how long the frame counter was left to run during the shop menu. But the possibilities quickly multiply and it will in practice be difficult to memorize all possible branches. This means real-time manipulation is likely going to be limited. There is one exception and that is race 1, which always starts from the same seed and therefore only depends on the frame counter.

Letters

This section is almost completely based on FatRatKnight's analysis, which can be found here: http://tasvideos.org/forum/viewtopic.php?p=468325#468325

Each individual letter item (to avoid any possible confusion, it's the white boxes with a black letter) is linked to one of six letter addresses (01CD-01D2). These links are static and are described further down. Each letter address is recalculated at the start of every race, regardless of if it's going to be used or not. The letter generation process is as follows:

  1. Update RNG-addresses 0756-0759. The detailed calculation with comments is described in http://tasvideos.org/forum/viewtopic.php?t=9164
  2. Perform an XOR on the "letters collected" address of one of the cars (07A1-07A4) and 0xFF. Since each letter collected is a binary 1 in the corresponding byte, the result will contain 1 for the bits corresponding to letters not collected by that car.
  3. Perform an AND on the result in 2 with 0756. The AND-operation is performed from left to right and stops as soon as it results in a 1.
  4. The position of the resulting 1 determines the letter in the order P, R, O, A and M, with the rest always resulting in an I. Write the corresponding result to the letter address.


Observations:

  • Only letters not collected by the determining car are possible (except I, which is always possible)
  • Assuming the RNG-generation algorithm is accurate (which appears to be the case), the probability of possible letters drops by roughly half each step and finally the rest going into I. E.g. if a car has collected the letters P, R and M, the probabilities become O - 50%, A - 25% and I - 25%.
  • A letter can never have a probability of >50%, except for I, which can actually be 100% determined if that's the only letter missing.
  • Since the letter items will contain the different cars' missing letters, it's an advantage to keep the opponents at roughly the same level as yourself (to the extent possible) since that will increase the chances of spawning letters you need.


The six letter addresses depend on the different cars in the following way:

  • 01CD - The XOR operation will be based on car 1's letters (red, address 07A1)
  • 01CE - Car 2's letters (blue, address 07A2)
  • 01CF - Car 3's letters (green, address, 07A3)
  • 01D0 - Car 4's letters (yellow, address 07A4)
  • 01D1 - Car letters depending on the race. In race 1, it's car 1's letters, in race 2, car 2's etc. Note that the bonus stages count as well. So race 9 will depend on car 2's letters.
  • 01D2 - Random car (= depends on the RNG-addresses and therefore not predictable)


The RNG-addresses are updated in-between, which means that 01CD and 01D1 are not necessarily the same in race 1 etc. Below is the link between these letter addresses and the individual letter items in the 15 first races.

Race 1
Only one letter - P1

Race 2
Left side - Random
Left of 3 letters - Race (P2)
Middle of 3 letters - P2
Right of 3 letters - P3

Race 4
Left at zipper - Race (P4)
Right at zipper - P4
Past zipper: P1

Race 6
Lower of 3 letters - P2
Middle of 3 letters - Race (P2)
Upper of 3 letters - P3
First of the left straight - P1
Second of the left straight - Random
Zipper "side pit" - Random

Race 7
Only one letter - P4

Race 9
Upper left - P1
Upper right - P3
Lower left - P2
Lower right - P4

Race 10
Upper right - P3
Left - Race (P3)
Lower right - P2

Race 11
Upper, ice section - P3
Lower, ice section - P2
Right side - Random
Finish line - Random

Race 12
Start - P4
Pit, right side - P4
Between bombs - P1
Pit, left side - Random
Left of 3 letters - P1
Middle of 3 letters - P2
Right of 3 letters - P3

Race 13
Only letter - Race (P2)

Race 14
Left of the first group of 3 letters - P1
Middle of the first group of 3 letters - P2
Right of the first group of 3 letters - P3
Left of the second group of 3 letters - P1
Middle of the second group of 3 letters - P2
Right of the second group of 3 letters - P3
Finish line - P4

Race 15
Right side, upper right - P1
Right side, middle left - P2
Right side, middle right - P3
Right side, lower right - P3
Left side - P4

Observations:

  • If two letter items draw their content from the same letter address, they will also always be identical. E.g there is no need to skip the zipper in race 6 and try to collect the letter instead since it will always be the same as the last letter on the left side (unless of course it was an I and you need one more).
  • Some of the letter items will rarely or never be collected by the cpu cars. By prioritizing collecting these and leave some of the easy-to-collect letters to the cpus, you'll end up being more even with them, which will result in a higher chance of the upcoming letters being the ones you're looking for.
  • There doesn't appear to be any particular pattern or structure to which letter item depends on which letter address. It's just whatever the developers decided the dependence should be.


As mentioned above, the letter in race 1 only depends on the frame counter in 043C. The table below shows the 256 different possible results:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0-15 R R P P P P A O R R
16-31 P P P P P M O R R P P P
32-47 P P O O R R P P P P
48-63 A O R R P P P P I O O
64-79 R R P P P P A O R R
80-95 P P P P M A R R P P P
96-111 P P M O R R P P P P
112-127 A O R R P P P P I A O
128-143 R R P P P P I O R R R
144-159 P P P P A O R R P P
160-175 P P M P R R P P P P P
176-191 O O R R P P P P A O
192-207 R R P P P P I A R R R
208-223 P P P P M O R R P P R
224-239 P M O R R P P P P P
240-255 A O R R P P P P I O O

Some observations:

  • P - 85, R - 43, O - 21, A - 10, M - 6 and I - 5 (and non-valid - 86). This corresponds extremely well with the "50%" probability decay, described above.
  • Roughly one third of the frames are not valid (= nothing happens when you press a button on these frames).
  • There doesn't appear to be any structure to the letters. There are no "islands" with one letter that would make it easy to get that particular one.
  • Since the same RNG appears to govern different elements, you can already from the start get an indication of the value of 043C the race began on by looking at the order of the cars at the line-up.


As already mentioned higher up, similar tables can be made from a save state for the other tracks as well. Unfortunately, this won't be of any value in a real-time attempt, since the RNG-seed at that point won't be predictable.

Traffic lights

The timing of the traffic lights can be seen in 06E2.

  1. The frame before the traffic lights appear on screen, 06E2 is set to 16. It then counts down by one every frame.
  2. At 0, 06E2 is reset to 32 and starts to count down again. The first traffic light is lit.
  3. At 0, 06E2 is reset to an RNG-value between 24 and 87. The second light is lit.
  4. At 0 (or actually one frame after), the green light is lit.


Since the green light timing follows the letter RNG, it's not possible to predict (other than to some extent in race 1). The piece of code determining the green light timer RNG has been described by FatRatKnight in http://tasvideos.org/forum/viewtopic.php?p=468741&highlight=#468741. In short, the time (in frames) is 24 + an RNG-value between 0 and 63.

Speed boost timing

The time window for getting the start boost appears to be linked to the race you're on. The first four races, which are the most important, have the following windows:

  1. 15
  2. 15
  3. 14
  4. 12


It looks like all the races after #4 (except 25, 28 and 31, which are copies of 1, 2 and 3, respectively) also have a time window of 12 frames for getting the start boost. However, if any of the other cars accelerate before you and within the "start boost time window", they will get the boost and you will not. It seems that the cpus get better and better to react as the game progresses, so it will be more and more difficult to get the start boost for that reason.

Menu navigation

  • After a race, when the result screens are showing, you only need to press start once. This is possible as soon as the screen turns black after the race.
  • Once the map screen has been shown for 10 frames, it can be clicked away by any button. Roughly every third frame is a blank though. So a good idea is to press two buttons almost at once to decrease the chances of getting stuck on blank frames.
  • The drag race screen can be clicked away after 47 frames and then (roughly?) every third frame is a blank.
  • The tug-o-truck screen can be clicked away after 46 frames and then (roughly?) every third frame is a blank.
  • A merchandise can be selected (A or B) two frames before it's selected/shown and then every frame without blanks.
  • A motor buy takes at least 55 frames (for the first one available).
  • It costs an additional 28 frames for each menu jump, regardless of it's the outer or one of the inner menus.
  • After 22 frames on the shop screen, your current motor type will be displayed. If you enter the motor menu after this point, you'll go directly to the next motor upgrade. However, if you enter the motor menu before your current motor type is shown, you'll be at the red motor and will have to navigate more menu items and lose time overall.

RAM addresses

All player-specific stats are for P1. The next three addresses contain the corresponding stats of the other cars.

  • 0596 - Car speed
  • 05B2 - Zipper boost
  • 0748 - Nitros
  • 0626/061E/0622 - Nitro boost/phase/counter (see section about nitros)
  • 043C - Frame counter giving input to the RNG (letters/line-up/traffic light)
  • 0756-0759 - RNG-addresses
  • 01CD-01D2 - Letter addresses. 103 - P, 104 - R etc. (see section about letters)
  • 06E2 - Traffic light countdown timer
  • 0700 - Motor type (0-6, where 0 is the standard motor and 6 is the Mega motor)
  • 0704 - Tyre type (0-4, where 0 is the standard tires and 4 is the Scoopers tires)
  • 0710 - Car upgrade (0-2, where 0 is standard and 2 is the 2nd car upgrade)
  • 05F2/05F6 - Big/Small money earned/collected during a race. The decimal value is multiplied by 10 for a player's earnings during the race.
  • 075F/075B - Big/Small money (total). The decimal value is multiplied by 10 for the player's total cash (added up after each race).
  • 07A1 - Letters collected. P is worth 64, R 32, O 16, A 8, M 4, the first I 2 and the second I is worth 1. This adds up to 127 (or 01111111 in binary). When you enter the shop with a value of 127, you'll get the first upgrade and the value changes to 128 (or 10000000 in binary). Once you reach 255 (128+127), you'll get the second car upgrade and the value is set to 253 for the rest of the game.
  • 0728/072C/0730/0734/0738/073C/0740/0744 - Buckshots/Missiles/Bombs/Lazers/Freezes/Mega Pulses/Shields/Slicks
  • 059E - Angle of the car. -33 is N and 33 is E (with reference to the screen, not the isometric view of the track).
  • 0531/052C - Big/Small x-position of the car (with reference to the screen). Positive to the right.
  • 053B/0536 - Big/Small y-position of the car (with reference to the screen). Positive down.
  • 055E/0559/056D - Lap/Segment/sub-segment, these addresses are the game's way of tracking player progress in the race (possibly to prevent any kind of shortcuts or manipulation of the lap counter)

More addresses are listed in http://tasvideos.org/forum/viewtopic.php?t=9164

Personal tools