ghostland-game

This is a continuation of my goland-game project.

While the previous project was implemented in go, for this project I was not able to get the go bindings for OpenGL working, and so I went with C++.

Repository Guidelines outlines code structure, build steps, and contribution conventions.

Configuration (ghostland.json)

ghostland.json is parsed at startup with a minimal line-by-line reader, so keep it a flat list of key-value pairs ("key": value). Omitted keys fall back to in-code defaults.

Key Type Default Description
camera_speed float 20.0 Scales how fast the free camera pans when you move the mouse to the screen edge or hold movement keys. Raise for faster fly-through, lower for precise adjustments.
ghost_reset_distance float 10.0 Minimum distance (units) between the player and the nearest ghost before the player is snapped back to the maze start. Increase for a safer buffer, decrease for higher tension.
ghost_count int 800 Number of ghosts spawned across the maze at startup.
minimap_enabled int 1 Set to 0 to disable the minimap overlay entirely.
minimap_width / minimap_height int 200 / 200 Size in pixels of the minimap rectangle rendered in the bottom-left corner.
minimap_margin int 16 Padding (pixels) between the minimap and the screen edges.
minimap_wall_[rgb] float 0.0 / 0.0 / 0.0 Wall line color per channel (01).
minimap_background_[rgb] float 1.0 / 1.0 / 1.0 Background fill color per channel (01).
minimap_arrow_[rgb] float 1.0 / 0.0 / 0.0 Player arrow color per channel (01).
minimap_zoom float 2.0 Zoom level (pixels per world unit) for the minimap.
minimap_breadcrumb_[rgb] float 1.0 / 0.3 / 0.3 Breadcrumb dot color per channel (01).
minimap_breadcrumb_radius float 3.0 Breadcrumb radius in pixels.
breadcrumb_max_distance float 200.0 Bread crumbs beyond this world-space distance from the player are not drawn (both in-world and on the minimap).
minimap_ghost_fill_[rgb] float 0.9 / 0.9 / 1.0 Ghost dot interior color on the minimap.
minimap_ghost_border_[rgb] float 0.2 / 0.2 / 0.4 Ghost dot border color.
minimap_ghost_radius float 4.0 Ghost indicator radius in pixels.

Example:

{
    "camera_speed": 30.0,
    "ghost_reset_distance": 8.5,
    "ghost_count": 600,
    "ghost_count": 600,
    "minimap_enabled": 1,
    "minimap_width": 220,
    "minimap_height": 220,
    "minimap_margin": 24,
    "minimap_wall_r": 0.0,
    "minimap_wall_g": 0.0,
    "minimap_wall_b": 0.0,
    "minimap_background_r": 1.0,
    "minimap_background_g": 1.0,
    "minimap_background_b": 1.0,
    "minimap_arrow_r": 1.0,
    "minimap_arrow_g": 0.0,
    "minimap_arrow_b": 0.0,
    "minimap_zoom": 2.0,
    "minimap_breadcrumb_r": 1.0,
    "minimap_breadcrumb_g": 0.3,
    "minimap_breadcrumb_b": 0.3,
    "minimap_breadcrumb_radius": 3.0,
    "breadcrumb_max_distance": 200.0,
    "minimap_ghost_fill_r": 0.9,
    "minimap_ghost_fill_g": 0.9,
    "minimap_ghost_fill_b": 1.0,
    "minimap_ghost_border_r": 0.2,
    "minimap_ghost_border_g": 0.2,
    "minimap_ghost_border_b": 0.4,
    "minimap_ghost_radius": 4.0
}

Minimap Overlay

The minimap is a HUD overlay that reuses data parsed from maze.txt to draw a scrolling view of the maze. Player breadcrumbs are recorded every second and rendered as solid discs so you can retrace recent movement. Ghosts are displayed as border + fill circles that remain unrotated while the player arrow rotates with camera yaw. Tweak the overlays sizing, colors, and zoom via ghostland.json—when minimap_zoom increases, the entire map scales up; breadcrumb/ghost radius and colors are controlled by the dedicated minimap_breadcrumb_* and minimap_ghost_* keys described above.

gameplay capture

Description
Navigate a maze and avoid ghosts. C with opengl.
Readme 412 KiB
Languages
C 84.9%
C++ 12.6%
Python 1.3%
GLSL 0.9%
Makefile 0.3%