90 lines
4.2 KiB
JavaScript
90 lines
4.2 KiB
JavaScript
// ---------------------------------------------------------------------------
|
||
// Render configuration
|
||
// ---------------------------------------------------------------------------
|
||
|
||
/** Internal render resolution of the raycast view. Originally 320×200 for the
|
||
* chunky retro look; now tripled — 1:1 with the 960×600 display canvas (still
|
||
* upscaled cleanly on larger windows). Drop these back down for more chunk,
|
||
* or if a low-end machine struggles. */
|
||
export const RENDER_WIDTH = 960;
|
||
export const RENDER_HEIGHT = 600;
|
||
|
||
/** Field of view. The camera plane length = tan(FOV / 2); 66° ≈ a plane of
|
||
* 0.66 against a unit direction vector, matching the classic Wolf3D feel. */
|
||
export const FOV = (66 * Math.PI) / 180;
|
||
|
||
/** Stub floor and ceiling fill colors (0xRRGGBB). */
|
||
export const CEILING_COLOR = 0x383838;
|
||
export const FLOOR_COLOR = 0x707070;
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// Player tuning
|
||
// ---------------------------------------------------------------------------
|
||
|
||
export const MOVE_SPEED = 3.0; // cells per second
|
||
export const ROT_SPEED = 2.4; // radians per second (keyboard turn)
|
||
export const MOUSE_SENSITIVITY = 0.0025; // radians per pixel of mouse movement
|
||
export const PLAYER_RADIUS = 0.2; // collision radius in cell units
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// Combat tuning
|
||
// ---------------------------------------------------------------------------
|
||
|
||
export const WEAPON_RANGE = 12; // cells
|
||
export const WEAPON_DAMAGE = 25;
|
||
export const WEAPON_FIRE_COOLDOWN = 250; // ms between shots
|
||
export const START_AMMO = 50;
|
||
export const START_HEALTH = 100;
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// Door tuning
|
||
// ---------------------------------------------------------------------------
|
||
|
||
export const DOOR_SLIDE_MS = 900; // time for a door to slide fully open/closed
|
||
export const DOOR_OPEN_MS = 4000; // how long a door stays open before closing
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// Content registries
|
||
// ---------------------------------------------------------------------------
|
||
// Wall tiles, overlays, items, enemies, and campaigns are all data-driven:
|
||
// defined in the JSON files under CONFIG_DIR and loaded by engine/registry.js
|
||
// at boot. See that module for the accessors (getWall, getEntityDef, …).
|
||
|
||
/** Folder (relative to the HTML page) holding the content config JSON files
|
||
* (walls.json, overlays.json, items.json, enemies.json, campaigns.json). */
|
||
export const CONFIG_DIR = './src/config/';
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// Level file format + campaign manifest
|
||
// ---------------------------------------------------------------------------
|
||
|
||
/** Schema version stamped into exported level files. Bump when the on-disk
|
||
* shape changes so old files can be detected/upgraded.
|
||
* v2: entities carry enemy types (e.g. "guard"); adds `overlays` and `items`
|
||
* arrays. v1 files are migrated on load (see levelIO.migrateLevel). */
|
||
export const LEVEL_FORMAT_VERSION = 2;
|
||
|
||
/** Default size of a fresh level created in the editor. ~20x the area of the
|
||
* old 16x16 grid so you can build big levels; scroll with the arrow keys or a
|
||
* middle-drag, and zoom with the mouse wheel. Bump these for even bigger maps —
|
||
* the editor only draws the cells currently on screen, so size is cheap. */
|
||
export const NEW_LEVEL_WIDTH = 72;
|
||
export const NEW_LEVEL_HEIGHT = 72;
|
||
|
||
/** Folder (relative to the HTML page) that holds level files + the manifest. */
|
||
export const LEVELS_DIR = './src/levels/';
|
||
|
||
/** Manifest listing the campaign's level files, in play order. */
|
||
export const MANIFEST_PATH = LEVELS_DIR + 'levels.json';
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// Cross-page handoff
|
||
// ---------------------------------------------------------------------------
|
||
|
||
/** localStorage key the editor writes a level to for "Play Test", and the game
|
||
* reads on boot. */
|
||
export const PLAYTEST_KEY = 'escape.playtest.level';
|
||
|
||
/** localStorage key for the editor's persisted working level ("Save"). */
|
||
export const EDITOR_SAVE_KEY = 'escape.editor.level';
|