Skip to content

Implement web-based brawler engine framework with React and TypeScript - #1

Draft
hynding with Copilot wants to merge 6 commits into
mainfrom
copilot/create-brawler-engine-framework
Draft

Implement web-based brawler engine framework with React and TypeScript#1
hynding with Copilot wants to merge 6 commits into
mainfrom
copilot/create-brawler-engine-framework

Conversation

Copilot AI commented Dec 9, 2025

Copy link
Copy Markdown

Implements a complete 2D brawler engine framework with physics, collision detection, and real-time rendering.

Architecture

Engine Core (/src/engine)

  • GameEngine: 60 FPS game loop with frame-based timers, state management, and win condition detection
  • Physics: Gravity, friction, collision detection, and spatial constraints

Type System (/src/types)

  • Comprehensive TypeScript definitions for fighters, game state, physics vectors, and input

React Integration (/src/hooks)

  • useGameEngine: Manages engine lifecycle and state synchronization
  • useKeyboardInput: Event-driven input handling with configurable key bindings

Components (/src/components)

  • Fighter: Visual representation with health bars and state indicators
  • Stage: Game arena with ground collision
  • Controls: Control scheme documentation

Fighter System

7 states: IDLE, WALKING, JUMPING, ATTACKING, HIT, BLOCKING, DEFEATED

interface Fighter {
  id: string;
  position: Vector2D;
  velocity: Vector2D;
  state: FighterState;
  direction: Direction;
  stats: FighterStats;
  hitbox: CollisionBox;
  hurtbox: CollisionBox;
  attackTimer: number;
}

Attack timing uses frame counters rather than setTimeout for consistent behavior across frame rates:

// Handle attack timer (18 frames at 60fps = 300ms)
if (fighter.state === 'ATTACKING') {
  fighter.attackTimer += deltaTime;
  if (fighter.attackTimer >= GameEngine.ATTACK_DURATION_FRAMES) {
    fighter.state = 'IDLE';
    fighter.attackTimer = 0;
  }
}

Game Mechanics

  • Movement: Velocity-based with friction when grounded
  • Jumping: Single jump with gravity and ground collision
  • Combat: Hitbox/hurtbox collision with damage calculation and knockback
  • Blocking: Negates incoming attacks
  • Win Condition: Game pauses when fighter health reaches zero

Demo Implementation

Two-player game with keyboard controls:

  • Player 1: WASD + Space (attack) + Shift (block)
  • Player 2: Arrow keys + Enter (attack) + Right Shift (block)

Screenshots

Initial Game State

Active Gameplay

Original prompt

This project is a web-based, brawler engine and framework built on React and TypeScript.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits December 9, 2025 16:29
Co-authored-by: hynding <2187861+hynding@users.noreply.github.com>
Co-authored-by: hynding <2187861+hynding@users.noreply.github.com>
Co-authored-by: hynding <2187861+hynding@users.noreply.github.com>
Co-authored-by: hynding <2187861+hynding@users.noreply.github.com>
Co-authored-by: hynding <2187861+hynding@users.noreply.github.com>
Copilot AI changed the title [WIP] Add web-based brawler engine and framework Implement web-based brawler engine framework with React and TypeScript Dec 9, 2025
Copilot AI requested a review from hynding December 9, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants