🧩
Grid Stealth
gameType: "grid-stealth"
Grid-based stealth puzzles where the player must navigate from a start position to a goal while avoiding patrol entities. Patrols follow defined paths in loop or ping-pong patterns. This is the generator that powers Spinnerzeit's Nightly Feed game — the first "proven" GameplayGen generator. Difficulty scales via patrol count, path length, wall density, and patrol coverage.
Interactive Example
🧩 Grid Stealth Puzzle
Navigate from start to goal while avoiding patrol routes & vision cones
difficulty: 0.52verified ✓
▼
S
G▲
Start Goal WallGuard AGuard BGoal GuardVision
Grid Size
8×8
Patrols
3
Solution Steps
0
Difficulty
0.52
Try it
await pf.generate({
gameType: "grid-stealth",
params: {
width: 8, height: 8,
patrolCount: { min: 1, max: 4 },
patrolLength: { min: 3, max: 8 },
guardVisionRange: 2,
guardSpeed: 1
},
count: 1,
difficulty: { target: 0.60 }
})API Parameters
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
width | number | Yes | — | Grid width. Range 4–64. |
height | number | Yes | — | Grid height. Range 4–64. |
patrolCount | { min: number; max: number } | Yes | — | Range for number of patrol entities. Actual count scaled by difficulty within this range. |
patrolLength | { min: number; max: number } | Yes | — | Range for patrol path lengths (number of waypoints). Scaled by difficulty. |
entityTypes | string[] | No | ["guard"] | Types of patrol entities to use. E.g. ["guard", "camera", "drone"]. Entities are randomly assigned from this list. |
hasDetection | boolean | No | false | Whether entities have detection zones (vision cones). |
detectionRadius | number | No | — | Detection radius for entities (if hasDetection is true). |
allowObservation | boolean | No | false | Allow the player a waiting/observation phase before the first move. |
Common Request Options
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
count | number | Yes | — | How many puzzles to generate. |
difficulty.target | number | No | 0.5 | Numeric difficulty (0.0–1.0). Controls patrol count, path length, and wall density. Higher = more guards, longer paths, denser walls. |
seed | number | No | — | Seed for reproducible generation. |
Generation Details
The grid stealth generator:
- Places start position at the left center and goal at the right center
- Creates a 2-cell exclusion zone around start and goal (no walls or patrol starts here)
- Generates walls with density scaling from 10–25% based on difficulty, reduced near start/goal
- Creates patrol paths via random walks, avoiding the exclusion zone
- Each patrol gets a random type from
entityTypesand mode (bounce by default; loop at higher difficulties if path forms a closed circuit) - Validates that at least one viable path exists from start to goal avoiding all patrols
Content Output
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
width | number | — | — | Grid width. |
height | number | — | — | Grid height. |
start | [number, number] | — | — | Player start position [x, y]. |
goal | [number, number] | — | — | Goal position [x, y]. |
walls | [number, number][] | — | — | Wall/obstacle positions. |
patrols | Patrol[] | — | — | Array of patrol objects: { type: string, path: [number, number][], mode: "bounce" | "loop", patrolMode: "bounce" | "loop" }. Bounce = ping-pong (default), Loop = closed circuit (requires last waypoint adjacent to first). |
collectibles | [number, number][] | — | — | Optional collectible positions. |
Example Request
bash
curl -X POST https://api.gameplaygen.com/generate \
-H "Authorization: Bearer gg_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"gameType": "grid-stealth",
"params": {
"width": 12,
"height": 10,
"patrolCount": { "min": 2, "max": 6 },
"patrolLength": { "min": 3, "max": 8 },
"entityTypes": ["guard", "camera"]
},
"count": 3,
"difficulty": { "target": 0.5 }
}'Example Response
json
{
"content": [
{
"id": "gg_gs4k2m1",
"gameType": "grid-stealth",
"content": {
"width": 12,
"height": 10,
"start": [0, 5],
"goal": [11, 5],
"walls": [[3, 2], [3, 3], [5, 7], [7, 4], [8, 4]],
"patrols": [
{
"type": "guard",
"path": [[4, 1], [4, 2], [4, 3], [5, 3], [6, 3]],
"mode": "bounce",
"patrolMode": "bounce"
},
{
"type": "camera",
"path": [[7, 6], [7, 7], [7, 8], [8, 8]],
"mode": "loop",
"patrolMode": "loop"
},
{
"type": "guard",
"path": [[9, 2], [9, 3], [9, 4]],
"mode": "bounce",
"patrolMode": "bounce"
}
]
},
"metrics": {
"verified": true,
"difficulty": 0.52,
"balance": 0.88,
"novelty": 1.0,
"quality": 0.80,
"solution": ["R","R","D","R","R","R","U","R","R","R","R","R"],
"notes": ["3 patrols, viable path length 12, 2 guard types"]
}
}
],
"requested": 3,
"delivered": 3,
"stats": {
"totalCandidates": 5,
"totalValidated": 3,
"totalRejected": 2,
"totalTime": 890,
"avgDifficulty": 0.51,
"difficultyRange": [0.42, 0.61]
}
}Tips for Game Integration
- ▸Patrol animation: Use the
patrolModefield to animate patrols. "bounce" (default) means the guard ping-pongs back and forth (A→B→C→B→A). "loop" means the patrol wraps from the last waypoint back to the first (only when they are adjacent). - ▸Turn-based or real-time: The grid works for both. In turn-based mode, advance patrols one step per player move. In real-time, animate them at a fixed interval.
- ▸Multiple entity types: Use different entity types for different behaviors. E.g., guards move, cameras rotate, drones have wider detection.
- ▸Proven in production: This generator powers Spinnerzeit's Nightly Feed game. The exclusion zone around start/goal ensures the player always has a safe opening and clear ending.