Hold the Line: Tower Defense Kit with Paths, Towers, Waves and a 10-Wave Map
- ..
- .metadata429 B
- Commander.component
- Game.component
- PathLook.component
- README.md37.8 KB
- api.module
- bounty.module
- example-a-lava-fork-map-from-an-empty-world.guide
- gallery.module
- grid.module
- how-to-make-a-tower-defense-game.guide
- layoutCheck.module
- layouts.module
- match.module
- net.module
- package.yaml1.1 KB
- pathLooks.module
- paths.module
- perf.module
- playtest.module
- rules.module
- towerDefenseKit.testSuite
- towers.module
- ui.module
- waves.module
- workflows
README.md
towerDefenseKit
A tower defense game in one call. Enemies walk smooth roads you draw (one lane, forks, merges), a goal at the end has lives, a build grid shows a green or red tile wherever you point and never lets a tower stand on the road, six towers with three upgrade tiers each pick targets by first / last / nearest / strongest / weakest, you upgrade or sell them, the team shares gold (kill pay, wave pay, a bonus for calling the next wave early), a wave preview always shows what is coming, and the camera pans, zooms and turns with a mouse, a gamepad or a finger. In multiplayer every player sees the same enemies, towers, gold and lives, and everyone can build.
Install and use in two lines: run zero zeromind installAsset 309904b1-6c63-464a-9d50-a238f73e718f in the engine shell, then put require("towerDefenseKit.api").build({ layout = "snake" }) in a scene's content() in its build.luau. The quick start below has the five steps in full.
Every big choice is one word: 6 map layouts, 6 road looks, 8 build-grid looks, 7 lives displays, 4 enemy looks, 3 tower styles, 6 wave preview styles, 4 build menus, 5 rule sets and 3 difficulties. A look gallery shows the roads, grid looks and lives displays side by side. The package holds the gallery's code (towerDefenseKit.gallery), not a scene, because a scene belongs to the world it lives in; see "A look gallery in your world" for the two short files that make one.
1.2.27: the Commander no longer stops with an error when the pointer position or its movement is briefly missing (a simulated or remote pointer, a window losing focus); it used to raise every frame until the pointer came back.
1.2.26: on a narrow window the one-line wave preview strip (top right) ran over the lives and gold row; it now stands just below that row (WP.show offset measured from the HUD).
1.2.25: a build menu with many towers splits into tabs (Towers.setGroups({ { id, label, icon, color, towers = { ... }, pinned? } })): the cards and bar menus show one group at a time behind a row of tabs, 1-9 count within the tab shown, Tab turns the tab, and LB/RB (cycling towers) turns to the picked tower's tab. With fewer than two groups the menu is unchanged. Clicking or tapping a tall tower's body now selects it (it used to land on the tile behind it, since a tower stands in front of that tile on screen). The controls hint counts the towers actually shown. Found in Arts TD, where 27 towers covered half of a small window; now 1-5% at every size from a sideways phone to a 2048x1536 tablet.
Version 1.2.27. The kit holds only the tower defense rules. Everything else is a published part it installs and uses:
| Part of the game | Comes from |
|---|---|
| Towers, targeting, tiers, upgrade costs, sell values, projectiles, air/ground and stealth rules | turretsKit (+ projectileKit) |
| Enemies walking the road, waves, pooling | spawnerKit |
| Eleven enemy types (runner, footman, armoured brute, swarmling, shieldbearer, flier, healer, splitter, the splitlings a splitter breaks into, sneak, the Warlord boss) in four looks: fantasy, sci-fi, cartoon, pixel | creepsKit |
| The match: the build break before each wave and its countdown, sending a wave early, victory, defeat, Play again, late joiners playing at once | MatchFlow (a waves match on the TDMatch entity) |
| Health and damage of every enemy | SecondWind / Lifeline |
| Team gold, cheat-proof bank | economyKit (shared acct:td account) |
| The wave preview (strip, timeline, cards, dial, minimal, pixel) | wavePreviewKit |
| Keyboard / gamepad / touch input and button prompts | controlsKit (rts scheme) |
| The build grid: cells, bounds, blocked cells and the eight highlight looks (free cells, hover tile, selected tower) | gridKit |
| The lives display (hearts, segmented bar, ring, orb, pixel and hologram bars) | barsKit |
| Toasts ("Wave 3 cleared +60 gold") | navUiKit |
| Victory and defeat screens | menusKit |
| Hit, coin, build and leak effects | juiceKit |
Quick start (five minutes)
- Install towerDefenseKit from ZeroMind. In the engine shell:
zero zeromind installAsset 309904b1-6c63-464a-9d50-a238f73e718f
(or search ZeroMind for "tower defense kit" and install it from there). An install always brings the newest released version. The install brings every part above; give it a minute, until it answers with installed. To see which version you got, run grep '^version' /zero/source/towerDefenseKit.package/package.yaml in the shell. creepsKit and wavePreviewKit are the kit's declared dependencies, so they arrive whole, with their own guides, galleries and tests (from 1.2.12; before, only the files the kit's code names came along).
2. Make a new empty scene for the map. Do not build the map into the starter scene a new world comes with: that scene already has the engine's default player, which clashes with the kit's commander player, and the build stops with "structural conflicts". In the engine shell:
zero scene create --startup td empty
A new empty scene may still hold no entrypoint.luau and a placeholder README.md, and a push refuses it that way (a platform issue, #25302). If scenes/td.scene/entrypoint.luau is missing, write it with one comment line such as -- towerDefenseKit runs the game; this scene needs no code of its own., and replace the placeholder in scenes/td.scene/README.md with a sentence saying what the map is.
- Lay out a map. Replace the new scene's
build.luau(scenes/td.scene/build.luau) with these lines:
local TD = require("towerDefenseKit.api")
function content()
TD.build({ layout = "snake", pathLook = "dirt", menu = "bar" })
end
A layout is all a map needs: everything else has a default that looks and plays well (a grass field, a sun and sky, the glowing build grid, the strip wave preview, classic rules on normal). Start on normal; difficulty = "easy" gives 30 lives and more gold, "hard" gives 10 lives, less gold and tougher waves once you know the map. For scenery no tower may stand in (a lake, rocks), add blockers = { { x, z, radius }, ... } to a map drawn as a table: the kit draws each circle in the road's own look (a lava pool, a pond, a rock outcrop) and refuses every tile inside it. The lava fork guide shows both.
-
Let players spawn. The kit brings its own player (the commander camera), so the scene must spawn players. A scene made with the
emptytemplate is playerless: after savingbuild.luau, once the road shows in the editor, runzero scene player spawnsonce (the kit also says so in the log when you play without it). "Structural conflicts" in the build come from a second player standing in the scene beside the commander, in either of two ways: the scene already had a player (a world's starter scene does, which is why step 2 makes a new one), orzero scene player spawnsran before the map was built and wrote the engine's default player in. Either way, delete the scene folder, create it again and do steps 2 to 4 in order. Without a player, play starts with no camera. -
Wait for the install to finish, then press Play. On the classic rules at normal difficulty you start with 20 lives and 450 gold. The 25-second build break before wave 1 starts counting only once your build bar and wave preview are on screen and the machine has finished loading (3 seconds of smooth frames, a minute at most; if nobody's controls come up at all, after 90 seconds anyway); the first Play in a new world can take a minute to load them on a busy machine, and the log says the game is waiting. Press 1 (or click the Gun Tower in the bar), point at a green tile beside the road (a tile inside a bend covers the most road), click. One Gun Tower there stops wave 1 (8 footmen); add a second before wave 2, which brings fast runners. Press Space to send the wave early for a bonus. Click a tower to upgrade it, change its targeting or sell it. Pressing Play while the install is still landing files can reload parts of the game mid-wave, and towers can then miss the whole first wave; after the install finishes that does not happen.
That is a complete ten-wave game: win by clearing wave 10, lose when the lives run out.
A look gallery in your world
Make a scene for it (zero scene create tdGallery empty), then give it these two files and open it:
scenes/tdGallery.scene/build.luau (ground, sun and sky, and a player whose camera looks down on the gallery):
function content()
require("towerDefenseKit.gallery").content()
end
scenes/tdGallery.scene/entrypoint.luau (the roads, grid patches and lives panel, built on every screen in edit and in play):
local Gallery = require("towerDefenseKit.gallery")
function onLoad() Gallery.show() end
function onEditLoad() Gallery.show() end
function onUnload() Gallery.hide() end
creepsKit and wavePreviewKit come with galleries of their own for the enemy looks and the wave preview styles (see their READMEs).
Swap anything with one word
TD.build field | Choices |
|---|---|
layout | snake (one long winding road), switchbacks (tight hairpins), fork (one road splits into two lanes), spiral (inward to a goal in the middle), merge (two entrances that join), ring (round an island, then onto it) |
pathLook | dirt, cobble, conveyor (sci-fi), lava (flowing molten lava with drifting crust, animatedMaterials' lavaToon, which forestKit brings), river (a ford), cartoon |
menu | ring (click a tile, pick from a ring around it), bar (bottom bar), cards (cards down the left side, under the lives, gold and wave display, with each tower's role; a finger-sized grid at the bottom on a phone held upright), minimal (a quiet line of icons and hotkeys) |
rules | classic, hardcore (one life), endless, goldRush (double kill gold, interest, no wave pay), noSelling |
difficulty | easy, normal, hard |
towerStyle | medieval, scifi, toy (towers, goal, entrance arch and HUD theme; enemies follow unless enemyStyle says otherwise) |
enemyStyle | auto (match the towers), fantasy, scifi, cartoon, pixel (creepsKit; medieval and toy still work) |
preview | strip, timeline, cards, dial, minimal, pixel |
highlight | how the build grid is drawn, any gridKit highlight look: glow (default), outline, fill, decal, pixel, hologram, dotted, pulse. While you pick a tower every free tile is drawn in the look itself (glow tiles, pixel blocks, dotted lines, pulse brackets); fill, decal and hologram draw free tiles as plain lines and show their look on the tile under the cursor |
lives | how the HUD shows lives, always as the lives count: number (default: a heart and the count), hearts, bar (one cell per life), ring (a round gauge with the count and LIVES inside), orb (a draining globe with the count inside), pixel, hologram (a sci-fi bar with the count in its readout). barsKit looks, never shown as a percent or HP |
roster | which turretsKit towers are for sale, e.g. { "machineGun", "cannon", "frost", "tesla", "missile", "sniper" } (the default) |
waves | waves to win (default: the rule set's 10) |
pathWidth, cell | road width (3.6 m) and grid cell (2 m) |
ground, lighting, player, camera | a grass field, a sun and sky, the commander player (all three on unless set to false: pass ground = false or lighting = false when your scene brings its own), the camera's opening { distance, pitch, yaw, x, z } |
The synced TDGame entity's towerDefenseKit.Game component holds the same choices, so you can also change them in the inspector, but several are named differently there:
TD.build field | towerDefenseKit.Game field |
|---|---|
layout (a name, or a map drawn as a table) | layout (the name) and layoutData (the table) |
pathLook, rules, difficulty, towerStyle, enemyStyle, highlight, pathWidth, cell | the same names |
menu | menuStyle |
preview | previewStyle |
lives | livesStyle |
roster (a list) | roster (a comma list: "machineGun,cannon,frost") |
waves (a count, or your own wave tables) | waveCount (the count) and waveList (the tables) |
ground, lighting, player, camera | not on the Game: they are what the build places |
The road restyles itself when layout or pathLook changes; rule, difficulty and wave changes take effect from the next game (Play again).
Your own map: require("towerDefenseKit.layouts").define("myMap", { size = { 72, 48 }, routes = { { id = "main", points = { { -38, 0 }, { 0, 12 }, { 38, 0 } } } }, goal = { 38, 0 } }), then layout = "myMap". Several routes that share a start make a fork; several starts that share an end make a merge. blockers = { { x, z, radius }, ... } in a layout marks scenery circles no tower may stand on, and the kit draws each one in the road's look: a lava pool beside a lava road, a pond beside a river, a rock outcrop beside any other road. Your own waves: pass spawnerKit wave tables through towerDefenseKit.waves (see the how-to guide).
How it plays
- Controls. Keyboard and mouse: WASD/arrows pan, wheel or Q/E zoom, Z/C or middle-drag turn, 1-6 pick a tower, click to build (Shift keeps building), right-click or Esc cancels, click a tower then U upgrade / T targeting / Delete sell, Space sends the next wave. Gamepad: the left stick moves a cursor over the grid and the view follows it, triggers zoom, the right stick turns, LB/RB pick a tower, A builds or selects (read straight from the pad, so it works whatever the control scheme maps), B cancels, Y sends the wave (or upgrades a selected tower), X sells, LB/RB cycle a tower's targeting. Touch: drag pans, pinch zooms, twist or the ⟲ ⟳ buttons turn, tap a tower in the menu then tap a tile twice to build (the first tap shows the ghost), tap a tower to open its panel.
- Gold. One team purse. Kills pay 1.5 x each enemy's bounty (creepsKit's
bounty), every cleared wave pays gold that grows by 15 a wave (50 for wave 1, 65 for wave 2, 80 for wave 3, up to 185 for wave 10), calling the next wave early pays 3 gold per second left on the clock. Unaffordable towers and upgrades are greyed with their price in red. - Lives. Each enemy that reaches the goal costs its
leak(1 for most, 2-3 for big ones, 5 for the Warlord boss: half its creepsKit value, set intowerDefenseKit.bounty, since even a well-defended road usually lets it through). - Air and stealth. Fliers can only be hit by towers that hit air (the Cannon cannot); sneaks are hidden until a Watchtower sees them or a blast hits them.
- Screen layout. The controls hint stands in the bottom-left corner. Where a centred build bar would run into it, it wraps to the room left of the bar, or stands just above the bar when that room is too narrow; the F3 readout always sits just above the hint and the minimal menu. Lives, gold, the wave and the Send wave button stand in one column in the top-left corner, the wave preview in the top-right corner beside it (a wide preview is given only the room the column leaves), and the build menu at the bottom (bar, minimal), on the left under the column (cards) or round the tile (ring). When menusKit's touch pause button is shown in the top-right corner, the preview steps down below it. In the cards menu each card puts the tower's name and price on one line and its subtitle ("Ground + Air") under them, wrapping if it is long, so the price never sits on the subtitle.
towerDefenseKit.layoutCheck.run()lays out every build menu x wave preview x lives display at desktop, sideways-phone and upright-phone sizes, plus a touch pass with a tower panel open and three messages up, and reports any overlap: the HUD, build menu, preview and pause button against each other; every text in every build card at its natural width; and on touch the turn buttons against the tower panel's tap area, the messages and everything else, plus where a tap on each turn button actually lands. It checks desktop sizes (2560 x 1440, 1920 x 1080, 1366 x 768), a tablet (2048 x 1536) and phones both ways, and on touch it also measures the engine's own round Menu button, which is drawn outside the UI. From 1.2.17 it also checks the bottom-left corner with the F3 readout on: the controls hint and the readout against the build menu, the HUD and each other. 104 desktop and tablet touch layouts, 0 problems; with the corner included, 77 keyboard-and-mouse layouts (every build menu at all seven sizes), 0 problems. - Messages never cover what you need. navUiKit's messages ("An enemy got through!", "Wave 3 cleared") stack in the bottom-right corner. Four times a second the commander measures what stands in that corner (the tower panel, the build menu, the turn and cancel buttons, the wave preview, the pause button and, on a touch screen, the engine's Menu button) and lifts the stack above them, or moves it left of the tower panel when there is no room under the preview. On touch the tower panel itself stands left of the Menu button.
- Phones. The HUD and menus switch to compact layouts below 760 x 520 points, with on-screen turn buttons and a cancel button. On a wide touch screen (a phone held sideways, a tablet) the two turn buttons stand side by side just under the wave preview on the right, clear of the messages that slide in at the bottom right; on a phone held upright they sit low on the right edge. The tower panel is centred above the build bar with nothing invisible around it, so the turn buttons stay tappable while a tower is selected, and messages (navUiKit 1.3.5 and later, which arrive with economyKit 1.2.8 and later; this release ships economyKit 1.2.10 with navUiKit 1.3.7) let every tap through to the buttons and the map under them. On a phone-sized screen the wave preview is one line (the
minimalstyle) so the map stays in view; the Waves button in the HUD opens the full preview style the map chose and closes it again.
Multiplayer
The match itself is MatchFlow's: one machine runs it, and every screen shows the same build countdown, wave start and end at the same moment (towerDefenseKit.match.state() reads it: phase, wave, seconds to the next wave). The machine that owns the synced TDGame entity decides the rest: it starts the match, sends each wave when MatchFlow starts it, reports each cleared wave back, ends the match in defeat when the lives run out, keeps the economyKit bank (Economy.setBankChooser points the bank at it), places and sells towers and pays gold. Every other player's build, upgrade, sell, targeting, call-wave and Play again goes to it through towerDefenseKit.net and is answered there. Towers and enemies are synced entities, lives are a synced field on TDGame, gold is the shared acct:td account, and since economyKit's bank answers balances only on the deciding machine, TDGame also mirrors the balance into its synced gold field five times a second, which every other player's HUD and tower cards read. A player who joins mid-game plays at once (MatchFlow's joinInProgress), sees the same wave, lives, gold, towers and enemies, and gets the build menu and the wave preview without touching anything.
API
towerDefenseKit.api(TD):build(cfg),catalog(),game(),VERSION, and the sub-moduleslayouts,paths,rules,waves,towers,pathLooks.towerDefenseKit.layouts:get,list,ids,define.towerDefenseKit.rules:resolve(set, difficulty, overrides),define,sets,difficulties,wavePay,earlyBonus.towerDefenseKit.waves:DEFAULT,HELD,campaign(rules, { lanes, waves, held })(held: each wave waits until it is sent, as the Game does when MatchFlow starts it),summary.towerDefenseKit.match:state()(the match as this machine shows it:phase=ready,build,wave,wonorlost,wave,waves,nextIn,round),find()(the MatchFlow component onTDMatch),settings(rules),place(rules).towerDefenseKit.towers:roster,setRoster,define,get,hits.towerDefenseKit.bounty:of(kind),set(kind, { gold, leak }).towerDefenseKit.net:request({ action = "build" | "upgrade" | "sell" | "target" | "callWave" | "restart", ... }),onResult,broadcast,onBroadcast,isAuthority.- Components:
towerDefenseKit.Game(rules, lives and gold, onTDGame), MatchFlow'sMatchFlow(the match, onTDMatch, whichbuildplaces),towerDefenseKit.Commander(one player's camera, cursor, menus and HUD),towerDefenseKit.PathLook(the road).
Guides
- How to make a tower defense game (
towerDefenseKit.package/how-to-make-a-tower-defense-game): what each part is, the swaps, rules, waves, towers, enemies, multiplayer. - Example: a second map from an empty world (
towerDefenseKit.package/example-a-lava-fork-map-from-an-empty-world): a sci-fi lava fork map with hard rules and your own waves, step by step.
Workflow: add a new map
addTowerDefenseMap (zero workflow start --name addTowerDefenseMap, idea = the map in your own words) takes a map from an idea to a balanced, dressed scene: it designs the routes, writes the scene, has the playtest bot (towerDefenseKit.playtest) play it as a decent and a careless player and tunes until the decent one just wins, then dresses it and reports with a picture. The same steps by hand are in the how-to guide.
Tests
tools.use("tests", "run", { suites = { "towerDefenseKit" } }): layouts, the grid never on a road, rules, gold, the campaign, path looks, roster, bounties, the HUD's padding and column, and every screen at desktop and phone sizes. For layouts in play, towerDefenseKit.layoutCheck (see How it plays).
Checked in play
On the showcase map ("Hold the Line"), played start to finish by the playtest bot through the same requests a player's clicks send, on normal: the careful player won three games in a row with 12, 8 and 15 of 20 lives left (about 17 Gun Towers, Cannons, Frost Spires, Tesla Coils and Missile Batteries with 10 upgrades bought from earned gold; the Warlord usually reaches the goal for its 5 lives), and the careless player lost on wave 8 and on wave 9, with the defeat screen; "Play again" on either screen starts a new game. Before every one of the ten waves the preview showed its name and size ("First Steps x8" ... "The Warlord x33"). Two players in one room saw the same towers, gold, lives, wave and enemies, and the second player could build. Enemy traits (armour, shields, splits from the death spot, heals, stealth, boss phases) and air-only targeting were checked in creepsKit's own play test.
Joining mid-wave, checked again with version 1.2.9 (a second editor joined while wave 1 was on the road): the joiner saw the same wave, lives, gold, towers with their tiers and enemies as the host, had the build menu and wave preview up before touching anything, and a build (100 gold) and an upgrade (120 gold) each cost gold once, on both machines. Counts read right at 1 ("1 enemy on the road", "1 life left", "1 enemy stopped", "1 kill"), and right after Play again the wave preview shows the fresh start, never "all waves cleared".
On 1.2.9 the careful playtest bot played the whole 10-wave map twice more, with another editor client busy in the same engine: at 3x speed it lost on wave 10 (the Warlord's wave, entered with 4 lives), at 2x it won with 1 life left. A careful player can win on normal, but by less than the three wins above suggest, and the bot's result depends on how loaded the engine is (see towerDefenseKit.playtest).
Known limits
-
gridKit's
decallook draws nothing on this engine (its decal material "provides no channel to stamp"), and itsfilllook draws free tiles as a near-clear wash; both, andhologram(whose lattice is heavy across a whole field), draw free tiles as plain lines and show their look only on the tile under the cursor and the selected tower. -
economyKit brings saveKit along. The Game starts economyKit with
save = false(the team's gold starts fresh every game, so there is no wallet to keep), so saveKit never starts and its level and XP panel ("LV 1, 0 / 100 XP") never shows (from 1.2.17; before, it sat in the bottom-left corner over the controls hint and the F3 readout). -
economyKit brings inventoryKit along. The Game starts economyKit with
inventory = false, so inventoryKit never starts: no hotbar, no wallet, and the number keys only pick towers (from 1.2.13; before, the commander set inventoryKit up hidden, which started it, and 1 also picked its first hotbar slot). -
Full-frame art styles that flatten light (styleKit's comic and toon looks) also flatten the glowing road layers. Leave them as rendered with
StyleKit.options({ exclude = require("towerDefenseKit.pathLooks").GLOWING }), as the showcase map does. -
In the kit's own world,
zm statusreads economyKit as "ahead of upstream" by one or two files after an update, although the files are byte-identical to economyKit's release. That is a platform bug (#24786), not a change to economyKit. -
The kit needs MatchFlow 1.4.0 or later (the build breaks,
endRound,joinInProgress). In the kit's own world it arrives as turretsKit's MatchFlow dependency; turretsKit stays at 2.2.0 there because turretsKit 2.3.x, installed over a world that already holds SecondWind, adds a second copy of SecondWind's API that its turrets then read, so they see no enemies (a platform bug in how installs share a dependency; reported). A fresh install brings one copy and is not affected. -
The playtest bot's build plan leans on the 100-gold Gun Tower. On the showcase map, with a roster that sells nothing that cheap (only Cannons, Mortars, Tesla Coils, Lasers, Frost Spires and Watchtowers), the decent bot spends its starting gold on two or three towers and loses by wave 3, so its result says more about the bot than the map there; a person can still win. With the default roster it held through wave 8 with 14 of 20 lives in a 5-minute run on 1.2.20.
-
After updating MatchFlow (or any kit whose components gained fields) in an open editor, restart the client: until then the running engine keeps the old field list and ignores the new settings.
-
A new world that installs the kit still gets controlsKit at three releases side by side: 1.3.1, which the kit, wavePreviewKit, navUiKit 1.3.7 and economyKit 1.2.10 use, plus two older ones that menusKit's own files still point at (menusKit 1.3.13 was released against controlsKit 1.3.1, but references it recorded against older releases kept them, and no update moves them; reported). Up to 1.2.14 it was four. The copies do no harm (each part reads the copy it was written against); they only take room. If you update an older install of economyKit and the update times out on menusKit's
package.yaml(a platform issue, reported), update the nested menusKit copy on its own first (zero zeromind update <path to deps/.../menusKit.package>), then economyKit.
What changed in 1.2.24
- Your own end screens.
require("towerDefenseKit.ui").setEndScreen(fn)replaces the kit's "Play again" victory and defeat screen:fn(kind, info)gets"won"or"lost"and{ wave, kills, leaks }and returns true when it drew its own (or holds it back because another screen of the game is up). Returning false, orsetEndScreen(nil), gives the kit's screen back. A campaign can send a win to its results screen with stars and a loss to Retry / Map.
What changed in 1.2.23
- Switch maps live.
TD.relayout()places the route spawn points, entrance arches, goal and grass field again for the layout the syncedTDGamenames now, and points theTDWavesspawner at the new routes. The Game calls it on every machine wheneverlayout,layoutDataorpathWidthchanges. A host moves everyone to another map by settinglayout,pathLookandwaveListon the Game and requesting a restart (towerDefenseKit.net.request({ action = "restart" })).buildplaces the same things it did before, through the same shared code.
What changed in 1.2.22
- Documentation only, no change to the game: a store description that says what the kit gives you, every variant it ships and how to install and use it, and the same install-and-use line at the top of this README. Released after moving the world to the current engine library.
What changed in 1.2.21
- A layout is enough.
groundandlightingare on unless a map sets them tofalse, and the build grid defaults toglow, soTD.build({ layout = "snake" })gives a finished-looking, playable map. - Every build-grid look reads as its own. While you pick a tower, the free tiles are drawn in the chosen look (before, six of the eight looks drew them as the same thin outline), in a pale mint that shows on grass, dirt and lava alike (the old grass green vanished on a green field).
- Blockers are drawn. Each
blockerscircle becomes scenery in the road's look: a lava pool in basalt, a pond with a sandy bank, or a rock outcrop. - Play again can't get lost. Esc closed the victory or defeat screen and left the board stuck with no way back, because MatchFlow moves to its next round at once. The Game now marks a finished game (
ended), the HUD shows Play again while it is, and the end screen comes back if anything closes it. - A friendlier first ten seconds. The first tower you can afford breathes in the build menu until you build, and the welcome message names the first move for your device ("Press 1, then click a glowing tile").
- The decent playtest bot plans like a player reading the preview: it looks two waves ahead for fliers, sneaks and armour, and buys a Cannon or Mortar before armoured waves.
- The lava fork guide is winnable as written. It now starts on normal (on hard the decent bot lost wave 1, as an installer found), the lanes run close enough that a tower between them covers both, a lava pool shows off
blockers, and its six waves are tuned so the decent bot wins with 6 of 20 lives. The showcase's Lava Fork map uses the same lanes and pool.
What changed in 1.2.20
- The playtest bot answers fliers and sneaks with whatever the roster sells that does the job, chosen by what each tower does: anti-air prefers the Missile Battery, then the Gun Tower, Tesla Coil, Laser and Watchtower, then any other tower on sale that hits air (never the Frost Spire, which only slows); against sneaks, any tower on sale that sees stealth. In 1.2.19 it only knew the Missile Battery, Gun Tower and Watchtower by name, so a roster that sold, say, the Tesla Coil but neither of the first two got no flier counter at all.
towerDefenseKit.playtest.counters(roster)returns the choice; the test suite checks it on four rosters.
What changed in 1.2.19
- A map drawn as data can keep towers off its scenery:
blockers = { { x, z, radius }, ... }in the layout table refuses every cell inside those circles ("Something is in the way") on every player's grid, so a lake inside a fork or a rock outcrop is never buildable. Maps without blockers are unchanged. - The playtest bot only builds towers the game sells. Before, on a roster without a Missile Battery or a Watchtower (the lava fork guide's own roster has no Missile Battery), it kept asking for one before flier or sneak waves: each refused request used up one of its build spots, and it saved its gold for a tower it could never buy, so it lost maps a decent player wins.
What changed in 1.2.18
- Every lives display shows the lives count, never a percent or HP: the ring has the count and LIVES inside (it showed "100% HP"), the hologram's readout shows the count (it showed "100%"), and the pixel bar's tag is a heart (it said "HP"). The ring, orb and hologram show the count inside, so no second number stands beside them; on a phone, where barsKit's small looks draw no text, the count stands beside them.
- Quick start: the install command names the kit's id, says an install brings the newest version, and shows how to check which version you got.
What changed in 1.2.17
- No level or XP panel: the Game starts economyKit with
save = false, so saveKit (which economyKit brings) never starts and its "LV 1, 0 / 100 XP" panel no longer sits in the bottom-left corner. - The controls hint and the F3 readout never sit under anything: the hint wraps left of a centred build bar (or moves above it on a narrow screen), and the readout stays above the hint and the minimal menu.
layoutCheckchecks both.
What changed in 1.2.16
- README only: a new install gets three controlsKit releases, not one as 1.2.15 said; the economyKit "ahead of upstream" note now says one or two files.
What changed in 1.2.15
- Ships with economyKit 1.2.10 (navUiKit 1.3.7, menusKit 1.3.13), all on controlsKit 1.3.1: a new install got four controlsKit releases side by side and now gets three (see Known limits).
What changed in 1.2.14
- README only: the known limit on controlsKit copies now says where they come from and where the fix stands.
What changed in 1.2.13
- The first build break waits until the machine has finished loading, not just until the controls are drawn: a player's commander reports ready after 3 seconds of smooth frames (a minute at most). On a busy machine the break used to start while loading still stalled the screen, and wave 1 could arrive before anyone could build.
- Number keys only pick towers: the commander no longer sets inventoryKit up (that started it, hidden, and 1 also picked its first hotbar slot). The Game already starts economyKit with
inventory = false. - The wave preview (wavePreviewKit 1.1.7) tags the enemies shown during a wave as the next wave ("NEXT · WAVE 2").
- The look gallery shows all eight build-grid looks: the row sits a little left and tighter, clear of the lives panel. Layouts whose id starts with
__(the gallery's own short roads) are left out oflayouts.list()andids(). - The how-to guide and the map workflow no longer point at a ready-made gallery scene.
What changed in 1.2.12
- creepsKit and wavePreviewKit are declared
dependenciesinpackage.yaml, so installing the kit brings both whole (tests, galleries, guides, the WavePreview component), not just the files its code names. - The first build break waits until a player's build bar and wave preview are on screen (at most 90 s), so a slow first load no longer eats the break before wave 1.
- During a break the HUD names the coming wave ("Wave 2/10 · Starts in 14s"), the same number the wave preview shows.
towerDefenseKit.gallerygainedcontent(),show()andhide(), so a look gallery in any world is two short files (see "A look gallery in your world").- README and guides: always build the map in a new empty scene (a starter scene's player causes "structural conflicts"), the empty-scene push workaround (#25302), 20 lives on classic/normal, wave pay spelled out per wave, what one tower holds in wave 1.
Performance
- The Game's
creepDetail(auto/full/lite) sets how many parts each enemy is drawn with.autodraws the light version in a browser or on a phone, and on a desktop switches to it while more than 60 enemies are alive (back to full below 30). The forest showcase also caps its draw distances in a browser (forestKit's ownqualitycap of 0.6). - Screens rebuild at most about 6 times a second (gold changes on every kill would otherwise rebuild them every frame), but at once when the player acts.
- Measure it yourself: press F3 in play for a frame-time line (platform, average, p50, p99, fps, enemies alive) over the last five seconds:
towerDefenseKit.perf. It works the same in a browser. - The Game starts economyKit with
inventory = falseandsave = false(economyKit 1.2.9 and later): a team bank needs no bag, and inventoryKit's screen host otherwise ran every frame (about 6 ms a frame here with nothing open). - Measured on 2026-11-12 on the forest showcase, by the kit's author, in a clean editor sub-client of the desktop app. This is a dev build of the engine (the profiler's cost report says so), running on efficiency cores, drawn at 1920 x 1080. Each row is frame time in ms over the stated stretch of play:
| situation | avg | p50 | p90 | p99 | max |
|---|---|---|---|---|---|
| 18 tier-3 towers, no enemies | 26 | 23 | 80 | ||
| 18 tier-3 towers, waves 9 and 10 sent back to back (normal speed, 80 s; the towers keep at most 14 alive) | 40 | 23 | 91 | 237 | 532 |
| a crowd of 140 enemies on the road (one 140-enemy wave at 6x health, 22 s) | 48 | 41 | 68 | 146 | 188 |
With the crowd the engine spent 43 ms of CPU and 0.14 ms of GPU per frame: it is bound by script time, not drawing. The largest costs were Luau garbage collection (8.4 ms), SecondWind's per-enemy Vitals (8.3 ms for 137 enemies), spawnerKit's per-enemy Enemy component (7.6 ms), preparing the UI for drawing (5.4 ms) and Lifeline's health bars (2.3 ms). The kit's own Commander took 0.8 ms and the Game under 1.3 ms. What remains is each enemy's own scripts in those kits, which a release build runs several times faster than this dev build.
- Not measured: a desktop release build and a browser. An agent here can only run the dev editor build in sub-clients, so those numbers have to be read by a person: press F3 in play (or
require("towerDefenseKit.perf").show(true)) for average, p50, p99 and fps over the last five seconds, then send a big wave (waveswith one 140-enemy wave reproduces the crowd above).