10000 GitHub - kevinmaes/eggdrop: Egg Drop Game built with React, Konva, XState, and TypeScript
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Egg Drop Game built with React, Konva, XState, and TypeScript

Notifications You must be signed in to change notification settings

kevinmaes/eggdrop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Egg Drop Game ๐Ÿฅš

React TypeScript Vite XState Konva Howler

Egg Drop Title

๐ŸŽฎ Play the Egg Drop game

๐Ÿ“– About the Game

Egg Drop is a fun web-based game where you control Chef Rafi who tries to catch eggs dropped by hens to make his egg drop soup. It was inspired by the old Atari 2600 game, Kaboom. Additionally, this version of game features a genetic algorithm that evolves the characteristics of the hens over time, making each playthrough unique and progressively challenging.

๐ŸŽค Conference Presentations

This project was originally created as a demo for my talk, "Evolving Game Development with Genetic Algorithms" that was delivered at:

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v18 or higher recommended)
  • Yarn package manager

Installation

  1. Clone the repository:

    git clone https://github.com/kevinmaes/eggdrop.git
    cd eggdrop
  2. Install dependencies:

    yarn install
  3. Start the development server:

    yarn dev
  4. Open your browser and navigate to:

    http://localhost:5173
    

๐Ÿ› ๏ธ Development Commands

Command Description
yarn dev Start the development server
yarn build Build the production-ready app
yarn preview Preview the production build locally
yarn tsc Run TypeScript type checking
yarn lint Run ESLint to check for code issues
yarn test Run unit tests
yarn ci Run CI checks locally (lint, type check, test)
yarn check Run comprehensive checks (lint, type check, test, build)

๐Ÿงช CI/CD Pipeline

This project uses GitHub Actions for Continuous Integration. The CI workflow:

  1. Runs on all Pull Requests to the main branch
  2. Verifies code quality with TypeScript and ESLint checks
  3. Ensures all tests pass before merging
  4. Confirms the build process works correctly

You can run these checks locally before pushing with:

yarn ci

๐Ÿงฐ Technology Stack

Core Technologies

  • React - UI library for building the game interface
  • TypeScript - Type-safe JavaScript for robust code
  • Vite - Fast build tool and development server

Game Development Libraries

  • Konva - Canvas library for 2D graphics and animations
  • React Konva - React integration for Konva
  • XState - State management using state machines and the actor model
  • Howler - Audio library for game sounds

๐Ÿงฌ Genetic Algorithm

The game features a genetic algorithm that evolves the characteristics of the hens who drop eggs. Each hen (referred to as a "Hendividual") has DNA composed of traits related to:

  • Movement patterns and speed
  • Egg-laying frequency and timing
  • Other behavioral characteristics

As the game progresses, hens evolve based on their performance, creating a dynamic and increasingly challenging gameplay experience.

๐Ÿ”ง Developer Tools

Dev Panel

The game includes a developer panel to track statistics related to the genetic algorithm:

  • Press cmd-d (Mac) or ctrl-d (Windows/Linux) to toggle the Dev Panel visibility
  • Monitor hen population statistics and evolution metrics
  • Track game performance and state

Project Structure

eggdrop/
โ”œโ”€โ”€ public/               # Static assets (images, sounds, fonts)
โ”œโ”€โ”€ src/                  # Source code
โ”‚   โ”œโ”€โ”€ App.tsx           # Main application component
โ”‚   โ”œโ”€โ”€ app.machine.ts    # Main state machine
โ”‚   โ”œโ”€โ”€ Hen/              # Hen components and logic
โ”‚   โ”œโ”€โ”€ Egg/              # Egg components and logic
โ”‚   โ”œโ”€โ”€ Chef/             # Chef (player) components
โ”‚   โ”œโ”€โ”€ GameLevel/        # Level management
โ”‚   โ”œโ”€โ”€ geneticAlgorithm/ # Genetic algorithm implementation
โ”‚   โ”œโ”€โ”€ DevPanel/         # Developer panel components
โ”‚   โ””โ”€โ”€ ...               # Other components and utilities
โ”œโ”€โ”€ package.json          # Dependencies and scripts
โ””โ”€โ”€ vite.config.ts        # Vite configuration

๐ŸŽจ Asset Creation Tools

The following tools were used to create game assets:

๐Ÿšง Development Status

THIS GAME IS STILL IN ACTIVE DEVELOPMENT

See the Issues for a list of upcoming features, fixes, and enhancements.

Current limitations:

  • No instructions screen
  • No defined end-game condition
  • Genetic algorithm still being refined

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ฌ Contact

Kevin Maes - @kvmaes

Project Link: https://github.com/kevinmaes/eggdrop

About

Egg Drop Game built with React, Konva, XState, and TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0