Numbers Drive Feel: Making an AI-Written Game Play Right
AI-written games have a peculiar property: it can produce a shooter that runs, but ‘feels right’ is a different matter. The latter lives entirely in numbers, and AI will not tell you whether those numbers are sound.
Feel is not an adjective — it is verifiable
"This gun’s recoil feels bad" is useless. Broken apart, it becomes three testable questions:
- Is the spray pattern’s early segment monotonically rising — can a player build muscle memory?
- At which shot does the pattern peak — too early and it is uncontrollable, too late and there is no suppression
- Does each gun’s pattern actually differ — swapping guns should require re-learning, which is where tactical depth comes from
Run it as a script and the answers appear: AK peaks at shot 4 with 0.082 m of climb, M4 at shot 4 with 0.053 m, Deagle at shot 3 with 0.127 m, and all three rise monotonically at the start — they are learnable. M4 pulls left, AK pulls right, Deagle kicks hardest: each gun demands its own practice.
An economy needs a 12-round curve, not a single round
Economy systems are where "looks reasonable" deceives you most. One round looks fine; twelve rounds expose the truth.
The first version gave +750 for surviving, and after simulating 12 rounds it was obvious: the player could afford a full M4 plus armour every single round, making the economy meaningless. Lowering it to +500/+400 finally matched real CS:
// 连败奖励阶梯:L = clamp(lossStreak - 1, 0, 4)
[1400, 1750, 2100, 2450, 2900][L]
// 存活奖金(只给活到回合结束的)
胜方: 3250 + clamp(roundTime / LIVE) * 500
败方: lossReward + clamp(roundTime / LIVE) * 400Simulating three scenarios gave:
- A dominant run (11 straight wins) → full buy every round, as expected
- Alternating wins → 3 full buys and 9 eco rounds, matching real CS
- Losing three then recovering → the income staircase is clearly visible, and the player can feel the savings building
And the BOT’s loadout must be derived from its budget rather than random, or the player’s economic decisions exert no pressure on the opposition.
Every new weapon needs a damage-curve table
Adding the MAG-7 shotgun with initial parameters fb:14 fm:0.1, the single-shot damage looked fine. Only the full distance-damage curve revealed it: at 15 metres it did 14 damage, less than a rifle — effectively a dud gun.
Changing it to fb:18 fm:0.18 gave 28 damage at 15 m and 25 at 25 m. The full curve:
距离 2m 5m 10m 15m 20m 30m 50m
MAG-7 198 140 93 28 25 22 18
步枪 40 36 31 26 22 17 12
结论: 2~12m 霰弹统治,15m 交叉,20m 步枪反超The rule: check at least four distances — 5, 15, 30 and 50 metres — and confirm the weapon is genuinely best within its intended range. Looking at single-shot damage alone hides the "falls off to worse-than-a-pistol at mid range" failure mode.
Keep the parameter tables in sync
Each weapon’s data lives in five tables: sound effects, ballistics, view model, inspect animation, and kill reward. Miss one when adding a gun and that feature silently fails — a new gun without a WPN_BAL entry, for instance, inherits another weapon’s tracer colour and bullet drop.
grep -n "WPN_SFX\|WPN_BAL\|WPN_INSPECT\|WPN_VM\|KILL_REWARD" game.jsOne grep confirming all five tables were updated beats checking function by function, and it is far harder to miss something.
Make BOT behaviour measurable
"The BOT looks a bit fake" cannot be fixed directly, but it can be measured. Track these and the problem becomes locatable:
- Yaw change per frame — real turning has a ceiling; exceed it and it reads as fake
- Instantaneous snap-turns — real players do not whip their head every frame
- Frame share spent clearing and reacting to hits — real players occasionally stop to listen and seek cover when hit
- Monotonicity of burst limits — more aggressive BOTs should fire longer bursts
With these numbers, changes get direction. An assertion like "instantaneous snap-turns under 1%" is what exposed the random-number-in-state-selector bug.