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.
// 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
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
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
- In the Terrain panel, under your layer's name (Grass), pick a style in Styles, or make one with Its own settings.
- Under Gameplay, tick Hides units inside. For grass that a big unit can be seen over, untick Hides taller units and set Height.
- View › Hiding patches (Shift+H) outlines each patch that hides.
Reference
| Field | Default | What it does |
|---|---|---|
conceals | no | The style hides who stands in it |
concealsTaller, height | yes, 1 | With false, a unit taller than height is seen |
conceal.reach | 2 | How near, in cells, another team must be to see into it |
conceal.hides | units on the ground | What it hides |
conceal.seenBy | Units that are seen anyway | |
conceal.rustle, rustleEvery | no, 0.3 s | A hidden unit's moves shake the grass on the screens of teams that can't see it |
conceal.heightOf | twice the radius | How 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.