Log inGet started
World

Kart Sprint Round: Short Kart Dash Party Minigame

Branchmain
Branchesmain
Commit429da2d967

README.md

kartSprintRound

A kart race round for party game shows: two quick laps of a short themed track for 2 to 8 contestants, people and computer players, finished in about a minute and a half. Every contestant drives a kart painted in their own colour with their costumed body in the seat. The finish order decides the places, and anyone still on the track when the clock runs out is placed by how far they got. Finishers climb out onto the golden winners' stand, and the camera follows whoever leads the rest of the race.

It follows the Showrunner round contract, so it drops into any show built on Showrunner. It is built on racingKit (the track, laps, checkpoints, live positions and AI drivers) and vehiclesKit (the karts, their handling and their keyboard, gamepad and touch controls).

Version 1.0.11.

Install

Install kartSprintRound from ZeroMind (search "kart race round party game"). It brings racingKit, and racingKit brings vehiclesKit. It does not bring Showrunner: the game installs Showrunner itself (search ZeroMind for "party game show kit" or install it by its guid), and the round plugs into whichever Showrunner release the game holds (1.0.1 or later, for setVehicle), so updating Showrunner in the game needs no new release of this round.

First example

In a world with Showrunner, register the round on every machine, at the end of scenes/main.scene/entrypoint.luau:

local Show = require("showrunner.api")
Show.registerRound(require("kartSprintRound.round"))

and practise it against three computer players, at the end of content() in scenes/main.scene/build.luau:

    require("showrunner.api").practice("kartSprint", { arena = "neon", tuning = "standard", bots = 3 })

Press Play. The title card explains the round, the 3-2-1 runs, and you race three computer drivers over two laps of Neon Night Loop. In a full show, add "kartSprint" to the show's rounds instead of practising it.

Arenas

idTitleLook
sugarSugar Rush SpeedwayA glossy strawberry-milk road through a toy-box world: giant lollipops, striped candy canes, gumdrops, ice cream cones and a frosted donut arch over the road.
neonNeon Night LoopA glowing night city: dark towers with lit window bands and glowing crowns, billboards, humming lamp posts and light rails along the road.
tikiTiki Beach DashA sand road between rock walls past swaying palms, grinning tiki heads, tiki torches, beach umbrellas, surfboards and a bright lagoon.

Each lap is about 600 to 655 metres. The scenery is modelled at run time and merged into a handful of meshes per arena (3 to 5 draw calls of scenery, 36k to 60k triangles), so it runs on a tablet. The scenes/gallery scene in this world shows all three side by side.

Tunings

idRoadTop speedExtrasRace
gentle18 m wide21 m/s, computer drivers at 90%noneabout 90 to 100 s
standard14 m wide23 m/s3 boost padsabout 80 to 90 s
chaotic13 m wide26 m/s5 boost pads, 6 springy bumpers on the road, 2 rows of item boxesabout 70 to 80 s

The round clock is 120 seconds. Boost pads (white chevrons) kick a kart on to 1.35 times its top speed.

Controls

The round's control labels are move = "Steer and drive", jump = "Brake and drift", action = "Boost". Driving is vehiclesKit's:

  • Keyboard: W or Up to drive, S, Down or Space to brake (and reverse at a stop), A/D or Left/Right to steer, Shift to boost, Ctrl to drift, R to recover.
  • Gamepad: right trigger to drive, left trigger to brake, left stick to steer, Y or LB to boost, B or RB to drift, View to recover.
  • Touch: a floating steering stick on the left half of the screen (the further you drag, the harder it steers), Gas and Brake pedals, Boost and Drift buttons and a Reset button.

