start a script to package data, stick it in dropbox, suck it down for

fast bootstrapping. split off developer instructions. not finished,
because I need a better connection to upload the seed data and test
everything...
This commit is contained in:
Dustin Carlino 2019-12-03 14:31:00 -08:00
parent d505c3e8a8
commit d47be1e175
7 changed files with 82 additions and 42 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
data/input/blockface.bin data/input/blockface.bin
data/input/google_transit_2018_18_08 data/input/google_transit_2018_18_08
data/input/neighborhoods
data/input/neighborhoods.geojson data/input/neighborhoods.geojson
data/input/offstreet_parking.kml data/input/offstreet_parking.kml
data/input/osm data/input/osm

View File

@ -349,6 +349,7 @@ impl<'a> Timer<'a> {
} }
impl<'a> std::ops::Drop for Timer<'a> { impl<'a> std::ops::Drop for Timer<'a> {
// TODO This often hides a panic
fn drop(&mut self) { fn drop(&mut self) {
if self.outermost_name == "throwaway" { if self.outermost_name == "throwaway" {
return; return;
@ -408,7 +409,6 @@ impl<'a> std::ops::Drop for Timer<'a> {
} }
// For repeated things // For repeated things
// TODO Why does the PartialEq derivation in sim require this?
pub struct Profiler { pub struct Profiler {
entries: Vec<ProfilerEntry>, entries: Vec<ProfilerEntry>,
current_entries: HashMap<String, Instant>, current_entries: HashMap<String, Instant>,

9
data/grab_seed_data.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# Run from the base repo directory: ./data/grab_seed_data.sh
set -e
curl -L -o seed_data.zip http://dropbox.com/TODO # TODO Need to upload this
rm -rf data/input data/system
unzip seed_data.zip
rm -f seed_data.zip

12
data/package_for_devs.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# Run from the base repo directory: ./data/package_for_devs.sh
set -e
if [ "$USER" != "dabreegster" ]; then
echo "Only Dustin runs this script, to help new developers avoid a long data import process.";
exit 1;
fi
zip -r seed_data data/input data/system
echo "Fire at will: mv seed_data.zip ~/Dropbox"

View File

@ -4,7 +4,9 @@ General disclaimer: This is a very rough demo. The user interface is clunky, and
gameplay is not cohesively tied together yet. Please email gameplay is not cohesively tied together yet. Please email
<dabreegster@gmail.com> or file a Github issue if you hit problems. <dabreegster@gmail.com> or file a Github issue if you hit problems.
## Installing the game from pre-built binaries ## Installing the game
Grab a pre-built binary release:
- Windows: - Windows:
https://github.com/dabreegster/abstreet/releases/download/v0.1.17/abstreet_windows.zip https://github.com/dabreegster/abstreet/releases/download/v0.1.17/abstreet_windows.zip
@ -17,6 +19,8 @@ Unzip the folder, then run `play_abstreet.sh` or `play_abstreet.bat`. On
Windows, you'll probably get a warning about running software from an unknown Windows, you'll probably get a warning about running software from an unknown
publisher. publisher.
Or you can [build from source](/docs/dev.md).
## Playing the game ## Playing the game
General controls: General controls:
@ -43,46 +47,6 @@ Things to try:
- Go back to the main menu and pick a challenge. Should be self-explanatory from - Go back to the main menu and pick a challenge. Should be self-explanatory from
there -- leave me feedbck if not. there -- leave me feedbck if not.
## For developers: Compiling from source
You will first need:
- Standard dependencies: `bash`, `curl`, `unzip`, `gunzip`
- `osmconvert`: See https://wiki.openstreetmap.org/wiki/Osmconvert#Download
- Rust, at least 1.38. https://www.rust-lang.org/tools/install
One-time setup:
1. Download the repository:
`git clone https://github.com/dabreegster/abstreet.git`
2. Download all input data and build maps. Compilation times will be very slow
the first time. `cd abstreet; ./import.sh && ./precompute.sh --release`
3. Run the game: `cd game; cargo run --release`
### Development tips
- You don't need to rerun `./import.sh` nd `./precompute.sh` most of the time.
- If you're just touching code in `game`, `sim`, and `ezgui`, you can just
`cargo run` from `game`
- If you're modifying the initial OSM data -> RawMap conversion in
`convert_osm`, then you do need to rerun `./import.sh` and `precompute.sh`
to regenerate the map.
- If you're modifying `map_model` but not the OSM -> RawMap conversion, then
you can just do `precompute.sh`.
- Both of those scripts can just regenerate a single map, which is much
faster: `./import.sh caphill; ./precompute.sh caphill`
- Compile faster by just doing `cargo run`. The executable will have debug stack
traces and run more slowly. You can do `cargo run --release` to build in
optimized release mode; compilation will be slower, but the executable much
faster.
- To add some extra debug modes to the game, `cargo run -- --dev` or press
Control+S to toggle in-game
- All code is automatically formatted using
https://github.com/rust-lang/rustfmt; please run `cargo fmt` before sending a
PR.
## Data source licensing ## Data source licensing
A/B Street binary releases contain pre-built maps that combine data from: A/B Street binary releases contain pre-built maps that combine data from:

54
docs/dev.md Normal file
View File

@ -0,0 +1,54 @@
# Developer guide
## Getting started
You will first need:
- Standard dependencies: `bash`, `curl`, `unzip`, `gunzip`
- Rust, at least 1.38. https://www.rust-lang.org/tools/install
One-time setup:
1. Download the repository:
`git clone https://github.com/dabreegster/abstreet.git`
2. Build all input data. This is very slow, so you should seed from a pre-built
copy: `./data/grab_seed_data.sh`. This will download about 1GB and expand to
about 5GB.
3. Run the game: `cd game; cargo run --release`
## Development tips
- Compile faster by just doing `cargo run`. The executable will have debug stack
traces and run more slowly. You can do `cargo run --release` to build in
optimized release mode; compilation will be slower, but the executable much
faster.
- To add some extra debug modes to the game, `cargo run -- --dev` or press
Control+S to toggle in-game
- All code is automatically formatted using
https://github.com/rust-lang/rustfmt; please run `cargo fmt` before sending a
PR.
## Building map data
You can skip this section if you're just touching code in `game`, `ezgui`, and
`sim`.
You'll need some extra dependencies:
- `osmconvert`: See https://wiki.openstreetmap.org/wiki/Osmconvert#Download
- `cs2cs` from proj4 (See X or `apt-get install proj-bin` on Ubuntu)
The seed data from `data/grab_seed_data.sh` can be built from scratch by doing
`./import.sh && ./precompute.sh --release`. This takes a while.
Some tips:
- If you're modifying the initial OSM data -> RawMap conversion in
`convert_osm`, then you do need to rerun `./import.sh` and `precompute.sh` to
regenerate the map.
- If you're modifying `map_model` but not the OSM -> RawMap conversion, then you
can just do `precompute.sh`.
- Both of those scripts can just regenerate a single map, which is much faster:
`./import.sh caphill; ./precompute.sh caphill`