AI Bus Driver Simulation for Malaysia

Introvert

Introvert Bocchi

The A.I Bus Driver — "An Introvert's New Hope"

This project simulates an AI-powered bus system for Malaysia that emphasizes reliability, hospitality, and realistic transit behavior.
Unlike traditional bus apps, this simulation models public buses as polite, responsive, and punctual companions, delivering a better experience by mimicking the high-touch service found in five-star hotels.
⚠️ This is an ongoing project and part of a passion initiative. It serves as a sandbox for public transport simulation and creative exploration using free APIs and open tools.

Features Implemented (MVP)

Realistic Road-Based Bus Movement

Buses follow actual road paths using OpenRouteService routes
Smooth animation between bus stops with precise location interpolation
Avoids cutting through buildings or unrealistic routes

Bus Timing Logic

Buses travel for 2.5 minutes between stops
Each stop has a 3-minute wait time
Continuous loop through all stops (circuit route)

Visual Display

Built with React and Leaflet.js
Map shows:
🚏 Bus stops (with names)
🛣️ Route lines for both directions
🚌 Animated buses using custom icons
ETA countdowns and stop labels

Informative Control Panel

Displays:
Bus ID and direction
Current segment (e.g. One Utama → SMK BU 2)
ETA to next stop
Current stop name

Technologies Used

Tech Purpose React.js Core front-end framework Leaflet.js Interactive map rendering OpenRouteService Road network routing between coordinates JavaScript State management and timing logic GeoJSON / Polyline Precise movement interpolation

Project Structure Overview

├── public/
│ └── Bus.png # Custom bus icon
├── src/
│ ├── data/
│ │ ├── stops.js # All bus stops with coordinates
│ │ └── paths.js # ORS-generated road paths
│ ├── components/
│ │ └── MapView.js # Handles map rendering & bus movement
│ ├── App.js # Main app logic and state
│ └── App.css # Styling
├── README.md

Setup Instructions

# Clone this repository
git clone https://github.com/yourusername/ai-bus-driver.git
cd ai-bus-driver

# Install dependencies
npm install

# Start the development server
npm start

Requirements

Node.js
NPM
OpenRouteService API key (only needed if regenerating routes)

How Bus Movement Works

Each bus:
Moves along a road segment (segmentIndex)
progress is updated every second based on elapsed time
Once it reaches the end of a segment, it stops at the next station for 3 minutes
Then continues to the next segment (loops at end)

Future Plans

Passenger simulation (boarding / alighting)
AI-based decision-making (avoid bus bunching, dynamic routing)
Real-time schedule board
Weather and traffic impact simulation
Deploy live with a backend

Disclaimer

This project is intended for educational and personal development. It's not affiliated with any public transport authority in Malaysia. No harm or offense is intended — it's a creative, exploratory attempt to simulate a better, more humane bus experience.

Contact

Built by @IntrovertBocchi For questions or collaboration, feel free to open an issue or pull request.

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode. Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes. You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode. See the section about running tests for more information.

npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes. Your app is ready to be deployed!
See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!
If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.
To learn React, check out the React documentation.

Code Splitting

Analyzing the Bundle Size

Making a Progressive Web App

Advanced Configuration

Deployment

npm run build fails to minify

Like this project

Posted Jul 6, 2025

Simulating AI-powered bus system for Malaysia with React and Leaflet.js.

Likes

0

Views

0

Timeline

Jul 3, 2025 - Ongoing