Skip to content

ViewWorld beta ​

Interface of @v12-engine/client

ts
export interface ViewWorld

The scene as the game's view draws it (GameView.world): its lights, glow and shadows, what is seen through, what is drawn at a distance, the picture's grade, the environments and the weather, the sky and the day, how the scenery is batched, the limits and the quality, and the map's rules for its looks

Members ​

camera ​

ts
camera?: RtsCameraOptions;

The camera: how steeply and how far it looks, how far it may zoom, where on the map the player may look (bounds), which way the view rests (yaw) and whether it may be turned. client.camera changes it while the game runs (panTo, lock, free, setLimits), client.follow(id, { offset, smoothing }) keeps it on an entity, and the rules say something of one player's with cameraFor

daylight ​

ts
daylight?: DaylightLook;

The sky's and the mist's colours by the hour, where a map says nothing of them: the client's preset (DAYLIGHT_COLORS: blue by day, dark at night, warm at dawn and dusk) or the game's own. None when left out: the sky and the mist are the same at any hour

detail ​

ts
detail?: WorldLayer<DetailLook, WorldDetail>;

How much detail things are drawn with by their distance (DetailLook): levels for every model that says none, levels by model, nothing past a distance, code that picks thing by thing; or a function given the scene's (WorldDetail, client.detail) once, which may give back what undoes it. The map's over it (MapEnvironment.detail). Everything at full when left out

environment ​

ts
environment?: MapEnvironment;

What every map of the game looks like where the map does not say: its sky, mist, water, light, weather

environments ​

ts
environments?: Record<string, MapEnvironment>;

Looks by name for the game's maps to start from (winter, swamp, dusk): the map editor's Look panel puts one on a map (editor.applyEnvironment), a scene plays a map with one (gameScene({ environment: 'dusk' })), the rules change to one (world.setEnvironment(view.world.environments.storm, { over: 20 })). Each replaces the parts of a look (LOOK_FIELDS) and keeps the map's own sounds, grounds and cliffs. The client has none of its own

fog ​

ts
fog?: FogBrightness;

How bright the fog of war is drawn: what was seen once, and what never was

frameBudget ​

ts
frameBudget?: number | FrameBudgetLook;

How much of a frame the work done in pieces may take (FrameBudgetLook, or the total alone in milliseconds): the switches of level, the scenery's merging, the debris, the units' skeletons asked for, the grass laid, which draw from one budget, the first in its order first where there is not room for all. 6 ms all together when left out; the 📊 window shows what each took. In code: client.frameBudget

glow ​

ts
glow?: WorldLayer<MapGlow, LiteGlow>;

How what is emissive glows past its edges: how bright by day and at night, how far (MapGlow), before a map's own (MapEnvironment.glow); or a function given the world's glow once (LiteGlow), as the world is made, in a game and in the editor. What it gives back is called when the world goes

lighting ​

ts
lighting?: Lighting;

The light of the scene, as data or decided from the hour and the report every frame: a storm, a lair. Over the day's light. client.setLighting changes it while the game runs

lights ​

ts
lights?: WorldLayer<never, WorldLamps>;

Lights of the game's own, besides the sun and the sky (WorldLamps.add: a lamp, a torch, a glowing rune): called once, as the world is made, in a game and in the editor. What it gives back is called when the world goes

limits ​

ts
limits?: ViewLimits;

The client's caps (ViewLimits): lights at low quality, sounds at once, splashes, areas of weather and of mist, how often the ground paint uploads, the longest frame simulated, how often the HUD updates. Each as it has always been when left out: what a game of thousands of units, or one for weak machines, tunes. Each client its own (client.limits)

mapRules ​

ts
mapRules?: readonly MapRule[];

Checks of the game's own on what its maps look like (MapRule): the editor runs them after the engine's and the client's (LOOK_RULES), and shows what they say with the rest of the map's problems. A rule of what a map's world plays like is the game's module's (MapEditorDef.check)

passes ​

ts
passes?: readonly PicturePassDef[];

Passes of the game's own over the picture (PicturePassDef: an outline, a pixelation, a painterly filter, in WGSL), each before one of the client's passes (before: taa, tone, screen when left out, end) and in its order there: drawn in every scene of the world, in a game and in the editor's view, once each one's shader is ready. In code, client.picture.addPass adds one while the game runs

picture ​

ts
picture?: WorldLayer<MapPicture, LitePicture>;

How the picture is finished after the world is drawn: tone, exposure, contrast, colours, a grade, bloom, a vignette, sharpening, by day and at night (MapPicture), before a map's own (MapEnvironment.picture); or a function given the world's picture once (LitePicture), as the world is made, in a game and in the editor (its look, its adjust). What it gives back is called when the world goes. Nothing is done to the picture when left out

quality ​

ts
quality?: QualityLook;

How much drawing asks of the device: what it changes of the presets, the preset for a first run from the device, the frame budget, whether a slow game goes lower by itself, and the GPU asked for. In code: client.quality

sceneryBatching ​

ts
sceneryBatching?: WorldLayer<SceneryBatchLook, SceneryView>;

How the scenery is merged by chunks of the map, to be drawn in a few draws a chunk (SceneryBatchLook: on or off, how big a chunk is, how many of a model make it copies instead, how long what changed is drawn on its own). Or a function given the scenery (SceneryView) once, as the world is made, in a game and in the editor: its batching, its batches to decide doodad by doodad. What it gives back is called when the world goes. A model says too (SceneryDef.batch), and a doodad (MapDoodad.batch)

seeThrough ​

ts
seeThrough?: SeeThroughLook | false;

Trees and scenery seen through where they hide units (SeeThroughLook): for whose units (the player's own, those selected, allies', all, or code), faded or a hole cut round each unit, how much is left, how fast, and which kinds of thing (trees, doodads, buildings). Nothing is seen through when left out (nor false), unless the map says (MapEnvironment.seeThrough, over the game's); {} turns it on as it comes. In code: client.seeThrough

shadows ​

ts
shadows?: MapShadows;

Which things cast the sun's shadow: small things (small, in cells) farther from the camera than near do not, as a shadow a few pixels across is not seen and costs a draw; cull: false draws every shadow. Before a map's own (MapEnvironment.shadows)

sky ​

ts
sky?: LiteSkyFactory;

A sky of the game's own, in code, in the place of the client's dome of clouds: a skybox, two moons

warm ​

ts
warm?: ViewWarm;

The warm-up behind the loading screen (ViewWarm): what is compiled and built ahead so that the frame that first draws it does not (a unit's copy as it comes up close, its shaders in every pass, a transition's pass), and how (its time, whether the loading screen waits on it). The unit types on the map, in their owners' colours, the cut's pass, 4 seconds at most, when left out; false for none; a function deciding by scene and map. The map's over it (MapEnvironment.warm). In code, at any time: client.warm

weather ​

ts
weather?: Record<string, WeatherLook | LiteWeatherFactory>;

The weather of the game, by kind (MapWeather.kind): nothing falls of a kind not here (presetWeather() is the ready-made rain and snow). What falls as particles (WeatherLook), or the game's own in code (LiteWeatherFactory: ash, fireflies, a sandstorm with its thunder). Rain and snow are the client's, which a game's of the same kind stands in the place of. The editor offers every kind