🎮
Platformer Chunks
gameType: "platformer-chunk"
Rhythm-based platform placement with jump arc validation. Generates platforms, hazards, collectibles, entry and exit points. Every chunk is validated for completability via jump physics BFS — the exit must be reachable, and all collectibles are checked for accessibility.
Interactive Example
🎮 Platformer Chunk
Rhythm-based platform placement with jump arcs
difficulty: 0.40completable ✓
🪙
🪙
🪙
⭐
🏃
🔺
🔺
Solid Platform🏃 Entry⭐ Exit🪙 Coin🔺 Hazard
Platforms
3
Hazards
2
Collectibles
3/3
Jump Height
4 cells
Try it
await pf.generate({
gameType: "platformer-chunk",
params: { width: 25, height: 12, jumpHeight: 4, platformDensity: 0.3 },
count: 1,
difficulty: { target: 0.50 }
})API Parameters
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
width | number | Yes | 30 | Chunk width in cells. Range 15–60. |
height | number | Yes | 15 | Chunk height in cells. Range 8–25. |
platformDensity | number | No | 0.3 | Platform density (0.1–0.8). Higher = more platforms. |
hazardDensity | number | No | 0.15 | Hazard density (0.0–0.6). Higher = more spikes/lava. |
jumpHeight | number | No | 4 | Maximum vertical jump in cells (2–8). |
Generation Details
The platformer chunk generator follows this process:
- Fill bottom row with solid ground
- Place platforms left-to-right in rhythmic groups, each reachable from the previous
- Horizontal gaps and vertical offsets scale with difficulty
- Platform widths decrease with difficulty (narrower = harder)
- Entry placed on the left ground, exit on the right (ground or last platform)
- Hazards placed on ground and between platforms (density scales with difficulty)
- Collectibles scattered above platforms and in jump arcs
- Validate: exit reachable via jump physics BFS, check all collectible accessibility
Jump Physics
The validator simulates platformer movement to verify completability:
- Walk: Move left/right on solid ground or platforms
- Jump: When grounded, jump up to
jumpHeightcells vertically - Jump arc: Horizontal reach up to 1.5× jump height during jumps
- Running jump: Horizontal leap without height gain (jumpHeight+1 cells)
- Gravity: Fall when not standing on solid/platform cells
Content Output
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
grid | PlatformerCell[][] | — | — | Cell types: "empty", "solid", "platform", "hazard", "collectible", "entry", "exit". |
platforms | Platform[] | — | — | Platform objects with x, y, width, and id. |
hazards | [y,x][] | — | — | Hazard positions. |
collectibles | [y,x][] | — | — | Collectible positions. |
entry | [y,x] | — | — | Level entry point. |
exit | [y,x] | — | — | Level exit point. |
jumpHeight | number | — | — | Jump height used for validation. |
Example Request
bash
curl -X POST https://api.gameplaygen.com/generate \
-H "Authorization: Bearer gg_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"gameType": "platformer-chunk",
"params": { "width": 40, "height": 15, "jumpHeight": 4, "platformDensity": 0.3 },
"count": 3,
"difficulty": { "target": 0.5 }
}'Tips for Game Integration
- ▸Infinite runner: Chain multiple chunks by matching exit→entry positions for endless levels.
- ▸Difficulty progression: Generate chunks with ascending difficulty for a complete level arc.
- ▸Collectible challenges: Use
metrics.solution.collectiblesReachablefor "collect them all" objectives. - ▸Custom physics: Adjust
jumpHeightto match your game's feel (higher = more forgiving).