Technical Samples     Tutorials     Web Player Commands     Demo

Demos

Shaders
Crash Cube
HydroBoat Race
Muridae Massacre
Sound Island
Tunnel

Making of Muridae Massacre: Creating a 2D Minimap or Radar

A common feature across many genres of games is to have a radar or mini-map in the GUI. Particularly in strategy and simulation games, 2D real-time maps of the game provide important information for the player. In designing MM, the team decided to include a mini-map of the level in order for the player to have quick access to gauge the overall situation. This mini-map would draw blips for rodents, traps, corpses, and so forth over a top-down drawing of the level’s layout.

To accomplish this goal, the team first reviewed Dev’s 2D drawing capabilities. Essentially, there are three different ways to create the effect of two-dimensional images (without using the SDK): 2D frames, 3D frames with constraints like Billboard BB, and Draw Rectangle BB. For the purposes of a simple radar or mini-map, Draw Rectangle BB most fits the requirements; both the size and color of the rectangle may be specified, which works well for distinguishing between different types of objects.

The included example composition implements two different types of radar. The top-most radar plots the objects in absolute relation to the world. The second radar plots the objects in relative relation to the orange arrow. An absolute system is best used for mini-maps integrated into the user interface. Most real-time strategy games use this method. The relative radar is useful for vehicle simulation games or first-person shooters, where the player is more interested in understanding a danger’s proximity to themselves than to the world.

The basic concept behind the absolute mini-map is fairly simple. An active area is defined in two dimensions (typically the X/Z plane). To plot an object, its coordinates are first converted into percentage values for each axis. For example, an object at an X position of 10 in an active area of 5 to 25 is at 25% X. Then, these percentage values are mapped onto a 2D frame on which to draw a blip for the object. If the 2D frame is 200 pixels wide, then the point to draw at will be 50 pixels from the side of the frame (which is what the 25% maps to). For more information on the implementation in Dev, see the comments in the absolute mini-map script.

The concepts behind the relative radar are somewhat similar to the absolute mini-map. First, an object’s world coordinates are converted into the local coordinate system of the entity we are drawing relative to. These local coordinates are converted into a 2D vector—this 2D vector describes which direction to draw a point relative to the center of a 2D frame. A range value is used to define the length of this vector relative to the size of the 2D frame. See the comments in the relative mini-map script in the example composition for more details on implementation.

The mini-map scripts are organized to draw arbitrary numbers of objects. An array is used to define a group to draw, and what color and sized blip to use. To draw more objects, simply create a group with them and add a new row to the array.

It should be noted that Draw Rectangle BB doesn’t require a 2D frame to draw upon. In fact, an interesting implementation for a map might be a full-screen display with transparent blips. The example composition implementation (in "minimap example.cmo") uses frames for easy position and scaling of the maps. Try dragging one around while the composition is playing.

Muridae