{"id":41481579,"url":"https://github.com/intertwine/flappy-bird-wasm","last_synced_at":"2026-01-23T17:20:40.333Z","repository":{"id":267534615,"uuid":"901547649","full_name":"intertwine/flappy-bird-wasm","owner":"intertwine","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-17T02:18:39.000Z","size":14858,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T03:19:16.817Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intertwine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-10T21:32:56.000Z","updated_at":"2025-05-17T02:18:43.000Z","dependencies_parsed_at":"2024-12-10T23:17:52.347Z","dependency_job_id":"a1abaff0-c564-4831-88b4-986a858ecb0e","html_url":"https://github.com/intertwine/flappy-bird-wasm","commit_stats":null,"previous_names":["intertwine/flappy-bird-wasm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/intertwine/flappy-bird-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intertwine%2Fflappy-bird-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intertwine%2Fflappy-bird-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intertwine%2Fflappy-bird-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intertwine%2Fflappy-bird-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intertwine","download_url":"https://codeload.github.com/intertwine/flappy-bird-wasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intertwine%2Fflappy-bird-wasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28696523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T15:57:05.722Z","status":"ssl_error","status_checked_at":"2026-01-23T15:56:27.656Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T17:20:39.625Z","updated_at":"2026-01-23T17:20:40.293Z","avatar_url":"https://github.com/intertwine.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flappy Bird WASM\n\nA WebAssembly implementation of the classic Flappy Bird game, built with Rust and compiled to WebAssembly. This version features progressive difficulty that increases as you play, making it both accessible to beginners and challenging for experienced players.\n\n## Play the Game\n\n[Click here to play the game!](https://intertwine.github.io/flappy-bird-wasm/)\n\n## 🎮 Gameplay\n\n### Controls\n\n- **SPACE / Click**: Make the bird flap\n- **P**: Pause/Unpause the game\n- **ESC**: Return to menu\n\n### Game Mechanics\n\n- The bird automatically falls due to gravity\n- Press SPACE or click to make the bird flap upward\n- Downward speed is capped so beginners can maintain control\n- Navigate through pipes to score points\n- Each point increases the difficulty by 5%\n- Game ends if the bird hits a pipe or the ground\n\n### Progressive Difficulty System\n\nThe game features a dynamic difficulty system that scales as you play:\n\n- **Starting Difficulty**: Easy and approachable for beginners\n  - Slower game speed\n  - Lower gravity\n  - Wider gaps between pipes\n- **Progression**: Each point scored increases difficulty by 5%\n  - Maximum difficulty caps at 2x the initial difficulty\n  - Affects game speed, gravity, and pipe gap size\n  - Flap strength automatically adjusts to maintain playability\n\n## 🛠 Technical Implementation\n\n### Architecture\n\nThe game is built using a hybrid of Rust (compiled to WebAssembly) and JavaScript:\n\n#### Rust (Core Game Logic)\n\n- `lib.rs`: Main game logic\n  - Game state management\n  - Physics calculations\n  - Collision detection\n  - Progressive difficulty scaling\n  - Rendering logic\n\n#### Web Technologies\n\n- **WebAssembly**: Compiled Rust code\n- **HTML5 Canvas**: Game rendering\n- **JavaScript**: DOM manipulation and game loop\n\n### Key Components\n\n#### Game State Management\n\n```rust\npub enum GameState {\n    Menu,\n    Playing,\n    Paused,\n    GameOver,\n}\n```\n\n- Handles different game states and transitions\n- Controls game flow and user input processing\n\n#### Physics Engine\n\n- Gravity simulation with dynamic scaling\n- Velocity-based bird movement\n- Collision detection with pipes and boundaries\n\n#### Asset Management\n\n- Sprite-based rendering system\n- Handles loading and drawing of:\n  - Bird sprite\n  - Pipe sprites\n  - Background image\n\n#### Progressive Difficulty System Parameters\n\n- Dynamic scaling of game parameters:\n\n  ```rust\n  game_speed: Initial 1.5 → Max 3.0\n  gravity: Initial 0.4 → Max 0.8\n  pipe_gap: Initial 200px → Min 150px\n  ```\n\n## 🚀 Development Setup\n\n### Prerequisites\n\n- Rust (latest stable)\n- wasm-pack\n- Node.js and npm\n- Web browser with WebAssembly support\n\n### Building\n\n1. Clone the repository\n2. Install dependencies:\n\n   ```bash\n   # Install Rust dependencies\n   cargo build\n\n   # Install npm dependencies and download game assets\n   npm install\n   ```\n\n   The `npm install` command will automatically download required game assets (sprites and images) to the `assets/` directory.\n\n3. Build WebAssembly:\n\n   ```bash\n   # Using npm\n   npm run build\n\n   # Or using wasm-pack directly\n   wasm-pack build --target web\n   ```\n\n4. Start local server:\n\n   ```bash\n   # Using npm\n   npm start\n   ```\n\n   This will start a local development server using the `serve` package. The server will automatically open your default browser to the game.\n\n5. If the browser doesn't open automatically, navigate to the URL shown in the terminal (typically `http://localhost:3000`)\n\n### Git Configuration\n\nThe project uses `.gitignore` to exclude build artifacts and dependencies. If you've cloned the repository and find that some ignored files are still being tracked, you can remove them from Git's index (while keeping them locally) with:\n\n```bash\ngit rm --cached \u003cfile\u003e\n```\n\nCommon files that might need this treatment:\n\n- `Cargo.lock` (for library projects)\n- `target/` directory\n- `pkg/` directory\n- `node_modules/` directory\n\n### Project Structure\n\n```text\nflappy-bird-wasm/\n├── src/\n│   └── lib.rs          # Main game logic\n├── assets/\n│   ├── bird.png        # Bird sprite\n│   ├── pipe.png        # Pipe sprite\n│   └── background.png  # Background image\n├── scripts/\n│   └── download_assets.sh  # Asset download script\n├── Cargo.toml          # Rust dependencies\n├── package.json        # npm dependencies and scripts\n├── index.html          # Web entry point\n└── pkg/                # Compiled WebAssembly\n```\n\n## 🔧 Dependencies\n\n### Rust Crates\n\n- `wasm-bindgen`: WebAssembly bindings\n- `web-sys`: Web API interfaces\n- `js-sys`: JavaScript API interfaces\n- `rand`: Random number generation\n\n### Web Dependencies\n\n- No external JavaScript libraries required\n- Pure WebAssembly and vanilla JavaScript implementation\n\n## 🧪 Running Tests\n\nIntegration tests are executed with `wasm-bindgen-test`. Ensure the `wasm32-unknown-unknown` target is installed and run:\n\n```bash\n# Using npm\nnpm test              # Run tests in Chrome\nnpm run test:firefox  # Run tests in Firefox\nnpm run test:chrome   # Run tests in Chrome\nnpm run test:node     # Run tests in Node.js\n\n# Or using cargo directly\ncargo test --target wasm32-unknown-unknown -- --nocapture\n```\n\nThe included `tests/game_logic.rs` verifies that the game's difficulty multiplier never exceeds `2.0` as the score increases.\n\n### Testing Approach\n\n- **Integration Tests**: Located in `tests/game_logic.rs`, these tests verify core game logic (e.g., difficulty scaling).\n- **Browser-Based Tests**: Tests are configured to run in a browser environment using `wasm_bindgen_test_configure!(run_in_browser);`.\n- **Running Tests**:\n  - **Firefox**: Use `npm run test:firefox` or `wasm-pack test --headless --firefox`.\n  - **Chrome**: Use `npm run test:chrome` or `wasm-pack test --headless --chrome`.\n  - **Node.js**: Use `npm run test:node` or `wasm-pack test --node`.\n\n### Test Configuration\n\n- The crate is configured with both `cdylib` and `rlib` crate types to support integration tests.\n- Test-specific methods (e.g., `new_headless` and `set_score`) are made available for testing but hidden from public documentation.\n\n## 🎯 Future Improvements\n\nPlanned features and enhancements:\n\n1. Sound effects and background music\n2. High score system with local storage\n3. Additional visual effects and animations\n4. Mobile-optimized controls\n5. Multiple difficulty modes\n6. Achievement system\n\n## 📝 License\n\nThis project is open source and available under the MIT License.\n\n## 🙋‍♂️ Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintertwine%2Fflappy-bird-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintertwine%2Fflappy-bird-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintertwine%2Fflappy-bird-wasm/lists"}