7 ms·
> Gaming, the combination of WASM and WebGPU will be the perfect platform for cross platform game development. That storm already happened. It was called Unity
by kllrnohj 5y ago
> Gaming, the combination of WASM and WebGPU will be the perfect platform for cross platform game development.
That storm already happened. It was called Unity. And since then others have joined, like Unreal.
WASM + WebGPU doesn't bring anything to the table here other than being a decade late, slower, and with fewer features. Why would anything outside of a web app touch any of it? Why would steam bother? You still have to build so, so much platform-specific stuff to make it work (input, audio, windowing, etc...), why would you do all that and then just pay a massive performance overhead to avoid compiling a whopping ~5 times?
WebGPU could potentially see a use as a middleware for things that want to use the GPU but aren't concerned all that much about performance or overhead, things like image filter effects. But there's also no shortage of existing solutions for them, either, like bgfx (as well as domain-specific offerings like halide of course)
- deleted 5y ago[deleted]
- y4mi 5y agoTo my knowledge (correct me if I'm wrong please), the performance issues from WASM only exist in the context of moving things back into the DOM. I was always of the understanding that WASM itself is super performant and if it's possible to run a WASM application without going through the DOM you'd get native performance, making it a valid choice for things like gaming. Most devs would obviously still use unreal engine etc, but these engines will be able to give you improved performance of your games by utilizing WASM
- kllrnohj 5y agoWASM gets you faster performance than JavaScript, sure, but it's not native, either. Sandboxing & byte code aren't free to have. See the extremely long history of existing byte code VMs here - WASM isn't really doing anything new.
- manmal 5y agoModern hypervisors have astonishing performance, and I don’t see why Chrome and Safari wouldn’t manage to eventually provide a similarly efficient implementation.
- kllrnohj 5y agoModern hypervisors don't run bytecode and are using the CPU to do security enforcement, not software emulating it like WASM is forced to do (since it's not using a hardware protection domain, aka a process)
- nullifidian 5y agoWASM is more secure than a hypervisor, since it prevents code injection.
- eyberg 5y agoIt is trivial to modify function pointers, implemented as indirect calls and "read-only" data in wasm.
- nullifidian 5y agoYes, WASM in combination with an unsafe language is less secure than memory safe languages, but more secure than a hypervisor. You can also use WASM with a memory safe language.
- eyberg 5y agoIt doesn't matter if it's rust or not. You can still modify read only data and still redirect indirect calls. You can still modify the stack and the heap. Rust changes nothing. Also, not sure where the comparison to a hypervisor is coming into play. As @kllrnohj mentioned hypervisors are relying on actual hardware.
- elevader 5y agoAFAIK you don't really get native performance, although it's hard to find good data on this (https://nickb.dev/blog/wasm-and-native-node-module-performance-comparison https://nickb.dev/blog/wasm-and-native-node-module-performan... was one I could find on the fly). WASM is still virtual machine based and not compiled to a native executable so this is to be expected I guess, it's supposed to be faster than JS and it achieves that goal. Maybe it can be an alternative to Unity, which would be good enough for a lot of games, but I don't know how that compares.
- dathinab 5y ago> not compiled to a native executable except it is, WASM is designed to be AOT compiled to native code. Sure there is a bit of difference, WASM needs additional bounds checks and WASM also doesn't have all the info a more high level compiler has. Now Unity is so much more then just a tool to make cross platform easier. So comparing it to WASM is kinda pointless IMHO. Though it probably is a grate choice for any extension mechanism, like mods or even in game scripting.
- elevader 5y ago> except it is, WASM is designed to be AOT compiled to native code. Interesting, I didn't know that. How does WASM handle different architectures? Do you build different binaries for x86/arm? Or does it do it the Apple way with the giant bundle that contains all binaries? > Now Unity is so much more then just a tool to make cross platform easier. So comparing it to WASM is kinda pointless IMHO. Though it probably is a grate choice for any extension mechanism, like mods or even in game scripting. Agreed, that was badly worded. Like you said, one could compare a module written in Unity and compiled to whatever Unity compiles to/is implemented in these days with a module in WASM. Edit: Or does the AOT mean that the format that is shipped is some non-native format but the client compiles everything before the first run?
- billti 5y ago> How does WASM handle different architectures? The same way JavaScript or C#/Java do. It's a bytecode format (typically the first stage in today's JavaScript engines is to turn into a bytecode), which the different engines then JIT for the OS and architecture they are running on. For more details on a couple different engine implementations, you may find the below of interest. - https://v8.dev/docs/wasm-compilation-pipeline https://v8.dev/docs/wasm-compilation-pipeline - https://hacks.mozilla.org/2020/10/a-new-backend-for-cranelift-part-1-instruction-selection/ https://hacks.mozilla.org/2020/10/a-new-backend-for-cranelif...
- truemotive 5y agoYou left out the part where running WebGL via Unity was an absolute nightmare, and was fudged in as a stopgap when NPAPI was deprecated and there was no more Flash web player target. Barring that, before you even got the build up on the web you got to sit through 20 minutes of emscripten and wasm magic compiling, hoping and praying you considered any bridging methods to .Net from the frontend that don’t appear until they’re useless emscripten errors in the unity console. Oh, you’d like audio/video comms in your product? Well, hope you’re ready to build the non-supported WebGL compatible version of Photon/Agora’s voice subsystems. Don’t get me wrong, I’m card carrying Unityman and just backed off of XR development recently in favor of more stable webdev work… but WebGL as a solution to high-performance browser gaming was an absolute shitshow from start to finish and I’m not even sure WebGPU lands in time for anything useful to be done with it to deprecate WebGL “support”. I assume that the lightweight 3D solutions based on threejs, etc. are going to drag the rest of the game engine industry kicking and screaming into whatever best solution arises and this wasm-as-k8s sounds like a neat component of that.
- kllrnohj 5y agoI meant Unity already solved the "make creating a cross platform game trivial" thing. Games on the web face far greater issues than WASM or WebGPU can solve (like a complete lack of an asset delivery pipeline), unless you're only after casual flash-style gaming anyway. But mobile largely replaced that market.
- nullifidian 5y agoInstalling a native unity game requires more trust than running a game in a web browser. Web browser games would also work on platforms like Chromebooks, and don't require Google's or Apple's store approval, with their 30% cut.
- jaegerpicker 5y agoAnd Streaming games does that even better over WebRTC in the browser and we have that today! With a good internet connection (like 5g that is rolling out) the experience is fantastic. I bought my kids iPad Mini's for christmas, they have both 5g and we have 1gb internet at home and GeForce Now and XBox Cloud Gaming have been absolutely great for them. A ps5 controller and the ipad mini can be the best gaming device available today IMO.
- deleted 5y ago[deleted]
- nullifidian 5y agoUnity is not a free standard with multiple implementations. Unity doesn't support a plurality of programming languages, while it's the goal of the garbage collected WASM. Unity is higher level in the stack, and could be executed on top of WASM and WebGPU. The work of making GCd WASM (which could interface with browser APIs without an overhead) and WebGPU fast is ongoing.
- pjmlp 5y agoThere are plenty of other middleware options, Unity is not the only game in town. What all of them have, is being able to take advantage of 2022 hardware in 2022, with 2022 3D APIs.
- nullifidian 5y agoNot all games need "to take advantage of 2022 hardware in 2022, with 2022 3D API". A good plenty would look fine with a middling level of graphical fidelity or "latestness" of employed GPU features. Using the web platform you also free yourself of gatekeeping, cut taking middlemen. So there is a niche for both WASM and WebGPU.
- pjmlp 5y agoSure, I also like to revisit my Playstation and Amiga 500 games.
- nullifidian 5y agoSo in your world there are only games employing the latest features, and "retro" games from the 80s and the 90ies, and nothing else? Ok. As far as I know WebGPU doesn't lack any significant features beside raytracing (They are prioritizing the MVP, and raytracing could come later). Some of the newest features like mesh shaders are not yet supported by the native engines either, because there isn't a sufficient hardware base. Intel for example will support mesh shaders only in the yet to be released Alechemist GPU.
- astlouis44 5y agoEpic deprecated support back in the 4.23 release of Unreal Engine, so developers haven't been able to export to HTML5 unlike Unity which has to this day maintained the abilit to target the browser, and in fact they are in the process of building out support for WebGPU. Check out this job ad: https://careers.unity.com/position/software-developer-unity-webgl/3474736?gh_src=1 https://careers.unity.com/position/software-developer-unity-... Our startup is working on support for Unreal to support WebGPU from 4.24 onwards, and we've already upgraded support so developers can use WebGL 2.0 instead of WebGL 1.0 like was available previously before Epic made it a community supported platform extension.