Menu

My room generator passed every test and still locked players in
📰

My room generator passed every test and still locked players in

DEV Community: dart·Felix Helleckes·1 day ago
#AF16etga
#devtodart#devto#dev#room#door
Long article (1420 words) — no AI summary yet.
Reading 0:00
15s threshold

Dash & Slash is a small one-hand roguelite I build in Flutter. Every room is generated: a 13 by 21 tile grid, a door at the top, the player spawning at the bottom, and a few mirrored "stamps" of walls and pits in between. Shortly after version 1.0.0 went live on Google Play, a room turned up where the door opened and the player could never reach it.

The fix was three lines. The interesting part, at least for me as a QA engineer, is why the existing test could never have caught it.

How the generator works

The generator is deliberately boring. It fills the room with floor, puts walls on the border and a closed door in the middle of the top row:

for ( var c = 5 ; c <= 7 ; c ++ ) { map . set ( c , 0 , T . doorClosed ) ; }

Enter fullscreen mode

Exit fullscreen mode

Then it drops two to four wall stamps and a few pit stamps at random positions. Every stamp is mirrored onto the other half of the room, so layouts look designed even though they are random.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.