In other languages: Deutsch 日本語 Українська 简体中文

Map structure: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
TheBloke (talk | contribs)
Initial creation of page, merged from Tile, Chunk and Region
 
 
(25 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
 
'''Map structure''' describes the division of the game world into standard [[Units|units]]: tiles and chunks. Tiles are the building blocks of the game, upon which all distance and area measurements are based. Chunks are blocks of 32×32 tiles used for various area-based calculations.
'''Map structure''' refers to...


== Tile ==
== Tile ==
[[File:MapStructure-GridExample.png|thumb|right|400px|The tile grid shown in-game; chunks (32×32 tiles) are indicated by the thicker black lines. Click to see at higher resolution.]]


A '''tile''' is the smallest piece of the world map. The whole [[Factorio]] world is made out of them.
A '''tile''' is a square which defines the smallest possible piece of the game world; the map is built on a grid of tiles. The tile is the basis for all area and distance measurement. Entity sizes are defined in terms of tiles; for example the [[rocket silo]] - the largest entity in the game - is 9 tiles wide and 9 tiles high, usually referred to as 9×9. The smallest possible entity size is therefore one tile, 1×1. Examples of 1×1 entities include [[transport belts]] and [[chests]].


Tiles are used as a [[Units|unit]] for measuring area and distance.
The [[Map_generator#Maximum_map_size_and_used_memory|maximum size of the map]] is a square 2 million tiles on each side, a total of 4 trillion tiles. In practice the map in an average game is likely to be in the range of hundreds of thousands of tiles up to a few million at most.


A [[Chunk]] (32×32 tiles) is the next largest unit for area/distance.
=== Tile grid alignment ===


=== How to see tiles and chunks? ===
Almost all placeable entities are aligned to the tile grid when placed in the game. Exceptions include the [[land mine]] and vehicles such as the [[car]], [[tank]], [[locomotive]] and [[wagon]]s.  Non-placeable entities that do not align to the grid include [[enemies]], [[tree]]s and decoratives.


You can either
[[File:MapStructure-PlaceableOffGridExample.png|thumb|none|300px|A few entities can be placed without aligning to the tile grid; this example shows cars, tanks and landmines.]]
* pause the game (by default with [[Keyboard bindings|Shift-Space]]) or
* you can use the [[Debug mode]] to turn the tile-layer on.


== Examples ==
=== Example distances ===


* Area covered by [[Radar]]: about 100 tiles diameter (100 tiles in each direction, bounded to the matching [[Chunk]], read about [[Radar]] to understand this)
* Area covered by [[Radar]]: about 200 tiles diameter (100 tiles in each direction, bounded to the matching [[#Chunk|chunk]]).
* Speed of a basic [[Transport belt]]: about 1.8 tiles/sec.
* It takes about 1 minutes and 52 seconds for a player to run 1000 tiles without being given a speed boost (such as via an [[exoskeleton]]).
* It takes about 1 minutes and 52 seconds to run 1000 tiles without speed up. <sup>[https://wiki.factorio.com/Talk:Exoskeleton#Movement%20speed%20experiments]</sup> (As a side note, this would mean that the character is a very healthy person.)


== Real size of tiles ==
=== Real world size analogy ===


1 tile is generally assumed to be 1 square meter in size (like Minecraft). According to [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=9182&p=73352#p73349 this discussion], this assumption seems to be true.
One tile is generally assumed to be one square meter in size. This measurement is proven to be technically true, and can be verified in-game. A test conducted via car will reveal that covering 250 tiles at 208.0 km/h (57.777 m/s) will take 260 game ticks (4.333 s). Using this data, it can be proven that <code>57.777 m/s ÷ (250 tiles / 4.333 s) ≈ 1 m/tile</code>.
<!-- This experiment was performed and verified by the editor. -->


== Chunk ==
== Chunk ==


A Chunk is a [[units|unit]] defined as either an area of the map 32×32 [[tile]]s in size (containing 1024 tiles in total) ''or'' a distance of 32 tiles.
[[File:radar_revealing_sectors.gif|thumb|220px|Animation of radars revealing chunks.]]
 
Chunks are used for:
* Map generation. When the [[player]] runs around, has a [[radar]] explore the map via sectors or has [[artillery shell]]s fired across long distances, the map is revealed in chunks.
* Chunks are "switched off" to save CPU cycles. If nothing important happens in a chunk (e.g. there are only fishes swimming around in the chunk) the chunk is not computed in the next [[Tick]].
* The [[pollution]] model is based on chunks, and pollution spreads to neighboring chunks.


== Region ==
The map is divided into a grid of '''chunks''', each 32x32 tiles (1024 tiles total).


A '''Region''' is 16 by 16 [[Chunk]]s large.
Several mechanics work on a chunk-by-chunk basis:
* The map is generated chunk-by-chunk during play. A 20x20 chunk area around each player is slowly generated over time, or immediately if revealed directly and not yet generated.
* [[Player|Players]], [[Radar|radars]], [[Roboport|roboports]], [[Spidertron|spidertrons]], and fired [[Artillery|artillery shells]] reveal chunks and provide [[Radar#Coverage|live coverage]] in remote view on a chunk basis.
* [[Pollution]] and [[Spores|spores]]{{SA}} are calculated and spread on a chunk basis. (This can generate chunks without revealing them.)
* [[Enemies#Expansions|Enemy expansion]] is calculated on a chunk basis.
* [[Demolisher]]{{SA}} territories are chunk-aligned.
* Enemy pathfinding works in multiple stages, and the first stage is chunk-based. [https://factorio.com/blog/post/fff-317] An unintended result is enemies tend to walk along chunk borders. Also biters and spitters will sometimes attack obstacles at chunk borders that they would normally navigate around.
* To reduce computation, entire chunks are set inactive when nothing important is happening in them. E.g.: Chunks with only fish or idling enemies may be set inactive, halting their idle movement.


Regions are actually not used anywhere in-game except for the debug info (no game mechanic depends on regions, no scripting functions have access to regions), and currently they are only used for organizing allocations.
== Visualizing tiles and chunks in-game ==


There is a chance that they will be removed completely in the future.
A tile grid overlay is available which shows the grid upon which the map is built:


== References ==
* The grid can be shown whenever the player pauses the game (by default with {{Keybinding|shift|space}}).
* http://www.factorioforums.com/forum/viewtopic.php?f=18&t=5754
** This is configured under Settings->Interface->'''Show grid when game is paused'''.
* To see the grid while the game is still running, [[Debug mode|debug settings]] can be used:
** Pressing {{Keybinding|F4}} will show the '''Debug settings''' window.
** Ticking '''show-tile-grid''' under '''always''' will show the grid at all times; ticking it under '''debug''' will show it only when debug mode is activated.
** If '''debug''' is chosen the grid will become visible whenever {{Keybinding|F5}} is used to enable debug display. Configuring debug mode in this way allows {{Keybinding|F5}} to be used as a convenient toggle for turning the grid on and off, which can be useful when attempting to place entities according to a neat and/or symmetrical design.


== See also ==
{{C|Main}}

Latest revision as of 03:48, 30 August 2025

Map structure describes the division of the game world into standard units: tiles and chunks. Tiles are the building blocks of the game, upon which all distance and area measurements are based. Chunks are blocks of 32×32 tiles used for various area-based calculations.

Tile

The tile grid shown in-game; chunks (32×32 tiles) are indicated by the thicker black lines. Click to see at higher resolution.

A tile is a square which defines the smallest possible piece of the game world; the map is built on a grid of tiles. The tile is the basis for all area and distance measurement. Entity sizes are defined in terms of tiles; for example the rocket silo - the largest entity in the game - is 9 tiles wide and 9 tiles high, usually referred to as 9×9. The smallest possible entity size is therefore one tile, 1×1. Examples of 1×1 entities include transport belts and chests.

The maximum size of the map is a square 2 million tiles on each side, a total of 4 trillion tiles. In practice the map in an average game is likely to be in the range of hundreds of thousands of tiles up to a few million at most.

Tile grid alignment

Almost all placeable entities are aligned to the tile grid when placed in the game. Exceptions include the land mine and vehicles such as the car, tank, locomotive and wagons. Non-placeable entities that do not align to the grid include enemies, trees and decoratives.

A few entities can be placed without aligning to the tile grid; this example shows cars, tanks and landmines.

Example distances

  • Area covered by Radar: about 200 tiles diameter (100 tiles in each direction, bounded to the matching chunk).
  • It takes about 1 minutes and 52 seconds for a player to run 1000 tiles without being given a speed boost (such as via an exoskeleton).

Real world size analogy

One tile is generally assumed to be one square meter in size. This measurement is proven to be technically true, and can be verified in-game. A test conducted via car will reveal that covering 250 tiles at 208.0 km/h (57.777 m/s) will take 260 game ticks (4.333 s). Using this data, it can be proven that 57.777 m/s ÷ (250 tiles / 4.333 s) ≈ 1 m/tile.

Chunk

Animation of radars revealing chunks.

The map is divided into a grid of chunks, each 32x32 tiles (1024 tiles total).

Several mechanics work on a chunk-by-chunk basis:

  • The map is generated chunk-by-chunk during play. A 20x20 chunk area around each player is slowly generated over time, or immediately if revealed directly and not yet generated.
  • Players, radars, roboports, spidertrons, and fired artillery shells reveal chunks and provide live coverage in remote view on a chunk basis.
  • Pollution and spores are calculated and spread on a chunk basis. (This can generate chunks without revealing them.)
  • Enemy expansion is calculated on a chunk basis.
  • Demolisher territories are chunk-aligned.
  • Enemy pathfinding works in multiple stages, and the first stage is chunk-based. [1] An unintended result is enemies tend to walk along chunk borders. Also biters and spitters will sometimes attack obstacles at chunk borders that they would normally navigate around.
  • To reduce computation, entire chunks are set inactive when nothing important is happening in them. E.g.: Chunks with only fish or idling enemies may be set inactive, halting their idle movement.

Visualizing tiles and chunks in-game

A tile grid overlay is available which shows the grid upon which the map is built:

  • The grid can be shown whenever the player pauses the game (by default with SHIFT + SPACE).
    • This is configured under Settings->Interface->Show grid when game is paused.
  • To see the grid while the game is still running, debug settings can be used:
    • Pressing F4 will show the Debug settings window.
    • Ticking show-tile-grid under always will show the grid at all times; ticking it under debug will show it only when debug mode is activated.
    • If debug is chosen the grid will become visible whenever F5 is used to enable debug display. Configuring debug mode in this way allows F5 to be used as a convenient toggle for turning the grid on and off, which can be useful when attempting to place entities according to a neat and/or symmetrical design.