fps-shooter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

FPS Shooter

FPS 射击游戏开发指南

A playbook for first-person shooters — the look/move controller, the shooting model, weapon feel, and combat. This is a compositional skill: it wires a 3D controller, input, and AI into a shooter. It does not re-teach 3D nodes or raycasts; it defines the shooting model and the feel knobs (TTK, recoil, spread) that decide whether the guns feel good.
这是一份第一人称射击游戏的开发手册——涵盖视角/移动控制、射击模型、武器手感以及战斗系统。这是一项组合式技能:它将3D控制器、输入系统和AI整合为完整的射击游戏框架。本手册不会重复讲解3D节点或raycast的基础内容;而是聚焦于定义射击模型,以及决定枪械手感的关键调校参数(TTK、后坐力、子弹散布)。

When to use

适用场景

  • Use when building a first-person game whose core verb is aim and shoot — arena shooter, tactical FPS, PvE shooter, boomer-shooter.
  • Use when deciding hitscan vs. projectile, tuning time-to-kill, recoil, spread, or aim feel.
When not to use: third-person/2D shooting → reuse the shooting model here but build the camera/controller from the relevant genre. Wave survival with towers →
tower-defense
. For the camera/character body itself, use
godot-3d-essentials
/
unreal-cpp-gameplay
.
  • 适用于核心玩法为瞄准与射击的第一人称游戏开发——包括竞技场射击游戏、战术FPS、PvE射击游戏、复古射击游戏。
  • 适用于选择hitscan或抛射物射击模式、调校击杀时间(TTK)、后坐力、子弹散布或瞄准手感的场景。
不适用场景: 第三人称/2D射击游戏→可复用本手册中的射击模型,但需基于对应类型重新构建相机/控制器;带塔防元素的波次生存游戏→参考
tower-defense
技能。相机/角色本体部分,请使用
godot-3d-essentials
/
unreal-cpp-gameplay

Core loop

核心循环

Scan → acquire a target → aim and fire → confirm the kill (feedback) → reposition / reload / advance. The whole experience rests on the aim-and-fire micro-loop feeling crisp: responsive look, clear hit feedback, and a death that reads instantly.
扫描环境→锁定目标→瞄准射击→确认击杀(反馈)→转移位置/换弹/推进。 整个游戏体验的核心在于“瞄准射击”的微循环是否流畅:响应灵敏的视角控制、清晰的命中反馈、即时的击杀判定。

Must-have systems

必备系统

  1. First-person controller — move (WASD/stick) + mouse/stick look, gravity, jump/crouch.
  2. Camera — eye-height view, configurable FOV and sensitivity, recoil kick.
  3. Shooting model — hitscan raycast and/or projectile spawn; one impact path for feedback.
  4. Weapons + ammo — damage, fire rate, magazine, reload, switching.
  5. Health + damage — HP, hit/headshot multipliers, death; player and enemy share the model.
  6. Enemy AI — perceive → alert → attack → search; cover and reaction delays (
    game-ai
    ).
  7. Feedback — hitmarkers, impact decals/particles, hit sounds, screen shake, kill confirms.
  8. Objectives — what you do besides shoot: clear, capture, survive, escort.
  1. 第一人称控制器——WASD/摇杆移动 + 鼠标/摇杆视角控制、重力、跳跃/蹲伏。
  2. 相机系统——眼高视角、可配置的FOV(视野)和灵敏度、后坐力镜头抖动。
  3. 射击模型——hitscan射线检测和/或抛射物生成;统一的命中反馈路径。
  4. 武器与弹药——伤害、射速、弹匣容量、换弹、武器切换。
  5. 生命值与伤害系统——HP、命中/爆头伤害倍率、死亡机制;玩家与敌人共用同一模型。
  6. 敌人AI——感知→警戒→攻击→搜索;掩体利用与反应延迟(参考
    game-ai
    )。
  7. 反馈系统——命中标记、命中贴花/粒子特效、命中音效、屏幕抖动、击杀确认。
  8. 任务目标——除射击外的核心玩法:清场、占领、生存、护送。

Design knobs

调校参数

