Suppose I am to develop 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, but it seems designed for a single game setup. I need a scalable structure to host multiple games efficiently.
My Current Considerations:
- Game Logic: Should each game’s logic be inside
src/lib
or within its route (routes/game/game1
)? - Asset Management: How should I organize game-specific assets (images, sounds) while keeping things modular? In
static
or inlib
? - Lazy Loading: How can I structure it so games are loaded only when needed to optimize performance?
- Best Practices: Are there existing open-source projects or recommended approaches for handling multiple Phaser games in SvelteKit?
What can best Project Structure for such platefrom built using Phaser.js and SvelteKit?