Log inGet started
World

Foundry: Skate Feel Lab

Branchmain
Commit9d171a389b

README.md

game.skate.rig

The board and the rider, as geometry. Everything comes out of game.geom, so it is tessellated, so the lamp pools roll across the deck as the skater passes under a light instead of the whole board changing colour at once.

This is the object the player looks at for six minutes without interruption, so it carries more detail than anything else in NIGHTGRIND: a kicked deck, griptape, trucks, four wheels, and a rider standing across the board with bent knees and their arms out for balance.

The local frame

Everything is authored in the board's own space:

  • y = 0 is the ground the wheels touch,
  • -Z is forward (the engine convention — an entity faces its local -Z),
  • +X is the direction the rider faces, because a skater stands across a board, not along it. That one fact is most of why this reads as a skateboard rather than as a surfboard.

Four meshes, seven materials

Split because the pieces move independently. The chassis barrel-rolls through a kickflip while the rider stays upright; the rider crouches into an ollie while the chassis does not. One mesh could do neither.

BuilderWhat
deckMesh()plank plus a kicked nose and tail, dropped by CHASSIS_PIVOT so a flip turns about the deck's own centreline
gripMesh()griptape, its own slab so the top and bottom of the deck are different colours — that contrast is what makes a kickflip legible
trucksMesh()baseplate, hanger and kingpin, twice
wheelsMesh()four octagonal wheels; a 1998 wheel had eight sides
riderBodyMesh()hips, torso leaning into the direction of travel, shoulders
riderHeadMesh()head, beanie, jaw block
riderLimbsMesh()feet, two bent legs, two arms out for balance

materials() returns all seven through game.mat, mid-tone and cool. The deck graphic is the one saturated thing on the player, which is what makes a spinning board readable against asphalt.

fixWinding — and why it has to exist

game.geom documents its winding convention as "the front face is v x u", and plane, ramp, quarterpipe and a z-axis tube all obey it. Two builders do not:

  • box — its four side faces are wound against their stated normals; the top and bottom are correct. Measured: the engine's mesh validator reported "96 of 144 triangles" on a box-only mesh, which is exactly the four sides.
  • tube with axis = "x" — every triangle. The angular tangent picks up the opposite sign when the axis swaps and the normal it writes does not. "64 of 64", on a mesh that is four wheels.

Those are bugs in a shared module this slice does not own, and inverted winding is the documented trap that renders a completely black frame with a healthy scene tree and no error anywhere. So rather than re-deriving anything by hand, every mesh built here goes through fixWinding: compare each triangle's geometric normal against the average of its three vertex normals and swap two indices where they disagree. O(triangles), once per mesh at build time, correct for any input, and a no-op on geometry that was already right.

rotX / rotZ rotate the vertices appended since a mark, positions and normals together. A rigid rotation preserves triangle orientation, so the winding survives untouched — they move geometry, never index order.

The version token

VER is baked into every mesh name. Geom.mesh memoises by name for the life of the module, and a memo that outlives a change to the geometry hands back the old mesh with no error anywhere — the same class of silent failure as the winding bug. Bump VER when the geometry changes.