Second game mode selectable at dog select (host-authoritative online): - js/sim_arena.js: top-down sim, same export surface as sim.js — x/y plane plus a z hop axis (Space / comma); KOs by knocking dogs into abyss pits - js/mapgen_arena.js: mirrored symmetric arenas — walls, pits, center clearing, guaranteed spawn-to-center corridors, crystals/spikes/launch pads, mirrored saw pairs; fallback pit pair since pits are the only KO mechanic - specials re-imagined per dog: zoom dash, ram + hop-slam, zip-leash slingshot, blink, hover (floats over pits/saws/spikes) - render: arena tiles with wall shadows + void pits, top-down dog drawing with z-lift over a ground shadow; new fall event/sfx - B.HOP input bit so 'up' can mean north in top-down (Space also jumps in side view); mode toggle UI + mode carried in start/rematch net messages Tested: arena mapgen determinism/symmetry/connectivity + chaotic matches + pit/hop scenarios headless; local chaos + full P2P arena match (host mode flip syncs to client) in two headless browsers with zero page errors.
17 lines
864 B
JavaScript
17 lines
864 B
JavaScript
// Shared constants for sim + render. Logical resolution is exactly the tile grid.
|
|
export const TILE = 12, GW = 80, GH = 45;
|
|
export const W = GW * TILE, H = GH * TILE; // 960 x 540
|
|
|
|
// Tile types. PAD is the side-view bounce block (solid); PADTOP is the
|
|
// top-down launch pad (walkable floor tile).
|
|
export const T = { EMPTY: 0, SOLID: 1, PLAT: 2, SPIKE: 3, PAD: 4, CRYSTAL: 5, PIT: 6, PADTOP: 7 };
|
|
|
|
// Input bitmask. JUMP rides on the up keys (side view); HOP is the dedicated
|
|
// hop key (Space / comma) so the top-down mode can move north without hopping.
|
|
export const B = { L: 1, R: 2, U: 4, D: 8, JUMP: 16, ATK: 32, SPC: 64, ITM: 128, HOP: 256 };
|
|
|
|
export const ITEMS = ['ball', 'bomb', 'shield', 'boost', 'heal'];
|
|
|
|
export const GRAV = 0.42, MAXFALL = 9.5;
|
|
export const STOCKS = 3;
|
|
export const SNAP_EVERY = 2; // host sends a snapshot every N sim ticks (30/s)
|