# wall_blast
A charge blowing a breach through a stone block wall, on a 9.6 s loop. The wall stands whole, a
fireball bursts from its face a second in, the blocks around the breach are thrown out as
tumbling, glowing debris with a spray of sparks, a shock ring runs out across the ground, and dust
and smoke roll out and settle. Over the first fifth of a second of the next loop the breach knits
back in.
Everything is a function of the graph clock modulo the loop, so it repeats with no solver ever
restarting. The wall runs along x at z = 8 in the generator's own space, and its blocks and
debris are drawn with the `blast_stone` shader, the fire, smoke and dust with `blast_puff`, the
sparks with `blast_spark` and the shock ring with `blast_shock`.
```lua
-- `graph` is this graph's reference: the AssetRef `asset.resolve` or a search returns for it.
local e = entity.spawn("wall_blast", { position = { 0, 0, 0 } })
e.component.add("Generator", { graph = graph, playOn = "load", ending = "loop" })
```
| Output | What it draws |
|---|---|
| `stone` | The wall's blocks, the breach's blocks while they stand, and the debris |
| `fire` | The fireball at the wall face |
| `sparks` | Sparks thrown out with the debris |
| `shock` | The shock ring on the ground |
| `smoke` | Smoke rising from the breach |
| `dust` | Dust rolling out across the ground |
| `light` | The light of the blast |
The timeline has no end and plays at 60 fps.
# blast_ground
Ground material for the `fx_blast` scene. The scene's `ground` entity (a built-in cube scaled 70 x
0.2 x 70 at (-50, -0.1, 140)) wears it through its Model component. mat.yaml describes it as
"Scorched packed dirt for the blast site."
Shader: `blast_ground` (`blast/shaders/blast_ground.shader`). Its header describes scorched, packed
ground: dark cool dirt with pebbles and dry cracks, computed in world space, with an old scorch
stain around the blast site. It is an engine-lit `surface()` shader: albedo comes from layered noise
with darkened cracks, perceptual roughness is 0.92, and occlusion varies between 0.85 and 1.0 with
the noise.
Render state (the `render` block of mat.yaml): `queue: 2000`, `type: opaque` (opaque blend), `cull:
back`, `instancing: true`.
## Properties
- `center_x: 0.4` and `center_z: 8.0`: world x and z of the scorch centre; the shader measures each
fragment's xz distance from this point. They are the same numbers as the `CX` (fire centre x on
the wall face) and `WZ` (the z the wall runs along) constants in `blast/wall_blast.procGraph`.
- `scorch_radius: 9.0`: radius of the stain. The darkening ramps in from this distance to 15% of it,
with noise added to the distance so the edge is ragged, and at full strength moves the colour 80%
of the way to (0.018, 0.016, 0.015).
# CuedSound
Plays its entity's sound on a moment of an effect: each time the clock of the Generator on `source`
passes `at` seconds into every `period`-second loop of it, the `Audio` component on the same entity
plays from its start. It cues in play (`update`) and stays silent while the world is edited.
In `fx_blast` it sits on the `blast_audio` entity beside the explosion clip, with `source` the
`wall_blast` Generator, `period` 9.6 and `at` 1.0: the charge goes off one second into each 9.6 s
loop of the `wall_blast` graph.
## Fields
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `source` | entity | none | The entity whose Generator's clock cues the sound. |
| `period` | number | 10 | The length of the effect's loop, in seconds of its clock. |
| `at` | number | 0 | How far into each loop the sound plays, in seconds. |
All fields are `Sync`. A `source` that is gone, carries no Generator, or has no graph bound cues
nothing until it has a clock again.
# explosion
Explosion sound clip held by the `fx_blast` scene. The `blast_audio` entity at (-50, 0, 140)
references it from an Audio component with autoplay off, looping off, the `sfx` channel, source type
`SoundEffect`, volume 1, pitch 1 and spatial off.
`source.mp3` is the imported original (MPEG layer III, 128 kbps, 44.1 kHz, stereo); its sha256 is
the `encoded.source` hash in `.metadata`, whose `import` record names the path it was imported from,
`/zero/source/game/environment/audio/explosion.mp3`.
`data.zaud` is the engine-native payload the runtime decodes and plays. Its header states Opus,
48000 Hz, 2 channels and 145449 frames, about 3.03 seconds. `settings.yaml` sets the encoding: codec
`opus`, 96 kbps, VBR on, `forceMono` false, load type `auto`.
# effectShowcase
The procedural effects of the Procgen Effects Showcase world. Each one is a `.procGraph` that plays
through a `Generator`, and every shader, material and module a graph draws with sits beside it in
this package, so the package carries everything its graphs need. Each graph's README says what it
makes, how to place it and what each of its inputs changes.
## Contents
| Folder | Graphs | What they make |
|---|---|---|
| `combat/` | `impact`, `muzzleFlash`, `tracer` | A round striking a hard surface, the bloom at a barrel as a weapon fires, and the glowing streak of a round in flight. They draw with `fxFlash`, `fxSmoke` and `fxSpark` in `combat/shaders/`. |
| `blast/` | `wall_blast` | A charge blowing a breach through a stone block wall, on a 9.6 s loop. |
| `storm/` | `storm`, `tower` | A thunderstorm around a lone tower: wind-driven rain, lightning striking on the schedule `schedule.module` keeps, and sparks and smoke where strikes land. `tower` is the stone keep it stands around. |
| `rift/` | `arcane_rift` | A rift tearing open in the ground, its motes and rubble moved by the compute shaders in `rift/compute/`. |
| `dragon/` | `dragon_breath` | A dragon's fire breath sweeping a courtyard: a flame jet, rolling smoke and drifting embers. |
| `launch/` | `launch` | A heavy-lift rocket liftoff on one looping timeline, with the heat-haze material `rk_haze_mat`. |
| `waterfall/` | `wf_env`, `wf_water`, `wf_spray`, `wf_foam`, `wf_mist` | A waterfall built in parts: the cliff, basin and boulders, the falling and still water, the droplets, the foam where the falls land, and the mist with its rainbow. Its water materials are in `waterfall/materials/`. |
| `shaders/` | | `fx_noise`, the noise functions the waterfall and wall blast shaders include. |
## Playing one
A graph plays on a `Generator` component bound to it:
```lua
-- `graph` is the graph's reference: the AssetRef `asset.resolve` or a search returns for it.
local e = entity.spawn("impact", { position = { 0, 1, 0 } })
e.component.add("Generator", { graph = graph, playOn = "load" })
```
Set a graph's inputs with the Generator's `params`, e.g. `params = { size = 3 }`.