33 lines
1.5 KiB
JavaScript
33 lines
1.5 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;
|
|
|
|
// The camera looks north from an orthographic elevation of 70° above the
|
|
// ground. That foreshortens the north-south axis by sin(70°) ~= 0.94 while the
|
|
// east-west axis is untouched: a gentle 3D tilt that keeps the current
|
|
// orientation. It is applied to the terrain, roads, borders, fog and ground
|
|
// overlays; units, cities and labels stay upright on top.
|
|
export const CAMERA_ELEVATION_DEG = 45;
|
|
export const CAMERA_TILT = Math.sin((CAMERA_ELEVATION_DEG * Math.PI) / 180);
|
|
|
|
// 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 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;
|