๐ Defy gravity. Master momentum. Conquer impossible worlds. ๐
A browser-based recreation of the classic Kula World, where physics bends to your will
Play Demo โข Watch Gameplay โข Report Bug โข Request Feature
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.
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
- ๐ฎ 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
- ๐ 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
- ๐จ 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
- ๐๏ธ 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
| 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 |
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
- Modern web browser (Chrome, Firefox, Safari, Edge)
# 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-
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
| 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) |
- ๐๏ธ 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
- 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
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
- ๐ฎ 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
// Example: Key Collection Flow
PlayerController โ Collision โ EventBus.emit('keyCollected')
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโ
โ โ โ
UIManager.updateScore() LevelManager.checkWin() AudioManager.playSound()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
# 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- 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
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"]
}
}- 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 | 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 |
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.htmlin your browser - Or navigate to
http://localhost:8080/editor.htmlwhen running the dev server
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!
| 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 | Shortcut | Description |
|---|---|---|
| Place | Q |
Place blocks at cursor position |
| Remove | W |
Remove blocks at cursor position |
| Select | E |
Select blocks for properties |
| Action | Shortcut | Description |
|---|---|---|
| Quick Select | 1-9 |
Select block type from palette |
| Mouse Select | Click palette | Choose from visual block palette |
| Action | Control | Description |
|---|---|---|
| Rotate | Left Mouse Drag | Orbit camera around focus point |
| Zoom | Mouse Wheel | Zoom in/out |
| Pan | Right Mouse Drag | Move camera laterally |
- Start with Floor 0: The editor starts at floor 0 by default
- Place Platform Blocks: Select a platform type and click to place
- Add Player Spawn: Place the green sphere where the player starts
- Add Keys: Place golden cones that the player must collect
- Add Exit: Place the purple ring that ends the level
- Add Hazards: Optionally add spikes and other obstacles
- Test Different Floors: Use floor navigation to build vertically
- Generate JSON: Click "Generate JSON" to export your level
For a valid, playable level you must include:
- โ Player Spawn Point (green sphere)
- โ At least one Key (golden cone)
- โ Exit Portal (purple ring)
- โ Platform blocks for the player to walk on
- Start Simple: Begin with a flat layout on floor 0
- Build Upward: Use floors 1-3 for vertical challenges
- Test Accessibility: Ensure all areas are reachable
- Use Visual Cues: Place decorations to guide players
- Mind the Gaps: Remember the ball can jump ~1.5 grid units
- Preview Other Floors: Check alignment between floors
- Save Often: Generate JSON periodically to save your work
- Click "Generate JSON" button
- Copy the JSON from the text area
- Save to a
.jsonfile inlevels/directory
- Click "Load JSON" button
- Select your
.jsonlevel file - The level will load in the editor for editing
- Grid Size Adjustment: Change the grid size for larger/smaller levels
- Theme Selection: Choose between different visual themes
- Block Behaviors: Some blocks have special behaviors (moving platforms, etc.)
- Multi-Floor Puzzles: Create complex vertical challenges using gravity mechanics
We welcome contributions from the community! Here's how you can help:
- Fork the Repository: Click the Fork button at the top of this page
- Clone Your Fork:
git clone https://github.com/yourusername/kula-browser.git - Create a Branch:
git checkout -b feature/amazing-feature - Make Changes: Implement your feature or fix
- Test Thoroughly: Run all tests and add new ones if needed
- Commit:
git commit -m 'feat: add amazing feature' - Push:
git push origin feature/amazing-feature - Open PR: Submit a Pull Request with a clear description
- Use ES6+ features where appropriate
- Follow existing code patterns and architecture
- Comment complex logic and algorithms
- Write self-documenting code with clear variable names
- Add JSDoc comments for public methods
- Ensure all tests pass before submitting
- Add E2E tests for new features
- Maintain or improve code coverage
- Test across different browsers
- Verify performance impact
- โ Core gameplay mechanics
- โ 5 introductory levels
- โ Basic hazards and moving platforms
- โ Sound effects and HUD
- โ Full test coverage
- ๐ 10 additional levels with increasing difficulty
- ๐ New hazard types (lasers, crushers, teleporters)
- ๐ Time trial mode with leaderboards
- ๐ Level restart and checkpoint system
- โ In-browser level editor (Implemented!)
- ๐ Community level sharing
- ๐ Achievement system
- ๐ฎ Gamepad support
- ๐ฑ Mobile touch controls
- ๐ฅ Local multiplayer races
- ๐ Online multiplayer
- ๐จ Custom ball skins and trails
- ๐ต Dynamic music system
- ๐๏ธ Workshop/modding support
- ๐ฏ Daily challenges
- ๐ Global leaderboards
This game was built following a rigorous test-driven development approach across five phases:
- Phase 1 - Core Engine: Three.js setup, basic physics, player controller
- Phase 2 - Gravity System: 6-directional gravity, momentum conservation
- Phase 3 - Level Objectives: Keys, exits, level loading system
- Phase 4 - Game Systems: Score, lives, HUD, audio integration
- Phase 5 - Polish: Hazards, moving platforms, visual effects
- ๐ Gravity Transitions: Smooth camera reorientation during gravity shifts
- โก Performance: Maintaining 60 FPS with complex physics calculations
- ๐ฏ Precision: Pixel-perfect collision detection for tight platforming
- ๐ Spatial Logic: Intuitive controls regardless of gravity orientation
- ๐จ Visual Clarity: Clear visual communication of game state
- Object pooling for entities
- Efficient collision detection with spatial partitioning
- Texture atlasing for reduced draw calls
- LOD system for distant objects
- Optimized shader usage
- Human Developer: Project vision, requirements, and guidance
- Claude AI Assistant: Implementation, architecture, and testing
- Collaboration: A testament to human-AI pair programming
- Kula World (1998): The original PlayStation classic that inspired this project
- Portal Series: Spatial puzzle design philosophy
- Super Mario Galaxy: Gravity mechanic inspiration
- Three.js - 3D graphics library
- CANNON.js - Physics engine
- Playwright - Testing framework
- Webpack - Module bundler
- The Three.js community for excellent documentation
- Open source contributors who make projects like this possible
- Classic game developers who inspire new generations
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Kula Browser Development Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
- GitHub Issues: Report bugs or request features
- Discussions: Join the conversation
- Email: your.email@example.com
Play Now | Watch Gameplay | Join Discord
Made with โค๏ธ and physics
"In a world where up is down and walls are floors, only the skilled survive."