Grand Theft Auto: San Andreas Q&A #2 - Physics, AI, Modding

The developers of San Andreas discuss some of the technical workings of the game.


Grand Theft Auto: San Andreas

There were no bigger games last year than Grand Theft Auto: San Andreas. Rockstar's blockbuster sequel sold more copies than any other video or computer game in 2004. And now, the hit PlayStation 2 game is coming to the PC. And despite the fact that we're getting the game months after the PS2 crowd did, we can look forward to a better San Andreas, courtesy of the PC's superior graphical power and its fan community, which has a very pleasant habit of using the game to create all-new, custom-made content. However, there's far more to San Andreas than just looks. You'll get the chance to guide your character through a heady life of crime that involves jacking cars, breaking and entering homes, and even engaging in aerial dogfights. To get some details on what makes San Andreas tick, we got a chance to throw some questions to some of the developers at Rockstar North.

CJ's in a hurry to make a name for himself.
CJ's in a hurry to make a name for himself.

GameSpot: What types of objects in San Andreas have physical properties? Is it mostly vehicles, or does every object work with the physics engine?

Obbe Vermeij: Pretty much every object has proper physics applied to it. Boxes can be pushed around or destroyed. Traffic and streetlights can be pushed over and destroyed. Objects now also split up into smaller objects when damaged. This looks particularly cool on benches. There is also a pool game with proper physics on the balls.

GS: How many different handling characteristics does each vehicle possess?

Sandy Roger: Automobiles have around 40 separate handling variables, which can be modified to set up the car's handling, while bikes and flying vehicles have an additional 15 to 20 variables tailored to their specific requirements. Each variable is influenced by other variables though, so you can't, for example, just increase wheel traction without having to "re-set up" the suspension to compensate.

GS: Are models given mass in the game? If so, how is it assigned? Is there a center of gravity, or is mass assigned to the entire model?

OV: Models do have a center-of-gravity set. The value is tweaked very carefully to make sure the object behaves as realistically as possible. In the case of vehicles, these values are tweaked for hours and hours to make driving as enjoyable an experience as possible.

GS: How are the collision dynamics for vehicles worked out? How is damage assigned in terms of how much damage a car can inflict?

SR: The damage a car can inflict is primarily determined by its momentum, or its mass and speed. Heavy and fast vehicles, such as the fire truck, can do more damage to other vehicles. We can also control how much damage a vehicle receives, or tweak how tough a vehicle is, through a variable in the handling.

You can jack pretty much any kind of vehicle in San Andreas.
You can jack pretty much any kind of vehicle in San Andreas.

GS: How are the floating-in-water mechanics worked out? How does this change between CJ and other character models and vehicles?

SR: The buoyancy forces that are applied through the physics engine are calculated based on the percent volume of an entity that is underwater. In the case of CJ or characters, this is simply based on the height of the water level--up the character's body--as a percentage of his or her height. For a vehicle, we must sample the water level at various points across the volume of the vehicle, and [we] use this to calculate the overall volume, as well at the center of buoyancy, which is the average position at which the buoyancy forces should be applied.

Pedestrian Behavior

GS: How many different types of responses do the pedestrians of San Andreas have when responding to events happening around them?

There's an entire city to plunder.
There's an entire city to plunder.

Gordon Yeoman: Each pedestrian's personality is reflected in his or her response to around 40 world events. Some of these events are relevant only to specific types of pedestrians, so a pedestrian's personality is typically formed by choosing responses to about 20 different events. A response to a specific event is decided by choosing randomly from a weighted distribution of up to six actions appropriate for that event. Six types of pedestrian personalities are loaded from a file and applied according to the pedestrian's model index: cop, gang member, fireman, weak, normal, and tough. Mission pedestrians can have their personalities individually edited in script.

GS: How are the artificial intelligence priorities of the recruited gang members handled? How do they pick targets?

GY: Recruited gang members respond to events in much the same way as regular pedestrians, except that their personalities tell them to divert some events to their group. The group then queries its personality to compute a response for each group member. Pedestrians prioritize their event responses that require individual action above the actions dictated to them by the group. Targets are picked by looking for nearby pedestrians that have been flagged as enemies.

GS: During police chases, how do the police plan intercept routes when coming from a side street in front of CJ?

OV: The police cars will plan the shortest routes from their current positions to the player. Generally, these cars will end up chasing the player. In addition, special points have been set up where the police wait for the player. These police cars come screaming 'round the corner when the player enters a special trigger zone. The zones are set up in such a way that the police cars pop up right in front of the player, resulting in surprising moments.

GS: How does dogfighting work? How do the government jets follow and target CJ in a plane?

OV: Enemy planes use proper physics, which means that the artificial intelligence has to be clever enough to control the height and turn and avoid stalling. The AI pilot does this by predicting the position and speed of its plane two seconds ahead, and by making modifications based on that. As enemy planes obey the laws of physics, the dogfights always feel fair and interesting.

GS: Are models rigged in the same way as they were in Vice City? With CJ's anamorphic model, how is he rigged, and can this be altered by modders?

John Whyte: The animation system is very similar to the one in Vice City, but the models are rigged differently. It should be possible to mod this stuff in a similar fashion to Vice City, but it may take a little perseverance.

GS: Will the German version of the game be modified for violence, like Vice City and Grand Theft Auto III were?

Fly off into the sunset.
Fly off into the sunset.

JW: Yes.

GS: Are there any other technical issues that mod groups should be aware of going into San Andreas? The file structure of the PS2 version of San Andreas is almost exactly the same as the earlier GTA games. Will this be the same in the PC version?

JW: Yes, the file structure in the PC version is almost identical to the PS2 version. There are a handle of changes in places, but they are basically the same.

GS: Thank you, guys.

Did you enjoy this article?

  • Join the conversation
    There are no comments about this story