Welcome to Babylon Game Starter, a powerful, modular framework for creating 3D games in the Babylon.js Playground. This system provides a complete foundation for building interactive 3D experiences with minimal setup, allowing you to focus on creativity and game design rather than infrastructure.
Babylon Game Starter is a configuration-driven game development framework that transforms the Babylon.js Playground into a full-featured game engine. It provides a complete set of managers, controllers, and systems that work together to handle everything from character movement to inventory management, from particle effects to behavior triggers.
any typesThis guide is designed for:
Babylon Game Starter follows a modular, manager-based architecture where each system is handled by a dedicated manager class. This design provides clear separation of concerns, making the codebase easy to understand, extend, and maintain.
The system is organized into several key layers:
index.ts): Initializes the playground and coordinates UI setupEach manager is responsible for a specific aspect of the game:
The system is designed to be customized primarily through configuration files:
config/assets.ts: Characters, environments, items, particlesconfig/game-config.ts: Core game settings (speeds, physics, effects)config/input-keys.ts: Keyboard input mappingsconfig/mobile-controls.ts: Touch control configurationconfig/character-states.ts: Character state definitionsThis approach means you can create entirely different games by changing configuration files without modifying the core code.
The SceneManager is the central orchestrator of the entire system. It:
Key Methods:
loadEnvironment(environmentName): Loads a new game environmentsetupEnvironmentItems(): Sets up collectibles for the current environmentchangeCharacter(characterIndexOrName): Switches the active characterThe CharacterController handles all character-related functionality:
Features:
Environments are complete 3D worlds that can be loaded and switched at runtime:
Environment Components:
Example Environment Configuration:
{
name: "Level Test",
model: "https://.../levelTest.glb",
spawnPoint: new BABYLON.Vector3(3, 0.5, -8),
sky: {
TEXTURE_URL: "https://.../sky.jpg",
TYPE: "SPHERE"
},
particles: [ /* particle configs */ ],
items: [ /* item configs */ ]
}
Switching Environments:
You can programmatically switch between environments using the switchToEnvironment helper function:
import { switchToEnvironment } from './utils/switch-environment';
// Switch to a different environment
await switchToEnvironment("Level Test");
This function handles all the necessary cleanup, physics pausing, and environment loading automatically.
The CollectiblesManager handles item collection:
The InventoryManager manages player inventory:
Item Types:
The BehaviorManager enables proximity-based interactions:
Behavior Features:
Example Behavior:
behavior: {
triggerKind: "proximity",
radius: 3,
checkPeriod: { type: "interval", milliseconds: 5000 },
action: {
actionType: "adjustCredits",
amount: -5
}
}
The EffectsManager handles all visual and audio effects:
Particle Systems:
Audio:
Visual Effects:
Physics is handled through Havok physics integration:
The SmoothFollowCameraController provides:
The HUDManager displays:
All HUD elements are configurable and can be toggled for mobile/desktop.
The MobileInputManager provides:
In his GDC talk, Jesse Schell explores Christopher Alexander’s philosophy of creating spaces and experiences that have “the quality without a name”—that feeling when something is just right, when it feels alive, whole, comfortable, free, exact, egoless, and eternal. Alexander identified 15 fundamental properties that create this quality, and Schell shows how these apply to game narratives.
This section will guide you through using Babylon Game Starter to manifest game narratives that embody these 15 properties, creating experiences that feel truly alive and meaningful.
What it means for narratives: Great narratives work at multiple levels simultaneously—the big picture (plot), the medium level (characters), and the small details (dialogue, moments).
How to manifest it in Babylon Game Starter:
Example Configuration:
// Large scale: Different environments for different story chapters
ENVIRONMENTS: [
{ name: "Chapter 1: The Beginning", /* ... */ },
{ name: "Chapter 2: The Journey", /* ... */ },
{ name: "Chapter 3: The Resolution", /* ... */ }
]
// Medium scale: Characters with different roles
CHARACTERS: [
{ name: "The Hero", /* ... */ },
{ name: "The Guide", /* ... */ },
{ name: "The Antagonist", /* ... */ }
]
// Small scale: Behaviors that create moments
particles: [{
name: "Magic Sparkles",
behavior: {
triggerKind: "proximity",
radius: 3,
action: { actionType: "adjustCredits", amount: 10 }
}
}]
What it means for narratives: Every good story has strong centers—key locations, characters, or moments that everything else revolves around.
How to manifest it in Babylon Game Starter:
Example:
// Create a strong center with special effects
particles: [{
name: "Portal Effect",
position: new BABYLON.Vector3(0, 0, 0), // Center of world
behavior: {
triggerKind: "proximity",
radius: 5,
edgeColor: new BABYLON.Color4(1, 1, 0, 1), // Golden glow
edgeWidth: 10
}
}]
What it means for narratives: Boundaries create meaning. Thresholds in stories mark important transitions. Conflicts arise when boundaries clash.
How to manifest it in Babylon Game Starter:
triggerOutOfRange to create behaviors that activate outside a radiusExample:
// Boundary behavior: Something happens when you leave an area
items: [{
instances: [{
behavior: {
triggerKind: "proximity",
triggerOutOfRange: true, // Triggers when OUTSIDE radius
radius: 4,
edgeColor: new BABYLON.Color4(0, 1, 0, 1), // Green = safe zone
action: { actionType: "adjustCredits", amount: -1 } // Lose credits outside
}
}]
}]
What it means for narratives: The rhythm of tension and release, action and reflection. Like flow state—not constant intensity, but alternating between challenge and rest.
How to manifest it in Babylon Game Starter:
Example:
// Create alternating rhythm with behaviors
// Intense area: Many particle effects and behaviors
particles: [
{ name: "Fire Trail", position: new BABYLON.Vector3(0, 0, 0) },
{ name: "Energy Field", position: new BABYLON.Vector3(5, 0, 0) }
]
// Calm area: Minimal effects, just ambient sounds
// (no particles, just background music)
What it means for narratives: In dialogue, positive space is what’s said; negative space is silence or what others say. Both need to be well-shaped.
How to manifest it in Babylon Game Starter:
Example:
// Positive space: Active, engaging areas
particles: [{ name: "Magic Sparkles", /* ... */ }]
items: [/* collectibles */]
// Negative space: Empty, contemplative areas
// (no particles, minimal items, just exploration)
What it means for narratives: When things serve their purpose perfectly, they naturally take on beautiful shapes. In narratives, this means the structure serves the story.
How to manifest it in Babylon Game Starter:
Example:
// Good shape: Behavior that matches its purpose
// Dangerous area should have warning behaviors
particles: [{
name: "Fire Trail",
position: new BABYLON.Vector3(10, 0, 0), // Dangerous area
behavior: {
triggerKind: "proximity",
radius: 2,
action: { actionType: "adjustCredits", amount: -5 } // Penalty for danger
}
}]
What it means for narratives: Different parts of the story have their own internal logic and symmetry, but they’re not all the same. Like characters—each has their own completeness.
How to manifest it in Babylon Game Starter:
Example:
// Each environment has its own "local symmetry"
ENVIRONMENTS: [
{
name: "Fire Realm",
particles: [{ name: "Fire Trail" }], // Fire theme
items: [{ name: "Fire Crystal" }] // Fire collectibles
},
{
name: "Ice Realm",
particles: [{ name: "Stardust" }], // Ice theme
items: [{ name: "Ice Crystal" }] // Ice collectibles
}
]
What it means for narratives: When the player’s story (what they experience) and the designer’s story (what you intended) interlock perfectly. Like a dovetail joint—neither is in charge, both are essential.
How to manifest it in Babylon Game Starter:
Example:
// Deep interlock: Player discovers behaviors through exploration
// The behavior exists whether player finds it or not
particles: [{
name: "Magic Sparkles",
position: new BABYLON.Vector3(-2, 0, -8), // Hidden location
behavior: {
triggerKind: "proximity",
radius: 3,
action: { actionType: "adjustCredits", amount: 10 } // Reward for discovery
}
}]
What it means for narratives: The unity of opposites. Comedy comes from contrast. Serious moments are made more serious by contrast with humor.
How to manifest it in Babylon Game Starter:
Example:
// Contrast: Dangerous area vs. safe area
particles: [
{
name: "Fire Trail", // Dangerous
behavior: { action: { actionType: "adjustCredits", amount: -5 } }
},
{
name: "Magic Sparkles", // Safe/beneficial
behavior: { action: { actionType: "adjustCredits", amount: 10 } }
}
]
What it means for narratives: Gradual changes over time. Not sudden jumps, but smooth transitions.
How to manifest it in Babylon Game Starter:
Example:
// Gradients: Background music crossfades smoothly
backgroundMusic: {
url: "https://.../music.mp3",
volume: 0.03 // Gradual volume
}
// Particle effects with gradual properties
particles: [{
name: "Nebula Cloud", // Gradual, flowing effect
updateSpeed: 0.007 // Slow, gradual movement
}]
What it means for narratives: Imperfection makes things feel real. Too much polish can feel artificial. Roughness adds authenticity.
How to manifest it in Babylon Game Starter:
Example:
// Roughness: Not all particles have the same update speed
particles: [
{ name: "Magic Sparkles", updateSpeed: 0.007 },
{ name: "Dust Storm", updateSpeed: 0.012 }, // Different, rougher
{ name: "Smoke Trail", updateSpeed: 0.009 } // Varied
]
What it means for narratives: Recurring themes, motifs, and patterns that connect different parts of the story. Like musical themes that return.
How to manifest it in Babylon Game Starter:
Example:
// Echoes: Same particle effect used in different environments
// but with different behaviors
ENVIRONMENTS: [
{
name: "Forest",
particles: [{
name: "Magic Sparkles", // Echo
behavior: { action: { actionType: "adjustCredits", amount: 5 } }
}]
},
{
name: "Cave",
particles: [{
name: "Magic Sparkles", // Same effect, different context
behavior: { action: { actionType: "adjustCredits", amount: 10 } }
}]
}
]
What it means for narratives: Empty spaces where important things happen. Silence in dialogue. The cave in the hero’s journey. Boss battle arenas.
How to manifest it in Babylon Game Starter:
Example:
// The Void: Empty space for important encounters
// No particles, no collectibles, just space
// This area becomes important because of what's NOT there
// (Add important encounter here through other means)
What it means for narratives: When everything unnecessary is removed, what remains has a quiet strength. Simple mechanics done well.
How to manifest it in Babylon Game Starter:
Example:
// Simplicity: One clear behavior, well-executed
particles: [{
name: "Magic Sparkles",
behavior: {
triggerKind: "proximity",
radius: 3,
action: { actionType: "adjustCredits", amount: 10 }
}
}]
// Simple, clear, effective
What it means for narratives: Everything is connected. The player’s experience, the game’s systems, the narrative—all interwoven. Like Brothers: A Tale of Two Sons, where the control scheme, the story, and the player’s neurology all connect.
How to manifest it in Babylon Game Starter:
Example:
// Not-Separateness: Behavior connects gameplay and narrative
particles: [{
name: "Portal Effect", // Narrative: portal to another world
behavior: {
triggerKind: "proximity",
radius: 5,
action: { actionType: "adjustCredits", amount: 100 } // Gameplay: reward
}
}]
// The portal IS the reward, the reward IS the portal
// They cannot be separated
To create narratives that have “the quality without a name,” focus on:
Feeling Over Logic: Does it feel right? Test it, change it until all imperfection is gone.
Multiple Levels: Ensure your narrative works at plot level, character level, and moment level.
Strong Centers: Identify what’s central to your story and make those elements strong.
Natural Boundaries: Let boundaries emerge from your narrative needs, not arbitrary rules.
Rhythm: Create alternating repetition—tension and release, action and reflection.
Balance: Balance positive space (active elements) with negative space (empty, contemplative areas).
Purpose: Let form follow function. If it serves its purpose perfectly, it will have good shape.
Local Completeness: Each area, each character, each moment should feel complete in itself.
Interconnection: Design so player story and designer story interlock deeply.
Contrast: Use opposites to strengthen each other.
Gradual Change: Prefer gradients over sudden jumps.
Authenticity: Allow roughness—imperfection makes things feel real.
Recurring Themes: Create echoes that connect different parts.
Empty Spaces: Use voids where important things happen.
Simplicity: Remove everything unnecessary. What remains will have inner calm.
Unity: Design so everything connects—gameplay, narrative, systems, all one.
Start with Feeling: What feeling do you want players to have? Write it down.
Identify Centers: What are the strong centers of your narrative? Mark them in your environment.
Create Boundaries: Where are the thresholds? Use behaviors to mark them.
Design Rhythm: Plan alternating repetition. Map out intense and calm areas.
Balance Space: Design positive spaces (active) and negative spaces (empty).
Test and Refine: Play your game. Does it feel right? Change what doesn’t. Keep what does.
Add Layers: Once the base feels right, add details—particles, sounds, behaviors.
Connect Everything: Ensure gameplay, narrative, and systems all support each other.
// A narrative that embodies the 15 properties
ENVIRONMENTS: [{
name: "The Journey Begins",
// Strong Center: The starting point
spawnPoint: new BABYLON.Vector3(0, 0, 0),
// Levels of Scale:
// Large: The environment itself (the journey)
// Medium: Key locations (the centers)
// Small: Individual moments (behaviors)
// Strong Centers: Marked with special effects
particles: [
{
name: "Portal Effect",
position: new BABYLON.Vector3(0, 0, 0), // Center
behavior: {
triggerKind: "proximity",
radius: 5,
edgeColor: new BABYLON.Color4(1, 1, 0, 1),
edgeWidth: 10
}
}
],
// Boundaries: Safe zone vs. danger zone
items: [{
instances: [{
position: new BABYLON.Vector3(10, 0, 0),
behavior: {
triggerKind: "proximity",
triggerOutOfRange: true, // Boundary marker
radius: 4,
edgeColor: new BABYLON.Color4(0, 1, 0, 1) // Green = safe
}
}]
}],
// Alternating Repetition: Intense and calm areas
particles: [
{ name: "Fire Trail", position: new BABYLON.Vector3(5, 0, 0) }, // Intense
// Empty area at (0, 0, 0) for calm
{ name: "Magic Sparkles", position: new BABYLON.Vector3(-5, 0, 0) } // Reward
],
// The Void: Empty space for important encounter
// (Area at (15, 0, 0) with no particles - becomes important)
// Echoes: Recurring collectible type
items: [
{ name: "Journey Crystal", /* ... */ },
{ name: "Journey Crystal", /* ... */ } // Echo
],
// Simplicity: Clear, simple behaviors
// Each behavior has one clear purpose
// Not-Separateness: Everything connects
// Collectibles give credits AND tell story
// Behaviors affect gameplay AND narrative
}]
Babylon Game Starter provides a powerful foundation for creating 3D games that feel alive and meaningful. By understanding the system architecture and applying the principles of Christopher Alexander’s 15 properties, you can create game narratives that have “the quality without a name”—experiences that feel right, whole, and eternal.
Remember: The timeless way of building games is to do what feels right, test it, and change it until all imperfection is gone. Start simple, add layers, and let your narrative emerge naturally from the interaction between player, systems, and story.
Happy creating! Share your narratives with #BabylonGameStarter!