Skip to content

PatternDef beta ​

Interface of @v12-engine/client/ground

ts
export interface PatternDef

A pattern a ground's texture is made of in code (GameView.ground.patterns for a game's own, PATTERNS for the client's): what the Ground editor offers by name, with a slider for each of its parameters, and what groundTexture makes a texture of. Written as a shade, lighter or darker than the tile's colour at each point of the picture (about 1 on average: the texture is made the tile's colour exactly, whatever the shade does), from the parameters and a noise that repeats; or as every pixel, where a shade is not enough (several colours, a drawing)

Members ​

description ​

ts
description?: string;

What it is, for the Ground editor's tooltip

height ​

ts
height?: (params: Readonly<Record<string, number>>, noise: PatternNoise) => (u: number, v: number) => number;

How high the picture stands at a point (u, v), 0 (low: covered first) to 1 (high: over its neighbour), where the shade alone does not say it: what the ground blends two tiles by (heightBlend). How light the shade is when left out. Grass's blades stand over dirt, a cobble over its seams

name ​

ts
name: string;

What the Ground editor calls it

params ​

ts
params?: Record<string, PatternParamDef>;

Its parameters, by id: each a slider of the Ground editor, and a field of params in code

pixels ​

ts
pixels?: PatternMaker;

Or every pixel, where a shade is not enough: RGBA, size by size, in the colour, from the seed and the parameters. Its alpha is its height (see height): 255 everywhere stands it level

shade ​

ts
shade?: (params: Readonly<Record<string, number>>, noise: PatternNoise) => (u: number, v: number) => number;

Lighter or darker than the tile's colour at a point (u, v) of the picture, 0..1 across it, about 1 on average: the whole of what makes it look like something, from its parameters (each at its default where not said) and a noise to make it of