I figured it would be a few days of work and I'd be done with the port, as Monogame implements almost all of XNA 4. Unfortunately, XNA 3 was the latest version when I made nfs, so first I had to update to XNA 4 and deal with all the breaking changes. Once that was done, it was running in Monogame pretty quickly. The problem was it wasn't as fun to play as I thought it was, and the code was much worse than I thought it would look :( Somehow if I leave code for several years it seems to degrade! I started ripping, replacing, refactoring, all the things that software devs love to do! The problem now was when I wrote the code I had built up a really good mental model of the Need for Speed track structure and how it was represented in code and in the data files. It's quite complex, with many parts, represented by classes with names like TrackNode, TerrainSegment, TerrainRow, TerrainStrip etc. Looking back on it now, the code doesn't do a good job of explaining how these objects fitted together. I used to know that a TerrainSegment always had 4 TerrainRows, and each row had 10 TerrainStrips, but a few years later there was a lot of head scratching!
Anyway, a few weeks of late nights later, a huge amount of refactoring, bug fixing, and more digging around the original data files with a hex editor, OpenNFS1 is much cleaner and more faithful to the original. A couple of things that made the biggest look n feel difference was changing the field of view and aspect ratio to match screenshots of the original. The values I used before were way off, and resulted in a lack of feeling of speed. I've added some simple ai to race against, here are a couple of screenshots with 100 racers! The original game used some really fun optimizations to have 8 cars simulated at once, which I am also using, and 100 cars is actually pretty computationally simple because of it.
I'm going to write a few posts about how the tracks and scenery and physics are organized
in the original game (as far as I can guess from understanding the data files) because some of the ideas could work well for mobile games today. Also, if I don't write it down this time, I'll forget and hopefully it will be interesting for someone else too.