What's more festive than Santa flying a plane through snowy mountains? In this project, I created a 3D holiday game where players control Santa's altitude to collect presents while following a winding path. The twist? No complex controls—just one mouse click to ascend. Run out of fuel or crash into the terrain, and it's game over!
A minimalist holiday game where:
The smooth flight path backbone using Babylon.js's built-in spline system:
const spline = new BABYLON.CatmullRomSpline3D([
new BABYLON.Vector3(0, 10, 0),
new BABYLON.Vector3(10, 5, 10),
// Additional points...
]);
Simplified physics for responsive gameplay:
// Core flight mechanics
let verticalVelocity = 0;
const GRAVITY = -0.05;
const CLICK_IMPULSE = 0.3;
scene.onPointerDown = () => {
if (fuel > 0) {
verticalVelocity = CLICK_IMPULSE;
fuel -= FUEL_COST;
}
};
function update() {
verticalVelocity += GRAVITY * deltaTime;
plane.position.y += verticalVelocity;
}
Built a custom tool to accelerate level design:
Using Babylon's intersection system:
// Present collection
meshes.forEach(present => {
if (plane.intersectsMesh(present)) {
fuel += PRESENT_FUEL_VALUE;
present.dispose();
updateFuelUI();
}
});
// Ground collision
if (plane.intersectsMesh(ground)) {
triggerGameOver();
}
Using Babylon's ParticleSystem:
const snow = new BABYLON.ParticleSystem("snow", 1500, scene);
snow.particleTexture = new BABYLON.Texture("flakes.png", scene);
snow.minSize = 0.1;
snow.maxSize = 0.4;
snow.gravity = new BABYLON.Vector3(0, -0.5, 0);
Adapted from ShaderToy:
// Optimizations:
#define STEPS 32 // Reduced from 64
// Removed ground reflections
// Simplified color palette
Element | Initial | Final | Effect |
---|---|---|---|
Flight Speed | 0.8 units/frame | 1.2 units/frame | Better tension |
Fuel Drain | 0.5%/sec | 0.3%/sec | Fairer difficulty |
Gravity | -0.08 | -0.05 | Smoother controls |
Sharp turns caused visual artifacts
Shader caused frame drops
This project demonstrated how strategic simplifications can create compelling gameplay. Key takeaways: