🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Spin up a local web server to serve downloaded HTML-type games?

A topic by sprite~1 created 14 days ago Views: 68 Replies: 4
Viewing posts 1 to 3
(Edited 2 times)

Some HTML5 games like those made in Godot have trouble running when directly opened locally.

Right now, the itch.io client seems to just download the files and extract them to a directory then opens it directly from there. My suggestion is, when the user tries to launch a downloaded HTML game, spin up a local web server in that game's folder and load the path

http://localhost:<somerandomportforthegame>

in the pop out window instead. Of course when the game is closed, the local web server should be terminated as well.

Admin

Hey there,

Can you link to a game that isn't working?

The app doesn't "just open the directory" using the file: protocol - it registers a custom protocol that serves the game's files, see:

If you link me to a game I can investigate further :)

(Edited 4 times)

Sure, here's a test I uploaded. It's set to restricted but I'm sure admins can still see it. 😋 made it public for less hassle

https://sprite-1.itch.io/html5test

It works when opened on a browser but when I try to open it from the client, it doesn't load. I thought it was serving the files directly using `file://` because this same behavior (it not working) can be observed when opening the HTML file of the game locally. 

Admin(+2)

Gave it a spin, and it seems the reason it's buggy has nothing to do with the protocol it's loaded over :)


It appears the `navigator.languages` array is empty in electron's browser window context.

Apparently it's a known issue, that we can work around: https://github.com/electron/electron/issues/11053

It'll have to wait for itch v25 though (the next big release). I've opened an issue here to track our progress: https://github.com/itchio/itch/issues/1758

Nice, thanks! Looking forward for 25 to drop. 🎉