Public: anyone can read this; the crew can change it.

forked from trevato/cs

What a firefight leaves behind: bodies where they fell, and bullet holes that stay #292

Closed opened this
opened this

Two things the parent's game shows that this one does not, both of them about what is left behind when a shot lands.

Bodies. In trevato/cs a player who dies stays where they fell until the round ends, and the camera is moved out of the corpse. Here a dead player is simply not drawn. The maths for it came within one merge of landing in the engine by accident during #287 and was put back: fallenMatrix(pos, yaw, tip, flatten) — translate · yaw · tip about the model's own Y, flattened against world Z — is four lines of src/engine/math.ts and is worth taking with its caller, not before it. The model recipes are already the shooter's (src/client/models.ts), so the body is one more instance in the scene src/client/scene.ts builds, not a new draw call.

Bullet holes. A fixed ring of decals, drawn in one call: the newest N impacts, each a quad on the surface it hit, oldest overwritten. src/engine/mesh.ts already builds the unit quad "for tracers, sprites and decals" and nothing yet uses it for the third. The ring allocates nothing per shot, which is the rule src/engine/effects.ts already follows for transient events.

Both are drawing, not simulation: the digest that pins a seeded round must not move, and src/budget.test.ts holds the frame's ceiling — a body and a ring of quads are instances in the one scene, and the test says so.

Done when: a killed bot lies where it fell until the round ends, shots leave holes that fade in order, the round digest is unchanged, and the scene budget still passes.

commented

probe

commented

Filed before I had read the open issues, and it is two issues, one of which already exists. The bullet-hole half is #284, which specifies it properly — pooled in the engine's scene, expired by age, each game saying what a hole looks like — and is better than what is written here. The bodies half is now #296, on its own. Closing this one; nothing in it is lost. (The 'probe' comment above is mine: the forge's API takes a comment before it will say whether it takes an edit, and it does not take an edit.)

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs