Skip to content

Ability visuals ​

How abilities and buffs look: a colour and a style per ability, a look per effect (its missile, its zone, its rush), the ground telegraphs, trails and links every ability gets, and styles of your own.

Quick start ​

ts
import { presetFx, type GameView } from '@v12-engine/client'

export const view: GameView = {
	units: { looks: {} },
	fx: {
		defs: presetFx(['burning-ground', 'fireball']),
		abilities: {
			looks: {
				stormBolt: { color: [0.6, 0.8, 1], style: 'missile' },
				thunderClap: { color: [1, 0.9, 0.5], style: 'slam' },
				blizzard: { color: [0.7, 0.9, 1], style: 'mark' },
				devotion: { color: [1, 0.85, 0.4], aura: 'glow' }
			}
		}
	}
}

Each ability is drawn in its style and colour, keyed by the ability's id (or the buff's, for aura). The client's eleven styles are always there; a look that names a style of neither the client's nor the game's is drawn as a ring, and the log says so once.

Common tasks ​

Pick a style ​

StyleDraws
ringa ring on the ground (the default)
tornadoa whirlwind that forms where cast and travels with what is sent
smashthe ground breaking open
tethera rope from caster to target (until: the buff it lasts as long as)
sonarrings going out one after another, for searching
missilean arrow, a rock or a bird of light on its way (options.shape)
burstsparks where it's cast
slamthe ground thrown up around the caster, after a rush too
marka place on the ground: where a star will fall, a field, a sky beam
barragemissiles called down one after another, each blast shaking the view
glowfor buffs (aura): sparks rising, falling or drifting, a ring, a bubble

Give each effect of an ability its own look ​

effects on a look overrides it per effect: by the effect's look name, else its place ('0', '1'… first to last, each before those it holds), else its type (missile, zone, dash…).

ts
import type { AbilityLooks } from '@v12-engine/client'

const looks: AbilityLooks = {
	// Ahri's orb, one look out and back
	orb: { color: [0.9, 0.45, 1], style: 'missile', options: { shape: 'ball' } },
	// Vel'Koz's halves another (`look: 'halves'` on the split's missile)
	fission: { color: [0.6, 0.35, 1], style: 'missile', effects: { halves: { color: [1, 0.6, 0.15] } } },
	// Flame Strike: the fall in `mark` style, then burning ground for the zone's life
	flameStrike: { color: [1, 0.5, 0.1], style: 'mark', effects: { zone: { color: [1, 0.2, 0.05], fx: 'burning-ground' } } }
}

Show stacks, a polymorph, a control mark ​

ts
import type { AbilityLooks } from '@v12-engine/client'

const looks: AbilityLooks = {
	bleed: { color: [0.95, 0.1, 0.1], counter: { max: 5 } }, // a pip per stack over the carrier
	hex: { color: [0.3, 1, 0.3], drawnAs: 'sheep' }, // drawn as another unit type
	terrify: { color: [0.6, 0.2, 0.8], marker: true } // the mark over a feared unit, in this colour
}

Telegraph the ground ​

Every ability with a shape shows it on the ground for everyone while it winds up (its castTime), flashes it as it goes off, marks a delayed blast until it lands and a zone for its life. ground: false on the look turns that off.

A unit rushed by a dash, pull or throw leaves a trail in the ability's colour (trail: false for none, fx to play an effect on it). A bouncing missile draws links between those it strikes (link: chain by default, ray, tether, or your own; false for none).

ts
import type { AbilityLooks } from '@v12-engine/client'

const looks: AbilityLooks = {
	chainLightning: { color: [0.6, 0.8, 1], style: 'missile', link: 'chain' },
	charge: { color: [1, 0.6, 0.2], trail: true, fx: 'dust-trail' }
}

For link, take the link effects into the view: defs: { ...presetFx(), ...linkFx() }.

Decide a look in code ​

abilities.for picks a look each cast from the caster and level (a hero's own colours, a fireball that grows with its level). looks is used when it gives nothing.

Write your own style ​

A style is an object of optional methods, told what happens, made with the renderer's kit (SpellContext). Add it beside the client's (one of the same name takes its place):

ts
import type { GameView, SpellStyleFactory } from '@v12-engine/client'

export const flash: SpellStyleFactory = (context) => ({
	cast(event, visual) {
		context.ring(event.x, event.z, visual.color, 0.2, 6)
	}
})

export const view: GameView = {
	units: { looks: {} },
	fx: { abilities: { styles: { flash }, looks: { nova: { color: [1, 1, 1], style: 'flash' } } } }
}

The client's styles in packages/client/src/lite/spells/styles are written the same way; start from one.

Reference ​

AbilityLook ​

FieldTypeWhat it does
color[r, g, b] (0 to 1)Its colour
stylestringThe style that draws it (ring when left out)
aurastringFor buffs: the style drawn on the carrier (glow); a small light when left out
untilstringFor tethers: the buff on the target the rope lasts as long as
optionsrecordAnything else a style reads
effectsRecord<string, Partial<AbilityLook>>A look per effect, by look name, place or type
groundbooleanIts shape drawn on the ground (yes)
fxstringAn effect of the view on a zone for its life, on a rushing unit, at a strike
trailbooleanA trail behind a rushed unit (yes)
linkstring or falseLinks between bounce targets (chain)
drawnAsstringOf a buff: its carrier drawn as this unit type
counterboolean or { max }Of a stacking buff: a pip per stack
markerbooleanOf a control buff: the mark over its carrier (yes)

GameView.fx.abilities (ViewAbilityLooks): looks, for, styles.

SpellStyle methods ​

MethodCalled
warm(visual)Once, up front, for every look that names the style
windup(event, visual)A caster started to cast
cast(event, visual)The ability went off
strike(event, visual)Something it sent arrived: a missile hit, a star fell
missiles(list)Every frame, with this style's visible missiles
auras(list)Every frame, with units in view carrying a buff whose aura is this
update(dt)Every frame
dispose()At the end

SpellContext holds the scene, the terrain, where entities are drawn, fog-covered materials, a clock, fx (play any effect), lights, and instance / clone for meshes made once and drawn together.

What every ability gets ​

Without a style of its own, the client draws (loaded when the first ability is seen):

WhatTold byTurn off or change
Its shape on the ground while it winds upthe windup (its aim, aimOf)ground: false
A cast with a shape, flashed as it goes offthe castground
A delayed blast until it lands, a zone for its lifeSnapshot.areas (AreaState)ground; fx
A trail behind a rushed unitcore.dashing (DashSight)trail: false; fx
Links between bounce targetsthe missileHitslink
Stacks over the carrierEntityState.stackscounter
The mark of a fear, charm, tauntcore.controlledmarker: false
A unit drawn as another typeits buffsdrawnAs
An effect where something struckthe strikefx

Shots of attacks ​

A unit's attack shot (ShotDef) can carry an effect as it flies (fx: 'fireball', in place of the ball when it names no model) and land with another (impact, or what its effect's impact knob names; false for none). shotFor decides both per shot; draw draws it your own way.