After spending a lot more work on the menu system than anyone should be expected to handle, I finally took the time to implement the time-trial mode ghost cars.
As I had expected, it was a lot easier to implement than the AI cars. As a bonus, it also needed less than half of the CPU cycles to run it. The ghost cars are essentially keyframed animations recorded when you play. The keyframes and some meta data are serialized to a plain text ghost file format.
We all know how fun it is to race against a ghost of yourself or a friend. I have fond memories of I and my brother playing Moto Racer on my first PC. Naturally, we want to enable this competitive excitement in our game, even when you play a quick game on the bus. (Or if you don't have any friends.)
Anyway... Ghosts are uploaded to our server and shared with other player over the world. You race against your own best time, plus two downloaded ghosts. Whenever you beat the best one, it will be replaced by a new one, at least 0.3 seconds faster than your best time. This means you will always race against ghosts slightly better or worse than yourself.
The result is a great gaming experience! Even after playtesting this all day long the last few days, it's still hard to put the game down when you lost the race by a fraction of a pixel.
Another great thing is that when you drive alongside a ghost, you can easily spot the tiniest gain or loss as you cut corners along the race track, allowing you to perfect your driving technique.