| type | Module | ||||
|---|---|---|---|---|---|
| title | osage-kart-native | ||||
| description | The native client of the kart world, built on Bevy, and the testbed of the rendering programme with its benchmark. | ||||
| resource | https://github.com/smichea/osage/tree/main/worlds/kart/native | ||||
| licence | MIT OR Apache-2.0 | ||||
| status | draft | ||||
| tags |
|
||||
| generated |
|
Show that a native client joins the same world as a browser, and give rendering work a real scene to be measured on.
- Pose: a kart to draw, as it is this frame. Whoever computes the karts writes poses; the scene only draws them.
- Two sources of poses: the network replica when playing, a local simulation in the bench.
- Content is optional: with the files of the asset manifest, surfaces are real materials; without, plain colours. The game runs either way.
Each frame has two stages. In Simulate, one of two plugins writes the poses: play applies what the world sent and predicts the player's kart — knocks with the other karts included, each stepped on with the controls its state carries to where it is at the player's moment, and drawn there (D-076, exact client prediction); bench steps a local race of AI drivers (osage-kart-racecraft). In Draw, the scene modules read the poses: track (road, markings, kerbs, mown verges, barriers with grime at their foot (D-106), the land with its knoll and lake), scenery (trees, bushes, flowers, rocks, clouds, balloons, mountains) and landmarks (start gantry and grandstand, tyre stacks and chevrons, arches, windmill, jetty and boat, fair with a big wheel; by the track's scenery, D-061: a lighthouse and its keeper's house on a coast, where track also draws the sea to the horizon and greys the ground into cliffs; rows of houses in a town; denser woods in a forest), both built with osage-procedural, karts (model and motion: wheels that spin and steer; the driver's hands on the wheel, the trunk a mass on a spring about the waist — thrown out of a bend by speed times rate of turn, forward under braking, back under acceleration, swinging a little past and settling, rattled on kerbs and grass — the helmet carried with it and the neck keeping the eyes nearer level; knocked, the trunk is thrown aside and the hands come off the wheel a moment (D-111); spun round, the driver shakes their head, and on the podium raises the left fist and waves it, D-087), effects (particles), rain (D-068, D-069: when the race is wet, or --rain on the bench, the sky turns to a photographed overcast one, calibrated by its brightness overhead, the camera 3.4 stops more open and unlit smoke, spray and rain exposed to match (scene::unlit); streaks of rain round the camera, the road and painted concrete darker and glossier as they wet over 6 s, the sun veiled, the sky and haze grey; effects adds spray and darkens its smoke; the prediction steps on the wet road), lights (D-085: at night — a race the world rolls dark, or --sky night on the bench — the photographed night sky with its stars brightened to a deep blue and its moon to a grazing moonlight, the camera 7.5 stops more open, a floodlight mast every 40 m round the circuit on alternate sides, 13 m tall, its spot light aimed at the road 14 m ahead, about 500 lux where it lands, none in a tunnel or on a bridge; a lamp under each kart's nose and a red glow at its back), spans (D-077, D-080: swept from cross-sections with texture coordinates in metres — photographed concrete and rock at their real size — and the weather's marks per vertex; a bridge's deck, its fascia and parapet one face under a cornice, crossheads on round columns sunk into the gorge; a tunnel's vault, faced with pale panels up to 3.4 m, lit by lamps high on the walls one side then the other, its rock shell and concrete portals; with track::place, the land of a mountain, a canyon or a coast, and bare rock where the ground is steep), marks (rubber laid where the rear tyres scrub — drift, slide, spin, a stop harder than brakes — and ruts in the grass, one mesh, fading over 25 s, D-067), wildlife (D-104: flocks wheeling over the hills, birds of prey gliding high, birds feeding near the track that a kart puts up, rabbits that bolt from a kart, deer that raise their heads to one — sculpted, seeded, the same on the bench), crowd (D-103, D-109: marshals waving their flags at karts within 45 m, the cloth a grid moved by a travelling wave, D-110; every spectator follows the race on a temper of their own — excitement from the karts near, the faster the more, a spin or a jump most; eyes on the nearest kart or the one behind; past their own threshold they cheer their own way, standing up in half a second and sitting back in one, bouncing and swaying at their own rhythm; tempers drawn anew for each race, the same on the bench), sound (a voice per kart made by osage-kart-sound from its state — the content's recordings where there are some, decoded at the start, synthesis otherwise — placed where it is and heard from the player's kart (D-070: its own voice centred, at full level from the driver's eyes and a little softer from behind and from above — ×0.75 and ×0.63, D-078 — the others at 9 / (9 + d) of theirs, panned as the camera looks, and shifted by the Doppler effect of the two speeds, all in each voice's stereo stream); the crowd in the grandstand; a cargo feature, sound, on by default — the bench is built without it and needs no sound library), and the chase camera: it follows a little late, looks into the bend the kart turns into, banks a little with it, widens with speed, and shakes as a following car would — a hum on asphalt, more on kerbs, bumps on grass, a jolt when the kart stops harder than brakes can (a smooth function of time: the bench's frames stay the same). Three views — behind (the default), the driver's eyes, high above — cycled with C or a gamepad's Select; Q, E and X held look left, right and behind, as does a gamepad's right stick, the head turning smoothly. paddock draws what the world sends of its paddock objects, and what the player's own kart lets go of at once, from the prediction, until the world's arrives (D-071), (osage-kart-items): crates of amber glass with a question mark on each face (a texture drawn at the start; texture coordinates made again so each side's mark stands upright), bobbing and turning, broken at once where the player's kart is predicted to touch one, in a burst of confetti; tyres rolling, cones tossed (and, knocked by a kart, sliding and tumbling, D-079), oil spreading, drones flying to the leader with their rotors turning and heard, a burst where one lands. Every kart carries what it holds on its back, small, for all to see (a nitro bottle, a spare tyre lying down — standing, it hid the driver from the chase camera — three for a stack, a cone, an oil can, a rocket, a smoke canister, a drone, an air bag, a red pit-crew flag); what it holds behind sits a metre and a half behind it, on the road; a kart under a push's guard glows in a bubble; a bumper used sends a ring out from the kart; a kart pouring smoke leaves a thick cloud of its colour. A kart with rocket left shows two rockets behind the seat (karts), with fire and a trail of smoke; a boost, nitro included, flames and smokes from the exhausts at every tier (effects). hud shows a RaceView, a plain description of the race that play fills, the item in hand included (how many tyres of a stack, whether it is held behind); F, Ctrl or a gamepad's North button uses it, and holding it keeps a tyre, a stack, a cone or oil behind the kart until it is let go (D-052). The interface's look is theme's (D-078): Saira (SIL OFL 1.1, from the content) — Bold, in place of Bevy's default face, for figures and titles, Regular for text — rounded see-through panels with a faint edge, amber for the accent and gold, silver and bronze for places, opaque dialogs (blending is in linear light, where a white text behind even a 95 % panel shows grey), keycaps for keys (the arrows drawn, as the faces have none), all scaled with the window's height (drawn for 720 lines, ×0.75 to ×2.5). The HUD: the place, the lap or the lives and the clock top left; the item in hand top centre; the standings top right (place, paint, name, lap or time or lives; the player's row lit; as tall as the field); the map, and the speed with its turbo gauge, bottom right; between races three cards — event, records, your kart — over a bar of keycaps. --bench --ui-preview draws the interface over the bench's race in four states set by hand — racing, the countdown under the crash-report question, results, a battle under the settings — into a picture the screenshots take (preview). Between races, the arrow keys or a pad's d-pad choose the driver (left, right) and the kart body (up, down) from the world's roster (osage-kart-roster, D-055), named in the panel under the prompt, where the cup being raced and its standings are shown too, with what is raced next (T chooses it for the host, a vote for the others; L, for the host, how hard the bots race, D-088, and G the engine class, 50 to 200 cc, D-089, both shown on the event card, the prediction stepping in the class; osage-kart-cup, D-057; a battle among them, D-065: 3 LIVES where the lap counter was, OUT once out, the board's lives in words, a clock counting down, WINNER! for the first, and karts out drawn seen through; a time trial among them, D-062: the lap counter reads TRIAL, the ghosts of the best runs — osage-kart-ghost — are drawn seen through, in one pale material, without shadow, sound, smoke or sparks, and the board shows each with the time it drives to); the player's kart is predicted with its build, and built again in its colour when it changes. The player's profile (osage-kart-profile, D-064, osage/kart-profile.txt) gives the world the driver, kart and paint raced with last, once a connection, keeps every change, counts the player's points when a cup ends, and P paints the kart with the next paint won; karts are drawn in PAINTS, the team colours and four special ones. When the world's track changes (a cup's next race, D-056) the scene is built again round it; --bench --track ID|FILE benches a track under its sky. A panel under the prompt shows the world's records (osage-kart-records): the best five laps, races and time trials, the player's marked, new ones flagged NEW!. Skill shows (D-050): the drift gauge and the sparks take the colour of the mini-turbo level charged (blue, orange, violet); over the circuit's crest the road, kerbs, verges, barriers, fences and land rise and fall together, drawn in half-metre pieces (track, D-051), and things on the road and the chase camera with them; a kart follows the crest's slope and its path through the air, and a trick rolls it over once; air streams past a kart in another's wake, and a stalled engine coughs black smoke (effects); during the countdown the HUD says to throttle as the lights go out, and the GO! becomes GREAT START! or STALLED. Escape opens the settings (settings, a panel of rows, the one chosen lit and its value between ‹ ›, what it does written under them): the frame rate wanted, sound on or off, music on or off, where the music comes from, and whether the radio directory is asked and for which kind of music — up and down pick one, left and right change it, and N and M switch sound and music at any time; they are kept in osage/kart-settings.txt. music plays through osage-music (D-059): auto (the host's shared playlist when the world announces one, Race.music_port, waiting five seconds to hear from the world; else the game's own), the game's five CC0 pieces (kart.playlist, levelled, files in the content), the player's folder osage/kart-music/, the host's, or radio — the stations of osage/kart-radios.txt (written with an example the first time) and, when chosen, the directory's for a kind of music; B skips to the next piece or station, Shift+B back, and what plays is shown at the bottom for six seconds. Music is quieter under the karts (a half for pieces, a third for stations, which master louder), and the sound setting does not mute it. voice joins the world's voice conference (osage-voice, D-060) under the driver's name when the world announces a relay (Race.voice_port): the others are heard at once; the microphone opens only for push to talk (V held) or an open microphone, chosen in the settings, where each other voice can be muted (left and right pick, Space mutes); who talks, and whether the player is heard, show above the music line. report (D-073, osage-report) watches each run in osage/kart-reports/, logs it there, and when the last run panicked, never finished starting or had renderer errors asks the player once whether to send such reports to the developers' relay. A small meter at the bottom centre shows the frame rate (D-078: no longer the tier, which the player has no say in; the log and the reports keep it). The tier is the game's to choose (graphics, D-075): from the graphics adapter (discrete T3, integrated T2, none T1; T4 only with --tier T4), after a failure at a tier — a run at it that went wrong (D-073), or a frame of one colour ten seconds into the race, after which the game starts again — the same tier without one technique more, the likeliest culprits first (the sky as a light, post-processing, ambient occlusion, shadows), the first set that works kept for the machine (trimmed), and only with every suspect left out a tier lower (D-090; a failure noted before that is tried again once); the player chooses only the frame rate (30 by default, D-074). photo is the photo mode (D-066): O freezes every kart where it was drawn and frees the camera through Viewpoint (W A S D, E and Q, the arrows; R and F zoom, Z and X focus, 1 and 2 the lens of a full-frame camera with Bevy's depth of field), hides the interface once its help has shown, and leaves the player's kart to coast; --focus METRES puts that lens on the bench's held camera. show presents the race (D-063; in the replay the particles slow with the karts, effects::Pace): on the grid a camera flies the circuit low over the road, the chase camera easing down behind the kart when the countdown starts; the last six seconds of every kart's pose are kept, and the player's finish is shown again at half speed — beside the kart, then by the line — with REPLAY where the lights are; both set the camera through Viewpoint, and a viewpoint from the command line turns them off. The whole race is kept too (D-082), thirty times a second from its countdown: between races, R shows it again as television would — cameras by the track every 42 m, the first ahead of the kart followed, on alternate sides at heights of their own, none in a tunnel; every fifth shot from a helicopter behind and above, every fifth from the kart behind its driver (always in a tunnel) — while the cards give way to a line saying whom it follows, the race clock and the speed; left and right follow another kart, up and down run it from a quarter to four times as fast, Space pauses, R goes back, and the next countdown ends it. Only the karts are replayed, not the things on the track. With --autodrive, the host starts the race at once, and --screenshot-after takes a list of times, so that a passage can be shot frame by frame; with --headless too, a game is played without a window and the pictures are taken of the off-screen picture (no interface, no sound, no crash watching). --players 2 splits the screen (D-086, play-two.bat on Windows): the second player has a connection of their own to the world — they are a player of it with their own kart, its controls sent through that connection, while the first's keeps the world's state for both — their kart predicted as the first's is; a second chase camera draws the lower half of the picture into the same off-screen picture, after the first's and without clearing it, the first's the upper half, and the show and the photo mode keep to the first's; player 1 drives with W A S D, Space or left Shift and F or left Ctrl and the first gamepad, player 2 with the arrows, right Shift and right Ctrl or / and the second; whichever is the world's host starts the race with Enter; a line at the top of the lower half gives player 2's place, lap, speed and item — between races their driver and kart, which they pick with the arrows and the second gamepad's d-pad, and a paint with . among those the profile has won, player 1 then with D A and S W — under a dark rule between the halves. Each particle faces the camera nearest it; the key bar between races shows player 1's D A / W S and player 2's arrows.
With the asset manifest's content (osage-content) the circuit is photographed instead of toy-like: the sky is a photograph (a photographed sky), at noon or, with --sky evening, in the late afternoon (the bench's is noon unless asked, and its report names the sky), the road (rubbered along the racing line, with skid marks through the bends), verges, gravel traps, kerbs and walls get real surfaces, the meadows vary in clumps and patches and no ground repeats: the road's grain is untiled from T2, the grass and gravel's from T3, and the road shows its history — a paving seam, repaired patches, cracks, stains — at every tier (ground that varies, D-054), concrete has a grain (steel and paint stay smooth), and from T3 the roadside is dressed with models and the land ringed by woods of tree cards (osage-kart-roadside, on osage-props) in place of the toys; at T2 the woods of tree cards come to 35 m from the track, with procedural bushes and no procedural tree; at T1, procedural trees only. The start is a club circuit's: a galvanised gantry with its start lights in a black housing, a grandstand of concrete tiers with plastic seats and sculpted spectators in everyday clothes (osage-kart-crowd), under a sheet-metal roof, chain-link fences between the walls and the spectators along the straights near the start, people standing behind them in small groups, marshal posts at the sharpest bends (a numbered post, an extinguisher, a marshal in orange with a yellow flag), a pit building across the straight (light concrete, six numbered roller doors under a canopy, two of them open on dark garages with a kart parked before each, its driver waiting in it and a mechanic in the team's colour beside it, a sign band, race control above behind a band of dark glass, windows at the ends), and advertising boards above the walls where the circuit bends gently, printed with the karts' sponsors' marks, no real brand. The land itself is a component (osage-kart-land).
Command line: a world's address to play, --bench to measure, --tier, --sky noon|evening, --without TECHNIQUE, --autodrive, --screenshot-after, --camera X,Y,Z,TX,TY,TZ to hold the camera at a place (pictures of the landmarks; a bench run with it is not the sanctioned bench), --focus METRES to give it the photo mode's lens, --film FROM,TO[,EVERY] to save a picture of every frame (or every EVERYth) of a stretch of the bench in place of its four screenshots — the frames of a smooth film whatever the machine's speed, since the bench steps time by a fixed amount (its timings are then not a bench's), --track ID|FILE a track or an arena. --fps N|off the frame rate wanted for this game. OSAGE_ASSETS names the content directory, or none.
Races: on the grid (PHASE_READY) the host — the first human driver — starts the race with Enter or a gamepad's North (the others see whom they wait for); a player racing alone can end the race from the settings (Enter); both go to the world as Step.call, carried by a few messages. Settings: Escape (or a gamepad's Start) opens them; the frame rate wanted (off, 30 to 144; 30 by default, D-074) is kept in osage/kart-settings.txt under %APPDATA% or ~/.config, and the engine holds that rate. While they are open, the keys do not drive.
Between races (D-131), a selection screen shows what is chosen by sight: events as cards with their circuits drawn from above (a cup's side by side) under tabs — cups, races, time trials, battles; drivers as portraits, each driver's kart filmed once by a camera of its own on a layer of its own, lit by a studio's lights and exposure whatever the circuit's sky; karts as cards with their character as bars. Cards are clicked; the keys still work and show their section; C hides the screen, and with it shown the records, map and speed panels step aside. While the circuit or its models load, a spinner turns; at start, a splash — osage's mark and name, then osage kart — covers the window until the circuit is there. Game sounds start muted when sound is off (they were muted a frame late, heard through a loading frame).
- The scene never reads the network, and the network code never draws.
- Everything in the scene is placed by repeatable arithmetic, never by a random number generator: the bench draws the same frames on every run.
- The player's kart is predicted with the world's own physics, so that prediction is exact.
- Algorithms: exact client prediction, timedemo bench, land around a track, sculpted scenery, particle pool.
- Module it draws with: osage-render. Physics: osage-kart-physics.
- Oracle: the render bench.
The split between "who computes poses" and "who draws them" lets the same scene serve a game, a replay and a benchmark. The procedural pieces (ribbons along a centre line, land that stays flat near a track) are described as algorithms and do not depend on Bevy.
Karts are a real kart's shape and size (osage-kart-model), moulded but without decals beyond a few stickers; the grandstand's spectators are mannequins, and the lake's jetty and boat are still toy-like. Modelled content for them comes with workstreams R8 and R9. The interface is shown in the bench only with --ui-preview.