Submission #5876: MrWint & Omnigamer's A2600 Dragster in 00:08.39

(Link to video)
Atari 2600
baseline
BizHawk 2.2.2
503
59.92375506314034
46
Unknown
Dragster (1980) (Activision, David Crane) (AG-001).bin
Submitted by MrWint on 3/26/2018 12:35:46 PM
Submission Comments

Objectives (in decreasing priority)

  • Does not early start or blow up (disqualifications)
  • Aims for the fastest in-game time
    • Secondary goal: Aims for maximum distance
  • Aims for track completion with fewest input frames
    • Secondary goal: Aims for fastest in-game time
    • Tertiary goal: Aims for maximum distance

Introduction

I was very impressed by Omnigamer's excellent investigation into the mechanics of Dragster, suggesting that the fastest achievable time in the game is 5.57, in contradiction to Todd Rogers' claim of achieving a 5.51. It was well researched and even included a spreadsheet simulating the game making it easy to try it for yourself. However, the missing piece in the chain of evidence for me was that it was not clear that spreadsheet modeled the game correctly. Maybe you could perform actions outside what the spreadsheet allowed for a faster time? It started nagging at me, I had no choice: I needed investigate the game for myself. If nothing else, it is good science to replicate the findings to add more confidence to the results.
In some ways, I feel bad submitting this and potentially obsoleting Omnigamer's submission, with all the original research they did on this. On the other hand, this maybe more than any other category shows that no run is unbeatable, even when you think it's at its limit already.
This run ends up saving 1 frame compared to Omnigamer's run for both primary objectives, and completes the fewest input frames objective with a faster finishing time and greater distance.

Note on emulation differences

This submission uses BizHawk 2.2.2, which emulates slightly differently than BizHawk 1.12.1 used in Omnigamer's run. Specifically, this run is 5 frames shorter due to emulation differences. All 5 frames are in the initial startup phase, and you can add/remove them at the start of the input file and the rest of the input will sync fine.

Investigation

So I disassembled the game for myself. It only consists of about 800 instructions total, so it was fairly easy to do. Next step, figuring out what the memory addresses are used for. Omnigamer provided a very helpful list in their submission to get started.
The first thing that became obvious is that it's not at all about emulation accuracy. The game has a main loop which is executed once per frame, and within that loop it increases the in-game time and advances the dragsters. Since we use the game's in-game timer for timing, any emulation timing inaccuracies are irrelevant. As long as the emulator executes the loop instructions in order (and it does, there are no hardware interrupts), it doesn't matter when it does it, the result will be the same. We're trying to minimize the number of iterations of that main loop here, not the number of frames.
The overall control flow starts the game up into a disabled state (the same state is also entered when switching game modes), and from there starting a new game clears most of the RAM to reset the dragsters and starts the countdown. During the game, each player is processed on alternating frames, running through exactly the same code paths. Each player has their own set of variables, including their own in-game timer, the game basically runs two isolated instances in parallel, which can't affect each other.
The game mechanics themselves work exactly as described by Omnigamer. As far as I can tell, the spreadsheet they created is an accurate representation of what happens during a game of Dragster when only looking at one of the players.

Findings

