AGS engine Web port

Started by eri0o, Wed 26/05/2021 02:45:17

Previous topic - Next topic

Crimson Wizard

#140
Quote from: uma on Thu 05/10/2023 13:36:08It's a first person game with only about 40% of the screen used for what I'd think of as the "room" in a regular 3rd person p&c with the rest being UI. The other 60% of those 5 images is mostly empty white space, with some "noise" behind where the UIs sit to give them some life. I knew this was inefficient when I started but I couldn't see how how to get a room background image to be anything other than stretched across the whole screen, and equally wasn't sure how to animate UI elements, so I padded all the backgrounds.

Padding also counts when loading or drawing images, as pixels are data regardless of whether they represent anything in the game.

This belongs to the tech help forum section, but from a quick glance this may be resolved by either:
1) having a smaller object or overlay on background, and animating that;
2) configuring room's viewport and camera so that the room is displayed exactly the size you want. This will also allow to have rooms of smaller size than the game itself. (See Viewport and Camera sections in the script API in the manual)

eri0o

@uma , try setting filter = linear in in the Editor, in your project Default setup - I forgot the exact name of the setting. If this doesn't change a thing on macOS, I believe there is a directory where the save files goes, so perhaps an acsetup.cfg is there.

I also think it's valuable to share a full-resolution screenshot of your room in case others have ideas.

@Crimson Wizard I think when downscaling, we always want linear filtering, maybe the solution would be to have a different setting for when upscaling and when downscaling, so they could have different defaults.

kikiMa

Hello, first of all, thank you for this fantastic software. :)

I am currently working on my first game, and unfortunately, I have encountered the following issue. The game is intended to be published on the web, but it is not running on Firefox. I have searched on Google but couldn't find any relevant information. Is it possible that I have overlooked some setting? :confused:

I am receiving the following error message:
"AGS Alert
Unable to initialize SDL library.
Gamepads not supported
Make sure your browser is compatible with SDL2 Emscripten port."

I would greatly appreciate any help with this issue. Thank you! 8-)

eri0o

#143
That sounds like a bug in SDL2, but just out of curiosity, do you have actual gamepads connected to the computer? If you do does disconnecting makes it work? Can you share information that helps identify the exact gamepad you have (a serial number would be sweet, but at least brand and name).

In AGS the issue is we initialize the video, audio, gamepad and all subsystems together - so if any of them fails, ags fails entirely. It would be best to initialize them separately, so we can recover if the system in the particular platform can be dismissed - which I think that gamepad for the web port is one we could survive errors that appears.

But there has to be an error in SDL2 too, because even if your gamepad is not supported, it should not block the gamepad subsystem from initializing entirely - it should be possible to connect later one or more gamepads and those may be supported.

The fix on AGS side should be very easy, but in SDL2 there are two things: add support for your gamepad, and making it not fail the entire system. The gamepad is only relevant for ags4, I don't remember why it's initialized in ags3 too.

kikiMa

Thank you very much for the quick response!

Hmm, that's strange. I'm not using any gamepads, and I've tested it on different PCs. It also works on Chrome, Safari, etc. Is there a way to exclude gamepads in the scripts at some point?

Crimson Wizard

Quote from: kikiMa on Mon 09/10/2023 08:20:31Hmm, that's strange. I'm not using any gamepads, and I've tested it on different PCs. It also works on Chrome, Safari, etc. Is there a way to exclude gamepads in the scripts at some point?

It's not your problem, it's the engine's issue, it has to be fixed in the engine.

kikiMa

hmm Ok.
Thank you nonetheless!

eri0o

@kikiMa , as mentioned by cw, there is an issue in ags and it should be fixed in the next update. Still, I am trying to understand what happened, you mentioned you don't have a gamepad and that it works in different browsers. Does it means it has the same error in different browsers or you only have this error in a specific browser? Do you see this error in other PCs? Sorry for the additional questions, it's just that this may indicate a problem in SDL2 too, so I would like to look into that too.

Regardless, it should work without this issue in the next AGS update.

RootBound

I'm working on a game with an "export text" feature that saves data to an external text file. Does that work in web versions?
They/them. Here are some of my games:

