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

Deploy examples on website in wasm #225

Merged
merged 14 commits into from
Dec 23, 2021
Merged

Deploy examples on website in wasm #225

merged 14 commits into from
Dec 23, 2021

Conversation

mockersf
Copy link
Member

Build examples in wasm and deploy them under https://bevyengine.org/examples

It adds:

  • a gallery page of the examples built in wasm:
    Screenshot 2021-12-21 at 19 32 43
  • a page per example
    Screenshot 2021-12-21 at 19 33 04

Notes

@Weasy666
Copy link

This is a really nice idea, i like it!
Also +1 for screenshots and a link in the topbar.

@cart
Copy link
Member

cart commented Dec 21, 2021

Great work as always! Some random thoughts:

  • It would be cool if we dumped each example's source in a code block below the canvas (not something id block this on, just an idea)
  • I think we should hold off on adding an "examples" link in high-visibility place like the navbar until we get feedback from people / see how these run generally on the various platforms we support. That should probably come in a separate pr.
  • I'm also a bit worried about adding another navbar category because space is limited, especially on mobile. Another category would almost certainly start collapsing the categories into a hamburger menu by default on mobile. But it does seem like the examples should be easily discoverable. I'm open to any and all suggestions!

@Weasy666
Copy link

Hm...you're right, it will be a problem on mobile. I guess a good compromise would be to put a link on the Learn page, besides (or instead of) the already existing link to the example folder on GitHub.
Code blocks would definitely be nice, and additionally a link to the example's source code file on GitHub would also be nice, so that devs can directly jump to the source file.

@mockersf
Copy link
Member Author

  • It would be cool if we dumped each example's source in a code block below the canvas (not something id block this on, just an idea)

Added! The example page is very lacking in styling, but that's not my strong suit...

  • I think we should hold off on adding an "examples" link in high-visibility place like the navbar until we get feedback from people / see how these run generally on the various platforms we support. That should probably come in a separate pr.

Yup, I wanted to have something deployed as soon as possible to check deploy is working, and to be able to point lots of people/os/browsers at it to check compatibility. But it doesn't need to be linked somewhere for that, plus an "official" link would be better with the 0.6 release post

@cart
Copy link
Member

cart commented Dec 21, 2021

Added! The example page is very lacking in styling, but that's not my strong suit...

Happy to give that a go once we merge this :)

Yup, I wanted to have something deployed as soon as possible to check deploy is working, and to be able to point lots of people/os/browsers at it to check compatibility. But it doesn't need to be linked somewhere for that, plus an "official" link would be better with the 0.6 release post

Makes sense!

@Nilirad
Copy link
Contributor

Nilirad commented Dec 21, 2021

The generate-wasm-examples script seems hardcoded in a way that doesn't work unless you cd into the script directory. Not sure if this could be a problem or not. It was quite annoying before I figured out that it was compiling the examples outside the workspace.

@mockersf
Copy link
Member Author

mockersf commented Dec 21, 2021

Not sure if this could be a problem or not.

It's how the two existing scripts, generate-assets and generate-errors, work. It would be best if the scripts worked no matter your current path, but they are meant to be run by the CI, and you can look into the action for how to run them.

Suggestions are welcome though, you can see from the number of commits to get the syntax right that I'm not really a fan of shell scripts 👍

@cart
Copy link
Member

cart commented Dec 23, 2021

Looks like a good baseline to me. Lets get this merged!

@cart cart merged commit 44c8357 into bevyengine:master Dec 23, 2021
@Weasy666
Copy link

Weasy666 commented Dec 23, 2021

Looks really nice, great work 😀

The 3D examples do not work for me. They throw the following error

panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in VERTEX | FRAGMENT | VERTEX_FRAGMENT shader: Ambiguous field 'webgl_80162f7b6c86f28b' in blocks 'webgl_b0642670a5062d75' (VERTEX shader) and 'webgl_9e44ea47afb977a9' (FRAGMENT shader) which don't have instance names.


', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:2273:5

I am on Firefox 95.0.2 (64-Bit) on Windows 10 with AMD Radeon RX570. All other examples, 2D, UI, Audio, Bevymark and the 2D game Breakout work fine. The link of the rect example does not work, but i guess that is because the example is from main branch and not available in latest, which will change with the release of 0.6.

@mockersf
Copy link
Member Author

The 3D examples do not work for me. They throw the following error

That's due to gfx-rs/naga#1616 which makes it crash on everything except firefox on macOS...

The link of the rect example does not work, but i guess that is because the example is from main branch and not available in latest, which will change with the release of 0.6.

Yup!

@mockersf mockersf mentioned this pull request Mar 15, 2022
7 tasks
bors bot pushed a commit that referenced this pull request Jul 8, 2022
I think we've ironed out enough of the kinks to justify making the examples page more prominent. We've been sitting on a lot of value here for awhile 😄 

For posterity: big thanks to @mockersf for putting together this feature in #225 and @doup for adding loading feedback in #355 and a bunch of other visual improvements.
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.

4 participants