- 895
- RF_Stonemonkey
That said, however, it seems to me that there are a lot of programming tricks going on to create an illusion of reality in the way the AI "drives". It's obvious that each AI car is programmed to carry out the exact same maneuvers in every iteration of the race until there is an "interaction with other drivers" or a "mistake", even though mistakes are pre-programmed too. It all saves processor cycles.
Ive seen similar thinking about the AI and that it's behaviour is somehow scripted, I don't believe that's the case though.
Some time ago I wrote a racing game, fairly simple and not particularly good physics (look up YABASIC PS2 F1 on youtube to see it). For the human player the physics routine took input from the controller and worked out what the car should be doing, for the AI players, the AI routine looked at the track ahead of it, worked out if it should be turning/braking/accelerating and passed that as if it was button presses to the same physics routine so the AI was acting as if it was playing through a controller too, the AI also looked at the positions of cars immediately in front and behind and could simulate pressing buttons to move over to pass or block.
When I started working on the AI, one of the things I found out was that if there was no human player then the race would always run exactly the same way no matter how many times i re-ran it and that included any mistakes or passes or blocks the AI made, to counter that I gave each AI player a small random delay for their reaction to the start light going out, from that point on the AI was always just running the same code but the race ran completely differently each time. I could however store the start delay values and replay that same race.
When I introduced a human player into the mix, that added more interference and the cars would be reacting to the player, without the random start delay the cars ahead would race out the same race each time until they were interfered with by the player. For replays I found that I only had to store the human players input, as long as the start light delays for each AI car were stored the AI would still play out exactly the same race with the recorded human players input as it did when the human was playing so I didn't have to store any data from the AI cars other than the start delays for the replays.
From all I've seen in GT, it's doing pretty much the same thing just with far more advanced physics and AI than I could manage but there's no scripting or anything telling the AI what to do, it just does it's thing and given the same starting conditions it will always play out the same way until the human player interferes with it.
Last edited: