Programming
- Text
@joshua / seaside-kart
Seaside kart
A three-lap kart race on a seaside circuit in three.js: drift sparks, boosts and two rivals that race back
Task
Read BRIEF.md beside this file and build what it describes. It is the whole brief: the game, the art direction, what it must not look like, the hooks to expose, the assets to make if it asks for any, and the mandatory self-review rounds.
Task brief
- Setting
One small game, made in three.js code from the same brief by every model: a three-lap kart race against two rivals on a seaside circuit. The point is how beautiful it looks and how complete and fair it plays. It is judged from screenshots of its demo race and from its code. Its pair, Seaside kart with Tripo, is the same race with generated models.
- Inputs
- Text
- Materials
BRIEF.md: the full brief. three.js r170 comes from npm (three@0.170.0), as BRIEF.md says.
- Deliverable
dist/index.html and dist/three.module.js (three.js r170, unchanged): the game on a canvas filling the window, working offline from these files. dist/review.md: the self-review rounds; dist/shots/: the last round's screenshots.
Files
BRIEF.md
Seaside kart
Build a small racing game that runs in the browser: a three-lap kart race against two rivals on a seaside circuit, on a sunny afternoon.
Make it beautiful and fun: toy-like and bright, like a frame from a premium animated racing game. Design your own circuit within the art direction below.
PRIORITIES
- Art direction. It has to look beautiful in a still screenshot and in motion. A plain, default-looking result fails however well it plays.
- It is a complete, fair game, and everything under FOR CHECKING works exactly as written.
- A steady frame rate on a laptop.
SETUP
- Use three.js r170 and nothing else. Get it from npm (
npm install three@0.170.0in a scratch folder) and copynode_modules/three/build/three.module.jsunchanged todist/three.module.js. - Write the game into one file,
dist/index.html. Import three.js withimport * as THREE from './three.module.js'. - No other libraries and no three.js addons: write any post-processing yourself, with render targets and full-screen shaders. No model, image, texture, HDR, font or audio files and no network requests: every shape, texture and sound is made in code.
- Every piece of text the game shows (titles, labels, counters, hints, buttons) is in English.
- The page will be opened in desktop Chrome from a local web server (http://localhost:8000/index.html) in a 1920x1080 window, and also shown small, in a 960x540 frame next to other versions. It must read well at both sizes and hold a steady frame rate on a laptop.
ART DIRECTION
- Palette, by role: sky top #6FB7EA, horizon and haze #FCE6C4, sun #FFF1D0, asphalt #3A3F4A with worn lines #E9E4D8, kerbs #E5484D and #F5F1E8, grass #6FBF5A to #3E8E4A, sand #EED7A1, cliff rock #B98B6A, sea shallow #4FC9C6 and deep #1F7FB5, foam #FFFFFF, my kart #FF6B35, rivals #3C6FE0 and #F2C230, driver suits #F5F1E8, boost flame #FFB347 to #FF4D2E, drift sparks #7FC8FF then #FF9A3C. Nothing outside it.
- Light: a sun #FFE6BF 35 to 45° high, in front of and to the left of the main straight, with soft shadows (a 2048 shadow map, soft filtering) under every kart and piece of scenery; a hemisphere fill, sky #BFE3FF and ground #6B8F45.
- Fog: a light linear haze #CFE8F5 from about 150 m to about 600 m.
- Materials: kart paint glossy (MeshPhysicalMaterial, clearcoat about 0.8, roughness about 0.3); tyres rough (about 0.9) with a tread drawn in code; asphalt with a noise texture and painted lines drawn on a canvas; grass with colour variation and instanced tufts; the sea an animated shader with waves, sun glints and foam where it meets the shore.
- Camera: a chase camera with a 58 to 62° field of view, 6 to 7 m behind and 2.5 to 3 m above my kart, lagging a little into turns; the field of view widens to about 70° during a boost. It never goes inside a barrier, a cliff or the ground.
- Post, written by hand: a bloom on boost flames, drift sparks and sun glints (bright pass, blur, add back); a radial speed blur during a boost; a warm grade; a vignette of about 0.25.
MUST NOT LOOK LIKE
- default grey materials: MeshStandardMaterial left at its defaults, MeshNormalMaterial, unlit flat colours;
- flat ambient-only light, with no key light, shadows or contrast;
- a black or empty void around the scene;
- primitives (boxes, spheres, cylinders) sitting on a plane;
- debug helpers: axes, grids, light or camera helpers, stats panels, GUI sliders;
- karts that are a box on four cylinders, or a driver that is a sphere on a stick;
- a flat grey oval with nothing beside it;
- rivals that slide along a rail at a fixed speed.
THE CIRCUIT
- One closed circuit, a lap of about 40 to 50 seconds at racing speed, with a designed shape: a hairpin, a chicane, a fast sweeper along the sea and a crest or a bridge where the road rises and falls. Not an oval.
- Kerbs on the corners, barriers where the road meets a cliff or the sea, a start-finish gantry over the grid.
- Scenery that gives it a place: a lighthouse, beach huts, palms or pines, a little harbour or a grandstand, gulls, boats on the sea. Something besides the karts always moves.
- One or two boost pads on the road, glowing arrows that give a short boost.
THE RACE
- Three karts on the grid: mine and two rivals. A 3-2-1-GO countdown starts the race.
- Up and Down arrows (or W and S) accelerate and brake or reverse; Left and Right (or A and D) steer. Holding Space while turning drifts: the kart slides, sparks fly from its rear wheels, blue then orange as the drift charges; letting go gives a boost, longer for orange.
- Grass and sand slow a kart; barriers and walls stop it with a bounce and a knock, never let it through. Karts bump each other.
- The rivals drive the same kart physics as mine, along a racing line, with small mistakes: they brake for corners, drift, overtake and can be overtaken.
- A lap counts only once every checkpoint around the circuit has been passed in order: no shortcuts.
- The HUD shows all the time: lap as "2 / 3", my place as "1st / 3", and the race time.
- After three laps a results screen shows each kart's place and time and offers to race again (R, Enter or a click), back on the grid with a fresh countdown.
- When the page opens, my kart is already racing by itself (a demo race: the same kart and physics, driven by the computer through the same controls) until I press one of the driving keys; then I am on the grid and the countdown starts.
FOR CHECKING Expose these on
window. Positions are in metres, y up; angles in radians.getState()returns{time, x, y, z, heading, speed, lap, laps, place, drifting, boost, finished, demo, rivals}:lapthe lap I am on (1 to 3),laps3,place1 to 3,driftingandboosttrue while they last,finishedtrue once I cross the line after lap 3,demotrue while the demo drives, andrivals[{x, y, z, speed, lap, place, finished}, ...].getTrack()returns{centre: [{x, y, z}, ...], width, checkpoints: [{x, z}, ...], start: {x, z, heading}}: the centre line as a closed loop in the race direction, and the checkpoints in order.- The game runs on a fixed 60 Hz tick, independent of the display rate. Anything random is seeded.
seek(t): start the demo race again from the grid and run it totseconds, as fast as it can; the page carries on live from there. The sametalways gives the same state. Openingindex.html#t=30doesseek(30)on load.restart(): put me, not the demo, on the grid before the countdown: everything back to the start, no keys held.advance(dt): run the game forwarddtseconds now (round(dt × 60) ticks) with the keys as they are held, then carry on live.- Keys are read from
keydownandkeyupevents onwindow, byevent.key.
SELF-REVIEW LOOP (mandatory)
- Screenshot the page at 1920x1080 at seek(5), seek(30) and seek(70) of the demo race, and mid-interaction: a drift with orange sparks, a boost on the sea sweeper, wheel to wheel with a rival, and the results screen, and once at 960x540. Use your preview tool or a headless browser; the
#t=hash makes set moments easy to capture. - Look at the screenshots as a harsh art director and a harsh player would: list what reads as cheap, default, unfinished, off-palette or unfair to play, worst first.
- Fix the top 5.
- Repeat. Do at least 3 rounds; stop only when the worst problem left is minor.
- Write
dist/review.mdin English: for each round, the moments you shot, the critique and the five fixes. Keep the last round's screenshots indist/shots/as JPEGs.
BUDGET About 60 to 90 minutes of work. Get a playable game early, then spend most of the time on the look, the feel and the review rounds.
DELIVER
dist/index.html,dist/three.module.js,dist/review.mdanddist/shots/.DONE WHEN The page opens with no console errors, the demo races by itself, I can race three laps against two rivals who race back, drift and boost, hit a barrier and carry on, see the results and race again, and dist/review.md records at least three review rounds.
How it’s checked
- The final screenshot looks like a bright, toy-like seaside kart race in the brief's palette: a winding circuit with kerbs and scenery, the sea beside it, karts with character; not default grey materials, an empty void or debug helpers.Judge model
- A clear sun with soft shadows under the karts and scenery, a sky gradient and haze in the distance, and glints on the sea and the kart paint.Judge model
- The karts and drivers are modelled with care: rounded chunky bodies, wheels that turn and steer, a helmeted driver, each rival in its own colour; not boxes on cylinders.Judge model
- The circuit has a designed shape (a hairpin, a chicane, a fast sweeper by the sea, a crest or bridge) with kerbs, barriers, boost pads and scenery that gives it a place; not a flat oval.Judge model
- The race is complete: a countdown, three laps, two rivals that race and overtake, a HUD with lap, place and time, a drift with sparks that charges a boost, and a results screen with a way to race again.Judge model
- The code has hand-written post-processing as the brief asks (bloom on flames, sparks and glints, a speed blur on boost, a warm grade, a vignette), and it shows in the screenshots.Judge model
- dist/review.md records at least three rounds of screenshots, a harsh critique and five fixes each, and the final page shows those fixes.Judge model
- Driving, laps, places and collisions come from the page's own fixed-tick simulation against the circuit's geometry; the demo race and the rivals drive with the same physics as my kart; nothing is scripted or faked for the checks.Red lineJudge model
- Everything is made in code on three.js r170: no model, image, texture, HDR, font or audio files, no other libraries or addons, and nothing loaded from the network.Red lineJudge model
Projects using it1
- Seaside kart
Claude Opus 5.5 · Claude Code9/9 passed
MiniMax M4 · Claude Code8/9 passed