Files
Battle-for-Tismo/client/js/map_view/constants.js
T

44 lines
1.7 KiB
JavaScript

// Tuning constants for the world map view.
export const RESYNC_HOURS = 0.75;
export const PREDICTION_GRACE_HOURS = 2.0;
export const DRAG_THRESHOLD = 5;
export const ZOOM_MIN = 0.2;
export const ZOOM_MAX = 2.0;
// A battle spreads the two stacks to either side of the tile centre, with the
// battle icon between them. Side offset is in pixels; step is the spacing
// between the (half-size) units of one stack.
export const BATTLE_SIDE_OFFSET = 15;
export const BATTLE_STACK_STEP = 9;
// The zoomed-out overview groups this many tiles per side into one block, so a
// full world is a few hundred flat elements instead of tens of thousands of
// textured ones.
export const OVERVIEW_BLOCK = 4;
// The detailed view is built from square blocks of tiles. Only the blocks that
// intersect the viewport (plus CHUNK_MARGIN blocks of slack on every side) are
// materialised, so panning costs the same no matter how big the map is. Tiles
// are pooled and recycled as blocks leave the view.
export const CHUNK_SIZE = 8;
export const CHUNK_MARGIN = 1;
// Built chunks are kept detached in an LRU cache so panning back over ground
// already visited reattaches them instead of rebuilding hundreds of tiles. The
// cap bounds how many detached tile nodes can be held at once.
export const CHUNK_CACHE_LIMIT = 160;
// Flat colours used by the simplified overview, keyed by terrain type. The
// full-resolution view keeps the textured hexes; this is only the LOD stand-in.
export const OVERVIEW_COLOURS = {
Forest: "#2f6b3a",
Hills: "#7a6a44",
Mountain: "#7d7469",
Desert: "#c2b280",
Ice: "#dcecf5",
Land: "#4f8a4f",
Sea: "#1b3f6b",
};
export const OVERVIEW_SEA = "#1b3f6b";
export const OVERVIEW_FOG = "#04040a";