https://github.com/naakinn/microtraffic
Microtraffic simulation written in python
https://github.com/naakinn/microtraffic
python python3 simulation traffic trafficsimulator
Last synced: 4 months ago
JSON representation
Microtraffic simulation written in python
- Host: GitHub
- URL: https://github.com/naakinn/microtraffic
- Owner: Naakinn
- Created: 2025-05-01T09:04:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-02T15:53:42.000Z (about 1 year ago)
- Last Synced: 2025-05-02T16:52:00.815Z (about 1 year ago)
- Topics: python, python3, simulation, traffic, trafficsimulator
- Language: Python
- Homepage:
- Size: 111 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> [!WARNING]
> Highly beta, PRs are welcome.
## Microtraffic simulation

## Get started
### Setup python execution environment
```
git clone https://github.com/Naakinn/MicroTraffic && cd MicroTraffic
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
### Build your own map with MapBuilder
```
python map_builder.py
```
It wil generate `surfarray.pickle` and `grid.pickle` in your current directory.
### Run the simulation using generated map
Run
```
python simulation.py
```
in the same directory to use saved map in your simulation.
### Check out simulation's state at web page
Run
```
python api/api.py
```
and check out localhost:8000/api/traffic/info
## Docs
### MapBuilder
Scroll your mouse wheel to select different blocks:
- white block - road
- arrows - intersections(arrow specify where a vehicle have to turn)
- green block - traffic light
Left click - place selected block
Right click - remove block
### Simulation
Scroll your mouse wheel to spawn vehicles with different directions
### Web API
Check out `localhost:8000/api/traffic/info` to see what happens inside a simulation.