Trimming meat off laser barriers and adding blood in Godot
Six fixes to the first dungeon: meat cut back from laser planes, a blood trail made of decals, a body chute with guide bars, and a scientist who stops clipping.
I fixed six things in the first dungeon today, all from notes I drew on screenshots while playing. The ones with the most going on are the meat that grew through laser barriers and the blood trail behind the dying scientist. The smaller ones are the instrument tray, the body chute, a light over a body and a broken bathroom door.
How can meat be kept off a laser barrier?
My note said meat was growing through the lasers and should be trimmed so none crosses a barrier in that room, and a second note said the same about another room. The meat painter doesn’t know lasers exist, so a wall’s growth just ran through the light.
A barrier is a sheet of light across a passage, so each one is a plane. A new class, MeatTrim, is called last by DungeonMeat.placed(), after the meat is laid, and finds every laser wall and laser grid. For each piece of meat whose bounds reach across a plane, within the barrier’s span plus 1.4 m past each end (where the wall’s growth stands), it does one of two things.
If the piece’s origin is on one side, I squash it along the plane’s normal about its far end until its near end is 0.06 m short of the plane. If the origin is within 0.06 m of the plane, which is the floor and ceiling mat of the grid’s square, the grid cuts it down the middle. So I lay that piece twice, each half squashed to its own side.
Only what is drawn gets trimmed. A trimmed piece keeps its collision boxes, so the pathing and line-of-sight checks answer exactly as before and the barrier stops the party. Because the trim runs inside placed(), the test sees the same meat the build does, and it asks MeatTrim.crossing() for what still crosses a plane and wants an empty list on all four floors. It works on every floor of every dungeon, not just that room. One test had to change: the meat-cover test was keyed by drawn bounds, which no longer match after a trim, so it’s keyed by the collision box now.
How do you lay a trail of blood without a mesh?
I drew three notes about the scientist at the end of the intro. He ran into the console, then the cutscene ended and he was on the other side of the room. I wanted him dead against the button, bloody, with “a trail of blood from the fight to this point”.
The box he clipped into was the console, so I gave NPCs a spot refinement for where they end up. Carl’s is the square at (18,1). His crawl runs up the aisle and presses on from 0.45 m off the console with a slight lean, and his figure is the seated wounded one.
The trail is FloorBlood.trail(), a line of Decal nodes along floor points. A Decal projects onto whatever is under it, floor tiles and meat both, so there’s no mesh and no material to maintain. Marks are every 0.27 m. Every second one is a smear 0.36 m wide and 0.62 m long, scaled by a fixed hash of its index, and the rest are 0.13 m drops, with a pair of loose drops up to 0.16 m off the line now and then. The decals are only 0.12 m deep so they wet the floor and no more. I used no randf(), so the trail is the same on every run, and each mark carries its distance along the trail so a test can check order and spacing. My first version looked faint in the film, so I made the marks bigger and closer together. The cultist leaves a trail to Pell the same way, and Pell’s body gets a wound and a pool from the shot.
Why did the bodies clip in the chute?
I said the bodies were “too flush to the bottom of the pipe” and suggested guide bars. Now vertical bars run from the pipe mouth’s back rim down to the slide bars, which sit 0.5 m over the table. The drop is one tween: the body falls straight down at 0.8 scale to where it meets the bars, plays a hit sound, slides to the foot of the bars, levels out, and bounces onto the table. Its back rides 0.05 m above the bars, the pipe’s radius, and that offset is what stopped the clipping.
Also done
- The trolley and tray stand at the head end of every table, at the scientist’s elbow.
- The Ward Orderly’s body has a lamp over it, from a
litrefinement on the NPC. - A broken door sits at the bathrooms, one square south of the corridor, with MEN’S ROOM on both faces. The party squeezes through its gap.
- Narrow passages still need rounding.