2
\$\begingroup\$

I am interested in how a large area 3D environment in games like Grand Theft Auto V or Far Cry can be stored (on disk, in what file format) and how that data can be retrieved when it is used in a game. By "the environment" I mean only static objects like terrain with vegetation, city areas with buildings, et cetera. I'm not referring to temporary or moving objects like people or cars. I am not interested in scene rendering.

I guess it may be convenient to shard (horizontally partition) the data by location creating something like "tiles" because it is usually accessed by location and such tiling will help to keep data that is related together (and reads will be faster). Also I guess the data for sure is stored in some (compressed?) 3D format with the respect to tiling. There probably have to be mechanisms that will split one object to two (or more) parts if it does not fit into a single tile.

I have found a somewhat related question (How a 3D game map is stored and handled) but it only briefly answers small part of my question.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The details you surmise basically sum up how this is done: the map is broken into pieces (whether by regular tiles, quad/octrees, logical chunks like neighbourhoods, or visibility regions connected by portals), and streamed in as needed. The main detail you're missing is level of detail: games will often store multiple versions of a region, and load a low-detail version when it's barely visible in the distance, upgrading to more detailed versions as you get closer. That's about as far as we can go for an overview - if you have a more specific question about your own implementation, ask that. \$\endgroup\$
    – DMGregory
    Commented Mar 1, 2017 at 23:05
  • \$\begingroup\$ The aspect of your question where you are, essentially, asking us to point you at some existing open-source implementation or similar isn't on-topic here (so I've removed it). You might try asking it over at GDNet however. \$\endgroup\$
    – user1430
    Commented Mar 2, 2017 at 15:28

1 Answer 1

2
\$\begingroup\$

Large levels are usually stored, as you guessed, broken up into small levels that can be streamed in and out of memory as they are needed. Generally all of the information needed for each chunk of the world is stored with that chunk (terrain, buildings and props, vegetation, LOD information, et cetera) although in some cases there will also be an overall umbrella or container level, always loaded, which may impart some data to the individual streamed chunks as they are loaded.

The file format for this varies, generally every engine or framework will use something that is specific to that engine, usually optimized for getting that data off the disk and into memory in the format needed by the code as quickly as possible.

Objects generally are not sliced along the tile boundaries like you surmise. That's expensive and difficult to deal with. Usually an object will simply exist in one of the levels on the boundary, and not the others. Sometimes the object might be placed in all levels, but that also requires some management to handle correctly.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .