Blockmap

From SRB2 Wiki
(Redirected from BLOCKMAP)
Jump to: navigation, search

The blockmap is a data structure used for collision detection in a map, provided by the resource lump called BLOCKMAP – it is used for a number of situations such as calculating when a moving Object hits a linedef or when two Objects (one or both moving) collide.

The blockmap is simply a grid of "blocks"', each of which is a size of 128×128 fracunits. Each of these blocks stores a linked list of all linedefs, Objects and PolyObjects located within themselves. Through these lists, a moving Object only needs to check through any blocks it takes up for detecting collisions with these map components, rather than the entire map. Whenever an Object or PolyObject changes position, the blockmap lists for these will be updated for the old and new positions' blocks.

If an Object has the primary flag MF_NOBLOCKMAP checked, the Object will be removed from the blockmap links for the block it is physically located in, making the Object effectively intangible to any moving Objects that would attempt to collide with it. This does not prevent such an Object from colliding with other Objects when it is moving itself, however.

When development mode is enabled and the automap is being shown, the blockmap for the current map can be seen by toggling the grid on. Note that not all maps will have a BLOCKMAP lump included with them in a WAD file; in this situation, SRB2 can build a new blockmap for the map from scratch. This is usually required when the map is too large for a blockmap to be successfully generated (due to a size limitation).

External links

  Map components [view]

ThingLinedefSidedefVertexNodeSectorRejectBlockmap