You cannot climb out of your kart mid-race: the seat is locked until the round ends. The driving HUD (speedometer, BOOST bar and the key prompts) stays off while the show's title card and countdown are up and comes on at GO, with the key prompts in the bottom-left corner (raised above any on-screen control stated there), clear of the show's running scores in the top left. On a touch screen the speedometer sits at the top middle just under the show's round timer, placed clear of every touch button (the kart's Gas, Brake, Boost, Drift, II, Exit, Cam, Horn, Reset and the engine's Menu), the running scores and the race's position block, a little smaller where it does not fit (R.gaugePlace); the round states the timer band and the speedometer with ui.setControlRegions (owner kartSprintRound_hud) so a graphics chip or the race's standings keep clear of them too. On a desktop the speedometer stays bottom right.

Computer drivers

Each computer player drives a real kart with racingKit's AI at its show level: easy drives the careful personality at about 82% pace, normal the rubber-band personality at 93%, hard the aggressive personality at full pace.

The contract fields it uses

Round table: id = "kartSprint", title, blurb, howTo, kind = "race", seconds = 120, arenas, tunings, controls, image (the round's card picture, card.texture, which a show that reads it puts on its picker and title cards; a show that does not read it ignores it), build, start, update, botThink, stop. Extra: showcase(arenaId, origin, tuningId) builds an arena alone (for a gallery or a menu backdrop) and VERSION.

From ctx: contestants (id, name, isBot, level, color, colorHex, body, visualBody, peer), origin, arena, tuning, isHost, localId, me(), finish(id), setScore(id, n) (race progress, so contestants who do not finish are placed by distance), announce(text, opts), place(id, position, yaw), moveBot(id, nil), and from Showrunner 1.0.1 setVehicle(id, kart | nil, { seat, follow }) and isParked(id).

Riders

Every contestant's body rides in their kart. The host seats each computer driver in its kart as a script driver and hands its body to the kart with Showrunner's ctx.setVehicle(id, kart, { seat }), the seat being the kart's driver seat with the body's hip height taken off (R.seatOffset). The show then switches the bot's character physics and steering off and carries its visual body on the seat on every machine, costume on, and every machine holds that body in vehiclesKit's seated driving pose (Pose.sit(c.visualBody, "drive")). A person's own machine calls setVehicle for them once they are in their kart, so the show leaves their inputs to the kart. When a computer driver crosses the line the host gives its body back (setVehicle(id, nil)): it climbs out, stands up and walks onto the winners' stand, and its empty kart leaves the track. A person who finishes does the same on their own machine, and the round's end gives every body back. After a host takeover the new host builds a new visual body for each bot; the round follows c.visualBody and seats the new one.

Multiplayer

The machine running the show owns the race: it spawns the karts, hands racingKit the roster, starts the race at GO and turns finishes into the show's finish order. Each person drives their own kart on their own machine, and racingKit records a finish from the kart's synced state, so every screen sees the same order. Race state lives in synced entities (the race director and the karts), so a new host picks it up when the old one leaves.

Changelog

  • 1.0.11: the README's 1.0.10 entry stands under Changelog again (1.0.10 shipped it at the top of the file). Nothing else changes.

  • 1.0.10: a person's kart drives in every round, not only the first. A player's kart belongs to that player's machine while they drive it, and the host could only remove the karts it owned, so at the end of every round each guest's kart stayed behind (owned by nobody once it came to rest). After a few rounds a guest had a pile of old karts of their own name: their new kart drove half a second off the grid and stuck (rear wheels spinning, 0 km/h, DNF), the standings listed them twice, and entity.find could hand the round an old kart. Measured with a desktop host and a browser guest (showrunner practice, 3 bots): before, 8 old karts after 9 rounds and the guest's kart stuck from round 3 on; after, one kart per contestant every round and the guest drove away at 18.5 m/s with W in rounds 2 and 3, and with a finger on the touch Gas pedal.

    • At stop each machine removes its own player's kart, and the host takes every kart it does not own once it is free (claim, then remove, by entity id, so a new round's kart of the same name is never touched: R.sweepKarts). A build clears karts an earlier run left the same way, and a player is seated in this round's kart, waiting while an old one is still on its way out.
    • Built on racingKit 1.0.24 (standings always fit on screen, clear of controls and the boost bar).
    • The version test reads package.yaml and the README instead of a hard-coded number; a new test checks the kart sweep. Tests 16.
  • 1.0.9: with touch, the speedometer no longer covers the show's round timer, and the race panels keep clear of the kart's touch buttons. In a browser at 1258x728 and on a tablet, vehiclesKit's touch speedometer (top middle) stood over the show's timer chip ("1:49 KART SPRINT"), and racingKit's standings stood over the Cam button.

    • The round now places the speedometer itself on touch (R.gaugePlace, R.timerBand): under the timer band, clear of the engine's and the kart's touch buttons (controlsKit draws Gas, Brake, Cam, Horn ... on the engine's overlay, which ui.safeArea().controls does not list, so the round reads zinput.touchControls.layout() as well), the show's scores and the position block, at 0.75, 0.62 or 0.5 size, and places it again twice a second when the buttons change. It states the timer band and the speedometer with ui.setControlRegions (owner kartSprintRound_hud), taken back at stop. Measured at 1280x720 touch: speedometer 467,84 346x131 under the timer (0..76), Reset from x 846; 844x390: 282,84 280x106; 1180x820: under the timer, clear of Reset.
    • racingKit 1.0.23: the standings panel keeps clear of the touch overlay's buttons too (1039,193 below Cam instead of 1039,112 over it), and the empty "NO ITEM" slot is not drawn in a race with no item boxes (it had been hidden only because the speedometer covered it).
    • Desktop unchanged: speedometer bottom right, standings top right.
  • 1.0.8: Kart Sprint loads from a fresh install of partyRoundsKit again, and the driving HUD waits for GO.

    • Built on racingKit 1.0.22 (vehiclesKit 1.2.9). A fresh install of partyRoundsKit + partyShowKit failed in registerAll with "round 'kartSprint' did not load: module ~vehiclesKit.pose names no package": the installer had put vehiclesKit only in a recorded version folder, which a named ~vehiclesKit reference cannot reach. racingKit now reaches its dependencies by their bare names (read through its package.yaml), and the round reaches racingKit the same way (require("racingKit.api"), asset.resolve("racingKit.RaceDirector", "component")), so it finds the racingKit release it declares however the install places it, and picks it out when a world holds several copies. Its own parts stay ~.arenas and so on.
    • The speedometer, BOOST bar and key prompts no longer sit over the show's title card: they are off from the moment the player is seated (title card, countdown) and come on at GO (R.start). The key prompts now sit in the bottom-left corner (R.hintsPlace, raised above any on-screen control stated there) instead of being switched off, so they never land under the show's running scores in the top left. The game's own HUD settings come back when the round stops.
    • Test for the HUD timing and the prompts' place (replaces the 1.0.7 key-prompt test). Tests 13.
  • 1.0.7: nothing of the race stays on screen after the round. In a party game holding several rounds (the partyRoundsKit sampler), stopping Kart Sprint for another round or the lobby left the karts, the player in the seat, vehiclesKit's speedometer, boost bar and key prompts on screen, and installing the rounds together could fail with module 'vehiclesKit.pose' not found. Cause: racingKit and the round reached their parts by bare world-wide names (racingKit.api, vehiclesKit.pose), which stop resolving when a world holds two copies of a kit, so the round's stop threw on its first line. Now:

    • Built on racingKit 1.0.21, which reaches its own parts and its dependencies through its own tree, and the round reaches racingKit as ~racingKit.api and its own modules as ~.arenas and so on.
    • Stop runs each step on its own (leave the kart, camera, bodies, karts, race, item boxes, audio, scenery, arena), logging a step that fails, so one failure never leaves karts or the driving HUD behind. The key prompts the race turned off come back last, after the karts are gone.
    • The package no longer declares vehiclesKit itself: racingKit brings it, and the round only ever uses racingKit's copy (one vehiclesKit fewer in a game's tree).
    • Two new tests: a stop with vehiclesKit unreachable still removes every kart, the race and the arena and leaves no kart or vehicle HUD screen shown; the key prompts come back after the karts are gone and no vehiclesKit_hud screen stays registered. Tests 13.
  • 1.0.6: the top-left corner no longer piles up. The show's running scores fill it (a row per contestant, up to eight), so racingKit's position block (place, lap, times) now sits below them (RaceHud:place), and vehiclesKit's key prompts give way during the race (the title card teaches the keys; they come back when the round ends). In 1.0.5 with eight contestants the scores list covered the position block and the prompts.

  • 1.0.5: fixes "never put in a kart" in shows, takes up to eight contestants, and runs much lighter.

    • The round now reaches vehiclesKit only through racingKit (Racing.vehicles(), Racing.pose(), racingKit 1.0.18 and later), the copy the karts are spawned with. Before, the round required vehiclesKit itself, and its published per-file pins could land on one-file copies of vehiclesKit beside an older racingKit in a show world that had installed rounds before: there require("vehiclesKit.api") failed, no kart spawned, nobody was seated and the bots kept identical grid scores. If a world's racingKit / vehiclesKit is still broken, the round now says so in the log by name instead of leaving everyone standing on the track, and a test checks that racingKit and the round use one vehiclesKit.
    • A run that ended without its stop (a show restarted mid-race) no longer leaves karts behind: the next run raced two karts per contestant and listed everyone twice in the standings.
    • 2 to 8 contestants: eight grid slots, eight karts and AI drivers and eight standings rows on every arena and tuning (tested).
    • The standings panel and the other race panels step down below other on-screen controls (a game's graphics chip, the touch buttons) instead of hiding under them (racingKit 1.0.18).
    • Lighter: racingKit 1.0.19's kart effects no longer leak failing compute dispatches and draw at most four boost flames near the camera. Engine CPU mean / p95 per frame, native, hard bots, 4 contestants, before -> after: Sugar Rush chaotic 20.52 / 26.93 -> 9.57 / 11.95 ms, Neon Night chaotic 21.04 / 31.25 -> 10.63 / 13.25, Tiki Beach chaotic 11.75 / 17.59 -> 10.07 / 13.41, Sugar Rush standard 11.05 / 13.55 -> 11.68 / 17.56 (a noisy run on efficiency cores, median 9.28). 8 contestants, chaotic: Sugar Rush 11.13 / 13.03, Neon 11.22 / 14.88, Tiki 11.75 / 14.99 ms, all held at 60 fps (16.1 ms frame). Tests 11.
  • 1.0.4: no longer pins partyShowKit: it is gone from the package's dependencies and from every file the round ships, so a game installs partyShowKit itself and can update it without a new release of this round. Checked against partyShowKit 1.0.4; racingKit 1.0.17 (vehiclesKit 1.2.8) exactly as published. Adds image, the round's card picture (card.texture), for shows that put round art on their picker and title cards. Nothing in how the round plays changed.

  • 1.0.3: built on partyShowKit 1.0.2 (show events, costume locks, music; additive, nothing in the round changes), so a show world moving to partyShowKit 1.0.2 holds one partyShowKit with this round. Its closure names vehiclesKit 1.2.8 alone (through racingKit 1.0.17) and racingKit exactly as published. Tests 9/9.

  • 1.0.2: computer drivers visibly ride their karts. Built on partyShowKit 1.0.1's setVehicle: each bot's costumed body sits in its kart's driver seat in the seated driving pose on every machine, with its character physics and steering off while it rides, and climbs out onto the winners' stand when it finishes; people are handed to their kart the same way; every body is given back at the round's end; a host takeover's new bot bodies are seated again. R.seatOffset added. Now on racingKit 1.0.17 (vehiclesKit 1.2.8, whose baked Joyride Island no longer blocks installers' pushes), partyShowKit 1.0.1 and controlsKit 1.4.15. Tests 9/9.

  • 1.0.1: first full release. Three arenas, three tunings, computer drivers at three levels, spectating from the winners' stand, original music for each arena and four sound effects, gallery scene, tests.

  • 1.0.0: an early, unfinished publish of work in progress (no README, guide or tests). Use 1.0.1.