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

Web client (compiling to WASM) #151

Open
12 of 16 tasks
ten3roberts opened this issue Feb 23, 2023 · 5 comments
Open
12 of 16 tasks

Web client (compiling to WASM) #151

ten3roberts opened this issue Feb 23, 2023 · 5 comments
Assignees
Labels
topic:web Related to running on the Web umbrella

Comments

@ten3roberts
Copy link
Contributor

ten3roberts commented Feb 23, 2023

If you have a feature request or issue regarding web support and running the Ambient client in the browser, please post it here.

@ten3roberts ten3roberts added topic:web Related to running on the Web umbrella labels Feb 23, 2023
@ten3roberts ten3roberts self-assigned this Feb 23, 2023
@ten3roberts ten3roberts changed the title Wasm client umbrella issue WebAssembly client umbrella issue Feb 23, 2023
@ten3roberts ten3roberts pinned this issue Feb 23, 2023
@ten3roberts ten3roberts changed the title WebAssembly client umbrella issue WebAssembly client Feb 23, 2023
@philpax philpax changed the title WebAssembly client Web client (compiling to WASM) Feb 27, 2023
@philpax
Copy link
Contributor

philpax commented Feb 27, 2023

So a potential blocker in the future might be WASM client modules (#6). We don't have that currently implemented, but when we do, we'll need to figure out a way to make that work in the web.

I've asked the Bytecode Alliance Zulip about this, and they've suggested a few things. The main takeaway I had is that we could potentially unpack WIT components and load them as WASM on the web. To call it from our host code, we could add another host generator to wit-bindgen that calls into the web WASM.

This seems like it might be a fair bit of an engineering headache, though, as we'll need to abstract all of the WASM-interfacing code so that it can be backed by wasmtime or by web WASM modules. I suspect that we're unlikely to ship clientside WASM on the web soon.

Edit: although this might be a problem we need to deal with sooner rather than later if we do loopback-servers-on-the-web and they need to run their own logic

@chaosprint chaosprint mentioned this issue Apr 17, 2023
@ten3roberts
Copy link
Contributor Author

Webtransport support in our networking stack is on the way

See #381 for details

@ten3roberts
Copy link
Contributor Author

Thought I would give a condensed progress update on this issue as there has been some time, but also a great deal of movement forwards.

The port to the web is going along fantastically. Webtransport is fully operational, and we are now able to serve both Quinn(Quic) clients on native and webtransport clients on web.

The renderer mostly works except it has some issues with regards to our indirect renderer, which I am tackling now.

The big blocker which lies within arms reach is somehow running our client scripts on the web securely, and sandboxed, while also communicating with ambient runtime through our API. This is something I and @philpax will be tackling in a moment.

For native we are using wasmtime but doing so is not possible due to the low level machinery it uses such as jit compilation and function pointer passing which is just fundamentally not possible on the web.

Additionally, we will need to set up our server infrastructure certificates and appropriate portals to enable you, the users to access the hosted client and connect to running servers and Embers. This is part of @pierd's domain as well as the rest of our awesome team for setting up the website and portal.

@ten3roberts
Copy link
Contributor Author

So a potential blocker in the future might be WASM client modules (#6). We don't have that currently implemented, but when we do, we'll need to figure out a way to make that work in the web.

I've asked the Bytecode Alliance Zulip about this, and they've suggested a few things. The main takeaway I had is that we could potentially unpack WIT components and load them as WASM on the web. To call it from our host code, we could add another host generator to wit-bindgen that calls into the web WASM.

This seems like it might be a fair bit of an engineering headache, though, as we'll need to abstract all of the WASM-interfacing code so that it can be backed by wasmtime or by web WASM modules. I suspect that we're unlikely to ship clientside WASM on the web soon.

Edit: although this might be a problem we need to deal with sooner rather than later if we do loopback-servers-on-the-web and they need to run their own logic

Since the time of this comment the state and plan of Ambient has changed.

Our games (Embers) are now increasingly dependent on client side logic for input handling, animations, ui, audio et al. These things were either not available or like user input spoon-fed to the server scripts by the Ambient runtime, but is now up to the game creator to decide on how to handle and send inputs or "commands".

Supporting client side scripting is as such of higher priority and must be done before shipping, as frankly even all but one of our examples currently require client side code.

@ten3roberts
Copy link
Contributor Author

The client side scripts, the big blocker looming over us like a ghost 👻 with lots of unknowns with technologies and libraries which have yet to exist is soon to be merged.

I have followed the valuable input from my team members in order to arrive at a broader brush stroked solution to get it initially working. This however means that there are some todos left and smaller bugs left unadressed. See: #805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:web Related to running on the Web umbrella
Projects
None yet
Development

No branches or pull requests

2 participants