Porting Update:
The traffic code is now ported and the end result is 600 lines of C++ and what appears to be the correct behaviour.
One aspect that the 80s home conversions missed, is that OutRun's traffic is relatively smart. If you drive up slowly behind it, it will accelerate to stay out of your way. It will also attempt to change lanes where possible to avoid the player and other AI traffic. Each traffic object has a series of flags to denote its proximity to other road objects.
The traffic code is now ported and the end result is 600 lines of C++ and what appears to be the correct behaviour.
One aspect that the 80s home conversions missed, is that OutRun's traffic is relatively smart. If you drive up slowly behind it, it will accelerate to stay out of your way. It will also attempt to change lanes where possible to avoid the player and other AI traffic. Each traffic object has a series of flags to denote its proximity to other road objects.
The traffic logic works by grabbing the traffic objects from the ordered sprite display list. This has the advantage of meaning that the traffic is already z ordered correctly as an optimisation for proximity checks. The display list references the original objects and the logic code then goes to work on these.
Next I'll be working on the ferrari crash routines. You may remember that I posted about them here a couple of years ago. Yes, it's been that long!
More bugs?
I know this attention to detail is becoming increasingly pedantic but today's random bug in the original game relates to the positioning of the passengers in the car. Come to a complete stop. Gently accelerate and you'll notice both man and woman shift to the right by a pixel. Slow down and they will shift left again.
I've found the line in the original code that's causing this, but I'm not sure if this is a bug or intentional behaviour? I'm pretty sure the programmers got a check for the horizontal flipping of the Ferrari inverted when setting the passenger offsets. What do you think?
Scoring
It's been a while since I've written something non-technical. So let's explain OutRun's scoring logic:- You will score when both Ferrari wheels are on road. The amount you score depends on your speed. This value will be incremented 30 times a second.
The table of values is as follows. The player's speed is used as an index into this table:
0, 10, 20, 30, 40, 50, 60, 80, 110, 150, 200, 260, 330, 410, 500, 600, 710, 830, 960
To score the highest value (960) you must be travelling at 287 kph. - Overtaking a car: 20,000 points
- 100,000 points per 0.1 second of bonus time on game completion