{"id":43961655,"url":"https://github.com/hastur-dev/rust-learning-game","last_synced_at":"2026-02-07T05:33:33.351Z","repository":{"id":312110118,"uuid":"1038684599","full_name":"hastur-dev/rust-learning-game","owner":"hastur-dev","description":"This is an attempt to make a video game about learning rust. I'll probably put it up on the steam store for $1 when it's complete, but it will always be free here","archived":false,"fork":false,"pushed_at":"2025-10-03T00:22:02.000Z","size":12881,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-03T02:37:22.895Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/hastur-dev.png","metadata":{"files":{"readme":"README-WASM.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-15T16:36:47.000Z","updated_at":"2025-10-03T00:22:06.000Z","dependencies_parsed_at":"2025-10-03T02:25:37.707Z","dependency_job_id":"a94fd7bb-598f-4d9e-b145-6fe2c27ff562","html_url":"https://github.com/hastur-dev/rust-learning-game","commit_stats":null,"previous_names":["hastur-dev/rust-learning-game"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hastur-dev/rust-learning-game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hastur-dev%2Frust-learning-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hastur-dev%2Frust-learning-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hastur-dev%2Frust-learning-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hastur-dev%2Frust-learning-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hastur-dev","download_url":"https://codeload.github.com/hastur-dev/rust-learning-game/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hastur-dev%2Frust-learning-game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29187224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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-02-07T05:33:32.513Z","updated_at":"2026-02-07T05:33:33.346Z","avatar_url":"https://github.com/hastur-dev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎮 Rust Steam Game - WebAssembly Edition\n\nThis documentation is wrong and is going to change. Don't deploy this to wasm because I have basically left this behind\nI'm going to fix this and make it work whenever I get the full game completed\n\n## 🌐 Web Version (WASM)\n\n### Prerequisites\n\n1. **Rust toolchain** - Install from [rustup.rs](https://rustup.rs/)\n2. **wasm-pack** - Install with:\n   ```bash\n   cargo install wasm-pack\n   ```\n   Or download from: https://rustwasm.github.io/wasm-pack/installer/\n\n### Building for Web\n\n#### Option 1: Using the build script (Windows)\n```bash\n.\\build-wasm.bat\n```\n\n#### Option 2: Using the build script (Linux/Mac)\n```bash\n./build-wasm.sh\n```\n\n#### Option 3: Manual build\n```bash\n# Build the WASM package\nwasm-pack build --target web --out-dir pkg --dev\n\n# Create distribution directory\nmkdir dist\ncp index.html dist/\ncp -r pkg dist/\n```\n\n### Running the Web Version\n\n1. **Start a local web server** in the `dist` directory:\n   ```bash\n   cd dist\n   python -m http.server 8000\n   ```\n   \n2. **Open your browser** and navigate to:\n   ```\n   http://localhost:8000\n   ```\n\n3. **Enjoy the game!** Use WASD or arrow keys to move, Space to scan, E to grab items.\n\n### Alternative Web Servers\n\nIf you don't have Python, you can use other web servers:\n\n- **Node.js**: `npx serve dist`\n- **PHP**: `php -S localhost:8000 -t dist`\n- **Live Server** (VS Code extension)\n- Any other local web server\n\n## 🖥️ Desktop Version\n\nTo run the desktop version:\n\n```bash\ncargo run\n```\n\n## 🎯 Game Features\n\n### Core Gameplay\n- **Grid-based exploration** with fog of war\n- **Robot movement** with WASD or arrow keys\n- **Item collection** system\n- **Enemy avoidance** mechanics\n- **Multiple levels** with YAML configuration\n\n### Movement Patterns\nThe game supports various enemy movement patterns:\n\n- **Built-in patterns**: `horizontal`, `vertical`, `random`, `diagonal`, `circular`\n- **Custom patterns**: Reference files in `movement_patterns/` directory\n\n### YAML Level Configuration\nCreate custom levels using YAML files in the `levels/` directory:\n\n```yaml\nname: \"My Custom Level\"\ngrid_size: \"20x15\"\nobstacles: 8\nstart_position: [1, 1]\nfog_of_war: true\nmax_turns: 0\nincome_per_square: 1\n\nenemies:\n  - start_location: [18, 13]\n    movement_pattern: \"random\"\n  - start_location: [5, 10]\n    movement_pattern: \"file:movement_patterns/spiral_movement.rs\"\n\nitems: []\n```\n\n## 🎮 Controls\n\n| Key | Action |\n|-----|--------|\n| **WASD** / **Arrow Keys** | Move robot |\n| **Space** | Scan area (requires scanner) |\n| **E** | Grab item |\n| **Q** | Use time slow (if available) |\n| **R** | Restart level |\n| **Esc** | Return to menu |\n\n## 🚀 Technical Details\n\n### Architecture\n- **Engine**: Macroquad (Rust game framework)\n- **WASM**: wasm-bindgen for web integration\n- **Build**: Conditional compilation for desktop vs web\n- **Levels**: YAML configuration system\n- **Movement**: Trait-based movement patterns\n\n### File Structure\n```\nsrc/\n├── lib.rs              # WASM entry point\n├── main.rs             # Desktop entry point\n├── game_state.rs       # Game logic\n├── grid.rs             # Grid and enemy management\n├── level.rs            # Level loading and parsing\n├── movement_patterns.rs # Enemy AI patterns\n└── ...\n\nlevels/                 # YAML level definitions\nmovement_patterns/      # Custom movement patterns\npkg/                    # Generated WASM output\ndist/                   # Web distribution files\n```\n\n### Platform Differences\n\n| Feature | Desktop | Web |\n|---------|---------|-----|\n| File I/O | ✅ Full filesystem access | ❌ Embedded levels only |\n| Hot reload | ✅ File watching | ❌ Not available |\n| Performance | ✅ Native speed | ⚠️ Slight overhead |\n| Distribution | 📦 Single executable | 🌐 Web-ready bundle |\n\n## 🔧 Development\n\n### Adding New Levels\n1. Create a `.yaml` file in the `levels/` directory\n2. For web builds, add the level to the `get_embedded_levels()` function in `lib.rs`\n\n### Custom Movement Patterns\n1. Create a `.rs` file in `movement_patterns/`\n2. Add the pattern marker comment: `// MOVEMENT_PATTERN: pattern_name`\n3. Reference it in YAML: `movement_pattern: \"file:movement_patterns/your_pattern.rs\"`\n\n### Building for Production\nFor optimized production builds:\n```bash\nwasm-pack build --target web --out-dir pkg --release\n```\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n1. **WASM build fails**\n   - Ensure `wasm-pack` is installed\n   - Check Rust toolchain is up to date\n   - Try `cargo clean` and rebuild\n\n2. **Game doesn't load in browser**\n   - Check browser console for errors\n   - Ensure you're using a local web server (not `file://`)\n   - Verify WebAssembly support in your browser\n\n3. **Controls don't work**\n   - Click on the game canvas to focus it\n   - Check that JavaScript is enabled\n\n### Browser Compatibility\n- **Chrome/Chromium**: Full support\n- **Firefox**: Full support\n- **Safari**: Full support (recent versions)\n- **Edge**: Full support\n\n## 📜 License\n\nThis project is open source. See the main README for license details.\n\n---\n\n**Happy gaming! 🎮🦀**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhastur-dev%2Frust-learning-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhastur-dev%2Frust-learning-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhastur-dev%2Frust-learning-game/lists"}