A 3D first-person game created with AI assistance using Rust and macroquad.
This project creates a classic first-person 3D gameplay experience using modern Rust development with the macroquad game framework. The development process is AI-assisted, combining learning with practical game development.
๐ NEW: Hybrid ECS A Pathfinding System* - The game now features a complete Entity Component System with intelligent A* pathfinding, reusable components, and excellent performance (120+ FPS after lighting optimization).
- Rust (installed via rustup)
- Cargo (comes with Rust)
# Clone the repository
git clone https://github.com/bonskari/GameByAI.git
cd GameByAI
# Build the project
cargo build
# Run the game
cargo run
# Run the visual test mode with AI pathfinding
cargo run -- visual-test
# Run visual test with custom duration
cargo run -- visual-test -d 30- โ Full 3D first-person rendering with textured walls, floors, and ceilings
- โ Complete ECS architecture with 253 entities (52 walls, 100 floors, 100 ceilings)
- โ Hybrid ECS A pathfinding system* with reusable Pathfinder component
- โ Intelligent TestBot navigation using A* algorithm for optimal pathfinding
- โ Texture-based rendering with proper material lookup system
- โ ECS collision detection working seamlessly with grid-based detection
- โ Excellent performance maintaining 120+ FPS consistently (after lighting optimization)
- โ
Modern 3D graphics with procedural textures
โ ๏ธ (dynamic lighting disabled for performance) - โ Integrated testing system with automated bot navigation
- โ Real-time minimap with pathfinding visualization
- โ First-person controls (WASD movement, mouse look, jumping)
- โ Cross-platform support via macroquad
- โ AI-assisted development process
The game features a complete Entity Component System (ECS) implementation with hybrid pathfinding:
- Transform - Position, rotation, and scale for all entities
- StaticRenderer - Texture-based rendering with material types
- Collider - Physics-engine-style collision with shapes and materials
- Player - Player-specific data and settings
- Wall/Floor/Ceiling - Level geometry components with texture mapping
- MaterialType - Texture material system (Wall, Floor, Ceiling variants)
- ๐ Pathfinder - Reusable A* pathfinding component for any entity
- ๐ TestBot - Automated testing bot with waypoint navigation
- Rendering System - Handles texture lookup and 3D rendering for 253 entities
- Collision Detection - Grid-based collision using entity component queries
- ๐ PathfindingSystem - Processes all entities with Pathfinder components
- Physics Integration - Gravity, jumping, and physics via direct component access
- TestBot Component: Manages high-level behavior (waypoints, test duration)
- Pathfinder Component: Handles low-level pathfinding (A* algorithm, path following)
- Reusable Design: Any entity can add a Pathfinder component for intelligent navigation
- A Algorithm*: Proper heuristic-based pathfinding with obstacle avoidance
- Performance Optimized: Binary heap implementation for efficient pathfinding
- โ Player Entity: Fully migrated to ECS with Transform + Player components
- โ 253 Static Entities: 52 walls, 100 floors, 100 ceilings all ECS-based
- โ ECS Rendering System: StaticRenderer actively rendering all ECS entities
- โ Texture System: Complete material-based texture rendering via ECS
- โ ECS Collision Detection: Grid-based collision working perfectly
- โ ๐ Hybrid Pathfinding: TestBot + Pathfinder components working together
- โ Performance: Excellent 120+ FPS with full ECS rendering and pathfinding (lighting system disabled)
โ ๏ธ Technical Debt: Dynamic lighting system exists but disabled for performance reasons
The game features a complete texture loading and rendering system:
- tech_panel.png - Wall textures
- hull_plating.png - Wall textures
- control_system.png - Wall textures
- energy_conduit.png - Wall textures
- floor.png - Floor textures with linear filtering
- ceiling.png - Ceiling textures
- MaterialType enum with Wall, Floor, Ceiling variants
- Texture lookup by material type
- Proper UV mapping for all surfaces
- Linear filtering for smooth texture rendering
The game features an advanced hybrid ECS pathfinding system:
- Heuristic-based pathfinding for optimal route calculation
- Binary heap optimization for efficient node processing
- Obstacle avoidance with proper wall detection
- Grid-based navigation integrated with map system
- Diagonal movement support with proper cost calculation
- Target position tracking for navigation goals
- Path calculation and storage for smooth movement
- Movement and rotation speeds configurable per entity
- Path following logic with waypoint progression
- Stuck detection and recovery for robust navigation
- Real-time minimap visualization showing:
- Blue areas: A* explored nodes (search area)
- Red areas: Actual pathfinding routes
- Yellow circle: Current target waypoint
- Green dot: Player/bot position and direction
- Rust - Systems programming language
- macroquad - Simple and easy to use 2D/3D game framework
- Custom ECS - Complete Entity Component System implementation
- A Pathfinding* - Intelligent navigation with binary heap optimization
- Texture Loading - PNG texture support with material system
- Grid-based Collision - Efficient spatial collision detection
- Cargo - Rust package manager and build system
- clap - Command line argument parsing
โโโ src/
โ โโโ main.rs # Main entry point and CLI
โ โโโ cli.rs # Command line interface
โ โโโ game/
โ โ โโโ mod.rs # Game module
โ โ โโโ state.rs # Game state management
โ โ โโโ player.rs # Player mechanics
โ โ โโโ map.rs # Level data and rendering
โ โ โโโ input.rs # Centralized input handling
โ โ โโโ ecs_state.rs # ECS game state
โ โ โโโ rendering/ # 3D graphics engine
โ โโโ ecs/ # Entity Component System
โ โ โโโ mod.rs # ECS module exports
โ โ โโโ entity.rs # Entity management
โ โ โโโ component.rs # Component storage
โ โ โโโ world.rs # ECS world container
โ โ โโโ system.rs # System management
โ โ โโโ components.rs # Game-specific components
โ โ โโโ systems.rs # Game-specific systems
โ โ โโโ pathfinding.rs # ๐ A* pathfinding algorithms
โ โ โโโ query.rs # Query system
โ โ โโโ resource.rs # Resource management
โ โโโ testing/
โ โโโ mod.rs # Testing module
โ โโโ tests.rs # Unit tests
โ โโโ runner.rs # Test runner
โ โโโ screenshot_validator.rs # Visual validation
โโโ cpp_backup/ # Previous C++ implementation
โโโ scripts/ # Build and utility scripts
โโโ Cargo.toml # Rust dependencies and metadata
โโโ .gitignore # Git ignore patterns
โโโ README.md # This file
- โ Basic project setup
- โ Rust toolchain configuration
- โ macroquad integration
- โ Advanced 3D graphics engine with procedural textures
- โ Complete player movement system (WASD, mouse look, jumping)
- โ Level loading and rendering system
- โ ๐ Hybrid ECS A pathfinding system*
- โ ๐ Reusable Pathfinder component for any entity
- โ ๐ Intelligent TestBot with A navigation*
- โ Visual debugging and testing system
- โ Minimap with real-time pathfinding visualization
- โ Automated testing with AI bot navigation
- โ Entity Component System (ECS) implementation
- โ Centralized input system
- โ Full ECS architecture with pathfinding integration
- WASD - Move and strafe
- Mouse - Look around (FPS-style)
- Space - Jump
- Tab - Toggle between 3D and 2D view
- M - Toggle mouse capture
- Esc - Exit game
The project includes an advanced automated visual test system with AI pathfinding:
The visual test mode runs comprehensive testing including lighting performance and AI bot navigation:
# Run the complete visual test suite (lighting + bot navigation)
cargo run -- visual-test
# Run with custom bot navigation duration (default: 15 seconds)
cargo run -- visual-test --duration 30
cargo run -- visual-test -d 30The visual test will:
- ๐ Test lighting performance first with progressive light count testing
- Generate optimal paths using A* pathfinding algorithm
- Navigate through waypoints automatically with intelligent pathfinding
- Visualize pathfinding on the minimap in real-time
- Test wall collision detection and avoidance
- Display progress with overlay information
- Complete automatically after the specified duration
Every visual test run includes a progressive lighting test sequence:
- Baseline Test: Performance with no lights (3 seconds)
- Single Light Test: Performance with 1 light (2 seconds)
- Multiple Lights: Performance with 8 strategically placed lights (3 seconds)
- Many Lights: Performance with 50 random lights (4 seconds)
- Stress Test: Performance with 100+ lights if previous tests show good performance (3 seconds)
This helps measure the impact of the lighting system on performance and identify optimal light counts for smooth gameplay.
- Main 3D View: Full first-person 3D rendering
- Minimap (top-right):
- Blue areas: A* algorithm exploration
- Red areas: Calculated pathfinding routes
- Yellow circle: Current target waypoint
- Green dot: AI bot position and direction
- Overlay (top-left): Progress information and test status
- Console Output: Real-time pathfinding calculations and navigation updates
- Modular Design: Pathfinding is a reusable component system
- High Performance: 120+ FPS with full pathfinding calculations
- Scalable: Any number of entities can use pathfinding simultaneously
- Intelligent Navigation: Proper obstacle avoidance and optimal routing
- TestBot: High-level waypoint management and test behavior
- Pathfinder: Low-level A* pathfinding and movement execution
- Transform: Position and rotation data
- Clean Architecture: Each component has a single responsibility
This is a learning project focused on AI-assisted game development. Feel free to explore the code and suggest improvements!
https://diglib.eg.org/items/93fc78c0-71fa-4511-8564-a7e5268bf27a