1
1
mirror of https://github.com/a-b-street/abstreet.git synced 2024-12-24 15:02:59 +03:00
abstreet/piggyback
2021-10-31 13:52:58 -07:00
..
src Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00
bundle_static_files.sh Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00
Cargo.toml Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00
data Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00
index.html Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00
README.md Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00
serve_locally.py Render A/B Street's lanes and traffic simulation on top of Mapbox GL () 2021-10-31 13:52:58 -07:00

A/B Street + Mapbox demo

This is an example of integrating parts of A/B Street with Mapbox GL. It's a normal web app using Mapbox, but it includes a layer rendering streets and moving agents from A/B Street.

The goal is to increase interoperability and meet developers where they're at. Parts of the A/B Street code-base are intended as a platform to build other transportation-related things, using unique features like the detailed street rendering. But Rust and our unusual UI library are a huge barrier. Treating A/B Street as a layer that can be added to Mapbox and as a library with a simple API for controlling a traffic simulation should be an easier start.

Another goal is to take advantage of all the great stuff that exists in the web ecosystem. Instead of implementing satellite layers, multi-line text entry (seriously!), and story mapping ourselves, we can just use stuff that's built aready.

How to run

You'll need wasm-pack and python3 setup. You'll also need the data/system/ directory to contain some maps.

Quick development: wasm-pack build --dev --target web -- --features wasm && ./serve_locally.py

To build the WASM in release mode: wasm-pack build --release --target web -- --features wasm && ./serve_locally.py

Maps can be specified by URL:

No deployment instructions yet.

How it works

The PiggybackDemo struct is a thin layer written in Rust to hook up to the rest of the A/B Street codebase. After beng initialized with a WebGL context and a map file, it can render streets and agents and control a traffic simulation. It serves as a public API, exposed via WASM. Then a regular Mapbox GL app treats it as a library and adds a custom WebGL rendering layer that calls this API.