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.
This project was originally created as a demo for my talk, "Evolving Game Development with Genetic Algorithms" that was delivered at:
- What The Stack - Skopje, North Macedonia, September 14, 2024 | Slides
- React Alicante - Alicante, Spain, September 21, 2024 | Slides | Video
- CityJS Athens - Athens, Greece, November 29, 2024
-
Clone the repository:
git clone https://github.com/kevinmaes/eggdrop.git cd eggdrop
-
Install dependencies:
yarn install
-
Start the development server:
yarn dev
-
Open your browser and navigate to:
http://localhost:5173
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 |
- React - UI library for building the game interface
- TypeScript - Type-safe JavaScript for robust code
- Vite - Fast build tool and development server
- 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
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.
The game includes a developer panel to track statistics related to the genetic algorithm:
- Press
cmd-d
(orctrl-d
on Windows/Linux) to toggle the Dev Panel visibility - Monitor hen population statistics and evolution metrics
- Track game performance and state
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
The following tools were used to create game assets:
- ChatGPT - Character image generation
- Logoist 5 - Vector graphics and animation alignment
- Texture Packer - Sprite sheet creation
- Audacity - Audio recording and editing
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
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Kevin Maes - @kvmaes
Project Link: https://github.com/kevinmaes/eggdrop