Difference between revisions of "Map system"

From GTAMods Wiki
Jump to navigation Jump to search
(See also)
m (Map file types)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
=== Coordinate 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 use the same coordinate system rules. Unlike [[wikipedia:DirectX|DirectX]] or [[wikipedia:OpenGL|OpenGL]] standard coordinate systems, GTA's coordinate system uses the following axes:
 
+
* '''X''' – east/west direction
* '''X''' – east-west direction
+
* '''Y''' – north/south direction
* '''Y''' – north-south direction
+
* '''Z''' – up/down direction
* '''Z''' – height information
 
  
 
== Map file types ==
 
== Map file types ==
Line 14: Line 13:
 
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.
 
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 ===
+
=== Archives ===
 
'' See main article: [[IMG]] ''
 
'' See main article: [[IMG]] ''
  
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.
+
Archives 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 ===
Line 33: Line 32:
 
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 as item definitions are limited by an [[hardcoded]] index range, map placements are limited to map boundaries which differs in each game.
+
Just as item definitions are limited by a [[hardcoded]] index range, map placements are limited to map boundaries which differs in each game.
  
 
==== Streaming IPLs ====
 
==== Streaming IPLs ====
Line 64: Line 63:
 
* [http://www.gtagarage.com/mods/show.php?id=9606 VC Map Cleaner] By Swoorup
 
* [http://www.gtagarage.com/mods/show.php?id=9606 VC Map Cleaner] By Swoorup
  
{{N|4|SA|VC}}
+
{{N|4|LCS|SA|VC|III}}
  
 
[[Category:Map Formats]]
 
[[Category:Map Formats]]
[[Category:GTA 3]]
 
[[Category:GTA LCS]]
 
 
[[Category:GTA VCS]]
 
[[Category:GTA VCS]]

Latest revision as of 13:51, 31 August 2020

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, GTA's coordinate system uses the following axes:

  • X – east/west direction
  • Y – north/south direction
  • Z – up/down direction

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.

Archives

See main article: IMG

Archives 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 a 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