Project Structure
my-game/
├─ src/
│ ├─ game.ts # entry point, calls StartBare
│ ├─ components/ # your ...Component.ts files
│ └─ generated/assets.ts # generated, do not edit
├─ public/
│ ├─ data/
│ │ ├─ settingsData.json # prefabs, animations, layers, settings
│ │ └─ levels/ # level files
│ ├─ initial/ # loaded before the game starts
│ ├─ images/ # streamed in when needed
│ ├─ sounds/
│ └─ fonts/
├─ texturePackImages/ # packed into an atlas automatically
├─ package.json
└─ vite.config.cjsExample: every sample game uses this layout. The Platformer is a small, complete one.
src/game.ts
The starting point of your code. It calls StartBare(Game), where Game extends Scene.
src/components/
Your components. Exported classes extending Component are registered with the engine automatically.
src/generated/assets.ts
Generated by the dev server. It gives you typed access to your assets and data, with autocomplete:
import { Asset, Data } from './generated/assets';
this.AddGameObject(Asset.Image.EMOJI_GEAR);Asset holds images, sounds, fonts and levels. Data holds prefabs, base prefabs, animations and layers from settingsData.json.
WARNING
The lists (Asset.Images, Data.Prefabs, …) are cleared in production builds to save space. To keep them, add "stripGeneratedAssets": false under bareEngine in package.json. See package.json Options. The single-value maps like Asset.Image.X are not affected.
public/data/settingsData.json
Prefabs, base prefabs, animations, layers and game settings. See settingsData.json.
texturePackImages/
While the dev server runs, images in this folder are packed into an atlas in public/initial/generated/. See Assets.
public/initial/
Everything here is loaded before your game runs, in parallel with your code.
public/images/
Images here are streamed in when first used. No code changes needed: refer to them by name and the engine loads them.
package.json
Besides your npm scripts and dependencies, this holds engine build settings under bareEngine, like your game's gameId. See package.json Options.