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

WASM support #19

Open
bbarker opened this issue Dec 10, 2023 · 0 comments
Open

WASM support #19

bbarker opened this issue Dec 10, 2023 · 0 comments
Labels
enhancement New feature or request platform

Comments

@bbarker
Copy link
Owner

bbarker commented Dec 10, 2023

bevy_voxel_world currently doesn't support WASM builds:


   Compiling bevy_voxel_world v0.3.3
error[E0308]: mismatched types
   --> /home/bbarker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_voxel_world-0.3.3/src/voxel_world_internal.rs:289:38
    |
289 |             .insert(ChunkThread::new(thread))
    |                     ---------------- ^^^^^^ expected `Task<ChunkTask>`, found `FakeTask`
    |                     |
    |                     arguments to this function are incorrect
    |
    = note: expected struct `Task<chunk::ChunkTask>`
               found struct `bevy_tasks::single_threaded_task_pool::FakeTask`
note: associated function defined here
   --> /home/bbarker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_voxel_world-0.3.3/src/chunk.rs:28:12
    |
28  |     pub fn new(task: Task<ChunkTask>) -> Self {
    |            ^^^ ---------------------

For more information about this error, try `rustc --explain E0308`.
error: could not compile `bevy_voxel_world` (lib) due to previous error
2023-12-10T01:56:25.435082Z ERROR ❌ error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
    2: cargo call returned a bad status

If it were to work, the directions for building would be something like this, based on the template:

### Building for the web (WASM)

        * requires [trunk]: `cargo install --locked trunk`
        * requires `wasm32-unknown-unknown` target: `rustup target add wasm32-unknown-unknown`
        * Start the web build: `trunk serve`
        * this will serve your app on `8080` and automatically rebuild + reload it after code changes
### Deploy web build to GitHub pages
 1. Trigger the `deploy-github-page` workflow
 2. Activate [GitHub pages](https://pages.github.com/) for your repository
     1. Source from the `gh-pages` branch (created by the just executed action)
 3. After a few minutes your game is live at `http://username.github.io/repository`

To deploy newer versions, just run the `deploy-github-page` workflow again.

Note that this does a `cargo build` and thus does not work with local dependencies. Consider pushing your "custom Bevy fork" to GitHub and using it as a git dependency.
 
# Known issues

Audio in web-builds can have issues in some browsers. This seems to be a general performance issue and not due to the audio itself (see [bevy_kira_audio/#9][firefox-sound-issue]).
@bbarker bbarker added enhancement New feature or request platform labels Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request platform
Projects
None yet
Development

No branches or pull requests

1 participant