Skip to content

gamebyte-ai/gamebyte-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐ŸŽฎ GameByte Framework

Modern Mobile-First Game Development Framework

License: MIT TypeScript Pixi.js v8

A comprehensive JavaScript game framework that unifies 2D and 3D game development with Laravel-inspired architecture.

โœจ View Live Demos โ€ข ๐Ÿ“– Quick Start โ€ข ๐ŸŽจ UI Components


โœจ Features

  • ๐ŸŽจ 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)

๐Ÿš€ Quick Start

Installation

npm install gamebyte-framework

Basic 2D Game

import { 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();

UMD Build (Browser)

<!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>

๐ŸŽจ UI Components

Modern Button

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());

TopBar with Resources

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);

๐ŸŽฌ Scene Management

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
});

๐Ÿ—๏ธ Architecture

Service Container

// Bind services
game.bind('my.service', () => new MyService());
game.singleton('global.service', () => new GlobalService());

// Resolve services
const service = game.make('my.service');

Service Providers

import { AbstractServiceProvider } from 'gamebyte-framework';

export class MyServiceProvider extends AbstractServiceProvider {
    register(app: GameByte): void {
        app.singleton('my.feature', () => new MyFeature());
    }
}

game.register(new MyServiceProvider());

Facades

import { Renderer, Scenes, UI, Audio } from 'gamebyte-framework';

Renderer.start();
await Scenes.switchTo('game');
const button = UI.createButton({...});
Audio.playMusic('background');

๐ŸŽฎ Core Systems

Physics

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 } });

Audio

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 } });

Input

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'));

Assets

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');

๐ŸŒ 3D Rendering

GameByte supports 3D rendering with Three.js:

  • UMD Build: Use direct Three.js API (see docs/3D_RENDERING_GUIDE.md)
  • ESM/CJS: Import ThreeRenderer and BaseScene3D directly
// 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 โ†’


๐Ÿ“ Project Structure

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

๐ŸŽ“ Live Demos


๐Ÿ› ๏ธ Development

# 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

๐Ÿ“š Documentation


๐ŸŽฏ Roadmap

โœ… v1.0 - Core Framework (Current)

  • โœ… 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

๐Ÿšง v1.1 - Enhanced UI (In Progress)

  • Enhanced animations
  • More components (Slider, Toggle, Modal)
  • Visual effects system

๐Ÿ“‹ v2.0 - Tools & Services (Planned)

  • Level editor
  • Analytics integration
  • Cloud save system
  • A/B testing framework

๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - see LICENSE file for details.


๐Ÿ™ Credits

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

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published