Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On the web, load different maps by making asynchronous HTTP calls. #21 #364

Merged
merged 2 commits into from
Oct 8, 2020

Conversation

dabreegster
Copy link
Collaborator

This is a very strange, specializd approach; it's unclear how it'll
generalize to reading scenarios and prebaked results. Ideally we could
call abstutil::read_binary as we currently do and somehow hide this async
trickery underneath, but I'm not sure how yet. In the meantime, this
moves us forward with the hack well-contained.

Next steps for web: stop bundling in all of data/system in the .wasm,
now that we can load from HTTP.

@michaelkirk

game/run_web.sh Outdated
@@ -4,4 +4,6 @@ set -e
wasm-pack build --dev --target web -- --no-default-features --features wasm
cp index.html pkg
cd pkg
rm -f system
ln -s ../../data/system/ .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively you could have the webroot checked in with a symlink. I'm a little nervous about a script which deletes files - especially when they don't enforce what directory you're currently in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, done. wasm-pack sticks a .gitignore in pkg/, but turns out you can delete it, add the symlinks, then let the gitignore file come back, and it all seems to work.

Copy link
Collaborator

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nice job getting something working!

This is a very strange, specializd approach; it's unclear how it'll
generalize to reading scenarios and prebaked results. Ideally we could
call abstutil::read_binary as we currently do and somehow hide this async
trickery underneath, but I'm not sure how yet. In the meantime, this
moves us forward with the hack well-contained.

Next steps for web: stop bundling in all of data/system in the .wasm,
now that we can load from HTTP.
@dabreegster dabreegster merged commit 64bc4ee into master Oct 8, 2020
@dabreegster dabreegster deleted the web_load_map branch October 8, 2020 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants