roguelike

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Roguelike

Roguelike游戏开发手册

A playbook for roguelikes — the turn engine, procedural dungeons, field-of-view, permadeath, and run economy. This is a compositional skill: it orchestrates procedural generation, tilemaps, save handling, and AI into a run-based game. It does not re-teach noise/RNG or tilemap APIs; it defines the loop and the systems that make a run compelling.
这是一份Roguelike游戏开发手册——涵盖回合制引擎、程序化地牢、视野机制、永久死亡以及局内经济系统。这是一项组合式技能:它将程序化生成、瓦片地图、存档处理以及AI整合为一款以单次游戏进程(run)为核心的游戏。本手册不会重复讲解噪声算法/RNG(随机数生成)或瓦片地图API;它专注于定义让单次游戏进程充满吸引力的循环机制与核心系统。

When to use

适用场景

  • Use when building a turn-based, grid-based dungeon crawler where each death ends the run and the world is regenerated — a roguelike or "roguelite" (with meta-progression).
  • Use when designing procedural dungeons, FOV/fog-of-war, permadeath stakes, or loot tables.
When not to use: real-time action with roguelike dressing → build the action genre (
platformer
/
fps-shooter
) and layer
procedural-gen
. Deep stats/quests/dialogue without permadeath →
rpg
. Open-world needs/crafting →
survival-crafting
.
  • 适用于开发回合制、网格类地牢爬行游戏,这类游戏中玩家死亡即结束当前进程,世界会重新生成——即Roguelike或"Roguelite"(带有元进度机制)游戏。
  • 适用于设计程序化地牢、视野/战争迷雾、永久死亡机制或战利品表时。
不适用场景:带有Roguelike元素的实时动作游戏 → 应先构建动作类游戏(如
platformer
/
fps-shooter
),再叠加
procedural-gen
(程序化生成)机制。无永久死亡的深度数值/任务/对话类游戏 → 属于
rpg
(角色扮演游戏)范畴。开放世界需求/ crafting(制作)系统 → 属于
survival-crafting
(生存制作)范畴。

What makes it a roguelike (design anchor)

何为Roguelike(设计锚点)

The community reference is the Berlin Interpretation (RogueBasin, IRDC 2008): a set of "roguelikeness" factors, not a checklist. The high-value ones are the design targets: random environment generation, permadeath, turn-based, grid-based, non-modal (all actions in one mode), complexity (many item/monster interactions), resource management, hack-and-slash, and exploration & discovery. Lean into these to feel roguelike; pick which to keep deliberately. "Roguelite" usually relaxes permadeath with meta-progression.
社区参考标准是Berlin Interpretation(柏林诠释,RogueBasin,IRDC 2008):这是一套衡量"Roguelike属性"的指标,而非严格的清单。其中高价值的核心设计目标包括:随机环境生成、永久死亡、回合制、网格类、非模态(所有操作在同一模式下完成)、复杂度(大量物品/怪物交互)、资源管理砍杀探索以及探索与发现。紧扣这些要素才能打造出纯正的Roguelike体验;可根据需求有选择地保留。"Roguelite"通常会通过元进度机制放宽永久死亡的限制。

Core loop

核心循环

Take a turn (move / fight / use) → the world resolves its turn → see new state → descend / loot / survive → die and restart with a fresh dungeon. Replayability comes from the world changing each run, not the player memorizing a fixed layout.
玩家行动(移动/战斗/使用道具)→ 世界结算回合 → 查看新状态 → 深入地牢/收集战利品/存活 → 死亡后重启并生成全新地牢。 游戏的重玩价值来源于每次进程中世界的变化,而非玩家记忆固定的关卡布局。

Must-have systems

必备系统

  1. Turn scheduler — energy/initiative system so fast actors act more often (Pattern 2).
  2. Grid map + movement — tile coordinates; bump-to-attack; blocked/walkable queries.
  3. Procedural dungeon generator — rooms + corridors, or BSP/cellular; guarantee connectivity.
  4. Field of view + explored memory — what's visible now vs. seen-before (Pattern 3 / refs).
  5. Combat + entities — HP, attack/defense, status; monsters obey the same rules as the player.
  6. Loot + drop tables — weighted, depth-scaled item/monster spawning (refs).
  7. Permadeath + (optional) meta-progression — wipe the run; persist only unlocks/score.
  8. Message log + clear UI — the player reasons from text/state; surface numbers and events.
  1. 回合调度器 —— 能量/ initiative(行动顺位)系统,让速度更快的角色更频繁地行动(模式2)。
  2. 网格地图 + 移动系统 —— 瓦片坐标;碰撞攻击;可通行/不可通行检测。
  3. 程序化地牢生成器 —— 房间+走廊结构,或BSP(二叉空间分割)/细胞自动算法;确保所有区域连通。
  4. 视野 + 探索记忆系统 —— 当前可见区域与已探索区域的区分(模式3/参考资料)。
  5. 战斗 + 实体系统 —— HP、攻击/防御、状态效果;怪物与玩家遵循相同规则。
  6. 战利品 + 掉落表 —— 带权重、随地牢深度缩放的物品/怪物生成机制(参考资料)。
  7. 永久死亡 +(可选)元进度机制 —— 清除当前进程数据;仅保留解锁内容/得分。
  8. 消息日志 + 清晰UI —— 玩家通过文本/状态信息进行决策;直观展示数值与事件。

Design knobs

设计调节项

KnobEffectNotes
Dungeon size / room countrun length, densityScale with depth.
Connectivity guaranteeno unreachable roomsAlways verify reachability after generation.
Monster density / depth curvedifficulty rampSpawn by depth-weighted table.
Loot rarity weightspower varianceRarer = bigger swing; identify adds discovery.
FOV radius / lightingtension, informationSmaller radius = scarier, slower.
Resource scarcity (food/HP/ammo)pressure to descendCore tension lever in classic RLs.
Permadeath vs meta-progressionrun stakes vs. retentionRoguelite softens the wall.
Identification / unknownsexploration valueUnidentified items reward experimentation.
Seedable RNGdaily runs, debuggingAlways allow a fixed seed (see
procedural-gen
).
调节项效果说明
地牢大小 / 房间数量进程时长、怪物密度随地牢深度缩放。
连通性保障避免出现玩家无法到达的房间生成后务必验证所有可通行区域的可达性。
怪物密度 / 深度曲线难度梯度按深度加权表生成怪物。
战利品稀有度权重强度差异稀有度越高,强度波动越大;物品鉴定机制可提升探索乐趣。
视野半径 / 光照效果紧张感、信息获取半径越小,游戏越惊险、节奏越慢。
资源稀缺性(食物/HP/弹药)推进地牢的压力经典Roguelike游戏的核心紧张感来源。
永久死亡 vs 元进度机制进程风险 vs 玩家留存Roguelite通过元进度降低玩家的挫败感。
物品鉴定 / 未知物品探索价值未鉴定物品鼓励玩家尝试。
可种子化RNG每日挑战、调试务必支持固定种子(参见
procedural-gen
)。

Patterns

设计模式

1. Deterministic, seedable run RNG

1. 确定性、可种子化的进程RNG

python
undefined
python
undefined

Pseudocode. One seeded RNG per run makes dungeons reproducible (daily runs, bug repro).

Pseudocode. One seeded RNG per run makes dungeons reproducible (daily runs, bug repro).

run_seed = chosen_seed or random_seed() rng = Rng(run_seed) # use your engine's seedable RNG, not global random dungeon = generate_dungeon(rng, depth) # same seed + depth => same dungeon
run_seed = chosen_seed or random_seed() rng = Rng(run_seed) # use your engine's seedable RNG, not global random dungeon = generate_dungeon(rng, depth) # same seed + depth => same dungeon

Persist run_seed in the save so a crash can resume the same world (see save-systems).

Persist run_seed in the save so a crash can resume the same world (see save-systems).

undefined
undefined

2. Energy-based turn scheduler (speeds differ)

2. 基于能量的回合调度器(角色速度不同)

python
undefined
python
undefined

Pseudocode. Each actor gains energy each tick and acts when it has enough.

Pseudocode. Each actor gains energy each tick and acts when it has enough.

Faster actors gain more per tick, so they act more often — no fixed "player then enemies".

Faster actors gain more per tick, so they act more often — no fixed "player then enemies".

TURN_COST = 100 def next_actor(actors): while True: for a in actors: # stable order avoids ties favoring one side a.energy += a.speed # e.g. speed 100 = normal, 150 = hasted if a.energy >= TURN_COST: a.energy -= TURN_COST return a # this actor takes exactly one action now
undefined
TURN_COST = 100 def next_actor(actors): while True: for a in actors: # stable order avoids ties favoring one side a.energy += a.speed # e.g. speed 100 = normal, 150 = hasted if a.energy >= TURN_COST: a.energy -= TURN_COST return a # this actor takes exactly one action now
undefined

3. Field of view + explored memory

3. 视野 + 探索记忆

python
undefined
python
undefined

Pseudocode. Recompute visibility from the player each time they move.

Pseudocode. Recompute visibility from the player each time they move.

visible = compute_fov(map, player.pos, radius=8) # symmetric shadowcasting (see refs) for cell in visible: explored.add(cell) # remember it forever (dim "fog of war")
visible = compute_fov(map, player.pos, radius=8) # symmetric shadowcasting (see refs) for cell in visible: explored.add(cell) # remember it forever (dim "fog of war")

