Difference between revisions of "Map system"

From GTAMods Wiki
Jump to navigation Jump to search
(Item placement)
m
Line 1: Line 1:
This article descripes the most important aspects of the GTA map system. It gives an overview over different files and which role they play for the game. Also it descripes general information about the game.
+
This article describes the most important aspects of the GTA '''map system'''. It gives an overview over different files and which role they play for the game. Also it describes general information about the game.
  
=== Coord system ===
+
=== Coordinate system ===
 
+
All ''Grand Theft Auto'' games use the same coordinate system rules. Unlike [[wikipedia:DirectX|DirectX]] or [[wikipedia:OpenGL|OpenGL]] standard coordinate systems, a location in the game world gets defined by an east-west, north-south and a height information where the axis are:
All ''Grand Theft Auto'' games are using the same coord system rules. Unlike [[wikipedia:DirectX|DirectX]] or [[wikipedia:OpenGL|OpenGL]] standard coordinate systems a location in the game world gets defined by an east-west, north-south and a height information where the axis are:
 
  
 
* '''X''' – east-west direction
 
* '''X''' – east-west direction
Line 10: Line 9:
  
 
== Map file types ==
 
== Map file types ==
 
 
=== Map listing file ===
 
=== Map listing file ===
 
 
'' See main article: [[gta.dat]] ''
 
'' See main article: [[gta.dat]] ''
  
Line 18: Line 15:
  
 
=== Images ===
 
=== Images ===
 
 
'' See main article: [[IMG]] ''
 
'' See main article: [[IMG]] ''
  
Images are collections of different files for GTA. Since the [[model]]s and [[texture]]s get streamed to reduce the memory the game allocates they need to be loaded every time they are shown and not yet inside the memory. Files are combined to [[archive]]s to reduce the amount of processor and hard-drive time that comes with opening a file.
+
Images are collections of different files for GTA. Since the [[model]]s and [[texture]]s are streamed to reduce the memory the game allocates they need to be loaded every time they are shown and not yet inside the memory. Files are combined to [[archive]]s to reduce the amount of processor and hard drive access time that comes with opening a file.
  
 
=== Item definition ===
 
=== Item definition ===
 
 
'' See main article: [[IDE]] ''
 
'' See main article: [[IDE]] ''
  
Line 34: Line 29:
  
 
=== Item placement ===
 
=== Item placement ===
 
 
'' See main article: [[IPL]] ''
 
'' See main article: [[IPL]] ''
  
 
Item placement file store locations of (previously defined) objects or other aspects like [[ZONE|map zones]], [[CULL|culling zones]] or [[GRGE|garages]].
 
Item placement file store locations of (previously defined) objects or other aspects like [[ZONE|map zones]], [[CULL|culling zones]] or [[GRGE|garages]].
  
Just like item definitions are limited by an [[hardcoded]] index range map placements are limited to map boundaries which differes with each game.
+
Just as item definitions are limited by an [[hardcoded]] index range, map placements are limited to map boundaries which differs in each game.
  
 
==== Streaming IPLs ====
 
==== Streaming IPLs ====
 
+
''San Andreas'' also makes use [[IPL#Binary_format|streaming or binary item placement files]]. The game searches for streaming IPLs for each plain-text IPL file it loads inside the image files. Those binary item placement files are called just like their "parent" files with the additional "<code>_streamXX</code>" in front of the file extension. '''XX''' represents an incrementing number what means there can be multiple streaming files for one IPL file.
''San Andreas'' does also use [[IPL#Binary_format|streaming or binary item placement files]]. The game searches for streaming IPLs for each plain-text IPL file it loads inside the image files. Those binary item placement files are called just like their "parent" files with the addition "<code>_streamXX</code>" in front of the file extension. '''XX''' represents an incrementing number what means there can be multiple streaming files for one IPL file.
 
  
 
Some pseudo-code algorithm searching for streaming files could look like this:<source lang="cpp">void setupStreamsForItemPlacementFile(IPLFile* pSourceFile)
 
Some pseudo-code algorithm searching for streaming files could look like this:<source lang="cpp">void setupStreamsForItemPlacementFile(IPLFile* pSourceFile)
Line 72: Line 65:
 
{{N|4|SA|VC}}
 
{{N|4|SA|VC}}
  
[[Category:Map Formats]][[Category:GTA 3]][[Category:GTA LCS]][[Category:GTA VCS]]
+
[[Category:Map Formats]]
 +
[[Category:GTA 3]]
 +
[[Category:GTA LCS]]
 +
[[Category:GTA VCS]]

Revision as of 12:07, 17 April 2012

This article describes the most important aspects of the GTA map system. It gives an overview over different files and which role they play for the game. Also it describes general information about the game.

Coordinate system

All Grand Theft Auto games use the same coordinate system rules. Unlike DirectX or OpenGL standard coordinate systems, a location in the game world gets defined by an east-west, north-south and a height information where the axis are:

  • X – east-west direction
  • Y – north-south direction
  • Z – height information

Map file types

Map listing file

See main article: gta.dat

The map listing file is the first one to get loaded by the game, if a new game is started. It stores information about the files that define the map itself. Each file that defines a part of the map needs to be defined inside this file.

Images

See main article: IMG

Images are collections of different files for GTA. Since the models and textures are streamed to reduce the memory the game allocates they need to be loaded every time they are shown and not yet inside the memory. Files are combined to archives to reduce the amount of processor and hard drive access time that comes with opening a file.

Item definition

See main article: IDE

Item definition files are holding information about the appearance of a model inside the game.

An object typically gets defined by an unique index, a model file, a texture archive file, draw distance information and appearance flags. GTA also allows to define additional information for special objects (like time controlled or animated objects). Once defined an object can be placed multiple times.

To easily address objects every definition gets an unique index. The index range is different for each game and cannot be increased. It defines the size of the object definition pool – a structure holding all item definitions after the game has loaded all IDE files.

Item placement

See main article: IPL

Item placement file store locations of (previously defined) objects or other aspects like map zones, culling zones or garages.

Just as item definitions are limited by an hardcoded index range, map placements are limited to map boundaries which differs in each game.

Streaming IPLs

San Andreas also makes use streaming or binary item placement files. The game searches for streaming IPLs for each plain-text IPL file it loads inside the image files. Those binary item placement files are called just like their "parent" files with the additional "_streamXX" in front of the file extension. XX represents an incrementing number what means there can be multiple streaming files for one IPL file.

Some pseudo-code algorithm searching for streaming files could look like this:

void setupStreamsForItemPlacementFile(IPLFile* pSourceFile)
{
	// Pointer to the streaming item placement file
	IPLFile* pStreamFile(NULL);
	// Number of the current streaming file, starting with 0
	DWORD dwCurrentStream(0);

	// Search for streams inside an global image file pool as long as there are some
	// The method builds up the file name somehow like this:
	// sprintf(buffer, "%s_stream%d.ipl", pSourceFile->fileName, dwCurrentStream);
	while ((pStreamFile = searchForStreamingFile(pSourceFile, dwCurrentStream)) != NULL)
	{
		// Extent the current item placement file
		pSourceFile->extendItemPlacementFile(pStreamFile);
		dwCurrentStream++;
	}
}

However it is important that streaming files extent their base files since LOD indices are relative to the first index inside the original non-binary file.

See also