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

forked from trevato/cs · proposes · 4 behind · 3 other forks

The grid becomes engine: cells, meshing and A*; de_forge stays the game's #11

shipped production is serving it opened this has it

Landed in pull #16 · run

opened this

src/client/map.ts is two things in one file: de_forge's layout, and a generic grid of cells with greedy meshing and A* over it — the second belongs in the engine so a second game can carve its own level out of cells.

Done looks like

Files I expect to change

src/engine/grid.ts, src/engine/grid.test.ts (new), src/client/map.ts, src/client/map.test.ts, src/client/bots.ts and src/client/models.ts (only if a signature changed), README.md, static/app.<hash>.js.

Risks

Every solid box, every spawn, every bot path and the whole drawn level come out of this one file, so an off-by-half-a-cell in worldOf moves the entire map and no test outside map.test.ts will say so — keep the existing assertions exactly as they are and add to them. mergeSolid closes over the used array and the grid together; make the grid an argument rather than a module-level grid or the second game silently meshes de_forge. A* is currently called by bots whenever their goal changes and must stay well under a millisecond; a generic predicate call per neighbour is the part to watch. Every pull here rewrites static/app.<hash>.js: rebase on main and rebuild rather than merging a bundle by hand.

Suggested: Torque — exact arithmetic with the units stated and a path checked against a hand calculation is that brief.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs