How Punchnaut is made
Punchnaut is a free online space brawler that runs in the browser on WebGPU. This is the technical story of its first weeks: what we took from three.js, what we wrote ourselves, how the lighting went from baked to realtime, and how one developer builds it together with AI models.
In short
- Punchnaut is a free multiplayer browser game. It needs WebGPU and has no WebGL fallback.
- It is plain JavaScript on the three.js WebGPU renderer. The final frame, the glow and the lighting data are our own.
- Lighting went through three versions in four days: vertex colours, then offline lightmaps, then realtime light from the eight best sources per 15 m cell.
- Halos are not drawn as shapes. Anything brighter than white in the frame glows on its own.
- Two round planets, 400 m and 560 m in radius, with no loading screen between them.
- 3D models are Blender Python scripts. Colour lives in the vertices, not in textures.
- Mobs run on one player's page. The server relays them and keeps health, deaths and experience.
- One developer makes the game with GPT 6 Astra, GPT 6 Sol, Claude Fable 5.2 and Claude Opus 5.5.
Why a browser game on WebGPU
We wanted an online game that opens from a link, needs no install and still runs on ordinary laptops with integrated graphics. We chose WebGPU only, with no WebGL fallback.
Punchnaut grew out of an earlier browser project by the same developer. The first commit of the space game is dated 1 November 2026. By 16 November it had more than 600 commits and its own name.
On 5 November we removed the last WebGL branches. Keeping two renderers means two sets of bugs and a picture tuned for the weaker one. If the browser cannot give the renderer a WebGPU backend, the game does not start. There is no slower path to fall back to.
Weak graphics cards shaped many decisions. The pixel ratio is capped at 1.5, so high-density screens render fewer pixels than they could. Objects are merged into shared meshes instead of being drawn one by one. Most models have no textures at all.
What we take from three.js and what we wrote ourselves
three.js gives us the WebGPU renderer, the scene and node materials written in TSL. The final frame, the glow, object batching, culling and the light data structures are our own code.
We use three.js 0.186.1 through its WebGPU renderer. Materials are three's node materials written in TSL, its shader language in JavaScript. Our light code is plugged into those materials as extra nodes.
The last steps of the frame are our own. The scene renders into a half-float target, so colours can go above 1.0. Our pass adds the glow, applies light grading of shadows and highlights and a soft vignette, and converts the result to the screen. It is written in WGSL and talks to the renderer's GPU device directly.
Props are not separate objects. Everything standing on a patch of ground is merged into one mesh for that patch. Patches beyond the planet's horizon or past their draw distance are not drawn. On the second planet, the view from jetpack height fits in 25 draw calls and 40 thousand triangles.
- Dropped: the WebGL fallback, grass and wind, the aurora, the landing ring, beams of light over places to discover.
- Dropped after a crash: a separate light object with its own lights node. A player's graphics card hung with
DXGI_ERROR_DEVICE_HUNG. We never reproduced the cause, but we removed the path. Losing the device now stops the frame and offers a reload button. - Switched to reversed float depth. With the ordinary depth buffer and a near plane of 0.1, a glow 5 cm above its floor started to flicker against it from 290 m away. With reversed depth the error grows with distance, not with its square.
One TSL detail cost us an experiment. A chained call like a.mix(b, t) treats a as the factor, not as the first colour. Our faceted ground normals came out covered in black grain, and we cancelled that experiment. Now we write mix(a, b, t) explicitly.
Lighting: from baked lightmaps to realtime light
The planet is lit by glowing crystals, mushrooms and lamps, about 1,600 fixed light sources. In four days we tried vertex colours, then offline lightmaps, and settled on realtime light from the eight best sources per 15 m cell, without shadows.
Version 1: light in vertex colours
At first the game computed light on the CPU when it built the world and wrote it into vertex colours. It was cheap to draw, but light can only change from one vertex to the next. On large triangles the edges of pools of light came out broken and jagged.
Version 2: offline lightmaps
On 12 November we moved to texture lightmaps. A Node tool baked all of the fixed sources offline into textures with 0.25 m texels. Shadow edges were smoothed with 4×4 samples per texel. The first single file weighed 30 MB and its textures took 54.7 MB of GPU memory. We then split the data into regions, so a player near the base downloaded 52 files, 6.6 MB, instead of the whole planet.
Small objects cast ugly shadows. One tall lamp threw a long stripe across the ground: 278 of 315 blocked rays hit its two slanted legs. So we added a rule. A shape narrower than 0.8 m in two directions casts no shadow, while a wide, thin wall still does. Lamps and flags never cast one. In a local test this cut visibility queries from 25,688 to 16,964 and the time from 93.8 to 37.5 ms.
- fixed light sources baked
- ~1,600
- regions of light data
- 363
- compressed light data
- ~56 MB
- full bake before each release
- 5-9 min
What broke
Every release now carried a bake of several minutes. The cache kept a fingerprint of the world, so the client could tell whether the light still matched the geometry. On 13 November a player saw no light at all. Their browser listed the faces of convex shapes in a different order than Node did, the fingerprints differed, and the client rejected every lightmap. Sorting the faces before hashing fixed it. The same day we added realtime lighting as an option and removed the choice of baked light later that day. On 14 November 2,805 lines of baking code and tools were deleted.
Version 3: realtime light
Both planets are divided into cells of at most 15 m on a cube projected onto the sphere. Each cell keeps a list of up to eight light sources that matter most to it. Sources and cells live in GPU storage buffers. The shader finds the cell of the point it is shading and adds those eight lights. Mining a crystal only switches its source off. Moving a rare crystal rebuilds the cells around it.
- The ground gets lamp light per pixel. Its vertices are metres apart, so per-vertex light would smear the pools.
- Props get lamp light at the corners of their faces, which is cheaper than per pixel.
- From 120 to 220 m away, ground light fades into a few pooled soft spots instead of per-cell light.
- Moving characters are lit by a pool of three point lights. The nearest sources are picked from the grid ten times a second.
- Lamp light casts no shadows.
Without a bake, a new model needs only a rebuild of the game. The new rocket brought its light sources down from 15 to 10. Its cyan belt light is spread along a quarter of a ring of sample points, so the band of light has no hot spot.
Glow: halos come from the frame, not from shapes
Halos are not drawn as transparent sprites or shapes. Lamps, crystals and stars are simply brighter than white, and a dual-filter glow pass turns that brightness into a halo.
Early builds drew halos as geometry: rings round crystals, beams of light over places, rays on bright stars. Each of them was another transparent draw, and a drawn halo could be cut by the ground. We removed them one by one.
Now a part of a model that should glow has a colour above 1.0. The rocket file marks such parts with a brightness factor. The glow pass picks out pixels above a threshold, shrinks the image several times and grows it back. That spreads the light smoothly at a fixed cost per frame.
Some graphics cards return NaN or infinity where others return a number. One such pixel used to flood the whole glow with white. The bright pass now replaces NaN with zero and clamps every value at 16. Glow can be switched off in the settings without a reload.
Planets and terrain
Both planets are spheres with gravity towards their centre, and you fly between them with no loading screen. The home planet's relief went from noise, to a smooth sphere, to named landforms with level pads under everything that stands.
The home planet has a radius of 400 m. The second planet, Amber, has 560 m and a surface gravity of 3.6 m/s². Gravity falls off with the square of distance, and the game picks the planet whose pull is stronger. The jetpack has no ceiling. On a hoverbike with boost the trip to Amber takes about 12 seconds.
The ground is a cube projected onto a sphere, split into chunks with levels of detail and skirts that hide the seams. While the game loads, the planets are built in 8 ms slices, so the loading screen keeps moving.
The relief, three times
The first builds had sharp relief and four biomes. On 12 November the home planet got rock shelves, basins and faceted normals. The same day we removed the procedural basins, terraces, ridges and noise. On 13 November the home planet went back to a clean sphere.
On 16 November the relief came back in a different form. It is no longer noise everywhere but a list of named landforms on calm ground: peaks with spurs you can walk up, ridges, a mesa with a gentle way up, a canyon open at both ends, craters and a caldera. One of the peaks, the Needle, rises 52 m.
- There is no relief near the base or under the places built as models.
- Every mob camp, landmark and discovery stands on a level pad cut into the landform. A script writes the pad list from the directions of those places, and the directions do not depend on the relief. So editing a mountain does not move the pads.
- Landmarks pick their spots on the plain sphere, and the relief only lifts them. Otherwise any edit would reshuffle every landmark and the crystals tied to it.
- The ground mesh has a 3 m step, too coarse for sharp rock. The rocky look comes from 132 boulders on summits, ridges and crater rims.
3D models: Blender scripts and vertex colours
Every model is a Blender Python script in the repository, not a hand-edited file. Colour is stored in vertices instead of textures, and every file is compressed with meshopt.
A script builds the mesh, names its parts by role and exports a glTF file. Roles mark what is lit, what glows, what only collides and where a light sits. Changing a model means changing code that can be reviewed and run again.
Colour lives in the vertices. A texture costs memory, sampling and a texture coordinate on every vertex. Flat faces with vertex colour suit the look of the game and stay cheap on integrated graphics.
Every file is compressed with meshopt: positions quantized to 16 bits, normals to 10. Then the triangles are reordered for the GPU vertex cache, because meshopt orders them for file size.
- the rocket, textured skin replaced by vertex colour
- 378,808 → 88,900 bytes
- triangles in the astronaut
- 8,130 → 2,388
- light sources on the rocket
- 15 → 10
- draw calls for an astronaut in any suit
- 2
The suit is a kit: a frame and ten sets of helmets, bodies, legs and boots on the same skeleton. Whatever you wear is merged into two draw calls. The new rocket is drawn as one shell and collides as five invisible convex pieces. Large places such as the cave or the wrecked cruiser are one model each. The ground under them is cut away, and the player, the camera, mobs and the hoverbike collide with the model's actual triangles.
Network: who runs the mobs
The server never simulates a mob. The page of one nearby player runs each group of mobs and sends its state, and the server relays it. Health, deaths, experience and everything the player owns are kept on the server.
The server is Node.js with WebSockets. For each group of mobs, one player's page is the owner: it runs their movement and fights and sends a row per mob. A row goes out only when something changes, plus once a second to keep the mob alive. Rows travel as packed bytes. When the owner leaves, the server hands the group to another player.
The server keeps what must not be faked or lost: who owns which group, each mob's health and how long it stays dead. A killed mob comes back in ten minutes, a site's keeper in thirty. Experience is counted on the server too. An experience orb only drops if the mob is a species listed for that place, died near its home and did not die too soon after appearing. The level formula is shared code: 40 points for the first level, then 18% more for each next one.
The account stores the level and experience, the crystal and rare crystal balance, owned and worn suit parts, jetpack upgrades and the inventory. A player's position is not sent while it does not change, except once a second to keep it fresh.
Fist fighting and moves
Punchnaut has no guns for the player. You fight with fists: a three-blow combo, a spin kick, a dodge, and 15 moves in total that open with levels.
The left button throws a three-blow combo: a lunge, a rising uppercut and a spinning hook. Each one moves the whole body and also plays on the run. The right button is a spin kick that takes 0.62 seconds. Shift is a dodge, with a reward for a dodge timed just right.
New moves open with levels into three right-button cells. The Uppercut opens at level 9, the Air Spin at level 16. A blow keeps facing the enemy it started at until the fist lands. That way an enemy who steps aside during the windup still gets hit.
Mobs react to the kind of blow: they flinch, get knocked back, fall, tumble when thrown up or sway, stunned. If you hit back within 3 seconds of taking damage, you win back up to 40% of what you lost.
Six languages
The game speaks English, Russian, Spanish, Brazilian Portuguese, German and French. Each dictionary is loaded only when its language is picked, and the build fails on a missing or unused key.
Each language is its own dictionary, a separate chunk fetched only when the player picks that language, so nobody downloads all six. Plural forms follow each language's rules.
A check runs inside the build. The player's text may live only in the dictionaries. All six dictionaries must have the same keys with the same {parameters}. Every key must be used, and every key used must exist.
How we work with AI models
Punchnaut is made by one developer with OpenAI GPT 6 Astra and GPT 6 Sol and Anthropic Claude Fable 5.2 and Claude Opus 5.5. The developer sets the tasks, plays the builds and decides. The models write the code and the Blender scripts and review each other's work.
- The developer plays and decides. The models do not run the game: the developer checks the picture, the controls and the fights in the game and accepts or rejects them.
- Models write code and 3D models. Many models start with a generated reference picture, then a Blender script is written to match it.
- Models review each other. Larger changes get an independent review by another model, which reruns the targeted tests and reads the change.
- Measure first, then speed up. Every speed-up starts with a number: draw calls, triangles, queries, milliseconds on a fixed test. Changes that cannot be measured are reported as unmeasured.
- The build catches the usual mistakes: materials made outside the paints module, names, state changed outside its actions, and the translation rules above.
- Decisions and their reasons are written down. A project guide and a journal of causes let the next session, or the next model, pick up the work.
Most checks run in Node without a browser: walking on slopes, the hoverbike, mobs of two pages against a real mob server, the light registry, the cache fingerprints. The developer runs the game itself.
What we learned
- A baked cache is only as reliable as its fingerprint. A face order that differed between engines once switched the light off completely.
- Realtime light from a few nearby sources per cell is enough for a night planet, and it turns every art change into a reload instead of a bake.
- Glow from brightness beats glow from geometry: fewer draws, no halos cut by the ground, one setting to turn it off.
- Relief should be authored, not generated, when things have to stand on it. Level pads and fixed landmark directions keep the world stable while the mountains change.
- Vertex colour and Blender scripts keep models small and reviewable. The rocket lost three quarters of its file when it lost its texture.
- Let a player's page run the mobs, but keep health, deaths and experience on the server.
Free, in the browser, no download. Needs WebGPU: current Chrome or Edge on a computer.