Flexible Dungeon Depth and Map Layout

When reimplementing the roguelike engine in Swift, one design goal was to modernize how the dungeon is presented on mobile devices.

Classic roguelikes were designed for terminal displays with fixed character grids, often using layouts such as 80×25 rectangles. That constraint shaped how levels were built and rendered.

On modern iOS devices, those limitations no longer apply. Because the game supports zooming and panning, the dungeon view is not restricted to a fixed terminal window. This made it possible to rethink how levels are structured.


From Rectangular Maps to Square Maps

Traditional roguelikes frequently use rectangular maps that match the shape of terminal screens.

In the Swift reimplementation, each dungeon level uses a square map instead.

This change was made for several reasons.

Better Camera Movement

The iOS version allows the player to:

A square map provides a more balanced exploration space when the player is freely moving the camera.

Consistent Exploration Radius

Because the player can zoom the map, the visible region is not limited by a fixed screen grid. A square dungeon ensures the player can explore evenly in all directions without the level feeling wider than it is tall.

Simpler Layout Design

Procedural generation algorithms often behave more predictably when the map dimensions are symmetrical. Square layouts help avoid bias toward horizontal or vertical corridors.

Although this change may seem small, it fits naturally with the touch-driven interface of modern mobile devices.


Supporting Multiple Dungeon Depths

Another change in the Swift reimplementation is support for different dungeon depths.

Instead of forcing every run to contain the same number of levels, the engine allows different depth configurations.

Each configuration defines how many levels the player must descend before reaching the final objective.

Conceptually:

enum DungeonDepth {
    case short
    case standard
    case extended
}

Internally, this simply adjusts the value that represents the deepest dungeon level.


Why Depth Matters

Changing dungeon depth affects the overall structure of a run without altering the layout of individual levels.

Run Length

Shorter dungeons allow faster play sessions.

Longer dungeons create extended adventures that require more planning and resource management.

Difficulty Curve

More levels allow the game to gradually introduce stronger monsters and more complex encounters.

Replay Variety

Allowing players to choose different depths creates different types of runs even though the core generation algorithms remain unchanged.


Keeping Level Generation Stable

An important design decision was to keep individual level dimensions fixed.

Instead of resizing the map or altering room generation algorithms, the game simply changes how many levels are generated.

This ensures that:

Only the overall length of the dungeon changes.


Player Choice

The engine is designed so players can select the dungeon depth before starting a new run.

For example:

Depth Setting Experience
Short Quick run, faster gameplay
Standard Classic roguelike pacing
Extended Longer exploration and deeper progression

This flexibility allows players to choose the type of adventure they want without affecting the core mechanics of the game.


Final Thoughts

Modern hardware allows roguelike engines to move beyond the limitations of classic terminal displays.

By switching from rectangular maps to square levels, the Swift reimplementation better supports touch controls such as zooming and panning on iOS devices.

At the same time, introducing multiple dungeon depth settings allows the game to offer both short and extended runs while preserving the balance of individual dungeon levels.

These changes maintain the spirit of traditional roguelikes while adapting the experience to modern platforms.