Skip to content

Hide units in tall grass ​

Give a style conceals: true and add foliagePack. A unit standing in that style is then hidden from every team with no unit in the same patch and none within two cells.

ts
// in src/rules.ts
import { defineCellLayer, foliagePack, presetFoliageStyles, type Rules } from '@v12-engine/engine'
import { rules } from './rules'

export const hidingRules: Rules = {
	...rules,
	cellLayers: [
		defineCellLayer({
			id: 'grass',
			name: 'Grass',
			values: [
				{ value: 1, name: 'Meadow' },
				{ value: 2, name: 'Tall grass', foliage: presetFoliageStyles.tallGrass }
			]
		})
	],
	packs: [...(rules.packs ?? []), foliagePack({ layer: 'grass' })]
}

Done: walk a unit into the tall grass and the enemy loses sight of it. Once one of the enemy's units enters the same patch, they see it again.

A wheat field that hides archers and burns when a fire arrow lands ​

ts
import { type AbilityDef, defineCellLayer, foliagePack, type Rules } from '@v12-engine/engine'
import { foliage, presetFoliage } from '@v12-engine/client'
import { rules } from './rules'

export const wheatRules: Rules = {
	...rules,
	cellLayers: [
		defineCellLayer({
			id: 'grass',
			name: 'Grass',
			values: [{ value: 1, name: 'Wheat', foliage: { conceals: true, concealsTaller: false, height: 1.3, flammable: 0.9, burns: 5, regrows: 180 } }]
		})
	],
	packs: [
		...(rules.packs ?? []),
		foliagePack({
			layer: 'grass',
			// only archers hide; another team's units see into the wheat from 3 cells away
			conceal: { hides: (_world, unit) => unit.def.id === 'archer', reach: 3, rustle: true },
			fire: { damage: 6 }
		})
	]
}

export const fireArrow: AbilityDef = { id: 'fireArrow', name: 'Fire Arrow', target: 'point', range: 10, cooldown: 15, effects: [{ type: 'foliage', act: 'ignite', radius: 1 }] }

export const wheat = foliage(presetFoliage.wheat)

Burning and burnt wheat hides nobody, so a fire drives the archers out. A unit taller than 1.3 is seen over the wheat. A unit's height is twice its radius.

Let some teams see in ​

ts
import { foliagePack } from '@v12-engine/engine'

// team 1 has a scout's eye on the grass: it sees whoever hides there
export const pack = foliagePack({ layer: 'grass', conceal: { seenBy: (_world, _unit, team) => team === 1 } })

seenBy is checked only for units that would otherwise be hidden, which suits things like a ward or a scout's ability.

In the editor ​

  1. In the Terrain panel, under your layer's name (Grass), pick a style in Styles, or make one with Its own settings.
  2. Under Gameplay, tick Hides units inside. For grass that a big unit can be seen over, untick Hides taller units and set Height.
  3. View › Hiding patches (Shift+H) outlines each patch that hides.

Reference ​

FieldDefaultWhat it does
concealsnoThe style hides who stands in it
concealsTaller, heightyes, 1With false, a unit taller than height is seen
conceal.reach2How near, in cells, another team must be to see into it
conceal.hidesunits on the groundWhat it hides
conceal.seenByUnits that are seen anyway
conceal.rustle, rustleEveryno, 0.3 sA hidden unit's moves shake the grass on the screens of teams that can't see it
conceal.heightOftwice the radiusHow tall a unit stands

Grass hides while it is whole or growing back. Cut, crushed, burning or burnt grass hides nobody. A hidden enemy is not sent to your screen, so it doesn't part any grass there. See Vision and stealth.