DevLog #5 “AI & Vehicles”

When starting the development of a new game, you usually start with prioritizing the first features to prototype. Back when we began working on Gas Station Simulator, we did that as well, but ended up starting with a rather unexpected choice.
You’d think renovation, building upgrades, the plethora of customer interactions or the tasks at hand like filling up tanks or checking vehicles would be the choices to start with. And you would be right, except many of them rely on something very basic: how the customers arrive and how they get to where they want before you get to the tasks or interactions.
This means we had to tackle the vehicle AI first to see if we can get it as detailed as we wanted it to be, because how many other features would play out is going to rely on what the vehicle AI will be able to handle. The thing about vehicles and their behavior is, that like characters, you spot any imperfection and odd behavior immediately, because we are all so used to seeing vehicles in every situation every single day.
[previewyoutube][/previewyoutube]
We didn’t just want a customer to arrive at the gas station by moving their vehicle from A to B. We wanted them to do it naturally, meaning decrease speed when turning, slowing down when it gets more crowded or narrow, navigate obstacles like other customers parking badly etc. We also needed the AI to handle all the changing conditions that arise from the upgrades you will make to your gas station, like adding parking spaces and new parking lots.
Then there is the matter of a complex decision tree. The customer wants to fill his tank and get a snack, so he wants to get to a gas pump closest to the entrance and thus shop area. Or a customer who wants to fill up his tank arrives, but all the gas pumps are currently occupied. Not to mention the many events that will occasionally activate like a tour bus arriving and thus presenting a whole new challenge for you to manage and the AI to handle.
As we are now in the process of completing the last phase of the vehicle AI we are more than happy with what we achieved. It is more akin to something you’d expect from a city simulation game with traffic decisions, dynamic obstacle handling, lane changes, traffic lights support and shortcut handling. While a gas station seems nothing like a city, from a game logic and the AI’s point of view it actually is exactly like a city, just a lot smaller. The requirements in terms of fictionality however are the same.