So that's all good and well, we now have a disassembly of the game, and some more confidence. But there were actually discrepancies and improvements compared to Omnigamer's original investigation and movie.
The first is an oversight in Omnigamer's model. It's not in the calculations, but in the initial conditions. As it turns out, when you start a new game, only most of the RAM is wiped, but not all of it. Most interestingly, the Tachometer is not set to zero when starting a new game, you can actually carry over your tachometer value from one game to the next. That means, instead of only being able to start off with a tachometer value that is divisible by 3, you can start out with any tachometer number you want, providing more possibilities to find an even faster starting configuration. Sadly though, as it turns out, starting at other tachometer values doesn't seem to end up allowing for any faster times or more distance than starting from values divisible by 3, at least as far as I could find. Feel free to try it out in Omnigamer's spreadsheet though, just ignore the "Must be multiple of 3" part, the maximum valid value is 31. Maybe this has interesting applications for non-TAS speedruns as well, allowing for an easier-to-perform setup (I did not investigate this; I think it's unlikely though, considering you'd need to do the tachometer setup before every attempt).
The other findings are improvements to Omnigamer's published run. The fastest in-game time of 5.57 and the largest distance with 0x62 subdistance spare are optimal from my calculations. However, the second primary goal of using the fewest input frames is not. To achieve the primary goal of the fastest in-game time and largest distance, the frame counter offset needs to be exactly 12 or 13. Due to an unintuitive quirk in how the frame counter is updated though (the active player is determined before the counter is incremented, but the frame rule is only evaluated after the counter is incremented), the bottom player actually is the first player in terms of where in its cycle the frame counter is, so it gets to the necessary offset of 12 first. In other words, it's player 2's turn at frame offset 12 and player 1's turn at 13, not the other way around as previously thought.
Thus, by having the fastest in-game time goal achieved by the bottom player, both players can start a frame earlier (with the top player starting first and using the earlier frame rule). This saves a frame compared to the current movie, with the last input on frame 337, and also makes the input file overall a frame shorter, without sacrificing any distance for the other player.
Additionally, the player using the least inputs finishes the race 20 frames (0.33 seconds) earlier than in the current movie, shortening the overall run time. Note that this was not an objective officially listed in Omnigamer's run, but it's likely they optimized for it considering they ended up with the optimal values for the chosen frame offset. Also, it feels like it fits this category well, so I added it as secondary and tertiary goals to this submission.

Data

