๐ฎ Kula Browser - Gravity-Defying 3D Puzzle Platformer
๐ฏ Game Overview
Kula Browser reimagines the beloved puzzle-platformer experience for the modern web. Navigate a mysterious sphere through mind-bending levels where gravity is just a suggestion, momentum is your ally, and every surface could become your floor.
What Makes This Special?
This isn't just another 3D platformer. Kula Browser challenges your spatial reasoning and reflexes in ways that traditional games can't:
- 360ยฐ Freedom: Every surface is potentially walkable - walls become floors at your command
- Physics-Based Puzzles: Master momentum conservation through gravity shifts to reach impossible places
- Strategic Gameplay: Plan your route carefully - one wrong gravity shift could leave you stranded
- Progressive Difficulty: From gentle introductions to mind-melting challenges that will test your mastery
Why You'll Love It
- ๐ฎ Pick Up and Play: Simple controls, deep mechanics
- ๐ง Brain-Teasing Puzzles: Each level is a spatial reasoning challenge
- โก Smooth Performance: 60 FPS gameplay optimized for all modern browsers
- ๐ฏ Clear Objectives: Collect keys, reach the exit, master the physics
- ๐ Endless Replayability: Perfect your routes, beat your times, master every level
โจ Features
Core Gameplay
- ๐ Gravity Manipulation: Shift gravity in 6 directions with Q/E keys
- ๐ฎ Smooth Physics: Realistic ball physics with momentum conservation
- ๐๏ธ Key Collection: Strategic objectives that unlock level completion
- ๐ช Dynamic Exits: Exits that activate only when all keys are collected
- ๐ Environmental Hazards: Deadly spikes and moving platforms to avoid
- ๐ Moving Platforms: Dynamic level elements that add timing challenges
Technical Excellence
- ๐จ Three.js Rendering: Beautiful 3D graphics powered by WebGL
- โ๏ธ CANNON.js Physics: Realistic physics simulation for authentic gameplay
- ๐ฑ Responsive Design: Adapts to any screen size and resolution
- ๐ต Immersive Audio: Sound effects for every action and event
- ๐ HUD System: Real-time display of lives, score, and objectives
- ๐ฏ Smart Camera: Intelligent camera that follows action smoothly
Architecture
- ๐๏ธ Modular Design: Clean, maintainable code architecture
- ๐ JSON Levels: Data-driven level system for easy content creation
- ๐ Event System: Decoupled components communicate via events
- ๐งช Test Coverage: Comprehensive E2E tests with Playwright
- ๐ฆ Zero Framework Dependencies: Pure vanilla JavaScript for maximum performance
๐ ๏ธ Technical Stack
| Technology |
Purpose |
Why We Chose It |
| Three.js |
3D Rendering |
Industry-standard WebGL library with excellent documentation |
| CANNON.js |
Physics Engine |
Lightweight, fast, perfect for web-based physics |
| Vanilla JavaScript |
Core Logic |
No framework overhead, maximum performance |
| Playwright |
E2E Testing |
Modern testing framework with great debugging tools |
| Webpack |
Module Bundling |
Efficient bundling and optimization |
| ES6 Modules |
Code Organization |
Clean, modern module system |
๐ Getting Started
Prerequisites
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- Modern web browser (Chrome, Firefox, Safari, Edge)
Installation
# Clone the repository
git clone https://github.com/yourusername/kula-browser.git
# Navigate to project directory
cd kula-browser
# Install dependencies
npm install
# Start the development server
npm start
Running the Game
Development Mode:
npm start
Opens the game at http://localhost:8080
Production Build:
npm run build
Creates optimized build in dist/ directory
Run Tests:
npm test # Run all tests
npm run test:e2e # Run E2E tests only
๐ฎ How to Play
Controls
| Action |
Key/Input |
Description |
| Move Forward |
W |
Roll the ball forward |
| Move Backward |
S |
Roll the ball backward |
| Move Left |
A |
Roll the ball left |
| Move Right |
D |
Roll the ball right |
| Jump |
Space |
Make the ball jump |
| Gravity Left |
Q |
Shift gravity 90ยฐ left |
| Gravity Right |
E |
Shift gravity 90ยฐ right |
| Camera |
Mouse |
Look around (click and drag) |
Objectives
- ๐๏ธ Collect All Keys: Find and collect all yellow keys scattered throughout the level
- ๐ช Unlock the Exit: The exit portal activates only after all keys are collected
- โ ๏ธ Avoid Hazards: Don't touch red spikes or fall into the void
- โฑ๏ธ Master Your Time: Complete levels as quickly as possible for the best score
Pro Tips
- Momentum Matters: Your velocity carries through gravity shifts - use it wisely!
- Plan Your Route: Survey the level before making risky gravity changes
- Jump + Gravity: Combine jumps with gravity shifts for advanced maneuvers
- Edge Safety: Be careful near edges when shifting gravity
- Platform Timing: Study moving platform patterns before attempting crosses
๐๏ธ Architecture
System Design
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Game Controller โ
โ (Main Game Loop & State) โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ โ
โโโโโโผโโโโโโ โโโโโโผโโโโโโ
โ Physics โ โ Renderer โ
โ Manager โ โ (Three) โ
โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ
โ โ
โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโ
โ Core Systems โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโค
โ Player โ Camera โ Level โ UI โ
โ Controller โ Controller โ Manager โ Manager โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
โ โ
โโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโ
โ Entity Components โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโค
โ Platform โ Key โ Hazard โ Exit โ
โ Entity โ Entity โ Entity โ Entity โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
Key Modules
- ๐ฎ Game.js: Main game controller and state management
- โฝ PlayerController.js: Ball movement, jumping, and gravity control
- โ๏ธ PhysicsManager.js: CANNON.js integration and physics simulation
- ๐ท CameraController.js: Smooth camera following and user input
- ๐บ๏ธ LevelManager.js: Level loading, entity creation, and management
- ๐ UIManager.js: HUD rendering and user interface updates
- ๐ต AudioManager.js: Sound effect management and playback
- ๐ฏ EventBus.js: Central event system for component communication
Event Flow
// Example: Key Collection Flow
PlayerController โ Collision โ EventBus.emit('keyCollected')
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
โ โ โ
UIManager.updateScore() LevelManager.checkWin() AudioManager.playSound()
๐งช Testing
Test Coverage
Our comprehensive test suite ensures reliability and stability:
- โ
E2E Tests: Full gameplay scenarios with Playwright
- โ
Integration Tests: Component interaction verification
- โ
Regression Tests: Ensuring new features don't break existing ones
- โ
Performance Tests: FPS and rendering optimization checks
Running Tests
# Run all tests
npm test
# Run E2E tests with UI
npm run test:e2e:ui
# Run specific test suite
npm run test -- --grep "gravity"
# Generate coverage report
npm run test:coverage
Test Categories
- Core Mechanics: Movement, jumping, gravity shifts
- Level Systems: Loading, entity creation, objectives
- Collision Detection: Player-entity interactions
- Game States: Win/lose conditions, score tracking
- Performance: Frame rate, memory usage, load times
๐จ Level Design
Level Format
Levels are defined in JSON for easy creation and modification:
{
"name": "Gravity Garden",
"difficulty": "medium",
"par_time": 120,
"spawn": { "x": 0, "y": 5, "z": 0 },
"platforms": [
{
"position": { "x": 0, "y": 0, "z": 0 },
"size": { "x": 10, "y": 1, "z": 10 },
"color": "#4CAF50",
"type": "static"
}
],
"keys": [
{
"id": "key1",
"position": { "x": 5, "y": 2, "z": 5 },
"color": "#FFD700"
}
],
"hazards": [
{
"type": "spike",
"position": { "x": -3, "y": 1, "z": 0 },
"damage": 1
}
],
"exit": {
"position": { "x": 0, "y": 2, "z": -8 },
"requiredKeys": ["key1", "key2", "key3"]
}
}
Creating Custom Levels
- Create a new JSON file in
assets/levels/
- Define platforms, keys, hazards, and exit
- Add to level registry in
LevelManager.js
- Test thoroughly with different gravity orientations
Entity Types
| Entity |
Purpose |
Properties |
| Platform |
Walkable surfaces |
position, size, color, movement |
| Key |
Collectible objectives |
position, id, color, value |
| Hazard |
Damage sources |
position, type, damage, pattern |
| Exit |
Level completion |
position, requiredKeys, nextLevel |
| Moving Platform |
Dynamic obstacles |
position, size, path, speed |
๐จ Level Editor
Accessing the Editor
The Kula Browser includes a powerful in-browser level editor that allows you to create custom levels with an intuitive 3D interface.
To access the editor:
- Open
editor.html in your browser
- Or navigate to
http://localhost:8080/editor.html when running the dev server
Floor-Based Editing System
The editor uses a floor-based editing system that makes it easy to work in 3D space:
- Current Floor Lock: You can only place/edit blocks on the currently selected floor
- Visual Hierarchy:
- Current floor: Full visibility with grid
- Floors below: Semi-transparent (25% opacity)
- Floors above: Very faint (10% opacity)
- Precise Placement: No more guessing which grid cell you're clicking on!
Editor Controls
Floor Navigation
| Action |
Controls |
Description |
| Move Up One Floor |
PageUp or Shift+Q |
Navigate to the floor above |
| Move Down One Floor |
PageDown or Shift+E |
Navigate to the floor below |
| Jump to Floor |
Alt+0 to Alt+9 |
Instantly jump to floor 0-9 |
| Direct Input |
Floor input field |
Type exact floor number (-5 to 10) |
| Visual Buttons |
โฒ/โผ buttons |
Click to move up/down floors |
Tool Selection
| Tool |
Shortcut |
Description |
| Place |
Q |
Place blocks at cursor position |
| Remove |
W |
Remove blocks at cursor position |
| Select |
E |
Select blocks for properties |
Block Selection
| Action |
Shortcut |
Description |
| Quick Select |
1-9 |
Select block type from palette |
| Mouse Select |
Click palette |
Choose from visual block palette |
Camera Controls
| Action |
Control |
Description |
| Rotate |
Left Mouse Drag |
Orbit camera around focus point |