KnobEffectSane default
Time-to-kill (TTK)lethality, forgivenessTune dmg × fire-rate × HP together (refs).
Hitscan vs projectileaim skill typeHitscan = flick; projectile = lead/dodge.
Damage falloffrange limitingFull to ~20 m, floor by ~60 m.
Headshot multiplierskill reward~1.5–2.0×.
Recoil patternlearnable kickFixed pattern > pure random.
Spread (bloom)suppress laser-accuracyFirst shot accurate; grows while firing.
Fire rate / magazine / reloadrhythm, downtimeReload = vulnerability window.
Mouse sensitivity / FOVcomfort, readabilityAlways expose both as options.
Aim assist (pad)controller parityMagnetism/slowdown near targets.
参数作用合理默认值
击杀时间(TTK)致命性、容错空间结合伤害×射速×HP共同调校(参考相关资料)。
Hitscan vs 抛射物瞄准技能类型Hitscan = 瞬狙;抛射物 = 预判/闪避。
伤害衰减射程限制全伤害至~20米,~60米时降至最低值。
爆头倍率技术奖励~1.5–2.0倍。
后坐力模式可学习的抖动规律固定模式 > 纯随机。
子弹散布(扩散)限制精准度第一发精准;持续射击时散布增大。
射速/弹匣容量/换弹时间节奏、空窗期换弹 = 脆弱窗口期。
鼠标灵敏度/FOV舒适度、可读性始终提供这两项可配置选项。
瞄准辅助(手柄)手柄操作平衡性目标附近的磁吸/减速效果。

Patterns

实现模式

1. Hitscan shot (instant ray, the workhorse)

1. Hitscan射击(即时射线,主力模式)

python
undefined
python
undefined

Pseudocode. Cast from the camera; first hit takes damage scaled by range + headshot.

Pseudocode. Cast from the camera; first hit takes damage scaled by range + headshot.

direction = apply_spread(camera.forward, current_spread) hit = raycast(camera.world_position, direction, max_dist=RANGE, mask=SHOOTABLE) if hit: dmg = base_damage * falloff(hit.distance) if hit.is_head: dmg *= HEADSHOT_MULT hit.actor.take_damage(dmg) spawn_impact_fx(hit.point, hit.normal) # decal + sound + hitmarker
undefined
direction = apply_spread(camera.forward, current_spread) hit = raycast(camera.world_position, direction, max_dist=RANGE, mask=SHOOTABLE) if hit: dmg = base_damage * falloff(hit.distance) if hit.is_head: dmg *= HEADSHOT_MULT hit.actor.take_damage(dmg) spawn_impact_fx(hit.point, hit.normal) # decal + sound + hitmarker
undefined

2. Projectile shot (dodgeable, leads the target)

2. 抛射物射击(可闪避,需预判目标)

python
undefined
python
undefined

Pseudocode. Spawn a moving body; it deals damage on its own collision.

Pseudocode. Spawn a moving body; it deals damage on its own collision.

p = spawn(projectile_scene, at=muzzle.world_position) p.velocity = camera.forward * PROJECTILE_SPEED p.on_hit = lambda other, point: (other.take_damage(base_damage), explode_fx(point)) p.lifetime = RANGE / PROJECTILE_SPEED # despawn so shots don't live forever
undefined
p = spawn(projectile_scene, at=muzzle.world_position) p.velocity = camera.forward * PROJECTILE_SPEED p.on_hit = lambda other, point: (other.take_damage(base_damage), explode_fx(point)) p.lifetime = RANGE / PROJECTILE_SPEED # despawn so shots don't live forever
undefined

3. Time-to-kill (balance the trio together)

3. 击杀时间(TTK)——三者联动平衡

python
undefined
python
undefined

Pseudocode. TTK falls out of HP, per-shot damage, and fire rate — tune as one system.

Pseudocode. TTK falls out of HP, per-shot damage, and fire rate — tune as one system.

shots_to_kill = ceil(target_hp / damage_per_shot) ttk_seconds = (shots_to_kill - 1) / fire_rate_per_second # first shot at t=0
undefined
shots_to_kill = ceil(target_hp / damage_per_shot) ttk_seconds = (shots_to_kill - 1) / fire_rate_per_second # first shot at t=0
undefined

Pitfalls / failure modes