Render: visible -> lit; explored-but-not-visible -> dim; never-seen -> hidden.

Render: visible -> lit; explored-but-not-visible -> dim; never-seen -> hidden.


Use a proven FOV algorithm (recursive shadowcasting or symmetric shadowcasting). Do not
roll a naive raycast-per-cell — it produces asymmetric, "blinking" vision. See refs.

请使用成熟的FOV算法(递归阴影投射或对称阴影投射)。不要采用简单的逐单元格射线投射——这会产生不对称的"闪烁"视野。详见参考资料。

Pitfalls / failure modes

常见陷阱/失败模式

  • Disconnected dungeons → rooms the player can't reach. Always run a connectivity/flood-fill pass and carve corridors until every walkable cell is reachable.
  • Naive FOV → vision that flickers or is asymmetric (you see them, they don't see you). Use shadowcasting; test symmetry.
  • Real-time loop pretending to be turn-based → input races and double-moves. Resolve one discrete turn at a time; queue input.
  • Flat difficulty → no descent pressure. Scale monsters/loot by depth and keep resources scarce.
  • Permadeath that wipes meta-unlocks → frustration. Separate run state (wiped) from profile state (unlocks, scores) when saving (see
    save-systems
    ).
  • Save-scumming a "permadeath" game → delete or invalidate the run save on load if you want true permadeath; keep only the profile.
  • Unreadable state → the player can't plan. Show HP, turn results, and a message log.
  • 不连通的地牢 → 出现玩家无法到达的房间。生成后务必运行连通性/ flood-fill(洪水填充)检测,直到所有可通行单元格都可达才停止开凿走廊。
  • 简陋的FOV实现 → 视野闪烁或不对称(你能看到敌人,但敌人看不到你)。请使用阴影投射算法;测试对称性。
  • 伪装成回合制的实时循环 → 输入冲突与重复移动。每次只处理一个离散回合;对输入进行排队。
  • 扁平化难度 → 没有推进地牢的压力。随地牢深度缩放怪物/战利品强度,并保持资源稀缺。
  • 永久死亡清除元解锁内容 → 引发玩家挫败感。存档时需区分进程状态(清除)与档案状态(解锁内容、得分)(参见
    save-systems
    )。
  • "永久死亡"游戏中的存档刷分 → 如果想要真正的永久死亡机制,加载时删除或作废进程存档;仅保留档案数据。
  • 状态信息不清晰 → 玩家无法制定策略。展示HP、回合结果以及消息日志。

Composition (build it from these skills)

组合构建(基于以下技能)

  • Generation:
    procedural-gen
    (noise, seeded RNG, dungeon/room algorithms) — the engine of replayability.
  • Map rendering:
    godot-tilemap
    /
    unity-tilemap-2d
    for the grid;
    level-design
    for set-piece rooms/vaults.
  • Enemies:
    game-ai
    for monster decision-making (often simple on a grid: seek/flee/patrol).
  • Persistence:
    save-systems
    for run-resume, profile/meta-progression, and true permadeath wipes.
  • Scripting/data:
    godot-resources
    /
    unity-scriptableobjects
    to define items, monsters, and drop tables as data.
  • UI:
    godot-ui-control
    for the message log, inventory, and HUD.
  • Feel:
    game-feel
    for hit/death juice — screen shake and hit-stop that sell impacts on a turn-based grid.
  • 生成系统:
    procedural-gen
    (噪声、可种子化RNG、地牢/房间算法)—— 重玩价值的核心引擎。
  • 地图渲染:
    godot-tilemap
    /
    unity-tilemap-2d
    用于网格地图;
    level-design
    用于固定场景房间/保险库。
  • 敌人系统:
    game-ai
    用于怪物决策(网格上通常很简单:追击/逃跑/巡逻)。
  • 持久化:
    save-systems
    用于进程恢复、档案/元进度以及真正的永久死亡清除机制。
  • 脚本/数据:
    godot-resources
    /
    unity-scriptableobjects
    用于将物品、怪物以及掉落表定义为数据。
  • UI:
    godot-ui-control
    用于消息日志、背包以及HUD。
  • 游戏手感:
    game-feel
    用于命中/死亡反馈——回合制网格上的屏幕震动与 Hit-stop(帧停顿)能强化打击感。

References

参考资料

  • For dungeon-generation algorithms (rooms-and-corridors, BSP, cellular automata, connectivity), FOV (shadowcasting), and weighted loot/spawn tables, read
    references/generation-fov-loot.md
    .
  • 关于地牢生成算法(房间+走廊、BSP、细胞自动机、连通性)、FOV(阴影投射)以及加权战利品/生成表,请阅读
    references/generation-fov-loot.md