22// Uses vanilla Three.js engine for better performance
33
44import { useState } from 'react'
5+
56import { VanillaGameScene } from './scene/VanillaGameScene'
67import { IntroOverlay } from './ui/IntroOverlay'
78import { GameHUD } from './ui/GameHUD'
@@ -16,16 +17,40 @@ import { CompassIndicator } from './ui/CompassIndicator'
1617import { GameOverOverlay } from './ui/GameOverOverlay'
1718import { WinOverlay } from './ui/WinOverlay'
1819import { StatsHUD } from './ui/StatsHUD'
20+ import { GameMachineProvider } from './machines/GameMachineProvider'
21+ import { ProgressionSync } from './machines/ProgressionSync'
22+ import { BadgeOverlay } from './ui/BadgeOverlay'
23+
24+ const LOADING_MESSAGES = [
25+ [ 'Convincing the waves to behave...' , 'They never listen' ] ,
26+ [ 'Teaching fish to avoid the boat...' , 'Mixed results so far' ] ,
27+ [ 'Polishing the cannon balls...' , 'Shiny = more damage, right?' ] ,
28+ [ 'Bribing the wind gods...' , 'They only accept doubloons' ] ,
29+ [ 'Untangling the anchor chain...' , 'Who even tied this?' ] ,
30+ [ 'Inflating the ocean...' , 'It was looking a bit flat' ] ,
31+ [ 'Waking up the sea monsters...' , 'Just kidding, letting them sleep' ] ,
32+ [ 'Calibrating the compass...' , 'North is... that way. Probably.' ] ,
33+ [ 'Stocking up on seasickness bags...' , 'Better safe than sorry' ] ,
34+ [ 'Negotiating with seagulls...' , 'They want crackers' ] ,
35+ [ 'Waterproofing the treasure maps...' , 'Learned that lesson the hard way' ] ,
36+ [ 'Training the AI pirates...' , 'They keep missing on purpose' ] ,
37+ [ 'Generating procedural waves...' , 'Each one is unique and special' ] ,
38+ [ 'Hiding easter eggs...' , 'You will never find them all' ] ,
39+ [ 'Rendering exactly 7 million polygons...' , 'Give or take a few' ] ,
40+ ]
1941
2042function LoadingOverlay ( ) {
43+ const [ messageIndex ] = useState ( ( ) =>
44+ Math . floor ( Math . random ( ) * LOADING_MESSAGES . length ) ,
45+ )
46+ const [ headline , subtext ] = LOADING_MESSAGES [ messageIndex ]
47+
2148 return (
2249 < div className = "absolute inset-0 bg-gradient-to-b from-sky-400 to-cyan-600 flex items-center justify-center z-50" >
2350 < div className = "text-center" >
2451 < div className = "w-16 h-16 mx-auto mb-4 border-4 border-white/30 border-t-white rounded-full animate-spin" />
25- < p className = "text-white text-lg font-medium" > Loading assets...</ p >
26- < p className = "text-white/60 text-sm mt-2" >
27- Preparing ocean, boats, and islands
28- </ p >
52+ < p className = "text-white text-lg font-medium" > { headline } </ p >
53+ < p className = "text-white/60 text-sm mt-2" > { subtext } </ p >
2954 </ div >
3055 </ div >
3156 )
@@ -35,38 +60,42 @@ export default function IslandExplorer() {
3560 const [ isLoading , setIsLoading ] = useState ( true )
3661
3762 return (
38- < div className = "relative w-full h-[calc(100dvh-var(--navbar-height))] bg-sky-500" >
39- { /* Loading overlay */ }
40- { isLoading && < LoadingOverlay /> }
63+ < GameMachineProvider >
64+ < ProgressionSync />
65+ < div className = "relative w-full h-[calc(100dvh-var(--navbar-height))] bg-sky-500" >
66+ { /* Loading overlay */ }
67+ { isLoading && < LoadingOverlay /> }
4168
42- { /* 3D Scene */ }
43- < div className = "absolute inset-0" >
44- < VanillaGameScene onLoadingChange = { setIsLoading } />
45- </ div >
69+ { /* 3D Scene */ }
70+ < div className = "absolute inset-0" >
71+ < VanillaGameScene onLoadingChange = { setIsLoading } />
72+ </ div >
4673
47- { /* Vignette overlay for depth */ }
48- < div
49- className = "absolute inset-0 pointer-events-none"
50- style = { {
51- background :
52- 'radial-gradient(ellipse at center, transparent 40%, rgba(0,20,40,0.3) 100%)' ,
53- } }
54- />
74+ { /* Vignette overlay for depth */ }
75+ < div
76+ className = "absolute inset-0 pointer-events-none"
77+ style = { {
78+ background :
79+ 'radial-gradient(ellipse at center, transparent 40%, rgba(0,20,40,0.3) 100%)' ,
80+ } }
81+ />
5582
56- { /* UI Overlays */ }
57- < IntroOverlay />
58- < UpgradeOverlay />
59- < CompleteOverlay />
60- < GameOverOverlay />
61- < WinOverlay />
62- < GameHUD />
63- < StatsHUD />
64- < Minimap />
65- < IslandIndicator />
66- < CompassIndicator />
67- < TouchControls />
68- < Shop />
69- < DebugPanel />
70- </ div >
83+ { /* UI Overlays */ }
84+ < IntroOverlay />
85+ < UpgradeOverlay />
86+ < CompleteOverlay />
87+ < GameOverOverlay />
88+ < WinOverlay />
89+ < BadgeOverlay />
90+ < GameHUD />
91+ < StatsHUD />
92+ < Minimap />
93+ < IslandIndicator />
94+ < CompassIndicator />
95+ < TouchControls />
96+ < Shop />
97+ < DebugPanel />
98+ </ div >
99+ </ GameMachineProvider >
71100 )
72101}
0 commit comments