Modern Mobile-First Game Development Framework
A comprehensive JavaScript game framework that unifies 2D and 3D game development with Laravel-inspired architecture.
โจ View Live Demos โข ๐ Quick Start โข ๐จ UI Components
- ๐จ Modern UI System - Beautiful components with gradients, glow, shadows, animations
- ๐ Laravel Architecture - Service providers, dependency injection, facades
- ๐ฌ Scene Management - Smooth transitions & lifecycle management
- โก Physics Integration - Matter.js (2D) & Cannon.js (3D)
- ๐ Audio System - Spatial audio, music, SFX with mobile optimization
- ๐ฑ Mobile-First - 44px touch targets, performance optimizations
- ๐ฏ TypeScript - 100% type safety
- ๐ฎ Dual Rendering - Pixi.js v8 (2D) & Three.js (3D)
npm install gamebyte-frameworkimport { createGame } from 'gamebyte-framework';
import * as PIXI from 'pixi.js';
// Create and initialize
const game = createGame();
const canvas = document.createElement('canvas');
canvas.width = 800;
canvas.height = 600;
document.body.appendChild(canvas);
await game.initialize(canvas, '2d');
// Get services
const renderer = game.make('renderer');
const sceneManager = game.make('scene.manager');
// Start game loop
game.start();<!DOCTYPE html>
<html>
<head>
<title>My Game</title>
</head>
<body>
<!-- Load Pixi.js from CDN -->
<script src="https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.min.js"></script>
<!-- Load GameByte -->
<script src="./dist/gamebyte.umd.js"></script>
<script>
const game = GameByteFramework.createGame();
// Your game code...
</script>
</body>
</html>import { UIButton } from 'gamebyte-framework';
const button = new UIButton({
text: 'PLAY',
width: 200,
height: 60,
backgroundColor: 0x4CAF50,
gradient: { enabled: true, colorTop: 0x66BB6A, colorBottom: 0x388E3C },
glowEffect: true,
shadowEffect: true,
rippleEffect: true
});
button.on('click', () => console.log('Clicked!'));
scene.addChild(button.getContainer());import { TopBar, TopBarItemType } from 'gamebyte-framework';
const topBar = new TopBar({
width: 800,
items: [
{
id: 'coins',
type: TopBarItemType.RESOURCE,
icon: coinTexture,
value: 1000,
format: 'abbreviate', // "1K"
animated: true
},
{
id: 'timer',
type: TopBarItemType.TIMER,
value: 60,
format: 'time' // "1:00"
}
]
});
scene.addChild(topBar.getContainer());
topBar.updateItem('coins', 1500, true);import { BaseScene } from 'gamebyte-framework';
class MyScene extends BaseScene {
constructor() {
super('my-scene', 'My Scene');
}
async initialize() {
await super.initialize();
// Setup your scene
}
update(deltaTime: number) {
super.update(deltaTime);
// Update game logic
}
}
// Add and switch scenes
const scene = new MyScene();
sceneManager.add(scene);
await sceneManager.switchTo('my-scene', {
type: 'fade',
duration: 500
});// Bind services
game.bind('my.service', () => new MyService());
game.singleton('global.service', () => new GlobalService());
// Resolve services
const service = game.make('my.service');import { AbstractServiceProvider } from 'gamebyte-framework';
export class MyServiceProvider extends AbstractServiceProvider {
register(app: GameByte): void {
app.singleton('my.feature', () => new MyFeature());
}
}
game.register(new MyServiceProvider());import { Renderer, Scenes, UI, Audio } from 'gamebyte-framework';
Renderer.start();
await Scenes.switchTo('game');
const button = UI.createButton({...});
Audio.playMusic('background');import { Physics } from 'gamebyte-framework';
// 2D Physics (Matter.js)
Physics.create2DWorld({ gravity: { x: 0, y: 1 } });
const body = Physics.createBody({ x: 100, y: 100, width: 50, height: 50 });
// 3D Physics (Cannon.js)
Physics.create3DWorld({ gravity: { x: 0, y: -9.8, z: 0 } });import { Music, SFX, Spatial } from 'gamebyte-framework';
Music.play('background', { loop: true, volume: 0.7 });
SFX.play('click');
Spatial.play('explosion', { position: { x: 10, y: 0, z: 5 } });import { Input } from 'gamebyte-framework';
Input.keyboard.on('KeyW', () => console.log('W pressed'));
Input.touch.on('tap', (e) => console.log('Tapped at:', e.x, e.y));
Input.gamepad.on('button-a', () => console.log('A pressed'));import { Assets } from 'gamebyte-framework';
await Assets.load([
{ key: 'player', url: 'player.png', type: 'texture' },
{ key: 'music', url: 'music.mp3', type: 'audio' }
]);
const texture = Assets.get('player');GameByte supports 3D rendering with Three.js:
- UMD Build: Use direct Three.js API (see
docs/3D_RENDERING_GUIDE.md) - ESM/CJS: Import
ThreeRendererandBaseScene3Ddirectly
// ESM/CJS approach
import { createGame } from 'gamebyte-framework';
import * as THREE from 'three';
const game = createGame();
await game.initialize(canvas, '3d');
// Use Three.js API directly for 3D scenes
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
// ... rest of Three.js setup๐ Full 3D Rendering Guide โ
gamebyte-framework/
โโโ src/
โ โโโ core/ # Framework core
โ โโโ rendering/ # 2D/3D renderers
โ โโโ ui/ # UI components
โ โโโ scenes/ # Scene management
โ โโโ physics/ # Physics engines
โ โโโ audio/ # Audio system
โ โโโ input/ # Input handling
โ โโโ assets/ # Asset management
โ โโโ services/ # Service providers
โ โโโ facades/ # Static facades
โ โโโ index.ts # Main entry
โโโ dist/
โ โโโ index.js # ES module
โ โโโ index.cjs.js # CommonJS
โ โโโ gamebyte.umd.js # UMD bundle (2D only)
โ โโโ renderers/
โ โโโ three3d.js # 3D renderer bundle
โโโ docs/
โ โโโ 3D_RENDERING_GUIDE.md
โโโ index.html # Demo hub
โโโ test-*.html # Demo pages
โโโ README.md
- Demo Hub - All demos in one place
- Modern UI - Beautiful button components
- TopBar System - Complete UI system
- 2D Simple - Basic 2D rendering
- 3D Direct API - Three.js integration
- Graphics API - Graphics abstraction
# Install dependencies
npm install
# Build framework
npm run build
# Development mode (watch)
npm run dev
# Run tests
npm test
# Start demo server
npx http-server -p 8080- ๐ 3D Rendering Guide - Complete 3D setup guide
- ๐ Changelog - Version history
- ๐ค Contributing - Contribution guidelines
- ๐บ๏ธ Roadmap - Development roadmap
- โ Service container & providers
- โ 2D rendering (Pixi.js v8)
- โ 3D rendering (Three.js)
- โ Scene management
- โ Modern UI components
- โ Physics (Matter.js, Cannon.js)
- โ Audio system
- โ Input handling
- โ Asset management
- Enhanced animations
- More components (Slider, Toggle, Modal)
- Visual effects system
- Level editor
- Analytics integration
- Cloud save system
- A/B testing framework
Contributions are welcome! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License - see LICENSE file for details.
Built on amazing open-source libraries:
Inspired by Laravel Framework architecture.
Built with โค๏ธ for Game Developers
โญ Star us on GitHub โ it helps!
Live Demos โข Quick Start โข Documentation