All data was generated using a program searching for optimal solutions based on a model of the game I extracted from the disassembly (which matches Omnigamer's model as far as I can tell).
Here's a table of the best achievable times and (sub)distances for each tachometer and frame counter offset value.
tach\offset 0-1 2-3 4-5 6-7 8-9 10-11 12-13 14-15
0 5.64/96 5.64/ef 5.64/62 5.64/7b 5.64/da 5.64/d9 5.64/5a 5.64/bb
1 5.64/d4 5.61/46 5.64/fc 5.64/c1 5.64/e8 5.61/34 5.64/a6 5.64/c1
2 5.61/67 5.61/7e 5.61/13 5.61/2a 5.61/2f 5.61/9a 5.61/8d 5.61/58
3 5.61/6d 5.61/80 5.61/ef 5.61/2c 5.61/4f 5.61/9c 5.61/9b 5.61/5a
4 5.61/7b 5.61/86 5.57/10 5.61/b6 5.61/c1 5.61/a2 5.57/34 5.61/68
5 5.61/f5 5.57/03 5.57/16 5.61/bc 5.61/cf 5.61/d0 5.57/3a 5.61/6e
6 5.61/f7 5.57/11 5.57/18 5.61/ca 5.61/d1 5.57/4f 5.57/3c 5.57/3f
7 5.61/fb 5.57/13 5.57/24 5.61/d0 5.61/d5 5.57/51 5.57/58 5.57/45
8 5.57/06 5.57/15 5.57/26 5.61/d4 5.61/dd 5.57/53 5.57/5a 5.57/49
9 5.57/08 5.57/17 5.57/28 5.61/d6 5.61/df 5.57/55 5.57/5c 5.57/4b
10 5.57/0a 5.57/19 5.57/2a 5.61/d8 5.61/e1 5.57/57 5.57/5e 5.57/4d
11 5.57/0c 5.57/1b 5.57/2c 5.61/da 5.61/e3 5.57/59 5.57/60 5.57/4f
12 5.57/0c 5.57/1b 5.57/2c 5.61/da 5.61/e3 5.57/59 5.57/60 5.57/4f
13-31 5.57/0e 5.57/1d 5.57/2e 5.61/dc 5.61/e5 5.57/5b 5.57/62 5.57/51
And a table for the earliest (in-game time) you can end the input, and their corresponding best finishing times and (sub)distances.
tach\offset 0-1 2-3 4-5 6-7 8-9 10-11 12-13 14-15
0 2.93/8.08/27 2.90/8.18/13 2.87/8.35/1c 2.83/8.65/15 2.87/8.75/03 2.90/9.05/00 3.00/7.88/10 2.97/7.91/1a
1 2.93/8.01/24 2.90/8.11/1a 2.87/8.24/1b 2.83/8.48/0f 2.83/8.98/06 2.87/9.01/03 3.00/7.84/29 2.97/7.91/20
2 2.93/7.94/25 2.90/8.04/25 2.87/8.21/0c 2.83/8.35/03 2.83/8.58/14 2.83/8.85/01 2.97/9.21/00 2.97/7.84/0e
3 2.93/7.94/2b 2.90/8.04/27 2.87/8.14/13 2.83/8.35/05 2.80/8.61/15 2.83/8.85/03 2.93/9.11/01 2.97/7.84/10
4 2.93/7.91/0a 2.90/8.01/02 2.87/8.08/0c 2.83/8.28/18 2.80/8.45/0f 2.80/8.95/06 2.83/8.98/03 2.97/7.84/1e
5 2.93/7.88/11 2.90/7.98/1c 2.87/8.08/12 2.83/8.24/08 2.80/8.41/02 2.80/8.68/0a 2.83/8.95/00 2.97/7.84/24
6 2.93/7.88/13 2.90/7.98/2a 2.87/8.08/14 2.83/8.24/12 2.80/8.41/04 2.77/8.58/15 2.83/8.95/02 2.97/7.28/33
7 2.93/7.88/17 2.90/7.98/2c 2.87/8.08/20 2.83/8.24/20 2.80/8.41/08 2.77/8.55/01 2.77/8.91/06 2.97/7.28/39
8 2.93/7.88/1f 2.90/7.94/01 2.87/8.08/22 2.83/8.21/02 2.80/8.41/10 2.77/8.55/03 2.77/8.91/08 2.97/7.28/3d
9 2.93/7.88/21 2.90/7.94/03 2.87/8.08/24 2.83/8.21/04 2.80/8.41/12 2.77/8.55/05 2.77/8.91/0a 2.97/7.28/3f
10 2.93/7.88/23 2.90/7.94/05 2.87/8.08/26 2.83/8.21/06 2.80/8.41/14 2.77/8.55/07 2.77/8.88/01 2.97/7.28/41
11 2.93/7.88/25 2.90/7.94/07 2.87/8.08/28 2.83/8.21/08 2.80/8.41/16 2.77/8.55/09 2.77/8.88/03 2.97/7.28/43
12 2.93/7.88/25 2.90/7.94/07 2.87/8.08/28 2.83/8.21/08 2.80/8.41/16 2.77/8.55/09 2.77/8.88/03 2.97/7.28/43
13-31 2.93/7.88/27 2.90/7.94/09 2.87/8.04/01 2.83/8.21/0a 2.80/8.41/18 2.77/8.55/0b 2.77/8.88/05 2.97/7.28/45
It is quite a nice coincidence that the best possible configurations for these two sets of objectives align in a way that allows showing them off in the same run. Note that the absolute fastest frame you could end the input and still finish (ignoring any other objective) is a single frame faster than shown in this run, and can be achieved by using the bottom player instead of the top player, with the exact same inputs.

Noxxa: Judging.
Noxxa: It's interesting to see how even one of the most thoroughly researched, dissected, and optimized games still has a small optimization (be it not in-game time) left in it. For the Vault, this technically counts as an improvement - as such, accepting as an improvement to the published movie.
feos: Pub.
Last Edited by adelikat on 10/25/2023 1:41 PM
Page History Latest diff List referrers