Log inGet started
Package

arcticKit.package

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

arcticKit

A whole walkable high-Arctic tundra for your world, in one component. Wide snowfields of fresh powder, wind-packed crust and carved sastrugi; a frozen lake where you look down through clear black ice in some places and walk on white cracked ice in others; an ice shelf ending in a sheer layered cliff over an open lead in the sea ice, with rifts behind its edge; crevasses you can look down into, their snow cornice lips overhanging blue ice walls that drop into a blue-black depth, across glacier tongues and in pressure-field sea ice (the ground is really cut under each one, and snow ramps at their ends let anyone who falls in walk out); crack networks and pressure cracks lying on the lake ice; jumbled pressure ridges; frost-shattered rock, lichen boulders and low tundra scrub with dwarf willow, cottongrass, moss hummocks and little arctic flowers poking through the snow; an inuksuk, a research hut with a spinning weather mast, a sled, fuel drums, expedition flags and survey pennants flying downwind at the camp, the stops and the lookout, whale bones and driftwood; and a marked walking route with stops, its snow trodden into boot prints and sled tracks, with wet slush along the lake shores and the lead's edge and frozen gravel round the rock and on the lookout. It comes with polar time of day (a low pink morning, a pale low noon, a long blue dusk and night), four kinds of northern lights, five kinds of cold weather up to a full blizzard, and wind, blizzard, lake ice and footstep sound that follow the time, the weather and where you stand.

Size, snow depth, scatter density and seed are each one setting, and every player builds exactly the same tundra from the same seed, on desktop and in the browser: the same things in the same places, and you bump into them in the same places.

Drop a tundra into your world

Paste this into an empty world (the editor's run box, or inside content() of a scene's build.luau):

entity.spawn("Tundra").component.add("arcticKit.Tundra", {
    size = 512, snowDepth = 0.6, density = "normal", seed = 7,
    landscape = "lakeBasin", look = "realistic",
})
entity.spawn("ArcticAtmosphere").component.add("arcticKit.ArcticAtmosphere", {
    time = "noon", aurora = "curtains", weather = "clear",
})

The ground streams in around you within a second or two and the props a moment later. A starter floor the new world came with (a flat slab named ground or floor) is hidden while the tundra stands, so it never shows at the horizon or under the clear ice, and shown again if the tundra is removed. Nothing is baked or saved: the ground, the props and their colliders are computed from the settings on every machine. Press play and the scene's player spawns are stood at the head of the route (turn that off with moveSpawns = false).

What you set

SettingValuesWhat it does
size192 to 1536 (m)the side of the walkable square; the ground carries on beyond it to the horizon
snowDepth0 to 2.5 (m)0 is bare summer tundra (moss, scrub, flowers), 0.6 a spring cover, 1.5 deep winter with only rock tips showing
densitysparse, light, normal, dense, lushhow thick the rocks, plants, drifts and ice are scattered
seedany whole numbereach seed is a different tundra, the same seed always the same one
landscapelakeBasin, iceShelfCoast, pressureField, openTundra, glacierFrontthe kind of place
lookrealistic, painted, cartoon, lowpoly, pixelthe art style of every surface and prop, for the whole world
routetrue / falsethe marked route and its stops
quality0.3 to 2how far props draw (the browser caps it at 0.65); nothing a player touches moves or goes away
moveSpawnstrue / falsestand the scene's player spawns at the head of the route
targetFpsnumber (60)frame rate each machine holds in play: when frames run long the render scale steps down (upscaled, floor 0.75 desktop / 0.6 browser) and comes back when there is headroom; a step that buys no time (a CPU-bound machine) is taken back. Visual only, nothing moves. 0 turns it off

The five landscapes:

  • lakeBasin: a big frozen lake in a ring of low hills, pressure cracks across its ice, a rocky lookout hill.
  • iceShelfCoast: land to the south, a frozen lake inland, pressure ridges where the floating shelf grinds the land, the shelf's sheer cliff over an open lead and sea ice to the north, a rocky headland lookout.
  • pressureField: a field of sea ice crushed into ridges and rubble, a low shore and a rock headland.
  • openTundra: rolling hills of moss and scrub, frozen ponds, boulder fields and moraine ridges.
  • glacierFront: a glacier tongue coming down from the north to a blue calving front on a frozen lake, with moraines and erratics.

Time of day, northern lights and weather

local Atmos = require("arcticKit.Atmos")
Atmos.setTime("dusk")          -- morning | noon | dusk | night, for every player
Atmos.setAurora("storm")       -- curtains | storm | crown | quietArc | off
Atmos.setWeather("blizzard")   -- clear | groundBlow | whiteout | diamondDust | iceFog | blizzard
print(Atmos.getTime(), Atmos.getAurora(), Atmos.getWeather())

Every player sees the same sky: time runs on worldClockKit's shared clock and the aurora and weather are synced, so a player who joins later gets them too. The scene keeps one clock: ArcticAtmosphere uses a WorldClock the scene already has, and creates one only when there is none, never a second one while worldClockKit is still loading.

Switch the look of the whole world

require("arcticKit.Look").set("pixel")   -- or set the Tundra's look field

Ground, lake ice, sea and every prop restyle in place; nothing moves.

Ask the ground

