Skip to content

Minimap

The minimap is a tactical 2D projection of nearby map cells centered on the player.

It exposes local topology that is not always obvious in first-person view: player position, heading, nearby walls, floor and void separation, and door state.

Bonus minimap

A rebuilt-per-frame map-space overlay centered on the player

The minimap samples nearby cells, classifies runtime geometry, draws the player heading, and composites the result before the HUD layer.

01
coordinate transform

For each sampled map cell, local offset becomes minimap pixel position.

dx = mx - floor(player.x)
dy = my - floor(player.y)

sx = origin_x + (dx + radius) * tile_size
sy = origin_y + (dy + radius) * tile_size

draw_rect(minimap, sx, sy, tile_size, color)
02
cell classification

Color is derived from semantic tile state, including dynamic doors.

wall floor void closed door open door player
interactive minimap model

Click the world map to move the player. Change zoom to resize sampled tiles.

2D map input
minimap radius 7 cells

click the map to move the player

01
map cell -> minimap pixel

sample a fixed radius around the player and convert local cell offsets into tile rectangles

02
semantic tile colors

walls, floor, void, doors, player marker, and heading are classified every frame

03
zoom changes tile size

larger tile size means stronger local detail, smaller tile size shows more context

OK
composite before HUD

minimap is drawn after world/sprites and before the final screen-space HUD overlay

The minimap is rebuilt every frame from current runtime state:

  • app->map.grid provides static layout.
  • app->player provides dynamic position and direction.
  • app->bonus.doors provides door passability/open state.
  • app->bonus.retro owns the minimap image buffer and zoom state.

The minimap is drawn after world raycasting and sprite rendering, then before the HUD. This keeps it part of the world overlay while leaving the HUD readable.

  • srcs_bonus/retro/minimap.c
  • srcs_bonus/retro/minimap_pixels.c
  • srcs_bonus/retro/api.c
  • include/defines_bonus.h