4 ms·
A godot dev said html5 games are difficult to do because of multithreading.
by jokoon 3y ago
A godot dev said html5 games are difficult to do because of multithreading.
- hu3 3y agosource? I'd like to learn more about the intrinsics of web games.
- Kiro 3y agoThere are a lot of restrictions when using multiple threads in the browser. You need to spawn workers and they can only share certain things in memory between the threads (transferable objects and SharedArrayBuffer for generic data). For everything else you need to pass messages back and forth between the workers. Another problem is that SharedArrayBuffer was disabled by default after Spectre and in order to enable it you need to send certain headers from the server (Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy). I don't know if itch.io has support for that, but maybe. I haven't used Godot but I'm thinking that the multithreaded models game engines are using don't convert very well to SharedArrayBuffers. It's a very crippled form if you're used to say C#.
- a1o 3y agoI think this is also not available in either iPhone or iPad Safari.
- aezart 3y agoItch does support the headers for SharedArrayBuffer, but it causes problems if you want to have both a web player and a downloadable version of the game. It was recently fixed for Chrome, but in Firefox trying to download a game from a page with SharedArrayBuffer results in the browser blocking the download from the CDN.
- omoikane 3y agoSharedArrayBuffer can be enabled on itch.io with one checkbox. https://itch.io/t/2025776/experimental-sharedarraybuffer-support https://itch.io/t/2025776/experimental-sharedarraybuffer-sup...
- a1o 3y agoCan you do that and still ping a server outside of itch.io? Say for analytics or for online gaming.
- omoikane 3y agoI haven't tried accessing any external network resources, but the article above suggest it wouldn't work: If your game accesses resources on other domains then those requests will fail by default.
- nightowl_games 3y agoThat's specific to the refactoring of godots internals in 4.0. specifically the performance will suffer in single threaded systems. Note that we are running a multithreaded Godot 3 game on the web. It only uses threads when sharedarraybuffer is available, otherwise uses single threaded mode. Mostly just affects the latency of audio.