Graphics quality
Shadows, anti-aliasing, resolution, effects and lights are a few knobs the player sets in Settings › View, grouped into Low, Medium and High presets. A game starts at High, at the screen's own resolution (100%), unless it says otherwise.
Quick start
world: {
quality: {
presets: { low: { fx: 'medium' } }, // what you change of a preset
budget: 50, // frames a second you mean to keep
pixels: 4_000_000, // most pixels a preset draws: a sharper screen draws at lower resolution (no cap when left out)
power: 'low-power' // the GPU asked for: high-performance when left out
}
}Low gets better effects, the game offers a lower preset when it drops under 50 fps, and a 4K laptop screen draws at a resolution it can keep.
Common tasks
Set quality from code
client.quality.set('medium')
client.quality.set({ shadows: 'off' }) // one knob: the preset becomes 'custom'
client.quality.get() // { shadows: 'high', antialias: 'taa', renderScale: 1, … }, a signal
client.quality.preset() // 'medium' or 'custom'Change a knob's default or hide it
hud: { settings: { change: { shadows: { default: 'off' } }, hide: ['debris'] } }A hidden knob is not the player's: presets leave it as your game sets it, client.quality.get() says the preset's value for it, and the preset is told from the knobs that are left.
Pick the first preset yourself
High where the game says nothing. To start from the client's guess for the device instead, and measure the card on the first run:
quality: { pick: pickPreset, probe: true }Handle a slow game yourself
quality: {
adapt: true, // lower it by itself: resolution a tenth at a time, then the next preset
onSlow: (lower, client, slowness) => true // true: you tell the player, the client's toast isn't shown
}
client.quality.slow() // the preset offered, or null
client.quality.slowness() // { fps, budget, gpu, pass: { name: 'shadows (sun)', ms: 6.2 } }, or nullslownessWords(slowness) says it in words.
Let the player test their graphics
client.quality.testGraphics(seconds = 6) flies the camera over the map at the current quality and reports the median fps, the slowest 5%, and a lower preset if it didn't keep 50 (client.quality.test(), a signal). It is also a line at the top of the settings.
Cap the frame rate
client.maxFps = 60 // any number; 0 for none
hud: { settings: { change: { maxFps: { default: '60' } } } }capFrames(engine, fps) does the same on an engine of your own. The rules go on at their rate whatever the cap.
Fewer shadow cascades
world: { shadows: { cascades: 2 } } // or a map's MapShadows.cascades, the Look panel's Shadows › PartsTwo instead of High's three is about 125 draws fewer, each part a little blurrier.
Reference
Knobs
| Knob | Setting | What | Low | Medium | High |
|---|---|---|---|---|---|
shadows | Shadows | none, or a shadow map of 1024 in two parts (low), 2048 in two, 2048 in three | none | 2048 × 2 | 2048 × 3 |
antialias | Smooth edges | off; fxaa (a cheap pass); taa (blends frames under a jittered camera: also smooths foliage and detail fades); msaa (4 GPU samples, sharpest and dearest) | fxaa | taa | taa |
renderScale | Resolution | share of the screen's pixels drawn (client.renderScale) | 60% | 80% | 100% |
effects | Effects | how many sparks, smoke, rain and snow | 35% | 65% | all |
debris | Debris | pieces of what breaks apart, at most | none | 80 | 240 |
decals | Marks | blood on the ground: how much and how long | 40% | 40% | all |
lights | Lights | lamps and torches: none, the nearest 32, or all | none | nearest | all |
foliage | Tall grass | how much grass is drawn: off, low (a third), high (all); bushes thin the same way. Hiding is the same at every setting (Grass and bushes). How far its levels reach follows detail; a fire's flames, smoke and embers follow effects, its lights lights | a third | all | all |
Also: glow (half, quarter or off), picture (on, off: tone mapping, bloom and colour grading), occlusion (low, high: ambient occlusion; Medium has low, High high), detail (Near, Medium, Far: multiplies level-of-detail distances 0.5, 0.75, 1, the grass's levels too). With debris at none, physics is not loaded.
The first run
- High, where the game gives no
pick.pickPresetis the client's guess from the device (client.quality.device: GPU name, threads, memory, screen pixels, phone or not): Low with no GPU or on a phone, Medium on an integrated GPU or small machine, High otherwise; a game that wants it sayspick: pickPreset(client.quality.suggested). - A probe (
client.quality.probe(),QualityLook.probe): before the game shows, the camera flies over the map start for two seconds at High with the game held, and the preset is set by the median frame: High at 50 fps or more, one lower under that, two lower under 28. A toast says so, once. Only where the game asks for it (probe: true), and not for a player with a kept quality, under automation, on a server game, or when the game opens on a cinematic.
The frame budget
While the game is played, a game under its budget (30 fps by default) for half a minute offers the preset below, once, as a toast and a line in the settings. It never changes by itself unless adapt. On WebGPU the offer names the heaviest pass ("shadows (sun) takes 6.2 of the card's 15.1 ms a frame"). The budget is a little under a player's frame cap where that is lower.
Pixels drawn
High draws at the screen's own resolution (100%). A game can cap each preset's renderScale so no more than QualityLook.pixels are drawn (no cap when left out, or 0; scaleCap(pixels, screenPixels) gives the resolution, in steps of 0.05): with pixels: 4_000_000 at 1440p 2× (14.7 million), High draws at 50%. A player's custom setting is not capped. fxaa: false turns FXAA off where it would be used.
QualityLook fields
| Field | What |
|---|---|
presets | what you change of each preset |
pick | the first run's preset, from the device (High when left out; pickPreset guesses) |
probe | measure the card on the first run (false) |
budget | fps to keep |
adapt | lower quality by itself |
pixels | most pixels a preset draws (no cap when left out) |
triangles | what a frame may draw at a preset, as the editor's Statistics panel measures (TRIANGLE_BUDGETS) |
onSlow | handle a slow game yourself |
power | 'low-power' or high-performance |
The editor's Look panel has a Quality fold for the pixel cap and each preset's resolution and edges, written to the game's quality.json (layFiles with QUALITY_FILE).
Caps
How much the client draws, plays and counts at once (GameView.world.limits, ViewLimits; client.limits; limitsOf(set)):
limits: {
lights: 32, // lights drawn at low quality, nearest the camera's target first
voices: 24, // sounds at once
splashes: 400, // rain splashes on the ground
weatherAreas: 8, // weather areas drawn at once
mistAreas: 8, // mist areas drawn at once
groundPaintEvery: 1 / 30, // seconds between ground paint uploads
frameTime: 0.1, // longest stretch simulated in one frame
uiInterval: 0.1 // seconds between HUD updates
}A game with thousands of units raises voices; one for weak machines lowers lights, mistAreas and splashes. A number that makes no sense is the default.
Game speed and frame cap
gameSpeed(0.5× to 3×) shows only where the player holds the pace (a game in the page or its worker). In codeclient.pace(0.25 to 4; undefined where it isn't the player's). The pause menu holds the game at 0 while open.maxFps: no cap, the screen's rate, or 30, 60, 75, 90, 120, 144, 165, 240. A skipped frame is skipped whole.