https://github.com/foxzool/last-stop
Connect the city, master the flow
https://github.com/foxzool/last-stop
bevy bevy-game
Last synced: 3 months ago
JSON representation
Connect the city, master the flow
- Host: GitHub
- URL: https://github.com/foxzool/last-stop
- Owner: foxzool
- License: apache-2.0
- Created: 2025-06-03T08:34:23.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-17T07:46:11.000Z (about 1 year ago)
- Last Synced: 2026-04-30T06:32:50.529Z (3 months ago)
- Topics: bevy, bevy-game
- Language: Rust
- Homepage:
- Size: 7.12 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Last Stop - Bus Route Puzzle Game
A bus route planning puzzle game built with the Bevy engine, where players place route segments to connect stations and
help passengers reach their destinations.
## đŽ Game Overview
### Core Gameplay
- **Route Building**: Place and rotate bus route segments (straight, curves, T-junctions, etc.) on a grid map
- **Passenger Transport**: Passengers travel from origin stations and need transfers to reach destinations
- **Chain Reactions**: Each new route affects the entire traffic network's passenger flow distribution
- **Smart Bus System**: Autonomous buses using advanced pathfinding algorithms
### Key Features
- đ **Intelligent Bus System**: Buses automatically discover routes and operate
- đ **Dynamic Transfers**: Passengers can switch between different lines at transfer points
- âąī¸ **Real-time Simulation**: Passengers have patience values requiring timely transport services
- đ¯ **Diverse Objectives**: Multi-dimensional challenges including efficiency, cost, and time
- đ **Detailed Analytics**: Complete passenger and operational data tracking
## đ ī¸ Technical Implementation
### Architecture
- **Bevy ECS**: Modular architecture based on Entity Component System
- **Smart Pathfinding**: A* algorithm-driven route planning system
- **State Management**: Complete game state and scene management
- **UI System**: Responsive user interface and audio system
### Core Systems
1. **Route System** (`route_segment.rs`)
- 6 route segment types: straight, curve, T-split, cross, bridge, tunnel
- Dynamic rotation and connection validation
- Terrain restriction handling
2. **Pathfinding System** (`pathfinding.rs`)
- A* algorithm implementation
- Multi-modal path calculation (walking, bus, transfer)
- Real-time path optimization
3. **Bus System** (`bus_pathfinding_system.rs`)
- Intelligent route discovery
- Autonomous driving and station stops
- Dynamic passenger management
4. **Passenger System** (`passenger_boarding_system.rs`)
- Smart boarding/alighting logic
- Waiting and riding state management
- Patience and satisfaction systems
## đ¯ Level Design
### Progressive Difficulty
1. **Tutorial Level**: Learn basic operations and connection concepts
2. **Transfer Challenge**: Master multi-route coordination and transfer mechanics
3. **Network Optimization**: Find optimal solutions under constraints
4. **Time Pressure**: Test quick response and adaptation abilities
### Scoring System
- **Base Points**: Complete basic objectives
- **Efficiency Bonus**: Optimize transfer counts and path lengths
- **Speed Bonus**: Complete challenges quickly
- **Cost Bonus**: Save construction costs
## đšī¸ Controls
### Basic Operations
- **Left Mouse**: Place selected route segment
- **Right Mouse**: Rotate route segment
- **Delete/X Key**: Remove route segment at cursor position
- **WASD/Arrow Keys**: Move camera
- **Mouse Wheel**: Zoom view
- **Escape**: Pause/Resume game
### Debug Hotkeys
- **F1**: Show detailed debug information
- **F2**: Passenger spawn statistics
- **F3**: Manually spawn test passenger
- **F4**: Smart bus route discovery
- **F5**: Smart bus status debugging
- **F6**: Passenger boarding system debug
- **F7**: Passenger movement state details
- **F8**: Connection system debug
- **F9**: Score calculation debug
- **F12**: Test game over interface
## đ Build and Run
### System Requirements
- Rust 1.75+
- OpenGL/Vulkan compatible graphics card
### Build Steps
```bash
# Clone repository
git clone
cd bus-puzzle-game
# Development build (includes debug features)
cargo run --features dev
# Release build
cargo run --release
```
### Web Build
```bash
# Install trunk
cargo install trunk
# Build WASM version
trunk build --release
```
## đ Project Structure
```
src/
âââ main.rs # Main entry point
âââ bus_puzzle/ # Core game module
â âââ mod.rs # Module exports
â âââ components.rs # Game component definitions
â âââ config.rs # Game configuration constants
â âââ level_system.rs # Level system
â âââ pathfinding.rs # Pathfinding algorithms
â âââ bus_pathfinding_system.rs # Smart bus system
â âââ passenger_boarding_system.rs # Passenger boarding system
â âââ connection_system.rs # Connection validation system
â âââ interaction.rs # Player interaction
â âââ ui_audio.rs # UI and audio
â âââ debug_info.rs # Debug information
â âââ ... # Other system modules
âââ dev_tools.rs # Development tools (dev only)
```
## đ¨ Assets
### Texture Assets
```
assets/textures/
âââ routes/ # Route segment textures
â âââ straight.png
â âââ curve.png
â âââ t_split.png
â âââ ...
âââ stations/ # Station textures
â âââ bus_stop.png
â âââ ...
âââ passengers/ # Passenger icons
â âââ red.png
â âââ ...
âââ terrain/ # Terrain textures
âââ grass.png
âââ ...
```
### Audio Assets
```
assets/audio/
âââ background_music.ogg
âââ place_segment.ogg
âââ passenger_arrive.ogg
âââ ...
```
## đ§ Development Features
### Debug System
- Real-time connection status visualization
- Passenger behavior tracking
- Performance metrics monitoring
- State machine debugging
### Hot Reload
The game supports asset hot reloading for convenient development and debugging.
### Extensibility
- Modular component system
- Configurable level data
- Plugin-based feature extensions
## đŽ Game Mechanics Deep Dive
### Chain Reaction System
- **Passenger Flow Chains**: New routes redistribute passenger flows
- **Transfer Chains**: Multi-route intersections create new travel possibilities
- **Time Chains**: Bus intervals affect passenger waiting experience
### Smart Buses
- Uses passenger-validated pathfinding algorithms
- Automatically discovers optimal operating routes
- Dynamic turnaround and round-trip operations
- Intelligent passenger loading and station stops
### Passenger Behavior
- Realistic waiting and riding states
- Patience-based abandonment mechanism
- Smart boarding/alighting decisions
- Diverse travel demands
## đ Performance Optimization
- ECS architecture ensures efficient system updates
- Intelligent path caching mechanisms
- Optimized rendering pipeline
- Memory-friendly resource management
## đ¤ Contributing
Contributions are welcome! Please ensure:
1. Follow existing code style
2. Add appropriate documentation comments
3. Include necessary test cases
4. Update relevant documentation
## đ License
This project is dual-licensed under:
### Apache License 2.0 or MIT License
You may use this project under either license:
- **Apache License 2.0** - See [LICENSE-APACHE](LICENSE-APACHE) file
- **MIT License** - See [LICENSE-MIT](LICENSE-MIT) file
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as
defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
## đ Acknowledgments
- [Bevy Engine](https://bevyengine.org/) - Excellent Rust game engine
- Game design inspired by classic transport planning games
---
Enjoy building your bus empire! đâ¨