Lesson 8 of 11
Difficulty curves and balancing with data
Replace Beacon Yard's flat rounds with a capped sawtooth wave curve backed by hits-to-kill tables, mixed-skill safety caps and round-death telemetry.
By the end you can
- Build hits-to-kill and minimum time-to-kill tables directly from Beacon Yard's Config.luau
- Design a sawtooth wave curve that scales with player count while respecting mobile and base-speed caps
- Balance mixed-skill lobbies without letting enemy speed outrun un-upgraded newcomers
- Retune wave difficulty from round-death and survival telemetry rather than gut feel
Before this: The drone: movement, targeting, damage, NPCs and pathfinding: the scrap crawler, Analytics: funnels, economy events, retention, Game design for Roblox: loops, retention, fairness
1Why Beacon Yard's 40-second drill goes flat
In Game design for Roblox: loops, retention, fairness you saw that a 10-minute session fits 12 full Beacon Yard rounds. Look at the combat numbers driving every single one of those rounds in Config.luau at m14-ship:
DRONE_SPEED = 12,
DRONE_DAMAGE = 15,
DRONE_HIT_COOLDOWN = 1,
DRONE_MAX_HEALTH = 100,
WRENCH_DAMAGE = 34,
WRENCH_RANGE = 14,
CRAWLER_SPEED = 11,
CRAWLER_DAMAGE = 10,
CRAWLER_MAX_HEALTH = 68,
CRAWLER_HIT_COOLDOWN = 1.2,
CRAWLER_STUN_SECONDS = 1.2,
CRAWLER_RESPAWN_SECONDS = 6,
On Round 1, a fresh player at WALK_SPEED = 16 learns to dodge a 12-speed drone and an 11-speed crawler. By Round 3, they own BOOST_SPEED = 24, know the yard layout, and face the exact same two enemies. They have drifted below the flow channelFlow channelThe band where challenge matches a player's current skill, avoiding boredom below and frustration above.Think of it as a treadmill incline that rises with your pace instead of staying flat or throwing you off the belt. into boredom.
After buying Speed (BOOST_SPEED = 24) and the Speed Pass (+4), how much faster is a player than Beacon Yard's m14-ship drone (DRONE_SPEED = 12)?
Answer
16 studs per second faster (28 vs 12), which turns a single static drone into a low-threat chase. Without escalating waves or extra enemy pressure, upgraded players quickly outgrow the yard's single static drone.
Open this step in lesson mode · Link to this step · This confused me
2TTK and hits-to-kill tables from Config
Before tuning waves, write down exact hits to kill (HTK) and time to kill (TTK)Time to kill (TTK)The minimum elapsed time needed to drop a target from full health to zero.Think of it as the stopwatch between the first wrench clang and the drone dropping out of the sky. in both directions: player vs enemy, and enemy vs player (default Roblox Humanoid.MaxHealth = 100).
Two formulas prevent classic spreadsheet mistakes:
hits = math.ceil(maxHealth / damage)(health drops in whole swings, never fractions).minTtk = (hits - 1) * cooldownbecause the first hit lands att = 0, so 3 wrench hits separated bySWING_GAP = 0.4 stake0.8 s, not1.2 s.
Run this cell to generate Beacon Yard's real m14-ship combat table and inspect the cliff between WRENCH_DAMAGE = 34 and 33.
local function htk(hp, dmg)
return math.ceil(hp / dmg)
end
local function minTtk(hp, dmg, cd)
local hits = htk(hp, dmg)
return math.max(0, hits - 1) * cd
end
print(string.format(
"Wrench(34)->Drone: %d hits, %.1fs | Wrench(33)->Drone: %d hits, %.1fs | Wrench(34)->Crawler: %d hits, %.1fs | Drone->Player: %d hits, %.1fs",
htk(100, 34), minTtk(100, 34, 0.4),
htk(100, 33), minTtk(100, 33, 0.4),
htk(68, 34), minTtk(68, 34, 0.4),
htk(100, 15), minTtk(100, 15, 1.0)
))
Wrench(34)->Drone: 3 hits, 0.8s | Wrench(33)->Drone: 4 hits, 1.2s | Wrench(34)->Crawler: 2 hits, 0.4s | Drone->Player: 7 hits, 6.0sNotice why Config.luau chose WRENCH_DAMAGE = 34 and CRAWLER_MAX_HEALTH = 68: 34 times 2 is 68 (exactly 2 hits for a crawler) and 34 times 3 is 102 (3 hits for a 100-health drone). Changing damage by a single point from 34 to 33 is a 2.9% DPS drop on paper, yet it adds a full extra swing (+33% hits on the drone, +50% hits on the crawler).
If you nerf WRENCH_DAMAGE by 1 point from 34 to 33 against CRAWLER_MAX_HEALTH = 68, what does this print?
local oldHits = math.ceil(68 / 34)
local newHits = math.ceil(68 / 33)
print(oldHits, newHits)
Answer
2 3. Always check integer hits-to-kill breakpoints before shipping a damage tweak; a 1-point nerf across a cliff transforms combat pacing.
Open this step in lesson mode · Link to this step · This confused me
3Wave curves: sawtooth tension and player-count scaling
| In the picture | In Roblox |
|---|---|
| Warm-up incline | Wave 1 baseline (1 drone at speed 12, 1 crawler) so newcomers learn the rhythm |
| Hills with recovery flats | A sawtooth wave curve that escalates counts and drops every third wave for a breather |
| The heart-rate readout | Server custom events (round_death elapsed seconds, round_survived) guiding Experience Config tweaks |
Design round waves like an interval treadmill program: warm up on Wave 1, push harder on Wave 2, give a short recovery flat on Wave 3, then climb to a higher peak on Wave 4.
Think of it as An interval treadmill program with a heart-rate monitor
Server sideRemember: Sawtooth difficulty curves and telemetry tuning is an interval treadmill program with a heart-rate monitor.
A pure function waveSpec(waveIndex, playerCount) keeps server difficulty predictable and testable:
- Sawtooth breather: every 3rd wave (
waveIndex % 3 == 0) drops back to 1 drone atBASE_DRONE_SPEED = 12so players recover, spend coins and feel contrast before the next peak. - Player-count scaling: add
math.floor((playerCount - 1) / 2)extra crawlers so a four-player crew has more ground pressure than a solo player. - Hard caps: clamp at
MAX_DRONES = 3,MAX_CRAWLERS = 6andMAX_DRONE_SPEED = 15.5so low-end phones never choke on NPCs and base walk speed stays viable.
Run this cell to inspect waves 1 to 6 for a solo player versus a 4-player group.
local function waveSpec(wave, players)
local pBonus = math.floor((players - 1) / 2)
if wave % 3 == 0 then
return { drones = 1, crawlers = math.clamp(1 + pBonus, 1, 6), speed = 12.0, breather = true }
end
return {
drones = math.clamp(1 + math.floor((wave - 1) / 2), 1, 3),
crawlers = math.clamp(1 + (wave - 1) + pBonus, 1, 6),
speed = math.min(12.0 + (wave - 1) * 0.5, 15.5),
breather = false,
}
end
local w1 = waveSpec(1, 1)
local w3 = waveSpec(3, 4)
local w4 = waveSpec(4, 4)
print(string.format(
"W1 solo: %dD %dC spd=%.1f | W3 breather(4p): %dD %dC spd=%.1f | W4 squad(4p): %dD %dC spd=%.1f",
w1.drones, w1.crawlers, w1.speed,
w3.drones, w3.crawlers, w3.speed,
w4.drones, w4.crawlers, w4.speed
))
W1 solo: 1D 1C spd=12.0 | W3 breather(4p): 1D 2C spd=12.0 | W4 squad(4p): 2D 5C spd=13.5Using the waveSpec rule above (crawlers = clamp(1 + (wave - 1) + floor((players - 1) / 2), 1, 6)), how many crawlers spawn on Wave 5 for a 3-player server?
Answer
6 crawlers. 1 + 4 + 1 = 6 crawlers, hitting MAX_CRAWLERS cleanly so mobile pathfinding and draw budgets stay bounded.
Open this step in lesson mode · Link to this step · This confused me
4Where one curve breaks: mixed-skill lobbies
Look at DataService.applySpeed in m14-ship:
function DataService.applySpeed(player: Player)
local data = dataOf(player)
local character = player.Character
if not data or not character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
return
end
-- PassService sets SpeedPass on the server after it checks ownership.
local passBonus = if player:GetAttribute("SpeedPass") == true then Config.PASS_SPEED_BONUS else 0
humanoid.WalkSpeed = (if data.speedOwned then Config.BOOST_SPEED else Config.WALK_SPEED) + passBonus
Every live server mixes newcomers walking at 16 with veterans running at 24 or 28. Answer the question below after checking where the single-runner treadmill analogy breaks.
Where does it break?“An interval treadmill program with a heart-rate monitor” is a good picture of sawtooth difficulty curves and telemetry tuning. Where does it stop being true?
It breaks here. A treadmill runs one program for one runner; in a shared yard, a brand-new player at WalkSpeed 16 and a Speed-Pass veteran at 28 face the same wave, so difficulty must scale through count and zoning rather than outrunning WalkSpeed 16.
The true model. Combat balance starts with exact hits-to-kill and TTK tables from Config, drives wave pressure through a capped sawtooth curve that scales with player count, and adjusts live parameters from round survival and time-of-death telemetry.
If you raise DRONE_SPEED to 18 or 20 to pressure veterans, you cross the WALK_SPEED = 16 wall. Every new player without Speed gets glued to the drone and dies in 6 seconds (7 hits at 15 damage) with zero counterplay. Keeping MAX_DRONE_SPEED = 15.5 preserves kiting for every newcomer, while extra crawlers, second drones and high-risk outer coin pads give veterans harder positioning puzzles. Half a stud per second is the thinnest margin that still lets a newcomer pull away on a straight line; the drone touches from 3.4 studs away and players lose ground on turns, so playtest it and lower the cap if newcomers still get caught.
Why does Beacon Yard's wave curve cap droneSpeed at 15.5 studs per second instead of scaling up to 22 for veterans who own BOOST_SPEED (24)?
Answer
Newcomers walk at WALK_SPEED = 16; any drone faster than 16 makes kiting impossible for un-upgraded players in the same server. Never tune a shared server's enemy speed above un-upgraded player speed; escalate through enemy count, flanking angles and optional risk-reward objectives instead.
Open this step in lesson mode · Link to this step · This confused me
5Balancing from telemetry, not gut feel
Designers who balance only from their own playtests tend to ship games that are too hard, because they have played the yard hundreds of times. Look at what RoundService.luau logs at m14-ship:
local function awardSurvival()
for _, player in Players:GetPlayers() do
local character = player.Character
local humanoid: Humanoid? = nil
if character then
humanoid = character:FindFirstChildOfClass("Humanoid")
end
if humanoid and humanoid.Health > 0 then
local balance = DataService.addCoins(player, Config.SURVIVAL_BONUS)
Analytics.coinSource(
player,
Config.SURVIVAL_BONUS,
balance,
Enum.AnalyticsEconomyTransactionType.Gameplay.Name,
"SurvivalBonus"
)
Analytics.onboarding(player, "SurvivedDrill")
BadgeAwards.award(player, "FIRST_DRILL")
Today Beacon Yard logs round_started and one-time SurvivedDrill, never per-round deaths. Add two custom events through Analytics.log1 (following Roblox's analytics essentials guide2):
round_deathwith value = elapsed seconds in the drill (0to40) whenhumanoid.Diedfires during anActiveround.round_survivedwith value = remaining health (1to100) insideawardSurvival().
Both carry the wave as a custom field ("Wave 3" in CustomField01), so one event name covers every wave and Explore can break it down by wave. Roblox's guide recommends fields over extra event names, which have a tighter limit1.
On Creator Hub's Explore page, break both events down by the wave field and check survival rate and average round_death time against a target band. Beacon Yard uses one band for every wave, 50 to 90% survival. Explore offers counts, sums, averages, minimums and maximums (overall and per user), not a median, and its charts aggregate by day1. Judge a wave across hundreds of drills there: the per-drill [Balance] line in Output is a playtest aid, not a verdict, because with one or two players a single early death flips it. Once the wave caps are Configs keys you can tune them live without republishing3; this build does not wire them, so you tune the caps in WaveCurve.

Select a numbered pin, or a row below, to read what it marks.
Creator Hub's Explore page showing round_death counts and average time-of-death; the charts update the next day, because they aggregate daily. Illustration with sample data, not a live Creator Hub capture.
On Wave 2 your Explore chart shows 72% survival overall, yet average round_death elapsed time is only 7 seconds. What is the most likely problem?
Answer
Players who die are getting burst down right after spawn (for example drone plus crawler overlapping at spawn), creating an unfair early spike. Survival rate alone can hide an unfair burst window. Watching the average time-of-death catches spawn camping and overlapping burst damage.
Open this step in lesson mode · Link to this step · This confused me
6Build it: curve-driven waves and death telemetry
Wire the sawtooth wave curve and round-death telemetry into Beacon Yard for m16-design-pass, keeping the math in one pure shared module so unit tests and the server share the exact same rules.
Build along
src/shared/WaveCurve.luausrc/server/RoundService.luausrc/server/DroneService.luausrc/server/CrawlerService.luausrc/shared/Config.luau
Create
src/shared/WaveCurve.luau, the finished version of this lesson's level 3 challenge, withhitsToKill,minTtkSeconds,waveSpecandclassifyTelemetryas pure Luau functions. The curve lives in code, not in a data file.You should see WaveCurve.waveSpec(waveIndex, playerCount) returns drones, crawlers, droneSpeed and isBreather with MAX_DRONES = 3, MAX_CRAWLERS = 6 and MAX_DRONE_SPEED = 15.5 enforced.
Update
src/server/RoundService.luauto addwaveIndex, computeWaveCurve.waveSpec(waveIndex, #Players:GetPlayers())when the drill goes Active, and put the wave in the start toast and announcement. SetwaveIndexback to 0 when the last player leaves, and when a drill startsConfig.WAVE_IDLE_RESET_SECONDS(600) or more after the previous one. The live Experience Config overrides for the caps are not wired; tune the caps inWaveCurve.You should see Each drill advances waveIndex, announces 'Drill started. Wave 3: a breather' (or just 'Wave N'), and passes the spec to DroneService.setWave and CrawlerService.setWave before the enemies switch on.
Add
setWave(spec)next to the existingsetActive(on)inDroneService.luauandCrawlerService.luau.DroneServicereplaces its fixedCOUNT = 1with acountthe wave sets (extra drones appear at once mid-drill), and clampsdroneSpeedtoMAX_DRONE_SPEEDandWALK_SPEED - 0.5.You should see DroneService runs up to 3 drones at the wave's speed, always below WALK_SPEED; CrawlerService starts each drill with the wave's crawler count, fanned out around the spawn.
In
RoundService,watchDeaths(activeStartedAt)connectsHumanoid.Diedfor every player (and any respawned character) and logsround_deathwithworkspace:GetServerTimeNow() - activeStartedAt.awardSurvival()logsround_survivedwithhumanoid.Health. After the drill,logBalanceclassifies the survival rate and the median first-death time against a 0.5 to 0.9 target band withWaveCurve.classifyTelemetryand logs onewave_balanceevent with the verdict and"Wave n"as fields.Analytics.log(player, name, value?, fields?)takes the fields since the retention lesson.You should see Dying during an Active drill logs round_death with elapsed seconds, surviving logs round_survived with remaining health, and each drill ends with a [Balance] wave N verdict in the Output.
Watch the plateau. Drones reach their cap at wave 5, crawlers at wave 6 and speed at wave 8, so from wave 8 on every peak wave is the same 3 drones, 6 crawlers and 15.5 speed. If waveIndex counted drills for the server's whole life, a server would spend most of it at the cap. Beacon Yard resets the wave to 1 when the server empties, and when no drill has started for Config.WAVE_IDLE_RESET_SECONDS = 600, so a quiet server starts fresh. A busy server still climbs, and a newcomer who joins it mid-climb starts at the cap. Cycling the curve as a shift (waveIndex = waveIndex % 9 + 1, with a "Shift complete" toast after wave 9) is the next fix if your telemetry shows late joiners quitting.
A brand-new player joins a Beacon Yard server on its 25th drill. Which wave do they face, and why is that a problem?
Answer
Wave 25: waveIndex resets only when the server empties or idles for 10 minutes, so on a busy server they start at the capped peak (3 drones, 6 crawlers, 15.5 speed) with no ramp to learn on. Resetting an empty or idle server fixes quiet servers. On a busy one, only cycling the curve gives every newcomer the ramp the wave table was tuned for.
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Data-driven sawtooth wave curve (Beacon Yard) | Deterministic wave table/function scaling with wave index and player count, capped for mobile and base walk speed. | Round-based survival, co-op and tower-defense games where players learn and compare wave milestones. | Does not adapt mid-round if a whole lobby gets injured early. |
| Fixed static rounds (m14-ship baseline) | Same enemy count and stats every round. | Early prototypes and onboarding tests while proving the core 40-second loop. | Players master it in three rounds and lose interest. |
| Dynamic AI Director | Adjusts spawn rate and breather beats in real time from team health and recent deaths. | Longer horror, extraction or co-op campaigns where pacing matters more than fixed wave leaderboards. | Harder to reproduce in bug reports and can feel rubber-banded if players notice it helping them. |
Which telemetry readings tell you a wave curve needs retuning before players churn?
Answer
Wave 1 survival drops below 60% for players with onboardingStep under 5; Average round_death elapsed time sits under 10 seconds inside a 40-second drill; Wave 4 survival sits above 95% with average remaining health over 85. Low early survival and early death spikes signal unfair difficulty; near-perfect high-HP survival on peak waves signals boredom.
Open this step in lesson mode · Link to this step · This confused me
7Challenges
Fix minTtkSeconds below so it accounts for the first hit landing at t = 0 ((hits - 1) * cooldown) instead of multiplying all hits by the cooldown.
local function hitsToKill(maxHealth, damage)
if maxHealth <= 0 then return 0 end
if damage <= 0 then return math.huge end
return math.ceil(maxHealth / damage)
end
local function minTtkSeconds(maxHealth, damage, cooldown)
local hits = hitsToKill(maxHealth, damage)
if hits == math.huge then return math.huge end
-- Bug: counts a cooldown before the very first hit at t = 0
return hits * cooldown
end
print(minTtkSeconds(100, 34, 0.4), minTtkSeconds(100, 15, 1.0))
Level 1, Apprentice
Challenge
Fix minTtkSeconds in htk-breakpoint so minimum time to kill counts only the cooldown gaps between hits.
- Start from
- The game at milestone m14 (download)
- Check it here
- Run the code cell in the lesson view; the challenge completes when it passes. No Studio needed.
Done means
- One-hit targets (hits <= 1) return 0 seconds
- Multi-hit targets return (hits - 1) * cooldown
- All four assertions in htk-breakpoint pass
Hints
- Return 0 whenever hits <= 1.
- Use (hits - 1) * cooldown for hits > 1.
Solution
local function hitsToKill(maxHealth, damage)
if maxHealth <= 0 then return 0 end
if damage <= 0 then return math.huge end
return math.ceil(maxHealth / damage)
end
local function minTtkSeconds(maxHealth, damage, cooldown)
local hits = hitsToKill(maxHealth, damage)
if hits == math.huge then return math.huge end
if hits <= 1 then return 0 end
return (hits - 1) * cooldown
end
print(minTtkSeconds(100, 34, 0.4), minTtkSeconds(100, 15, 1.0))
Level 2, Builder
Challenge
Build a one-page five-wave balance sheet for Beacon Yard and document your first-response tuning plan if live Wave 1 survival falls to 40%.
- Start from
- The game at milestone m14 (download)
Done means
- Write a 5-wave Beacon Yard balance sheet listing drones, crawlers, droneSpeed, combined enemy DPS and target survival band per wave
- Verify every wave keeps droneSpeed strictly below WALK_SPEED (16) and respects MAX_DRONES and MAX_CRAWLERS
- Name the two Config.luau or Experience Config knobs you would adjust first if Round 1 survival drops to 40%
Hints
- Wave 3 should be a breather beat returning to baseline speed.
- If Round 1 survival is 40%, consider lowering DRONE_DAMAGE (from 15 to 12, moving HTK from 7 to 9) or delaying the first crawler spawn by 8 seconds.
Locking down breakpoints and caps in CI
Keeping hits-to-kill math, sawtooth wave caps and telemetry classification in one pure Luau module catches accidental speed-wall breaks and damage-cliff regressions before a patch ships.
Level 3, Professional
Challenge
Start from m14-ship in the game repo and implement the pure TTK, sawtooth wave generator and telemetry classifier in challenges/work/balance_curve.luau, then verify with game.ServerScriptService.RunGameTests:Invoke("difficulty-and-balance", "balance-wave-curve").
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("difficulty-and-balance", "balance-wave-curve")in the server command bar. Copy the pass code from Output.
Done means
- challenges/work/balance_curve.luau computes integer hitsToKill and first-hit-at-t0 minTtkSeconds including zero/invalid edge cases
- waveSpec escalates drones, crawlers and droneSpeed with player-count scaling while turning every 3rd wave into a baseline breather
- waveSpec caps drones at MAX_DRONES (3), crawlers at MAX_CRAWLERS (6) and droneSpeed at MAX_DRONE_SPEED (15.5 < WALK_SPEED)
- classifyTelemetry flags low survival or early death spikes (< 10 s) as too_hard, high survival as too_easy, else in_band
- RunGameTests:Invoke("difficulty-and-balance", "balance-wave-curve") passes all 8 checks
Hints
- Use wave % 3 == 0 for the breather branch.
- Check summary.survivalRate < targetMin and summary.medianDeathSeconds ~= nil and summary.medianDeathSeconds < 10 before checking too_easy.
With every 3rd wave acting as a breather (1 drone at speed 12) and non-breather waves using droneSpeed = min(12 + (wave - 1) * 0.5, 15.5), what does this print for Waves 2, 3 and 4?
local function spd(w)
if w % 3 == 0 then return 12.0 end
return math.min(12.0 + (w - 1) * 0.5, 15.5)
end
print(spd(2), spd(3), spd(4))
Answer
12.5 12 13.5. Dropping on Wave 3 and resuming higher on Wave 4 creates the classic sawtooth tension curve.
Open this step in lesson mode · Link to this step · This confused me
8Recap
Retiring the analogy
You no longer need “an interval treadmill program with a heart-rate monitor”. Combat balance starts with exact hits-to-kill and TTK tables from Config, drives wave pressure through a capped sawtooth curve that scales with player count, and adjusts live parameters from round survival and time-of-death telemetry.
Recap
- Compute integer hits-to-kill (math.ceil(hp / dmg)) and first-hit-at-t0 minimum TTK ((hits - 1) * cooldown) from Config.luau before changing any combat number.
- Use a sawtooth wave curve with breather beats, player-count scaling and hard entity caps so tension stays inside the flow channel.
- In mixed-skill lobbies, cap enemy speed below un-upgraded WALK_SPEED (16) and add pressure through count and zoning instead.
- Log round_death (with elapsed seconds) and round_survived (with remaining HP) via Analytics.log so you retune waves from telemetry, not guesswork.
Sawtooth difficulty curves and telemetry tuning is an interval treadmill program with a heart-rate monitor, until a treadmill runs one program for one runner; in a shared yard, a brand-new player at WalkSpeed 16 and a Speed-Pass veteran at 28 face the same wave, so difficulty must scale through count and zoning rather than outrunning WalkSpeed 16.
Queued for review
- After buying Speed (BOOST_SPEED = 24) and the Speed Pass (+4), how much faster is a player than Beacon Yard's m14-ship drone (DRONE_SPEED = 12)?
- If you nerf WRENCH_DAMAGE by 1 point from 34 to 33 against CRAWLER_MAX_HEALTH = 68, what does this print?
- Using the waveSpec rule above (crawlers = clamp(1 + (wave - 1) + floor((players - 1) / 2), 1, 6)), how many crawlers spawn on Wave 5 for a 3-player server?
- Why does Beacon Yard's wave curve cap droneSpeed at 15.5 studs per second instead of scaling up to 22 for veterans who own BOOST_SPEED (24)?
- On Wave 2 your Explore chart shows 72% survival overall, yet average round_death elapsed time is only 7 seconds. What is the most likely problem?
- Which telemetry readings tell you a wave curve needs retuning before players churn?
Open this step in lesson mode · Link to this step · This confused me