Skip to content

Latest commit

 

History

History
162 lines (110 loc) · 6.25 KB

README.md

File metadata and controls

162 lines (110 loc) · 6.25 KB

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. The 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

🧰 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 (or ctrl-d on 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