Isometric projection is a form of pseudo-3D in which the 2D icons used by BYOND can be arranged in a way to give the appearance of three dimensions. If you look at a map top-down, each tile on the map is a square. The map is rotated 45° clockwise and then tilted at an angle (30°) so that each square now looks like a foreshortened diamond from the viewer’s perspective. What was once north now points to the northeast end of the viewer’s screen; what was once east now points southeast to the viewer. Tiles that are more to the south or east are “nearer” to the viewer, and tiles that are north or west are “farther”. The actual direction the map faces can be changed by using client.dir
.
It is important to remember that this is an illusion of 3D, not real 3D.
To use isometric mapping, set world.map_format
to ISOMETRIC_MAP
. You should set world.icon_size
so the tile width is a multiple of 4 pixels. The width of the tile is highly important. The height of your tiles should be at least half that value. BYOND uses a 2:1 isometric format, meaning that the diamond base of each tile is half as high as its width. For example if you have a 64x64 tile size, every diamond in the map will be 64 pixels wide by 32 high, and you have an extra 32 pixels at the top of your icon for vertical projections like buildings. If you set the tile size to 64x80, the base is still a 64x32 diamond and you have 48 pixels left over for vertical structures.
In this mode pixel_x
and pixel_y
will offset icons along the “ground”. To adjust horizontal and vertical positions, use the pixel_w
and pixel_z
vars.
Layers
The layer
var behaves differently in isometric mode. Because some tiles are nearer to the viewer than others, the tiles that are farther back need to be drawn first so they are behind any tiles that should go in front of them. So in isometric mode, the back row of tiles (a diagonal line of them) is drawn first, followed by the next row forward, and so on. The layer
var only matters when icons overlap each other in the “physical” space, like an obj sitting on a turf.
When pixel or step offsets, or gliding, place an object on multiple turfs, it is drawn on top of the nearer turf (assuming its layer is higher).
Using icons wider than the regular tile size can have an impact on layering as well. See Big icons for more information.
Because of the order in which icons are drawn, you may want to limit the ability of an atom to cut diagonally around corners. While moving northeast behind a dense wall, for instance, a mob might temporarily appear in front of the wall because its pixel offsets (from gliding) temporarily put it on the same tile as the wall. If you do not want to limit corner-cutting, a simple workaround for this case is to give the wall a higher layer than the mob.
Screen objects (in client.screen
) are always drawn on top of all isometric tiles, as is the case in other map modes as well.
Since it may be desirable in some games to use a topdown map for some situations (like a special battle map), you can add TOPDOWN_LAYER
to any atom’s layer—e.g., TOPDOWN_LAYER+TURF_LAYER
—to make it appear in topdown mode. Topdown and isometric tiles really aren’t meant to be mixed, but if they do mix you’ll see topdown tiles always display above isometric tiles, just like screen objects do. The best way to use this is to apply TOPDOWN_LAYER
to every tile in a certain part of the map that the players can’t walk to.
If you want to use an overlay that should not be covered by other “nearer” icons on the map, such as a name or health meter, you can add EFFECTS_LAYER
to the overlay’s layer. Icons with EFFECTS_LAYER
will draw above regular icons. Then objects with TOPDOWN_LAYER
will draw on top of everything else. However, be aware that EFFECTS_LAYER
has largely been superseded by the plane
var.
Screen size
In this mode, world.view
or client.view
is used to define the minimum number of map tiles you will see, not the screen/HUD size which is calculated from client.view. Extra map tiles are shown to fill out the screen size. HUD objects use screen coordinates, so 1,1 is still the lower left.
The actual HUD size is always a full number of tiles, whose size is defined by world.icon_size
. If you have a tile size of 64x64
, and world.view=6
(a 13x13 map), a full 13x13 diamond of map tiles will be shown. The width of this diamond is 13 tiles. The height is only half that, plus whatever vertical space is needed to show the icons in that area. Then everything is rounded up to a full tile size, so the result is a 13x7-tile screen. This is the formula you need if you want to calculate the screen size:
pixel_width = round(icon_width * (view_width + view_height) / 2)
pixel_height = round(icon_width * (view_width + view_height - 2) / 4) + icon_height
screen_width = round((pixel_width + icon_width - 1) / icon_width)
screen_height = round((pixel_height + icon_height - 1) / icon_height)
If you use TOPDOWN_LAYER
, any topdown sections of the map will be limited to this same view.
See also
- icon_size var (world)
- dir var (client)
- pixel_w var (atom)
- pixel_z var (atom)
- screen_loc var (movable atoms)
- Big icons
- Side-view maps
- Topdown maps
- HUD
- BACKGROUND_LAYER
- EFFECTS_LAYER
- **BROKEN LINK: /notes/topdown_layer**