local site = require("arcticKit.TundraSite").active()
local Shape = require("arcticKit.TundraShape")
local plan = entity.find("Tundra").component.get("arcticKit.Tundra"):plan()
local x, z = 0, 0          -- any ground point, for example a player's position
site:heightAt(x, z)     -- the top a foot meets (the lake's ice counted)
site:surfaceAt(x, z)    -- freshPowder, windCrust, sastrugi, blackIce, whiteIce, frostRock, ... (the classification the scatter reads)
Shape.dressed(plan, x, z) -- as drawn and heard: adds troddenSnow (route, camp), slush (lake and pond rims, lead edge), frozenGravel (rock fringe, lookout)
site:footstepAt(x, z)   -- freshSnow, crust, ice, rock, scrub
site:zoneAt(x, z)       -- tundra, lake, shelf, ridge, rock, sea, glacier
site:stop("lookout")    -- world position of a stop on the route

entity.find("Tundra").component.get("arcticKit.Tundra"):stats().fingerprint is a short code over every placement: equal codes on two machines mean equal tundras.

What is inside

  • Tundra (component) and TundraBuilder (module): build, restyle and tear down a tundra; TundraBuilder.build(opts) from code, planFor(opts) and spawnFor(opts) without building.
  • TundraTypes, TundraLayout, TundraShape, TundraScatter, TundraSite, TundraRender, Noise: the five recipes, the plan (lake, coast, shelf, glacier, ridges, route, stops), the ground as pure functions, the placement, the ground questions, the instanced drawing with levels of detail, and deterministic noise.
  • Look and Props (modules): the world look (arcticMaterials' ArcticLook) and the prop catalog (arcticProps' ArcticProps) under the kit's own name, so require("arcticKit.Look") and require("arcticKit.Props") resolve in any world that installed arcticKit.
  • ArcticAtmosphere (component), Atmos, Aurora, Weather, Ambience, Footsteps: the polar sky and light on worldClockKit's clock, the northern lights, the cold weathers, the ambience on soundstage, and footsteps by the ground under each walker.
  • Guides: How do I add an arctic tundra with snow, ice, a frozen lake and northern lights to my world and Example: a frozen lake crossing in a blizzard, a small arctic expedition game from an empty world. Tests: tests/.

It installs arcticProps (the props), arcticMaterials (the surfaces) and worldClockKit (which brings soundstage).

Every player, the same tundra

The plan, the ground heights and every placement come from integer-hash noise and plain arithmetic (no math.noise, no trigonometry in any decision), which IEEE doubles compute identically on every machine, so the desktop engine and the browser engine stand the same ground, the same props and the same colliders. The ground is a TerrainStream fed by that function, so it collides wherever any player walks. Time, aurora and weather are shared state; footsteps are soundstage's, heard from every walker.

Set it up step by step

arcticKit.setupTundra is a workflow that walks you through it in stages: drop the tundra in, choose a look, set the time of day, the weather and the northern lights, place the route, then walk it in play. Each stage hands over the exact code for that step and checks what it built before the next one starts.

zero workflow start --name setupTundra --args '{"landscape":"lakeBasin","look":"painted","time":"dusk","weather":"blizzard"}'

Every argument is optional; setupTundra.workflow/workflow.yaml lists them with their defaults.

In the browser

The browser builds exactly the same tundra (same places, same props, same colliders) and draws it lighter: props draw nearer (quality capped at 0.65), shadows of small props end sooner and the shadow pages refresh 30 times a second, the ground streams with a smaller per-frame budget once it is all drawn, and targetFps lowers the render scale further when frames run long. require("arcticKit.TundraBuilder").webProfile = true gives a desktop the same light profile (false turns it off in the browser, nil follows the platform).

With the light profile the browser runs at about 40 ms a frame (about 25 fps), measured in the browser on the showcase scene (it was about 61 ms before this profile). That is the engine's browser frame cost (#19390), not the tundra's: the same scene draws in well under half that time on a desktop. See Known limits.

The ground stands as quickly in the browser as on a desktop. Every ground sample is computed once and kept, a background task computes the tiles nearest the spawn first (every sample near it, every fourth further out, the spacing the distant levels of detail draw at), and while tiles are still to stand the stream gets a loading budget (10 ms a frame in the browser, 4 on a desktop) that drops back to the light steady one once every tile is drawn. entity.find("Tundra").component.get("arcticKit.Tundra"):stats().groundTiles says how many tiles are drawn.

The build runs as a system task, which the engine never holds for a pause or a change of mode, so a slow machine finishes it however long its frames or mesh loads take, and a finished tundra stays finished. It is built again only if the build task fails outright, at most three times, and the log says why.

Known limits

  • #19390: frame rate in the browser. With the light profile the tundra runs at about 40 ms a frame (about 25 fps) in the browser, measured on the showcase scene; the desktop holds a much higher rate on the same scene.
  • #23712: the size of TerrainStream's ground textures is fixed by the engine, so ground detail up close is limited.
  • #23672: the terrain guide does not cover writing computed heights; arcticKit streams them through TerrainStream:setSource.

Trodden snow, slush and frozen gravel

The ground is drawn in two passes. TundraShape.eval classifies it (snow, rock, moss, ice, lake bed) and the heights, colliders and scatter read only that, so they never change. TundraShape.dressed then draws three surfaces over it: trodden snow along the route (a band about 2.5 to 3 m wide) and round the camp, slush on the wet rim of every lake and pond and along the far edge of the sea-ice lead, and frozen gravel on the fringe of rock outcrops and over the lookout's crown. Footsteps follow the drawn ground (site:footstepAt): trodden snow crunches like crust, slush sounds like soft snow, gravel like stone. A TerrainStream tile draws at most eight surfaces, so TundraBuilder.tileBudget counts each 128 m tile once and, where one would name more, lets moss, scrub and the rarest layers give way to what they stand on (the path and the shore last); every landscape at seed 7 stays within eight.