Log inGet started
World

Frag Arena: First-Person Shooter Kit with Deathmatch, Bots and Scoreboards

Branchmain
Branchesmain
Commit499680811e

README.md

showcase.environment

A finished outdoor setting around a flat arena clearing, for a first-person arena shooter: a forestKit beech forest (big beech trees, undergrowth, rocks, deadwood and a brook when one fits) with a clearing that is flat at y = -0.05 and completely empty, a held afternoon sky, sun and ambient light, worldClockKit's clock with the forest's beechwood sky look and ambience, and a cel/toon look from styleKit + toonBlocks tuned so players, weapons and HUD stay readable. Called from a scene's build.luau content().

function content()
    local Env = require("showcase.environment")
    Env.build({
        clearing = { size = { x = 84, z = 84 } },  -- or { radius = 48 }; optional center = { x, z }
        density = "medium",                         -- "low" | "medium" | "high"
        look = "arenaCel",                          -- any styleLook id (comicInkCel, saturdayMorning, ...) or "none"
        seed = 112,
    })
end

What it places

EntityWhat
EnvironmentRoot for everything below.
ArenaForest (synced)showcase.ArenaForest component: every peer builds the same forest from its synced settings (deterministic forestKit placement; parked across play/edit so it is not rebuilt).
EnvSky, EnvSun, EnvAmbientProceduralSky at the held hour, a warm 3.2 sun with shadows, a cool 0.9 ambient. Fixed: the clock does not relight them (lights = false hands lighting to the clock instead).
WorldClock (synced)worldClockKit clock, paused at hour, beechwood sky look, engine sky, no rain/lightning. Gives the light far fog.
ForestAtmosphereforestKit grade, ambience and footstep surfaces. Its haze and shafts are off by default: they wash a 64 m arena out toward the sun.
StyleStack (synced)The look. arenaCel (default): toonBands (3 bands, lifted cool shade), toonRim, celFill keeping the scene's light, toonFarLine 2.4 px ink thinning to 0.6 px by 45 m.

Options

clearing, density, look, seed, plus stream (default true), hour (15.5), forestType (beechForest), forestLook (real / painted / toon props), quality (LOD scale, web capped at 0.6), lights, atmosphere, shafts, haze, ambience, exclude (entity names the look leaves as rendered), parent. Returns { root, forest, clock, atmosphere, stack, plan }.

How the forest fits the arena

  • M.plan(opts) sizes the forest site to the clearing plus 46 m of forest on every side (220 m for an 84 m square) and picks the first seed from seed up whose brook stays at least 16 m outside the clearing, sliding the site up to 20 m sideways. With no such seed the brook is left out.
  • M.buildForest(plan) runs forestKit's own parts (Ground site, Rules placement, ForestRender instancing, StreamWater, its collider scheme and edge walls) with one change: the site's height is flat at FLOOR_Y inside the clearing and eases into forestKit's relief over 12 m (BLEND). Every prop whose footprint (crowns of canopy trees +3 m) reaches the clearing is dropped. forestKit's ForestBuilder.build has no way to flatten ground, which is why the steps are composed here rather than calling it.

Performance

Instanced draws with forestKit LODs (trees 34/80/900 m, ground cover gone past ~40 m); shadows only from near/mid trees and near rocks; instanced props get no outline shells (only Models do). Medium density, 84 m clearing: ~8,900 props, ~970 instanced draws. The web build caps the LOD scale at 0.6. See the showcase notes for measured frame times.

Removing it

Delete the Environment entity (or drop the Env.build line). StyleKit.clear() removes just the look.