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.
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 |
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) |
This project uses GitHub Actions for Continuous Integration. The CI workflow:
- Runs on all Pull Requests to the
main
branch - Verifies code quality with TypeScript and ESLint checks
- Ensures all tests pass before merging
- Confirms the build process works correctly
You can run these checks locally before pushing with:
yarn ci
- 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
(Mac) orctrl-d
(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 ani 6FCD mation 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