Skip to content

Add world options for feral human, military site and military/police vehicle spawn scaling - #1305

Closed
wnsnnnmwlls wants to merge 1 commit into
CrimsonCrossBunker:masterfrom
wnsnnnmwlls:topic/military-spawn-options
Closed

wnsnnnmwlls wants to merge 1 commit into
CrimsonCrossBunker:masterfrom
wnsnnnmwlls:topic/military-spawn-options

Conversation

@wnsnnnmwlls

@wnsnnnmwlls wnsnnnmwlls commented Nov 14, 2026 •

Copy link
Copy Markdown

SummaryFeatures "新增疯人、军事建筑与军警车辆生成量世界选项"#### Responsible human@wnsnnnmwlls#### Purpose of change玩家需要按口味调节末日世界的生成构成,但现有世界选项缺少三类常用调节:1. 疯人(feral humans)的刷新与常规怪物(僵尸等)完全耦合,无法实现「僵尸规模 0、疯人规模 1 → 世界中只见疯人」这类设定;2. 军事地点(mil_base、military_outpost、military helipad、military_bunker_1)的出现概率无法调节;3. 军警车辆(悍马、APC、警车、消防车等)混在民用载具组里刷出,没有独立开关。本 PR 为上述三类需求各提供一个世界生成滑条,数值风格与原版 SPAWN_DENSITY 一致(0.0–50.0,步长 0.1,默认 1.0)。#### Describe the solution新世界选项(src/options.cpp)- FERAL_SPAWN_SCALE(Feral human spawn scaling factor):加入 game_world_opts 组,紧跟 SPAWN_DENSITY;- MILITARY_SITE_SPAWN、MILITARY_VEHICLE_SPAWN:加入新折叠组「Military sites and military/police vehicles」(军事建筑和军警车辆调整),下挂两个滑条。疯人规模——按物种分层密度SPAWN_DENSITY 作用于刷新「事件」的概率/数量(共 4 处:mapgen.cpp 静态刷怪、jmapgen_monster、map::place_spawns、overmap.cpp 城区尸潮),直接乘 0 会连刷新点一起砍掉。因此改为两层:- 事件门控密度:非动物组取 max(SPAWN_DENSITY, FERAL_SPAWN_SCALE),动物组保持 SPAWN_ANIMAL_DENSITY(新增 MonsterGroupManager::spawn_gate_density);- 生成单怪时按物种乘自身密度/G(新增 MonsterGroupManager::spawn_multiplier,按 species FERAL 判定,动物组豁免)。数学上每物种有效刷新率恒等于自身选项值;默认 1/1 时与现有行为逐位一致(roll_remainder(x×1.0) 恒等于 x)。缩放点:静态刷怪、jmapgen_monster、map::place_spawns(mapgen 期)与 mongroup population 解析(map.cpp)。军事地点——flag 判定 + deck 成功牌缩放overmap::place_specials 的 unique special deck 抽牌路径中,带 JSON flag MILITARY 的 special 将其 successes(occurrences.min)乘以选项并 clamp 到 [0, occ_max]:0 严格禁用(显式守卫,规避 x_in_y(0,N) 在 rng_float 恰为 0.0 时返回 true 的引擎边界行为),≥1 时逐倍提高每 overmap 出现概率。mod 里带 MILITARY flag 的 special 自动被覆盖,无需硬编码 ID。军警车辆——C++ 侧 ID 表 + 抽取后放行- src/vehicle_group.cpp 静态 ID 表(30 个):apc/apc-gl/aapc-mg/aapc-gl、humvee×3、military_cargo_truck×2、armored_car×2、policecar/policesuv/K9 运兵车、truck_swat、car_fbi、ambulance、fire_engine、fire_truck、apache/blackhawk/osprey 坠机变体×9;固定炮 cannon_3in 排除;- 混合组(city_vehicles、parkinglot、highway 等):抽取后按选项放行(拒绝则该槽位留空);- 纯军用组(military_vehicles、crashed_helicopters 等):jmapgen_vehicle 的 chance 乘选项缩放;坠毁直升机 map extra 在函数入口按选项门控;- 选项为 0 时显式守卫,严格禁用;=1 时行为与现版本完全一致。实现约束:不改任何原版 data JSON(军事地点复用现成 flag、载具用 C++ 侧表),避免与上游同步产生冲突;未引入生成文件、Schema 或 Lua 注册变化。#### Describe alternatives you've considered1. 给原版载具/地点 JSON 加 flag 再由代码读取——更「数据驱动」,但要改动大量原版 JSON,上游同步时易产生冲突,与本项目「维持与上游同步」的原则冲突,故改用 C++ 侧 ID 表 + 现成 MILITARY flag 的组合;2. 疯人规模直接作为 SPAWN_DENSITY 的二次乘数——实现最简单,但全局密度为 0 时刷新事件本身消失,无法实现「僵尸 0、疯人 1」的目标场景,故采用按物种分层密度的方案;3. 把疯人从僵尸组拆出独立怪物组——数据层面更干净,但需要改动大量 monstergroup 与 mapgen JSON,侵入面过大。#### Testing- 本机(Windows 10)仅有 CMake,无 make/gcc/astyle/python 工具链,本地编译与测试未执行,此项如实说明: - make astyle-check:未运行(本机无 astyle)。新增代码已按 .astylerc 约束书写(全部单行语句、无跨行调用续行;仅描述字符串字面量超长,与现有选项先例一致); - make -j2 tests 及聚焦测试:未运行(本机无编译器)。CI 的 cpp-format / cpp-tests 将执行;新增 tests/military_spawn_scale_test.cpp([military_spawn] 标签,5 个用例:默认值回归、4 种选项组合的物种拆分、place_spawns→spawn_monsters 全链路、载具表与放行、MILITARY flag 守卫); - make -j2 json-check:不适用(未改任何 JSON)。- 已做静态验证:全量 diff 复核、include 核对、超长行扫描、选项默认值/边界(0 值严格禁用)守卫核对。- 审阅建议:优先跑 ./tests/cata_test "[military_spawn]";游戏内验证路径为新建世界 → 世界默认选项调 SPAWN_DENSITY=0 / FERAL_SPAWN_SCALE=1 → 生成世界确认只遇疯人;军事两项可在世界设置中调 0 后新建世界确认 mil_base 与军警车辆消失。#### Documentation impactNone#### Related CCB-Docs PRNone#### Affected documentation IDsNone#### Generated reference impactNone#### Additional context- 界面文案当前仅英文源串,中文翻译随仓库翻译流水线后续落库;- 三个选项均为世界生成参数:老存档不受影响(有默认值),改动需新建世界(或对新生成区域)生效;- 疯人规模的「每物种有效刷新率 = 自身选项值」模型意味着:调高 FERAL_SPAWN_SCALE 不会压低其他怪物,反之亦然;动物刷新由 SPAWN_ANIMAL_DENSITY 独立控制,互不干扰。

…vehicle spawn scaling

Add three world generation options, all defaulting to 1.0 with the same
range as SPAWN_DENSITY (0.0-50.0):

- FERAL_SPAWN_SCALE: splits monster spawn density per species, so feral
  humans can be scaled independently of other monsters.  Spawn events of
  non-animal groups are gated by max(SPAWN_DENSITY, FERAL_SPAWN_SCALE)
  and each spawned monster is weighted by its own species option, which
  preserves vanilla behaviour at defaults and allows e.g. zombie scale 0
  with feral scale 1 to produce a world with only feral humans.
- MILITARY_SITE_SPAWN: scales the deck success cards of overmap specials
  flagged MILITARY in JSON, so mods adding military sites are covered.
- MILITARY_VEHICLE_SPAWN: scales military, police and emergency vehicles
  (C++-side ID list) both when picked from mixed vehicle groups and when
  placing military-only groups; zero strictly disables them.

The two military options live in a new collapsible world options group
'Military sites and military/police vehicles'.  Includes focused tests.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T15:14:40.419263Z
We couldn’t complete this review. Comment @codex review to try again.
fae6640 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@wnsnnnmwlls wnsnnnmwlls reopened this Nov 14, 2026
@LunaGlaze LunaGlaze closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants