← All work

CASE STUDY / C99 / PROCEDURAL DUNGEONS / ENEMY BEHAVIOR

1.44 MB :: Sectors of the Lost Disk

A constrained dungeon crawler combining generation, rendering, and enemy behavior. This case study follows the systems behind the image, with links to a fixed source revision.

1.44 MB :: Sectors of the Lost Disk gameplay
Screenshot of the existing project. The browser lab is a separate implementation.
96,256 B
Windows / UPX build recorded in size-log.md, not a new measurement.
15 floors
Procedural floor count documented in the README
C99
Public generation, game state, enemy AI, and raycasting code

ROLE & CONSTRAINTS

The problem and my scope.

Game design and C99 implementation. TIGR provides graphics/input; DCSS tiles are third-party CC0 assets.

How can a game fit exploration and readable turn-based interactions into a single floppy-disk budget?
CRaycastingBSPMinGW-w64

DESIGN DECISIONS / SOURCE EVIDENCE

Follow the implementation.

01

BSP rooms with L-shaped connections

Recursively partition the bounds and place a room in each leaf. Connect successive room centers in generation order with L-shaped corridors. Although a comment calls this MST-like, the implementation does not compute a minimum spanning tree.

src/map.c / bsp_split & connect_centers ↗
02

Enemies remember a last-seen position

An enemy updates its target when its tile is in the visible region. Chasing first tries a diagonal sign-step, then cardinal alternatives. Flags add erratic movement and teleportation. This is local rule-based behavior, not A* or learned AI.

src/mob.c / ai_step ↗
03

Separate rendering from game rules

DDA wall casting, perspective-correct floor/ceiling mapping, and depth-tested sprites live in render3d.c; turn progression lives in game.c. The size log records the cost of embedded images and successive UPX-compressed builds.

src/render3d.c / size-log.md ↗

LIMITATIONS & NEXT QUESTION

Limits and the next question.

  • The size log describes particular build stages. Rebuild size with different toolchains has not been verified here.
  • Rooms are connected in generation order. This project does not publish a multi-seed comparison of path length, branching, or reachability.
  • Local chasing can fail to navigate around obstacles. It does not guarantee shortest paths or advanced decision-making.

I want to evaluate fixed seed sets for reachability, route length, and pursuit success. The browser lab is a separate implementation that starts exploring that evaluation workflow.

REPRODUCTION / READING GUIDE

Inspect and reproduce.

Commands are from the public README. Native development and Windows submission builds are different targets. The existing game was not rebuilt during this website revision.

make mac
make run

# Windows submission / MinGW-w64 + UPX
make submit

The case study refers to a fixed public source revision, README, and project logs inspected on November 1, 2026.

FROM SOURCE TO EXPERIMENT

Take the next step.

Try terrain generation × pathfinding ↗