常见陷阱/失败模式

  • Look tied to frame rate or unscaled by
    dt
    → sensitivity changes with FPS. Look should be driven by raw mouse delta; movement integration uses
    dt
    (see
    physics-tuning
    ).
  • Pure random recoil/spread → feels uncontrollable and unfair. Use a learnable recoil pattern; keep the first shot accurate.
  • Hitscan with no falloff → pistols snipe across the map. Add range-based damage falloff.
  • No hit feedback → players can't tell if shots land. Always show hitmarkers, impact FX, and a distinct kill confirm.
  • Mismatched TTK → too low feels twitchy/unfair; too high feels spongy. Tune damage, fire rate, and HP as one system (Pattern 3).
  • Trusting the client in multiplayer → cheating and "I shot first" disputes. Keep authority server-side; use lag compensation (refs) and defer netcode to the engine multiplayer skill.
  • No FOV / sensitivity options → motion sickness and accessibility failures. Always expose them.
  • 视角控制与帧率绑定或未按
    dt
    缩放
    →灵敏度随FPS变化。视角控制应基于原始鼠标增量;移动逻辑需使用
    dt
    (参考
    physics-tuning
    )。
  • 纯随机后坐力/子弹散布→手感失控且不公平。采用可学习的后坐力模式;确保第一发子弹精准。
  • Hitscan无伤害衰减→手枪可跨地图狙击。添加基于射程的伤害衰减机制。
  • 无命中反馈→玩家无法判断是否命中。始终显示命中标记、命中特效和明确的击杀确认。
  • TTK失衡→过短会导致手感生硬/不公平;过长会让目标显得“肉”。需联动调校伤害、射速和HP(参考模式3)。
  • 多人游戏中信任客户端→作弊和“我先开枪”争议。权威逻辑保留在服务器端;使用延迟补偿(参考相关资料),并将网络代码交由引擎的多人游戏技能处理。
  • 无FOV/灵敏度选项→引发晕动症和无障碍问题。始终提供这两项配置选项。

Composition (build it from these skills)

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

  • Controller + camera:
    godot-3d-essentials
    (Godot) or
    unreal-cpp-gameplay
    /
    unreal-blueprints
    ; Unity uses
    unity-physics
    + a character controller.
  • Input:
    input-systems
    (or
    unreal-enhanced-input
    ) for look/move, rebinding, and gamepad aim assist.
  • Shooting physics:
    godot-physics
    /
    unity-physics
    for raycasts and projectile collision.
  • Enemies:
    game-ai
    with
    unity-navmesh
    /
    unreal-behavior-trees
    / Godot navigation.
  • Camera & feel:
    camera-systems
    for FOV/recoil kick and look smoothing;
    game-feel
    for hit-stop, screen shake, and impact juice.
  • Polish:
    audio-design
    for weapon/impact sound;
    shader-programming
    for muzzle/impact VFX.
  • Process:
    prototype-fast
    to validate aim feel before building content.
  • 控制器+相机:
    godot-3d-essentials
    (Godot引擎)或
    unreal-cpp-gameplay
    /
    unreal-blueprints
    ;Unity引擎使用
    unity-physics
    + 角色控制器。
  • 输入系统:
    input-systems
    (或
    unreal-enhanced-input
    )用于视角/移动控制、按键重绑定和手柄瞄准辅助。
  • 射击物理:
    godot-physics
    /
    unity-physics
    用于射线检测和抛射物碰撞。
  • 敌人AI:
    game-ai
    搭配
    unity-navmesh
    /
    unreal-behavior-trees
    / Godot导航系统。
  • 相机与手感:
    camera-systems
    用于FOV/后坐力抖动和视角平滑;
    game-feel
    用于击中停顿、屏幕抖动和冲击特效。
  • 打磨细节:
    audio-design
    用于武器/命中音效;
    shader-programming
    用于枪口/命中视觉特效。
  • 开发流程:
    prototype-fast
    在制作内容前先验证瞄准手感。

References

参考资料

  • For hitscan vs. projectile trade-offs, damage falloff, recoil/spread, TTK math, hit registration/lag compensation, and enemy AI states, read
    references/shooting-and-feel.md
    .
  • 关于hitscan与抛射物的取舍、伤害衰减、后坐力/子弹散布、TTK计算、命中判定/延迟补偿以及敌人AI状态,请阅读
    references/shooting-and-feel.md