Open History to see the last commit
1/**
2 * Centralized configuration for the 1 Million Boxes game.
3 *
4 * This file re-exports shared game configuration from shared/game-config.ts
5 * and adds frontend-specific configuration values.
6 */
7
8// =============================================================================
9// Re-export shared configuration (single source of truth)
10// =============================================================================
11
12export {
13 // Game end conditions
14 type GameEndMode,
15 GAME_END_MODE,
16 FIRST_TO_SCORE_TARGET,
17 // Grid configuration
18 GRID_WIDTH,
19 GRID_HEIGHT,
20 HORIZ_EDGE_COUNT,
21 VERT_EDGE_COUNT,
22 TOTAL_EDGE_COUNT,
23 TOTAL_BOX_COUNT,
24 // Quota configuration (from shared - server-side enforced)
25 MAX_QUOTA,
26 QUOTA_REFILL_INTERVAL_MS,
27 QUOTA_BONUS_SINGLE,
28 QUOTA_BONUS_DOUBLE,
29 QUOTA_STORAGE_KEY,
30} from "../../shared/game-config"
31
32// =============================================================================
33// Zoom Configuration
34// =============================================================================
35
36/**
37 * Minimum zoom level (fully zoomed out).
38 * At 0.05 with DOT_SPACING=10, a box is 0.5px - barely visible but allows
39 * seeing large portions of the grid.
40 */
41export const MIN_ZOOM = 0.05
42
43/**
44 * Maximum zoom level (fully zoomed in).
45 * At 20 with DOT_SPACING=10, a box is 200px.
46 */
47export const MAX_ZOOM = 20
48
49/**
50 * Default zoom level on initial load.
51 * At 2 with DOT_SPACING=10, a box is 20px - comfortable for interaction.
52 */
53export const DEFAULT_ZOOM = 2
54
55/**
56 * Zoom step for zoom in/out buttons (multiplier).
57 */
58export const ZOOM_STEP = 1.5
59
60// =============================================================================
61// Rendering Configuration
62// =============================================================================
63
64/**
65 * Visual spacing between grid dots in world coordinates.
66 */
67export const DOT_SPACING = 10
68
69/**
70 * Base radius for grid dots.
71 */
72export const DOT_RADIUS = 2
73
74/**
75 * Line width for placed edges.
76 */
77export const EDGE_LINE_WIDTH = 2
78
79/**
80 * Line width for hovered (preview) edges.
81 */
82export const HOVERED_EDGE_LINE_WIDTH = 3
83
84/**
85 * Color for hovered edge preview.
86 */
87export const HOVERED_EDGE_COLOR = `rgba(0, 0, 0, 0.5)`
88
89/**
90 * Minimum zoom level at which grid dots are visible.
91 */
92export const DOT_VISIBILITY_ZOOM = 0.3
93
94// =============================================================================
95// Touch/Mobile Configuration
96// =============================================================================
97
98/**
99 * Minimum size for touch targets (in pixels).
100 */
101export const MIN_TOUCH_TARGET_SIZE = 44
102
103/**
104 * Hit radius multiplier for touch devices.
105 */
106export const TOUCH_HIT_RADIUS_MULTIPLIER = 1.5
107
108// =============================================================================
109// Animation Configuration
110// =============================================================================
111
112/**
113 * Duration for quick UI transitions (in ms).
114 */
115export const TRANSITION_FAST_MS = 150
116
117/**
118 * Duration for normal UI transitions (in ms).
119 */
120export const TRANSITION_NORMAL_MS = 250