AGS 4: WEB version

Started by Vincent, Fri 29/11/2024 18:18:30

Previous topic - Next topic

Vincent

Hi I just finished to compile a mini game with AGS-4.00.00.06-Alpha11. The .exe file is working all good but when I try to open it on broswer it gives me this kind of error. Is there any bug related with this version and the web compiling?




Here's the file of ags.js
Spoiler

eri0o

Afaik it should be working. The AGS.js file is the same for all builds, AGS has always a runtime and the game files - mainly the .ags file. Is your game available somewhere?

Vincent

Quote from: eri0o on Fri 29/11/2024 19:26:52Afaik it should be working. The AGS.js file is the same for all builds, AGS has always a runtime and the game files - mainly the .ags file. Is your game available somewhere?

I've uploaded the whole web folder if that help
Spoiler

Here's the game but my friend say that he can't upload the web version for some reason
https://digital-mosaic-games.itch.io/dust-n-rust

eri0o

#3
Hey @Vincent, what do you mean with the error message you sent? I tried the game here and it works.

The game can only work if it's served by a server, if you are simply trying to double click the html to run in the browser it won't work. For local testing you need to run from a server, you can do so using "python -m http.server" in the folder of the game from the command line if you have python installed. It should work fine when served from itch io.

I really would like to make this work somehow in the Editor so one could run it from the Editor and open in whatever browser for testing, but I could never come up with a UX design for how it could work to test it locally.

Also itch doesn't accept rar files, just use a zip file and it should work. (also rar should just never be used, it's a terrible format, just install 7-zip, it's free and open source)

eri0o

#4
MinimalWebServer.zip

I made something in WinForms just to test if it works, here is a zip that contains a file named MinimalWebServer.exe, if you run it, it will set the name of the directory it is in, in a text box, and clicking the button will make it serve the files in that directory be served to the Web Browser. (If you just replace the text in the input box with any other directory in your pc it will serve the other things instead).

The idea here is you place the MinimalWebServer.exe in the Web folder that has your game built for web and just double click the exe file.

Then you load a web browser and just type the url as http://localhost:8000, and it should just be the index.html of whatever is in the directory. If no index.html is in the directory you will get a 404 error.

I sent the source files along, the Visual Studio solution and all. It's written using WinForms and the same C# and .NET used by the Editor currently. The idea is to try and kinda figure out the basics of how the UX of this should work before attempting something in the editor itself.

This is just something written in very few minutes, so there is no stop of the server, if you close the window it will terminate the server. Only one window can be opened at the same time or it will cause problems.

Vincent

@eri0o Thanks a lot as usual you are always very kind. Sorry for the trouble regarding this: "The game can only work if it's served by a server, if you are simply trying to double click the html to run in the browser it won't work." Is actually what I was trying to do by my side since i dont own the account on itch so i wasn't sure how to test it properly. Btw I tried it with your MinimalWebServer.zip and its working all good indeed. Now I will share those info with my friend and hopefully we should upload a web version to itch page - im still not sure why he had trouble on uploading the web version but I'll let you know in case, still thanks a lot for your time.

eri0o

#6
I just tried in itch and it really has to be a zip file.



after the upload, there is a check box that says "This file will be played in the browser", it has to be checked for the zip file that contains the web build. It will be automatically hidden from downloads too in the game website in itch.

My suggestion would be the person uploads both files as zip, and also use a naming scheme like game_name_PLATFORM.zip, so it would be like rust_n_dust_windows.zip and rust_n_dust_web.zip. This also makes things easier for them when using the dashboard, as the file name are the only information available when one is tagging what the file is on the itch pane.

Ah, after this is working, the web game frame and small details can be set if one scroll the dashboard down, in the embed options section



(I understood you don't have an itch account, just mentioning in case you want to forward this message)

Vincent

@eri0o Thank you very much - btw this isn't our first time uploading a web version of our games on itch and indeed we never had any troubles. This time I have a feeling that my friend tried to upload the rar file i shared with him so i believe that is the problem, still thank you very much!  :)

RootBound

@eri0o this is awesome! I was planning to release a web version of my current game but wanted to find a way to test it without having to upload it to itch yet. This is working perfectly so far.
They/them. Here are some of my games:

Crimson Wizard

#9
Quote from: RootBound on Sat 30/11/2024 13:10:33I was planning to release a web version of my current game but wanted to find a way to test it without having to upload it to itch yet.

I'll mention this just in case, there may be numerous tools and browser plugins around that let do this.
For example. there was this plugin for google chrome called "Web Server for Chrome" that lets create a local server:
https://chromewebstore.google.com/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb
where you simply point to a folder with generated game, which has index.html in it.


eri0o

I opened a topic in the forums in case we want to have something like this in the Editor itself

I believe the amount of code is relatively small but the issue is more about designing the feature. I think neither Godot or Gamemaker have this in themselves so I used as basis my own previous Game Engine for the proposal. But I would need other game devs input to see how they would imagine such feature and for people to pick problems and edge cases in my proposal.



heltenjon

Quote from: RootBound on Sat 30/11/2024 13:10:33@eri0o this is awesome! I was planning to release a web version of my current game but wanted to find a way to test it without having to upload it to itch yet. This is working perfectly so far.
There's also the option to upload it to itch, but not available for the public. You may then issue keys for testers other than yourself, if needed.

RootBound

Quote from: heltenjon on Sat 30/11/2024 13:47:43There's also the option to upload it to itch, but not available for the public. You may then issue keys for testers other than yourself, if needed.

I've done this in the past, but that seems to be what flagged my games as suspicious on itch, so I've been trying to avoid it. It's also nice not to have to upload a new version every time I fix a bug.

They/them. Here are some of my games:

SMF spam blocked by CleanTalk