Author Topic: AGS engine Web port  (Read 2360 times)

Re: AGS engine Web port
« Reply #20 on: 24 Nov 2021, 07:46 »
i'm having some issue, can't run my project html, i think is the size (beyond 300 mb) it run when i try on github...

wich files have to include in my_game_files.js? in the array there are just the.ags and cfg file
thank you in advance

i noticed that brand new compiled game doesn't run..
« Last Edit: 24 Nov 2021, 14:30 by maDDam »


Re: AGS engine Web port
« Reply #21 on: 01 Jan 2022, 13:23 »
Hey, I pushed a new version here:

If people could try running their games there, it's based on the latest 3.6.0 release. I haven't yet updated the single game package.  Erh, just updated now the first post!
I did have some issues with the native fullscreen mode, the music stops playing for some reason when switched to full screen, but the in-game switch seemed to work fine. Any idea what that could be about?

@Hobo, could you give me a game that this happens so I could try to figure it out? (it didn't happen with Prelude in the latest build at least)
« Last Edit: 01 Jan 2022, 17:51 by eri0o »


Re: AGS engine Web port
« Reply #22 on: 03 Jan 2022, 12:57 »
This is a test EDITOR, please backup your game before trying it!!!!!

Better yet, make a copy of the game you want to test with this.

This adds an option in the General Settings, where you can select Web for the Web build. This is in super experimental state.

(I am trying to understand how adding new build targets in the Editor works, code is from here)

Maybe the Editor could have a webserver too for serving the web build (something like this), but not sure yet how it would work in the interface and stuff, so didn't add it.
« Last Edit: 03 Jan 2022, 13:15 by eri0o »

Re: AGS engine Web port
« Reply #23 on: 05 Jan 2022, 13:35 »
Wow!. Export from the editor is an excellent feature. . You are amazing @eri0o. I'll test and if I had questions I'll ask you!
« Last Edit: 05 Jan 2022, 13:44 by Mehrdad »
My official site:

Re: AGS engine Web port
« Reply #24 on: 14 Jan 2022, 06:54 »
Oh wow, this is truly amazing! I used the and I could export it to web! My game is huge, build size is 2.68 GB. I still tried and uploaded it to gamjolt and it worked!! it takes like 15 minus to load, but it's perfectly playable on desktop browser (does not load in mobile browser).

Then, I tried with the demo (build size ~900MB) and it only takes ~5min to load on desktop, mobile does not load either:

I'm very interested in saved files, would appreciate some insight on this.
If you want persistent save files, ask me about it here in the thread, they are technically possible

I'm working on a very light version of the game, trying to bring it down to ~300MB as you recommended because I'm after a mobile web version.

Thanks so much for this!


Re: AGS engine Web port
« Reply #25 on: 14 Jan 2022, 07:25 »
The whole game has to be loaded in RAM, usually mobile devices have a lot less RAM than desktop - and RAM is used by everything here, the filesystem, AGS, and everything else. Also there's a hard limit on RAM size allowed for the tab that simply depends - I think max it goes is 4GB in perfect temperature and pressure conditions. So reaaally bring down that number. Use sprite compression in AGS, and if possible use lower quality ogg audio, which may not be perceptible to the player and keep the game as nice as is. I think there was even a test for other sprite compression algorithms... Also reminder that the game size is full uncompressed game and not the zip you upload. Also remember that one person on a phone that is not warned before the download may end up spending all their limited data in your game by accident - warns all the time to keep size of the web game low, and this is one of the reasons.

About persistent savefiles, currently the implementation is a bit tricky, it works like this, the browser has a very limited storage per website, of around 50MB.

The idea is to sync the virtual filesystem save directory (which is mostly smokes and mirrors) to the key and value browser storage. Now the problem is that game savefiles in AGS can get quite big - the main culprit are Dynamic Sprites, if they exist when the game is saved, then we are going to serialize them, and they are serialized as bitmap, so they may take a lot if they are very big. So if you have lots of dynamic sprites you may need a custom save system.

The other thing is that if the user never access your game website after sometime, well, you will keep using that storage for your game in his computer indefinitely until they ever find out how to clean this in their browser. This is something that I don't know any easy solution. I wanted to add at least a sync option somewhere as a button so at least the person clicks this and this should remind them that they may need to delete this. The other possibility is to let people download their savegames, but this would not work with a custom save file. Anyway, there are some design issues I haven't been able to figure out.

Re: AGS engine Web port
« Reply #26 on: 15 Jan 2022, 04:38 »
Well, im not using dynamic sprites so no problem with that. I just checked and a completed agssave file is ~500KB (the total folder is 900Kb).
The web game will only be available for students in a school. They use tablets, chromebooks, etc, but they dont always use the same device. So Id like that the game creates the save files so the school can save them in the student user profile (they have their own infrastructure for this).

So I wonder how I could do this?
The idea is to sync the virtual filesystem save directory (which is mostly smokes and mirrors) to the key and value browser storage.



Re: AGS engine Web port
« Reply #27 on: 15 Jan 2022, 08:42 »
I have not implemented the file sync, I may eventually but it's not on my priority list right now, I asked people to ask because I need to understand in what order to do things. Right now the biggest problem is unfortunately not in AGS at all, but in Google Chrome Android builds:

Other than this I am looking into how to merge my work into AGS codebase so I don't have to rebase and build things by hand - I have just yesterday fixed a bug in emscripten so now I am waiting a new version to be released - should probably happen in a few days.

In between I am looking how to make the HTML nicer - I want to merge both multigame and single game launchers in a single HTML to ease maintenance.