eri0o

You can't download that specific file. If you are saving it in the same directory as saves, they will be persisted - so you can load it from the same place next time the game opens in the same browser.

RootBound

Hmm. I wanted it to be a plain .txt file the player could keep if desired. Sounds like that won't work for the web port.  :-\
They/them. Here are some of my games:

eri0o

I haven't properly tabulated this, but I guess at some point I (or someone motivated) has to inspect the iframe a of the webstores (itch io, gamejolt, Newgrounds, ...) and make a relation of what types of Feature-Policy are allowed in those. This would give a general idea of what is allowed and what isn't.

---

My general feeling towards file download is that it's best to have it inside a Share action instead, which can have files attached to it. This is more portable - in Android these translate to intent. This avoids having to concede file permissions to an app and instead allows to work with these as they are needed - general file access in Android would require blank permission access to files, which is weird for a game.

Unfortunately SDL doesn't include anything similar to a share action so we would have to either maintain our on or contribute some version of this for SDL. I think in this specific case MAYBE maintaining our own is easier, but I would need to think about this.

RootBound

Thanks, good to know. It's not an urgent issue and I may just make that feature available on the download version only.
They/them. Here are some of my games:

kikiMa

Quote from: eri0o on Tue 10/10/2023 15:03:35@kikiMa , as mentioned by cw, there is an issue in ags and it should be fixed in the next update. Still, I am trying to understand what happened, you mentioned you don't have a gamepad and that it works in different browsers. Does it means it has the same error in different browsers or you only have this error in a specific browser? Do you see this error in other PCs? Sorry for the additional questions, it's just that this may indicate a problem in SDL2 too, so I would like to look into that too.

Regardless, it should work without this issue in the next AGS update.
Hi eri0o,
Sorry, I haven't checked in here for a while!
Oh, that would be great if it gets fixed :)
The issue occurred for me only in the Firefox browser. It worked in Chrome, Safari, etc. I work on both Mac and PC, and the behavior is the same on both. So, Firefox is problematic.

Thanks a lot!

kikiMa

it works now on firefox!
Thank you so much  :-*

eri0o

Thanks @kikiMa !

I couldn't reproduce the previous issue you had in my devices, so the approach we went is to in ags3 we removed any Joystick handling there, as it's not yet supported in the engine, and in ags4 we made so if the joystick part of the engine fails to initialize, it reports but the engine keeps working, at least on currently supported platforms, as it may not be an issue.

So you shouldn't see any crash anymore, but in ags4, it's possible it won't work yet with your specific devices if you want to support joysticks in the web on Firefox - the workaround for the time being is using a different browser if such issue occurs. In the meantime I am working in fixing the SDL2 Emscripten port (SDL itself not ags) upstream, so we can update it to a version that hopefully works without this issue.

eri0o

There has been a recent change that may help improve Safari port, WebKit Webassembly now builds and runs on Windows too, this should make it easier to test things going forward. Until now it only built and ran in macOS. :)

eri0o

#157
I finally managed to upgrade the SDL2 used in Emscripten (to 2.28.4, which is what I tested mostly and concluded is working ok) so it should soon be upgraded AGS too soon. This should fix weird issues related to gamepads - that either you see in the log or you experience when using ags4 with specific configurations.

Ah and I documented how to do that I'm Emscripten, so at least I won't forget this next time I have to do this again. :)

Ah, additionally, I will probably have to introduce a sort of "breaking change" in the port as it will need a screen with a play like button that you click before loading the game. The reason for this is some platforms (iPhone/iPad/macOS Safari) are making it more strict to check that the user actually interacted with the page before allowing the page to emit sounds. This causes the current sound implementation to fail and only start working later (macOS Safari) or not at all (iPhone/iPad).

The workaround is to not start things until the user has clicked the "play" button. I am not sure about loading, if loading should only happen after or if we can start already loading beforehand. I am inclined to let loading go on and simply holdback the play to start after the button is hit.

What would be nice in this is if we add a cover image to the game so that you can personalize this play button somehow.

SMF spam blocked by CleanTalk