Adventure Game Studio | Forums

AGS Development => Editor Development => Topic started by: Crimson Wizard on 05 Dec 2020, 08:58

Title: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Crimson Wizard on 05 Dec 2020, 08:58
So, here's the engine with SDL2 backend, for testing:
http://www.mediafire.com/file/xp8wcfqujkmjp1a/acwin-3.6.0-sdl2-test.zip/file

Repository branch: https://github.com/adventuregamestudio/ags/tree/ags3--sdl2

The updated fix list for SDL2 port: https://github.com/adventuregamestudio/ags/issues/1148

It's based on AGS 3.5.0 with some minor additions, which are probably irrelevant now, and then have Allegro 4 library switched to SDL2.
This is still WIP, and I am interested to know if you can find anything non-working, unexpected, and so on.
If successful, this will become a 3.6.0 release.

EDIT:
The primary reasons for changing libraries were:
* better modern OS support,
* better device support (e.g. Allegro 4 did not have any native touchscreen support, and SDL2 does),
* because Allegro 4 is long discontinued we are stuck with ancient utility libraries based on Allegro 4, or have to write our own.

We still are going to use parts of Allegro 4 embedded into the engine, because SDL2 did not have alternative for everything (Allegro is just a more wholesome library), that's easier approach at the moment.
Raw bitmaps and drawing functions are prime example, as SDL2 has only rudimentary support for that (it's more focused on texture-based gfx).


-----------


Methods to use:
1) Copy to the AGS 3.5.0 Editor directory, backing up old "acwin.exe" (well, or make a full copy of AGS Editor for this test and do it there), rebuild your game, and manually copy SDL2.dll to Compiled/Windows folder (as editor won't do that automatically). Then run resulting game.
2) Copy acwin.exe + SDL2.dll to any existing AGS game, and run acwin.exe. It will use existing setup (except for sound iirc, which will probably be always on).

NOTES:
* SDL2 is currently provided as a separate DLL, which must be present aside with the game exe. But it might be possible to link this library with engine, this is something that I'd look into afterwards.
* Software renderer is now not fully software, to present final game image it will use a method automatically created by SDL2, depending on your system. Which may be DirectX or OpenGL. But you cannot control this now (maybe we will add this to config settings later). Other renderers should work as before.
* This port will potentially support resizable window, but I think I forgot to enable this, so will later.
Will add more notes if remember or find anything noteworthy.
Title: Re: [WIP] AGS SDL2 port for testing
Post by: Monsieur OUXX on 11 Dec 2020, 08:29
Hey! I missed that.

Can you explain what was the main motivation behind moving to SDL2? Was it just to stay up to date and move away from a code base that was no longer going to be maintained, or was it to get some specific feature?

The resizable window is nice.
Title: Re: [WIP] AGS SDL2 port for testing
Post by: Crimson Wizard on 11 Dec 2020, 08:43
Can you explain what was the main motivation behind moving to SDL2? Was it just to stay up to date and move away from a code base that was no longer going to be maintained, or was it to get some specific feature?

Well I wrote quick explanation here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=58611.msg636629504#msg636629504
Quote
The primary reasons for changing libraries were:
* better modern OS support,
* better device support (e.g. Allegro 4 did not have any native touchscreen support, and SDL2 does),
* because Allegro 4 is long discontinued we are stuck with ancient utility libraries based on Allegro 4, or have to write our own.


The updated fix list for SDL2 port: https://github.com/adventuregamestudio/ags/issues/1148

If successful, this will become a 3.6.0 release.

EDIT: added more info to the first post.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Joseph DiPerla on 12 Dec 2020, 23:54
I played "Off the Clock" With the new SDL2 version. Great Job!

I noticed that in the beginning when you pick up the letter in the Allegro version you hear footsteps when the character walks. But on the SDL version, you do not.

Second... Save Games do not work from one version to another. Not sure if this was expected or not. So when I save a game in the Allegro version, you see the save game in the SDL version, but if you select it, the game crashes.

On the other hand, if you save a game in the SDL version and try to restore a game in the Allegro version, the save slot just says Invalid Save Slot and also crashed the game.

But in general, Saves work when restoring from it's own version that the slot was saved on.

Only played about 20 minutes with this version. Will keep playing to see what else I find.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Crimson Wizard on 13 Dec 2020, 13:39
Second... Save Games do not work from one version to another. Not sure if this was expected or not. So when I save a game in the Allegro version, you see the save game in the SDL version, but if you select it, the game crashes.

