# Key Concepts

A **grid point** is a vector with integer coordinates. Grid points support all the usual vector operations such as addition, subtraction and multiplication with a scalar (which has to be an integer). Grid points can be 2D or 3D. 1D “grid points” are simply integers, and when we use “grid point” when talking about grids of any dimension, we include integers. See GridPoint2 and GridPoint3.

A **grid **is a data structure, similar to an array. Grids can be 1D, 2D, or 3D, and are indexed with int, GridPoint2 or GridPoint3. Grids can contain any data (integers, game objects, other grids). We usually talk about the data in the grid as its cells – there is one cell for each grid point that is inside the grid. You can also view grids as dictionaries. The grid points are the keys, and the cells are the values. See Grid1, Grid2, and Grid3.

Grids have a “shape” – they can be rectangular or cross-shaped or any other collection of cells. Shapes are also useful for other purposes, such as in many grid algorithms. You can think of a shape as a set of grid points.

An **implicit shape **is an object that can tell whether a grid point is inside the shape or not. Implicit shapes can be 1D, 2D, or 3D. See IExplicitShape.

An **explicit shape** is an object that is an implicit shape, and in addition, can produce the points (as an IEnumerable) inside it and give its bounds as a GridInterval (1D), GridRect (2D), or GridBounds (3D). These three objects are themselves explicit shapes. See IImplicitShape.

Grids implement all the methods of explicit shapes, so another way to view grids is that they are explicit shapes with a piece of data associated with each grid point inside the shape.

A **forward map **is an object that converts one thing to another. It is similar to Func<T, U>, but does its calculation through a method called Forward. See IForwardMap.

A **reverse map** is *also* a an object that converts one thing to another, but represents an inverse function. It is therefore similar to Func<U, T>, but does its calculation through a method called Reverse. See IReverseMap.

A **map** is both a forward and reverse function. It can convert one thing to another, and can also covert it back. They are *almost* like invertible mathematical functions, but they may not necessarily be *completely * invertable. For example, a map can represent a conversion from 3D to 2D space. In this case, the forward function maps many 3D points to the same 2D point. So map.Reverse(map.Forward(x)) will not in general equal x. Maps are internally used for converting between Unity world coordinates to grid coordinates. See IMap and Map.

A **space map** is a map that operates on Vector3. It can, for example, represent a translation, or rotation, or something more interesting like a polar transform.

A **round map** is a map that converts a Vector (or float) to a grid point (or int). It basically takes continuous space, and makes it discrete. Rounding (as implemented by Mathf,Round) is one type of operation that can be represented with a round map.

A **grid map** is the functional composition of a space map and a round map. That’s a complicated way of saying the maps are applied in sequence. The combination of the space and round map is used to do a conversion from Unity world space and grid space (and vice versa). The GridMap class supports methods such us WorldToGrid so that it easier to get the conversion you want. You should seldom need to work with space maps and round maps individually.

As mentioned before, grids can have any type of data, but you usually want some concrete representation of your grid in the game engine. A **grid builder** is a component that builds such a concrete grid in the editor.

A **tile grid** is a grid where each cell is a separate game object (typically a sprite or a mesh).

A **mesh grid** is a grid that is a single mesh. There is a grid builder for each type of grid.

A **grid behaviour** is a MonoBehaviour (in fact, a GLMonoBheviour) that gives you convenient access to the grid, the grid map, and the grid builder. See GridBehaviour.