Grand Theft Game Design: Interiors And Instancing

In our previous, debut post of Grand Theft Game Design, we looked at the game's props and showed you why trees are indestructible while lamp posts will flatten with the wind. Today, we'll take a look at how building interiors work (and sometimes don't).

The topic of this post was inspired by a recent thread on the /r/gtaonline Subreddit. The OP encountered the "this warehouse is for vehicle cargo only" message when colliding with a random building that *isn't* a vehicle warehouse.


The first reaction was to assume this was a stray bit of pre-loaded code from an upcoming update that will add more warehouses (and this isn't necessarily wrong, either), however the discussion that ensued proposed another answer: instancing.

People who have played MMOs before might be familiar with the term, though they might not know the technical meaning. Colloquially, and depending on where you are from, "instances" can be used interchangeably with "dungeon" or "raid".

If you go "instancing" with your World of Warcraft guild, it means the same thing as doing raids. Technically the term is correct because you are entering a different instance from the main world. While the raid may be located somewhere on the world map and have an entrance there, it isn't physically there.

Instances are kind of like pocket dimensions within the game that are independent of the main open world. You wouldn't be able to avoid the entrance and noclip into a raid because it isn't actually behind the entrance.

The technical reasons for this are numerous, but the main ones are optimization and segregation. Usually instanced areas are particularly complex in terms of gameplay programming and AI, much more so than the overworld. Activities within instances are usually more "important" to players, therefore the added stability of not having to keep processing the overworld is crucial.

Segregation, on the other hand gives players the calm they need to complete a raid without having to worry about others blundering in accidentally and, say, aggroing the mobs for example.

Another use for instances, and one more relevant to GTA, is to allow standardized personal areas. Take your warehouse, for example. Every player can choose from the same selection of warehouses, and multiple players within the same session may own the same warehouse. You may also enter this warehouse at the same time.

However, when this happens there aren't multiple players prancing around the same physical space. You all have the same warehouse in the same location, but you all have independent warehouses to yourselves.

But in GTA, instances are only kinda instances. The method is based on the same principle, but simplified, probably to shorten loading times (yeah, we know that sounds funny...). Instead of each instance being a different, independent pocket dimension, these instances inhabit the same physical space as the open world, but not where you'd think they are.

There are as many physical warehouse interiors present in a lobby as many players there are in the lobby that own it. If 7 players own it, then the warehouse exist 7 times (alternatively, there are always the max number of warehouses, but only as many are populated as many players own them are present.). Each warehouse is linked to a player with a unique ID, and the player's data is loaded into the warehouse.

When you go to the warehouse on the map and go in, you don't actually go into that building but are teleported to the warehouse which matches your ID. These are physical spaces scattered around the map, hidden under it or inside static objects. Maybe your warehouse is actually inside a building, just not the actual warehouse building.

This is probably what happened to the author of the Reddit post. The building he collided with had a player's instanced warehouse in it, and the author clipped through just enough for the game to think he was inside someone else's warehouse - something that shouldn't be normally possible.

This same instancing method is likely used for all warehouses, offices, businesses and clubhouses. You may be asking, however, what's with the shops and apartments?

Shops are easily answered. They're not instanced simply because multiple players being in the same shop is perfectly normal. They're actually located in the interiors of the buildings in which they should be. There really is no need for any kind of magic or trickery here, this is the simplest affair there is.

Apartments are more difficult. See, some apartments have windows that actively show you the outside world, as well as a telescope. Of course, not all apartments have "live" windows, and all of these are instanced similarly to the warehouses. This can be most easily seen when the rather common glitch of retaining a wanted level in an apartment occurs, and the swarms of police searching for you in the ass-end of the Grand Senora desert while you're lounging in your downtown loft.

The live windows are something I can only speculate about, I'm afraid. The baffling thing here is that sometimes players outside can look through the window and see the person inside their apartment in real time, and vice versa. The obvious answer here is that the apartment is actually where it should be inside the building. But the issue of multiple players owning the given property and going inside at the same time remain.

My best guess is that this apartment is instanced as well, with one of them being placed where the actual apartment should be. One player is then treated to a "live" window version, while the others are found elsewhere. If you look through the telescope in the non-live versions, the camera is simply anchored to the actual location of the apartment, making it seem like you're looking through that telescope.

Instancing has been a bit weird in GTA for a long time in the history of the franchise. In the 3D era, most interiors weren't connected to the rest of the map seamlessly but were separated by loading screens. The odd thing is, however, that all interiors were located in the same physical space as the rest of the map, and were loaded at all times. These interior sections were placed either right below the map or, in the case of San Andreas, so far above it that you'd hit the invisible ceiling long before you could even see them.

Players could even use mods to pass through this otherwise impenetrable barrier to access the interior sections without the loading screen, however this way their functionality was limited and not all assets were present. The loading screens hid the loading of some props that weren't there before as well as the various scripts that lent the area its functions. Odd thing is, these weren't particularly resource intensive, even back then, so loading up most of the interiors without these finals bells and whistles was an odd choice.

The entirely singleplayer 3D era games also didn't really need to worry about instancing, since there was no issue of multiple players in the same session owning the same property. Technically, the interiors very well might have been placed inside the actual buildings where they belong, and true enough, some of them are, while others are not.

Instancing is one of the less apparent forms of video game trickery and optimization, and an aspect that few gamers really think about when they don't encounter strange phenomena like the one described in the Reddit post. However, if the next time you "hear" a commotion just outside your property, remember that it might be half the map away!

Logan Smith

Logan is our resident GTA 5 cheat code and guide expert, and has been a gamer ever since he could pick up a controller - over 30 years ago! You'll find him roaming the streets of Los Santos most often, though San Andreas gets bought out occasionally! Logan on Twitter.