Repository navigation
Replies: 1 comment
|
Hi! I would recommend keeping one SvelteKit application and organizing each Phaser game into its own module, rather than creating a separate application for every game. A possible structure would be: 1. Game logic Keep game-specific scenes, configuration, and logic in 2. Assets Use 3. Lazy loading Load Phaser and the selected game's configuration only when the game component mounts in the browser: const loaders = {
game1: () => import('../games/game1/config'),
game2: () => import('../games/game2/config')
};Then, inside the This avoids executing Phaser's browser-dependent code during server-side rendering and means users don't need to download every game's code when opening the website. 4. Cleanup When navigating away from a game, call If the user navigates between two URLs using the same For a small or medium-sized collection of games, I think this approach provides a good balance between maintainability, performance, and simplicity. You can add more games without changing the overall architecture. |
Uh oh!
There was an error while loading. Please reload this page.
I am developing a gaming website using SvelteKit and Phaser.js, where users can play multiple 2D games. Each game should have its own assets (images, sounds, etc.) and be accessible via routes like:
http://somehost.com/game/game1
http://somehost.com/game/game2
http://somehost.com/game/game3
I checked the official Phaser.js + Svelte template https://github.com/phaserjs/template-svelte , but it seems designed for a single game setup. I need a scalable structure to host multiple games efficiently.
My Current Considerations:
staticor inlib?What can best Project Structure for such platefrom built using Phaser.js and SvelteKit?
All reactions