Wow, I didn't know you were incorporating banking. That's so cool! You guys went above and beyond with this game.
A.I. Cars Unleashed!
Welcome to GRITS Racing version 0.2.0! The long-awaited AI has finally been added to our early-access game. This is just the first round of the AI and, thus, it is not complete yet. The 5 personalities I built for the 4 cars (one of the personalities changes depending on number of players) are behaving more or less as I had hoped. You can expect more personality tweaking to come but, primarily, what is missing from the AI agents are pit stops and braking, to make them more competitive and/or interesting.
The AI agents know how to find the pit lane, when they choose to (which is rare at the moment), but they don't yet know when or how to make a pit stop. The AI agents only get one car apiece, and that probably won't change. Also, originally, I hadn't planned to program pit stops into the AI either (not intentional pit stops anyhow) -- they were originally specced to be more of the environment than the race -- but testing as a single player has shown that at least some of the AI agents should go for a pit stop when they need to -- particularly with a small number of players. Otherwise, it is too easy to knock them out of the race to kill the competition... which is boring when playing alone, and maybe in two-player mode as well.
The AI currently knows how to let off the gas when over-committed to a turn... but this is not enough. They really need to also know which turns to slow down for ahead of time, and by how much. Thus, they are currently pretty stupid about turn 5 on the Finger Lakes grand prix track and will quickly destroy themselves on this track.
Enough of what's missing, what about what is included in this update? Much like how I went overly crazy with the physics in the game, I did a similar thing with the AI. I've mentioned before that I didn't want just another racing game with AI cars chasing a bunch of waypoints around the track. And, so, I didn't do that. I do have a few waypoints on each track because I need three or four just to keep the agents pointed in the right direction around the track. After that, however, it's up to the AI agent to decide how best to get from one point to another, or how to best recover from a wreck. To allow for this, I create a navigation mesh for each track with different navigation areas of different cost within that mesh. Then, I use A* pathfinding for long-distance navigation decisions and context steering for local navigation decisions. This gives the agents a lot of freedom to express their personalities, but also comes with a lot of settings to tweak and it could take a while to dial it all in.
The current AI personalities are these:
- Claude: a.k.a. "Speed Racer" against 1 player, medium "Speed Racer" against 2 players, and "Traffic Ma'am" against 3+
- Bob: a.k.a. "Student Driver"
- Rob: a.k.a. "Wrong Way Ray" occasionally gets turned around
- Maud: a.k.a. "Heat Seeker" tries her best to follow the race leader without hitting the race leader (which is not always possible)
This update also brings a banked-turn feature. Don't expect perfectly-calculated 3D banking, however. I do a lot of faking when it comes to the third dimension in this 2D game to save on processing where it would not be terribly significant. I do calculate speed-relative downforce increases on the individual wheels in a bank ("Isn't that enough?"), but banks are also mostly non-directional (that is, don't expect to roll downhill when sitting idle on a bank). The banking feature was needed now versus later because it affects setting up the AI agents. Currently, there is no visible indication of which turns are banked and by how much. We'll get there.
- The major turns in the tri-oval are heavily banked and the finish-line turn is medium banked. You can now drop the hammer in the tri-oval. Yay!!! Makes for a better novice-level entry track as well.
- The red-clay oval has no banking. (The real track it is based on is banked at only 4.3 degrees and is banked evenly throughout the track.)
- The yellow-clay oval has light banking in the turns.
- Turns 2 and 5 on the grand prix track are lightly banked. (I perhaps cheated a bit on turn 5 versus the real track.)
I had also planned to not include the AI agents much in the UI stuff but I feel I should change that soon. This includes things like AI lap counters (not sure where to fit those in yet) and including the AI in Bubba Prizes and the championship standings with only one or two players. Hopefully, these things will come shortly. Then, it's on to finally implementing name entry and high-score storage. Then, back to track making, I hope.
Love 'em or hate 'em, let us know what you think of the AI personalities. It's all trial-and-error at this early stage.