On the other hand, if you save a game in the SDL version and try to restore a game in the Allegro version, the save slot just says Invalid Save Slot and also crashed the game.

But in general, Saves work when restoring from it's own version that the slot was saved on.

Saves are supposed to work between this and 3.5.0 at least, so that's a bug. But the build also includes some new changes unrelated to SDL2 port, which may cause regressions as well. Ofcourse that will complicate the testing, so I'll be checking these out with a pre-SDL2 build soon.
For example, I noticed that the speech is not skipped by timer when it comes with voice-over, and this happens before SDL2 was added.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: eri0o on 13 Dec 2020, 16:32
I played "Off the Clock" With the new SDL2 version. Great Job!

I noticed that in the beginning when you pick up the letter in the Allegro version you hear footsteps when the character walks. But on the SDL version, you do not.

Just played it, both allegro and SDL2 doesn't have footstep sounds in the first view of the player character (happy walk animation), after the player character reads the letter, then the view (animation) changes to a sad/annoyed walk animation and this one does have footstep sounds in both. So maybe this is what happens in the reported case...
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Crimson Wizard on 14 Dec 2020, 00:36
Second... Save Games do not work from one version to another. Not sure if this was expected or not. So when I save a game in the Allegro version, you see the save game in the SDL version, but if you select it, the game crashes.

Well, following this, I already found 4 unrelated bugs...


I noticed that in the beginning when you pick up the letter in the Allegro version you hear footsteps when the character walks. But on the SDL version, you do not.

I listened really hard to the original game, but do not hear any footsteps before you pick the letter...
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Joseph DiPerla on 14 Dec 2020, 02:12
The footsteps occur after you pick up the letter. Sorry. On the Allegro version, for me, I hear them. But not on the SDL Version. I am not sure if it related to system issues or the transition from Allegro to SDL.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: eri0o on 06 Jan 2021, 11:53
Hey, it would be very helpful if more people could try this version of the Engine on Windows and find more problems/bugs when running theirs or other games available.

Thanks @Joseph DiPerla! I think there's a way to read it on the command line which system SDL2 is using in the computer to output sound but I am not sure.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Crimson Wizard on 16 Jan 2021, 18:05
Updated download to the latest revision, now with multiple fixes mostly not related to SDL port itself, but hopefully will make it easier to distinguish SDL specific problems.
http://www.mediafire.com/file/xp8wcfqujkmjp1a/acwin-3.6.0-sdl2-test.zip/file
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Joseph DiPerla on 18 Jan 2021, 23:10
I don't know if it helps, but I just saw this pull from SCUMMVM for support for AGS: https://github.com/scummvm/scummvm/pull/2738. I know they use SDL. But I don't know how much would be useable or helpful for you due to coding styles and approaches.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Crimson Wizard on 19 Jan 2021, 02:09
I don't know if it helps, but I just saw this pull from SCUMMVM for support for AGS: https://github.com/scummvm/scummvm/pull/2738.

Yeah, and he brought all the unrefactored dirty code there sadly.....
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Dualnames on 23 Feb 2021, 09:03
Hey, I run a test today, some stuff I noticed:

1) Video skipping doesn't work ( I play a video and hitting escape would normally skip it, it doesn't)
2) Not 100% sure on this, but it seemed loading rooms/sprites seems vastly improved!
3) Somehow drawing custom dialog windows seems to be dropping a lot of fps, like FPS goes to 20 from 40 being the default.
4) Speech doesn't seem to work.
Title: Re: [WIP] AGS SDL2 port for testing (supposedly AGS 3.6.0)
Post by: Crimson Wizard on 23 Feb 2021, 14:54
2) Not 100% sure on this, but it seemed loading rooms/sprites seems vastly improved!

This is not related to SDL2 port, but likely to addition of buffered file reading which speeds up loading data from disk. I did some tests in the past and it seem to improve loading times by 15-20%, iirc.

3) Somehow drawing custom dialog windows seems to be dropping a lot of fps, like FPS goes to 20 from 40 being the default.

I'd need to have some test case to compare and debug, as there are too many factors here. Also, I assume you mean custom dialog options?

4) Speech doesn't seem to work.

Do you mean text or voice-over?
EDIT: I tested several games, and both seem to work. What exactly happens in your case?


I'll be posting a 3.5.1 beta release after small time, some of the issues or improvements may be coming from it, so it would be interesting to compare.


UPDATE: uploaded an updated version containing few fixes (same link).