Contributing to Open76 - Pathfinding
It’s been around 2 and a half years since the last entry, so it’s probably time for a new one.
Recently I learned about a project called Open76. What it aims to do is basically get the game Interstate 76 working on modern machines using the Unity engine. Since I’m a big fan of the original game and I use the Unity engine at work, I figured I’d take a closer look. Interestingly this is the first Open Source project created by someone else that I’m contributing to as well.
After replaying the entirety of the original game using the GoG release to refresh my memory on the gameplay I’ve decided to delve right in. So far most of the assets seem to have been figured out. Most of the data files were reverse engineered over several months by someone known as ‘That Tony’. His blog posts were certainly an interesting read into how the game ticks.
While a majority of the assets were available and cars were derivable, the world was more or less devoid of life. Cars would spawn but they wouldn’t move, you can’t shoot at anything and so far the missions basically put you at your starting location, that’s it.
What I began to look at was giving the AI controlled cars some basic life support - so I started to implement some path finding for them. Closely monitoring the original game as well as the data that’s now being read in this project it became clear that cars appear to be given a destination in the form of a ‘path’, but the way they get there is by following the roads in the level. Putting this information together I created some simple pathfinding.
In my first iteration I simply had cars following the paths directly, which meant they would often happily drive off of cliffs to their demise.
The second iteration was a little more forgiving to the poor sods and actually has them following the roads. Nothing particularly fancy yet - no collision avoidance or awareness of the player, but it certainly makes them look a lot more intelligent than sitting still.