Adventure Game Studio | Forums

AGS Support => AGS Engine & Editor Releases => Topic started by: Crimson Wizard on 25 Mar 2021, 02:28

Title: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 25 Mar 2021, 02:28
AGS 3.6.0 - Alpha - for Public Test

ACHTUNG!
(http://i.imgur.com/3gHhXIz.png)
This is a ALPHA version of AGS 3.6.0.
It's not considered stable yet and must go through extensive testing.
Use at your own risk. Please back up any games before opening them in this version of AGS.
New settings in this version may make your project files unusable in previous versions after saving with this version.


Last update: 13th September 2021


Preword

This release presents a SDL2-based engine. For about 2 decades AGS engine was based on Allegro 4 graphic library, which was discontinued somewhere in the early 2010-ies (only received few patches since). There was an intent to move either to Allegro 5 or SDL (1 or 2) since, but for various reasons this task was continiously postponed. Finally we have a good progress there enough to make a build for public test.
(NOTE: Allegro 5 is very different in everything, therefore it was not trivial to just go from Allegro 4 to 5. In fact it appeared to be easier to change from Allegro 4 to SDL2).

NOTE: contains all the changes from AGS 3.5.1 (Patch 3) (https://www.adventuregamestudio.co.uk/forums/index.php?topic=59376.0).


Credits

- SDL2 port mostly done by Nick Sonneveld;
- New Android player made by eri0o;
- me basically gathered Nick Sonneveld's works together, tidied and fixed where necessary.
+ added some new script commands
+ some stuff added by Alan v. Drake.


Downloads and instructions

* Full AGS 3.6.0 as installer (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.9/AGS-3.6.0.9-Alpha10.exe)
* Full AGS 3.6.0 as a .zip archive (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.9/AGS-3.6.0.9-Alpha10.zip)
* SDL2.dll (v2.0.12) for Windows (just in case it's missing) (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.0/SDL2-2.0.12-win32-x86.zip)

* Android game player (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.9/AGS-3.6.0.9-debug.apk), aka launcher (APK signed with Debug key), suitable for running any compatible AGS game.
* Android native libs (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.9/AGS-3.6.0.9-android-libs-release.zip), for building your own signed game APK.


Notable changes related to new backend

* Freely resizable window (in desktop windowed mode, obviously).
* Software renderer uses SDL2 as a final output, meaning the actual drawing on screen may be done by anything that your system supports from DirectX to OpenGL. This presumably ensures that it works on any version of Windows.
* Fully rewritten audio playback, now uses OpenAL interface and modern SDL-based sound library.
* On Android supports both "software" and "hardware" types of renderers (they are both OpenGL but use different approaches drawing sprites and effects).
* New rewritten Android game player (aka "launcher"). Suitable for building for Google Play and similar stores, can read game assets from the android-specific packages (apk, aab).
* Removed AVI/MPEG video support (may be temporary...). The main reason is that in the old engine they were implemented using Windows-only DirectX interface and Allegro 4 was already providing access to these. SDL2 does not, and it may be an extra hassle to recreate them. So this is under question now.
* For similar reasons removed support for DirectX-related functions in plugin API. I'm afraid this will break some older plugins that require DirectDraw and similar things. Direct3D plugin maybe will continue working as it wants Direct3D renderer, and that is still present.


Other Notable engine/editor changes

Engine now supports Unicode translations. More information on use is here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59240.0

Editor supports packing custom files into the game (General Settings -> Compiler -> Package custom data folder(s)). These may be read in script using File.Open with "$DATA$" path token.

Fixed display of certain TTF fonts which previously had their heights calculated wrongly. This could lead to incorrect vertical alignment, as well as texts being cut of at the bottom due to the graphical surface being not larger enough.

Custom font outline thickness and style, works for automatic outlines only. In the font properties you may set how thick outline is in pixels, and choose between "Square" and "Round" style.

Removed a limit of Overlays created at the same time (was 30).

Now has 16 max Audio Channels (was 8).


New Script API

 - DrawingSurface.DrawImage() and DrawSurface() now accept optional source rect coordinates, so you can draw a chosen part of the sprite directly;
Code: Adventure Game Studio
  1. DrawingSurface.DrawImage(int x, int y, int spriteSlot, optional int transparency, optional int width, optional int height,
  2.                 optional int cut_x, optional int cut_y, optional int cut_width, optional int cut_height);
- Functions for getting drawing surfaces for room areas and regions, letting you paint them at runtime:
   static Hotspot.GetDrawingSurface(), static Region.GetDrawingSurface(), GetDrawingSurfaceForWalkableArea(), GetDrawingSurfaceForWalkbehind();
 - Room.Exists(): tests if the room of certain number is available;
 - Every function accepting file path now supports "$DATA$" location token, which lets you read game resources. This was added mainly for reading custom packed files, but will work with any game resource fwiw. Opening files like this will only work in read mode, writing will fail. Examples:
Code: Adventure Game Studio
  1. File *f = File.Open("$DATA$/MyDir/myfile.txt", eFileRead);
Code: Adventure Game Studio
  1. ListBox.FillDirList("$DATA$/MyDir/*.*");
- WaitMouse(): complements other Wait* functions.
 - SkipWait(): skips current Wait (will normally only work from repeatedly_execute_always callback).
 - All the Wait* functions now accept "0" as "no timeout", in which case waiting may only be interrupted using either corresponding input or SkipWait.
 - All the Wait* functions now return a code telling how they were interrupted:
Quote
* positive value means a key code;
* negative value means a -(mouse code);
* 0 means timeout or interrupt with a script command.
- AudioChannel.Pause(), Resume() functions and AudioChannel.IsPaused read-only property.
 - AudioClip.PlayOnChannel() lets you play a clip explicitly on a certain channel, disregarding any audio type rules. Works with channels 1-7 now (channel 0 is kept reserved for a speech voice-over).
 - Characters now may be scaled freely, not limited to 5 - 200% (new range is 1 - 32767 for technical reasons).
 - Object.SetView() now resets loop and frame to 0 by default. Previously default was -1 which made object retain loop & frame, which was often unexpected, and could cause game errors.
 - Object.ManualScaling and Scaling properties, now letting to scale an object by command similar to Character (previously objects were only scaled by the walkable area).
 - Game.BlockingWaitSkipped: returns the last reason of the last blocking action interruption: this is same as Wait* function return value, but also works for skipped blocking speech, and so on.
 - readonly Overlay.Width and Overlay.Height: let you know the overlay's size;
 - Overlay.Transparency lets you change overlay's translucency without recreating its image.
 - Overlay.ZOrder lets you to define overlay's drawing order on screen. Overlays are now sorted among GUIs.
 - Speech.TextOverlay and Speech.PortraitOverlay: give access to the text and portrait overlays of a current blocking speech. In practice these are only available in repeatedly_execute_always callback. Among other things, these properties allow to detect appearance, removal, and change of the blocking speech; also calling Speech.TextOverlay.Remove() will work as a speech interrupt.
 - System.Log(): prints into the engine log.



Expected problems

* On Windows we currently build engine dynamically linking to SDL2.dll. This means one have to be put along with the game exe. Because this may be a hassle, I suppose we may later change this to static linking just like Allegro 4 was linked to the engine before.
* On Linux, if you are using our prebuilt binaries you should be fine, if not then you have to install SDL2 runtime libs on your linux system.
* Noticed there may be problems playing MIDI, again need to test more and fix.
* Can't yet configure what exactly software renderer uses for final output - it will be decided automatically by SDL2.
* Not really much ways to configure audio output yet (on Windows you likely won't need that though).
* Anything we don't know yet about ....

Title: Re: AGS 3.6.0 WIP (Alpha) - SDL2-based engine for Public Test
Post by: Joseph DiPerla on 29 Mar 2021, 15:05
Nice. I will give this ago within the next couple of days. Thank you all!
Title: Re: AGS 3.6.0 WIP (Alpha 2) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 06 Apr 2021, 09:40
Updated to Alpha 2, this is just to include latest fixes and changes from AGS 3.5.1, to keep them in sync.

New download links in the first post.
Title: Re: AGS 3.6.0 WIP (Alpha 2) - SDL2-based engine for Public Test
Post by: nightmarer on 11 Apr 2021, 20:49
Hello.

I have received this error while running a room.
https://imgur.com/byuwNv7 (https://imgur.com/byuwNv7)
x1 x2 x4 x8
Title: Re: AGS 3.6.0 WIP (Alpha 2) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 11 Apr 2021, 21:07
I have received this error while running a room.
https://imgur.com/byuwNv7 (https://imgur.com/byuwNv7)
x1 x2 x4 x8


Does this room open well in the editor? If so, can other engine (like 3.5.1) run same game?
Title: Re: AGS 3.6.0 WIP (Alpha 2) - SDL2-based engine for Public Test
Post by: nightmarer on 11 Apr 2021, 22:16
Hello, I'm not having this error in the 3.5.1 version.
This error happens while being in that room during a half minute. It is truth that this room has a lot of things going on, animations and other events, but it works fine in the 3.5.1.
Title: Re: AGS 3.6.0 WIP (Alpha 3) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 18 Apr 2021, 03:51
Updated to Alpha 3, this is just to include latest fixes and changes from AGS 3.5.1. New download links in the first post.


Hello, I'm not having this error in the 3.5.1 version.
This error happens while being in that room during a half minute. It is truth that this room has a lot of things going on, animations and other events, but it works fine in the 3.5.1.

Sorry, I did not have a chance to reply. I don't think I will be able to do much without game itself. Can I get a copy to test?
Title: Re: AGS 3.6.0 WIP (Alpha 3) - SDL2-based engine for Public Test
Post by: nightmarer on 20 Apr 2021, 08:40
Hello.

The thing is that it happens randomly. Yesterday I got the same error in another part of the game.
But I tried to replicate and it doesn't happen.
https://imgur.com/a/oyD4syF (https://imgur.com/a/oyD4syF)
Title: Re: AGS 3.6.0 WIP (Alpha 3) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 20 Apr 2021, 15:06
The thing is that it happens randomly. Yesterday I got the same error in another part of the game.
But I tried to replicate and it doesn't happen.
https://imgur.com/a/oyD4syF (https://imgur.com/a/oyD4syF)

I won't be able to solve anything having only this error message, because there may be various reasons why program runs out of memory.
I would like to test and compare the game in 3.5.1 and 3.6.0 to observe how much memory they use, and and maybe find out what causes this difference.
Title: Re: AGS 3.6.0 WIP (Alpha 3) - SDL2-based engine for Public Test
Post by: Potajito on 26 Apr 2021, 21:04
Hi!
So far, so good, but the game crashes when I alt-tab when running in Full Screen mode. (Compiled exe). No problems so far Windowed.
This is the error:
https://imgur.com/zOZodXH
Let me know if you think this is worth investigating/need any more info.
Thanks for everything!
Title: Re: AGS 3.6.0 WIP (Alpha 3) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 11 May 2021, 03:14
Heads up regarding the memory issue: there's definitely a memory leak in this version, and it seems to be related to audio (found out by disabling certain functions in the engine code).

EDIT: well, apparently the loaded audio never gets deleted from memory in the new code.

The easiest way to observe this is:
Code: Adventure Game Studio
  1. function room_RepExec()
  2. {
  3.         atest.Play();
  4. }
  5.  

game crashes in several seconds.

or more manual:
Code: Adventure Game Studio
  1. function on_key_press(eKeyCode key)
  2. {
  3.         atest.Play();
  4. }
  5.  
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 12 May 2021, 00:45
Updated to Alpha 4
(use download links in the first post)

Updated to include all changes from v.3.5.1.5.

Fixed major memory leak in the audio subsystem.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: eri0o on 12 May 2021, 15:48
@Potajito, do you still have the crash when alt+tabbing?
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Potajito on 16 May 2021, 20:14
@Potajito, do you still have the crash when alt+tabbing?
Yes as of 3.6.0.3! That is, using Direct9. Open GL is all fine (was also with previous alpha). Are we not supposed to used Directx?
Thanks!
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 23 May 2021, 04:20
Potajito, we found out that this is because AGS 3.6.0 does not properly support suspending the game when it's alt+tabbed, so it always keeps running and redrawing in background. And Direct3D seem to not like that in fullscreen: similar error happens if you run any previous version in fullscreen and have "SetMultitaskingMode(1)" in script.

So, the fix is then first to restore proper handling of disabled multitasking (which is the default) and then figure out conditions under which game should not be redrawn even if multitasking is on.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Potajito on 24 May 2021, 10:26
Potajito, we found out that this is because AGS 3.6.0 does not properly support suspending the game when it's alt+tabbed, so it always keeps running and redrawing in background. And Direct3D seem to not like that in fullscreen: similar error happens if you run any previous version in fullscreen and have "SetMultitaskingMode(1)" in script.

So, the fix is then first to restore proper handling of disabled multitasking (which is the default) and then figure out conditions under which game should not be redrawn even if multitasking is on.
Nice! Thanks for looking into it. I'm more than happy using just OpenGl, but you never know what people would prefer.

Another one on the latest Alpha 4:
(https://i.imgur.com/Sj9bDW5.png)

When creating a new project, either new or from a template.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 24 May 2021, 10:39
Where do you create your game, is the location writeable and you have permissions there? Were you able to create a game in the same place with the previous versions (3.5.0, 3.5.1)?
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Potajito on 24 May 2021, 11:55
Where do you create your game, is the location writeable and you have permissions there? Were you able to create a game in the same place with the previous versions (3.5.0, 3.5.1)?
Yep, it is writable! in fact what I did was create a project in 3.5 (same folder, same name) and then just open it with 3.6.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 24 May 2021, 12:29
Yes, there's something wrong with it, I'll investigate.


EDIT:
Sorry for this, there was a stupid mistake made in template extraction.

The fixed version will be available here, under "Artifacts", as soon as build server finishes working:
https://cirrus-ci.com/task/6038530150367232
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 04 Jul 2021, 02:51
Seeing as some people already use this engine when building their games, I'd like to ask for an opinion of Windows users about SDL2.dll.

All the previous versions depended on "Allegro 4" library, but that library was merged with the engine exe, so you only had that game.exe or acwin.exe to handle and copy around.

This new version currently links SDL2 library dynamically, so you have to additionally have SDL2.dll.

Is this a big deal for people? I think we may reconfigure the engine to use "static linking" with SDL2. This is bit less flexible (e.g. one won't be able to swap it by hand if it needs an update), but I don't remember if there are other disadvantages.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Gilbert on 04 Jul 2021, 03:56
I'm not familiar with these kind of stuff, but my question is, does it matter which version of the dll the user have?
That is, is the AGS engine guaranteed to work with whatever version (or, at least the newest version one can retrieve from the net) of sdl2.dll one has on their hands?
So, if sdl2.dll is not of the same version used when the AGS engine is compiled the games still work?
If the engine works only with specific version of the dll I think it's better to link it statically to the executable. (Or, at least advise people to include the file when they distribute their games).

I have been using some very old programming package and the resultant executables rely on openal32.dll to run. However, they only work with the dll precompiled included with the engine, not every other version you can find on the net.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on 04 Jul 2021, 04:16
I'm not familiar with these kind of stuff, but my question is, does it matter which version of the dll the user have?

Yes of course. The DLL's interface should be matching: function prototypes, but also function adresses in memory I think. So it mostly depends on how the library developers keep backwards compatibility (if they do). It may stay compatible in a small range of updates, or larger range, but I don't know about this particular lib.


Maybe I should not have mentioned this point at all, as being able to swap the DLL is not important. Having DLL may simply mean less maintenance for engine devs.

Or, at least advise people to include the file when they distribute their games

If we have it as DLL we will definitely include it with Editor's distribution, there's no question about that.
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 04 Jul 2021, 20:31
Updated to Alpha 5
(use download links in the first post)

Updated to include all changes from v.3.5.1.8.

Updates sound library, this fixes few sound formats not playing in the new engine.



SUPER EXPERIMENTAL, but AGS now supports Unicode translations, if your TRS files are saved as UTF-8 and certain hint is added to the files, engine should correctly interpret the text as unicode, and display unicode texts with appropriate fonts.

Unfortunately texts in the game properties and script cannot contain unicode yet. Hence we call it "partial unicode support".

More explanation on how to use Unicode translations in your game may be found here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59240.0

In short, you should have following line among the other options in TRS file:
Code: [Select]
// Text encoding hint
//#Encoding=UTF-8

The translation compiler will add it to TRA data, to let engine know to interpret these translations as unicode.
If there's no such line, or value it empty, - it will be interpreted as ASCII.

And TRS should of course be saved as UTF-8 (plain UTF-8, without BOM!).
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Joseph DiPerla on 05 Jul 2021, 03:35
Neat. I am sure there are quite a few who need this feature.
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Gilbert on 05 Jul 2021, 08:17
If we have it as DLL we will definitely include it with Editor's distribution, there's no question about that.
Should be okay, but it's still safer to put a note somewhere to remind people to distribute their games with the dll file. Say, if for some stupid reasons (such as errr... saving space?) someone doesn't ZIP the entire Compiled folder of their game for distribution, but decides to remove a few files from it they may receive confusing reports from players, that some could run the game (as long as a compatible dll file is in the path) and some couldn't (can be either missing the file from the path or they have a version sdl2.dll file in the path that is not compatible with that particular AGS engine; an even nastier problem is a player might be able to run the game at one point, but after some updates of their system that somehow updated also the sdl2.dll in the path would suddenly make the game unstartable).

Another problem is when someone wants to run a game in a different version (e.g. drops the engine of say V3.8 onto the folder of a game created with V3.6) and if these two engine versions somehow use different version of the dll this may not work, until they also drops a suitable version of the dll file onto the folder. Swapping engine is considered a more advanced action though, so I think it's less of a problem here.

We're glad that currently the AGS engine only relies on one single external library to work, so either way it's not a very big problem ATM.
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: eri0o on 05 Jul 2021, 11:48
We could have a directory inside the Editor install directory named platforms (or runtime) and then inside this directory have one for each OS: Windows, Linux, ... And then inside these, one for each Architecture.

Then when picking up the engine, the Editor would just grab everything in the directory specified. So in this way, if the engine was built with static library (which I prefer and think is the best approach) or dynamic library, it will work with both. Of course we still need to figure out default, but at least it could pickup both from it's specific engine directory.
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Andrea1992 on 06 Jul 2021, 07:53
Hey guys. I opened my game with AGS 3.6.0 alpha 4 and everything has played amazingly. We made the game with AGS 3.5.0.24. I also tried the android launcher.

This new version currently links SDL2 library dynamically, so you have to additionally have SDL2.dll.

Is this a big deal for people?

I do not think it's a big deal, it's great. The improvements ARE  a big deal. Many many thanks for the hard work.

The performance, animations, interactions, the whole game feels smoother and quicker than previous versions. I love that I can change the audio output device and the game reacts to that!

I'm not getting Potajito nor nightmarer issues. It's all good.

Some small things I noticed and questions:

*maybe i'm doing something wrong or missed something, but I cannot reproduce any video.
  I was using .ogv without problems in the 3.5 version. Now it says "Unable to load theora video 'videoname.ogv' ".
  I tried mp4 but it's not supported as you stated.
  Any recommendation? Thanks

*In full screen, it behaves similar to windows mode, I can move the cursor outside of the game (I have two monitors) and if I click outside, the game minimizes. This happens even if I "auto lock to window" in the mouse options in winsetup.
Something similar happens in AGS 3.5 with openGL only. When the cursor clicks very near the edge, it bounces down to the bottom of the screen and minimizes the game. Is it possible to fix this in AGS 3.5?

*Not important, just to mention, but in debug mode ctrl+X for changing rooms, I cannot write the room number as I used to in previous versions. I use a lot this function because it's faster to write the number than clicking the arrow (i have more than 100 rooms)

*And finally, I don't have much to compare to the android version  since it's the first time I use the launcher. Here I just have two questions.
The process to create a standalone apk is the same as previous versions? I have read about it but never tried. If the process is indeed the same, what libraries should I use?
And second, how can I get the keyboard to appear in the screen using the 3.6 launcher? anyway, sorry if this is answered in some other forums but couldn't find any.
In general, I love it! the game plays nicely on the phone. There are some rooms with big backgrounds, alpha channel or parallax that do not plays well, but It's an easy fix I guess.

We're releasing our game in STEAM in the couple of weeks, therefore we're using the AGS 3.5 version, we don't have the time to do a thorough test. But looking forward to do it and update it in the future.

Thanks again for doing this.
Have a great day.

Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Manu on 06 Jul 2021, 09:40
I compiled 3.6.0.4 on my Mac from source code (followed the guide I posted some days ago in the Mac thread). My game works perfectly. The only problem that I found is that in windowed mode, there's no way to open the game with the window enlarged. The game always opens in a small window 320x200 in the center of the screen. I can drag the window corner and resize works perfectly, respecting the ratio, but the game always starts small. This is the config.

Code: [Select]
[graphics]
driver=software
windowed=1
screen_def=max
game_scale_fs=proportional
game_scale_win=max_round
filter=stdscale
vsync=0
render_at_screenres=1
match_device_ratio=1

I tried also with "game_scale_win=3", it doesn't change.


Another thing: how to distribute the game for mac? My game works probably because I have SDL2 installed on my MacBook, but if I want to send the game to someone else how can I embed the library?
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: eri0o on 06 Jul 2021, 11:15
Quote
I compiled 3.6.0.4 on my Mac from source

How do you do it? CMake is wired to do full static library compilation. It doesn't depend on anything, you can check with ldd on command line.
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Manu on 06 Jul 2021, 11:25
How do you do it? CMake is wired to do full static library compilation. It doesn't depend on anything, you can check with ldd on command line.

I don't understand your question. I just downloaded ags-v.3.6.0.4.zip, extracted it, copied the resources of the game, compiled it with "Cmake" and "make" (like I did with 3.5.1.8). Everything worked smoothly. It wasn't supposed to work?
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: eri0o on 06 Jul 2021, 13:21
Quote
My game works probably because I have SDL2 installed on my MacBook

Perhaps I am not understanding what you said. What do you mean by the above?

To clarify, all cmake builds are self contained in any OS, it's scripted to download all dependencies, build them on your machine, and static link to all of them. The result is a self contained binary that should work pretty much anywhere that's the same OS and architecture.

So if you are referring to a binary you built on MacOS, SDL2 is already inside the binary. It should work as long the standard C libraries are compatible across machines.

About distribution, you need to notarize and sign your application, here's a guide:
http://www.edenwaith.com/blog/index.php?p=112
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Manu on 06 Jul 2021, 15:35
So if you are referring to a binary you built on MacOS, SDL2 is already inside the binary. It should work as long the standard C libraries are compatible across machines.

Ah ok, I get it now. I thought the SDL2 was not in the binary, because I read for the windows version the DLL should be zipped together with the exe. Or am I wrong?
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: eri0o on 06 Jul 2021, 15:53
Quote
Ah ok, I get it now. I thought the SDL2 was not in the binary, because I read for the windows version the DLL should be zipped together with the exe. Or am I wrong?

Windows version provided by the Editor is built with a different build system (using VS Solutions). And there hasn't been a decision yet to build it statically or to keep it dynamically yet, this is why it's not shipped together yet.

If you use CMake on Windows, a static-linked version of ags executable will be built.

For Windows and Linux, for distributable binaries, I recommend using the Docker Images generated by the CI or building the same images from the Dockerfiles as a standardized build environment - it's not needed, on Windows it should be fine, but on Linux you may have glibc incompatibilities when running your binary elsewhere.
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 06 Jul 2021, 22:43
I compiled 3.6.0.4 on my Mac from source code (followed the guide I posted some days ago in the Mac thread). My game works perfectly. The only problem that I found is that in windowed mode, there's no way to open the game with the window enlarged. The game always opens in a small window 320x200 in the center of the screen.

I finally realized why that may be, will link a test build soon.

EDIT: https://cirrus-ci.com/build/5531686894043136
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 15 Jul 2021, 01:02
Updated to Alpha 6
(use download links in the first post)

Backported a number of simplier Script API entries from the experimental ags4 branch; because many of them are ready for a while, and they are simple enough to not require big changes to the engine:

 - DrawingSurface.DrawImage() and DrawSurface() now accept optional source rect coordinates, so you can draw a chosen part of the sprite directly;
Code: Adventure Game Studio
  1. DrawingSurface.DrawImage(int x, int y, int spriteSlot, optional int transparency, optional int width, optional int height,
  2.                 optional int cut_x, optional int cut_y, optional int cut_width, optional int cut_height);
- Room.Exists(): tests if the room of certain number is available;
 - WaitMouse(): complements other Wait* functions.
 - SkipWait(): skips current Wait (will normally only work from repeatedly_execute_always callback).
 - All the Wait* functions now accept "0" as "no timeout", in which case waiting may only be interrupted using either corresponding input or SkipWait.
 - All the Wait* functions now return a code telling how they were interrupted:
Quote
* positive value means a key code;
* negative value means a -(mouse code);
* 0 means timeout or interrupt with a script command.
- Object.SetView() now resets loop and frame to 0 by default. Previously default was -1 which made object retain loop & frame, which was often unexpected, and could cause game errors.
 - Object.ManualScaling and Scaling properties, now letting to scale an object by command similar to Character (previously objects were only scaled by the walkable area).
 - Game.BlockingWaitSkipped: returns the last reason of the last blocking action interruption: this is same as Wait* function return value, but also works for skipped blocking speech, and so on.
 - Speech.TextOverlay and Speech.PortraitOverlay: give access to the text and portrait overlays of a current blocking speech. In practice these are only available in repeatedly_execute_always callback. Among other things, these properties allow to detect appearance, removal, and change of the blocking speech; also calling Speech.TextOverlay.Remove() will work as a speech interrupt.
 - System.Log(): prints into the engine log.


Oh, and Characters now may be scaled freely, not limited to 5 - 200% (new range is 1 - 32767 for technical reasons).
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Manu on 15 Jul 2021, 09:36
Great job! Thanks for adding System.Log(), super useful addition.
Title: Re: AGS 3.6.0 WIP (Alpha 5) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on 15 Jul 2021, 10:13
- WaitMouse(): complements other Wait* functions.
 - SkipWait(): skips current Wait (will normally only work from repeatedly_execute_always callback).
 - All the Wait* functions now accept "0" as "no timeout", in which case waiting may only be interrupted using SkipWait.

Is -1 still a valid parameter for Wait* functions?
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 15 Jul 2021, 10:24
Is -1 still a valid parameter for Wait* functions?

What is -1  :-\? I tried in AGS 3.5.1 and passing anything negative results in error.
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on 15 Jul 2021, 10:27
Is -1 still a valid parameter for Wait* functions?

What is -1  :-\? I tried in AGS 3.5.1 and passing anything negative results in error.

I seem to recall it was mentioned on Discord? I'll try to find the conversation, maybe I'm getting things mixed up...
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on 15 Jul 2021, 10:37
Found the conversation and you're right; somebody mentioned that WaitMouseKey(-1) was an alternative in 3.5.1 to while(WaitMouseKey(1) == 0) {}, but indeed, it didn't compile. For some reason, the idea that -1 was valid had gotten stuck in my head.
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 16 Jul 2021, 05:14
I'm sorry, but I'll have to fix and reupload the latest version, because the speech is broken completely, I forgot to test it.
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 16 Jul 2021, 07:53
Ok, I fixed the broken speech bug, and reuploaded Alpha 6 version, please download again.
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 16 Jul 2021, 08:48
In regards to the recent additions, Speech.TextOverlay and Speech.PortraitOverlay are exposing internal overlays created by the engine for the standard blocking speech.
They may come useful if you don't want to bother writing full custom speech, but at the same time would like to do some adjustments to built-in one.

Couple of examples of what you may do with them in script:


Detecting when the blocking speech has begun, changed to the next line or is over:
Code: Adventure Game Studio
  1. Overlay* lastSpeech;
  2.  
  3. function late_repeatedly_execute_always() {
  4.     Overlay* curSpeech = Speech.TextOverlay;
  5.     if (lastSpeech == null && curSpeech != null) {
  6.          // speech has started
  7.     } else if (lastSpeech != null && curSpeech == null) {
  8.          // speech is over
  9.     } else if (lastSpeech != null && curSpeech != lastSpeech) {
  10.          // speech changed to the next line
  11.     }
  12.     lastSpeech = curSpeech;
  13. }
  14.  


Waving a speech portrait up and down
Code: Adventure Game Studio
  1. #define PORTRAIT_YMIN 5
  2. #define PORTRAIT_YMAX 30
  3. int plast = -1;
  4. int pmove = 1;
  5. function repeatedly_execute_always() {
  6.         if (Speech.PortraitOverlay != null) {
  7.                 if (plast >= 0) Speech.PortraitOverlay.Y = plast;
  8.                 Speech.PortraitOverlay.Y += pmove;
  9.                 if (Speech.PortraitOverlay.Y < PORTRAIT_YMIN) pmove = 1;
  10.                 if (Speech.PortraitOverlay.Y > PORTRAIT_YMAX) pmove = -1;
  11.                 plast = Speech.PortraitOverlay.Y;
  12.         }
  13. }
  14.  
Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Manu on 16 Jul 2021, 17:20
I receive this exception when I try to save the game with 3.6.0.5 editor.

https://ibb.co/CtCM3yb

Let me know if I can do something to solve it.

Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 16 Jul 2021, 18:36
I receive this exception when I try to save the game with 3.6.0.5 editor.

https://ibb.co/CtCM3yb


Apparently this error has been there since previous alpha, but was not noticed for some reason.
There will be a fixed build here after a short while: https://cirrus-ci.com/task/6002945838809088
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 18 Jul 2021, 23:15
Updated to Alpha 7
(use download links in the first post)

Had to do another update soon, because number of serious bugs were found and fixed recently.

* Editor not saving sprite file correctly after new sprites were added;
* Some OGV videos not loading;
* AudioChannel.PositionMs only returning values with second-precision;
* Papagayo lip sync not working well (related to the above);
* few less important ones.


Also we now distribute SDL2.dll within the Editor's installer/zip file, for convenience (at least until we change to static SDL2 linking).
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Mehrdad on 19 Jul 2021, 06:07
Sorry, The links doesn't work for me.
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: arj0n on 19 Jul 2021, 07:53
Sorry, The links doesn't work for me.
There's a "v." in the folder name which shouldn't be there.
Go here and scroll down a bit for the DL's: https://github.com/adventuregamestudio/ags/releases/tag/3.6.0.6
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 19 Jul 2021, 08:18
Fixed links.

I created downloads with the wrong folder, but since it's an alpha version I'd leave it as it is perhaps.
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 01 Aug 2021, 03:32
I have a small idea, but I'd like to hear some opinions, in case someone can see problems with this.

There has been an ongoing struggle with audio system in AGS, when people try to make channels work like they want but AGS has its own mind and results are often unexpected.

Not planning any system rewrite in this version, but I thought that it may be possible to ease this situation by giving a more "low-level" function for those who might want to write their own channel logic in scripts. The idea is to introduce a new function e.g. AudioClip.PlayOnChannel(int chan, optional AudioPriority, optional RepeatStyle). This function would put the clip on the exactly given channel, ignoring any rules, such as audio type reservation, priority, and so on. In other words, so long as the sound is successfully loaded, it will be put on exactly that channel no matter what.
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Dualnames on 02 Aug 2021, 08:06
Does AGS struggle with audio being cut now, with SDL being implemented?
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 02 Aug 2021, 12:00
Does AGS struggle with audio being cut now, with SDL being implemented?

Do you have a sound clip or a game for a test?
Title: Re: AGS 3.6.0 WIP (Alpha 7) - SDL2-based engine + Unicode Translations
Post by: Potajito on 03 Aug 2021, 13:20
Does AGS struggle with audio being cut now, with SDL being implemented?
I used to get that a lot in previous AGS versions, but with SDL so far I haven't had that issue.
Title: Re: AGS 3.6.0 WIP (Alpha 8) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 06 Aug 2021, 12:36
Updated to Alpha 8
(use download links in the first post)


More fixes
* SDL2 Software renderer now draws 8-bit games correctly again;
* Fixed AudioClip.Play() wrongly returning success even when the audio system failed to load the sound.


Sprite manager update
* There's now a Zoom slider, and zoom may be changed with a Ctrl+mousewheel.
* Can drag & drop image files from the file explorer to import them into the game.


Support packing custom files in game, and reading game resources in script

Editor now can pack custom files into the game. The option is General Settings -> Compiler -> Package custom data folder(s). This setting accepts a comma-separated list of folders. These folders must be located inside the game project. All of their contents will be packed into the game, including ones in subfolders and their subfolders recursively.

These files may be opened for reading in script using File.Open with "$DATA$" path token.

All the script functions that accept filepaths now support "$DATA$" token. This makes them work with the game resources. Game resources may be only opened for reading.
For example:
Code: Adventure Game Studio
  1. // open custom packed file
  2. File *f = File.Open("$DATA$/MyDir/myfile.txt", eFileRead);
  3. // create a dynamic sprite out of a custom packed image file
  4. DynamicSprite *spr = DynamicSprite.CreateFromFile("$DATA$/MyDir/mypic.bmp");
  5. // List all existing resources
  6. ListBox.FillDirList("$DATA$/MyDir/*.*");
  7.  

You may even use this with regular game files, even though that may be not commonly meaningful (if only for some hacks):
Code: Adventure Game Studio
  1. // List all existing rooms
  2. ListBox.FillDirList("$DATA$/*.crm");
  3.  


Room masks may be retrieved as 8-bit DrawingSurfaces and modified in script

Code: Adventure Game Studio
  1. static DrawingSurface* Hotspot.GetDrawingSurface();
  2. static DrawingSurface* Region.GetDrawingSurface();
  3. DrawingSurface* GetDrawingSurfaceForWalkableArea();
  4. DrawingSurface* GetDrawingSurfaceForWalkbehind();
  5.  

Because these are 8-bit images, and each area index corresponds to one of the colors from 0-255 range, painting certain area is as trivial as
Code: Adventure Game Studio
  1. ds.DrawingColor = 4; // will draw area number 4.
  2.  

You may do almost everything with them, but "DrawImage" will only work correctly if you draw a 8-bit image, otherwise colours will get all messed up (also I think this may cause crashes).


AudioClip.PlayOnChannel()

This is a workaround for AGS audio system limitations.

This function lets you play a clip explicitly on a certain channel, disregarding any audio type rules. So you may script your own channel logic.
Works with channels 1-7 now (channel 0 is kept reserved for a speech voice-over).


Misc stuff

Added readonly Overlay.Width and Height properties to let know the size of the overlay.
Title: Re: AGS 3.6.0 WIP (Alpha 9) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 26 Aug 2021, 15:44
Updated to Alpha 9
(use download links in the first post)

Has all fixes from AGS 3.5.1 - Patch 3.

Also...

Fonts

Fixed display of certain TTF fonts which previously had their heights calculated wrongly. This could lead to incorrect vertical alignment, as well as texts being cut of at the bottom due to the graphical surface being not large enough.

Added support for custom automatic outline thickness and style, originally created by fernwelten. You may now choose outline thickness in font properties, and choose between Square or Round automatic outlines.

Overlays

There's no more limit to how many overlays you may create and have simultaneously.

Overlays now have ZOrder property and are sorted among the GUI. By default, for backward compatibility, speech overlays have very high ZOrder, which places them on top, and custom overlays have a very low negative zorder, which places them below GUI. But you may change that using that property.

Added Overlay.Transparency, which lets you change overlay's translucency without recreating its image.

Android

eri0o had adjusted a game project template for building for Google Play and similar stores. Engine now supports reading game assets from the Android-specific packages (apk, aab).
For more information please visit this post: https://www.adventuregamestudio.co.uk/forums/index.php?topic=55681.msg636638927#msg636638927
We'll be writing a better documentation after a while.


I think we may be done adding new features to this version; there's already more than anticipated. Now it's time to test, fix and polish what we have.
Title: Re: AGS 3.6.0 WIP (Alpha 9) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 27 Aug 2021, 06:12
A small update, I found an annoying bug in the latest alpha release, and reuploaded a fixed version.

The problem was related to Editor failing on some paths with non-latin characters; please keep an eye on such situations.
Title: Re: AGS 3.6.0 WIP (Alpha 9) - SDL2-based engine + Unicode Translations
Post by: ThreeOhFour on 31 Aug 2021, 02:21
I just wanted to stop by and sing my praise for the way AGS handles regions/characters/hotspots in rooms now. I was quite content with how it used to do it, but the new way is better and more flexible. Thank you for the ongoing hard work!
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 13 Sep 2021, 19:07
I've been up to fixing number of things in this Alpha, but got distracted lately, so meanwhile here's a small update with just some additions, some to "fill" couple logical "gaps" in scripting, others to enhance existing functionality.

Updated to Alpha 10
(use download links in the first post)

Audio related

* Rised number of audio channels to 16 (was 8).
* added AudioChannel.Pause() and Resume() functions, and AudioChannel.IsPaused read-only property.

Editor

* Alan v.Drake added line numbers in the Dialog script editor; and also line and cursor position in script are now printed on the status bar.

Character's idle views

* exposed IdleDelay property for Characters in the editor (was only possible to set through script function SetIdleView).
* fixed idle view timing, now it is now correctly based on the game speed rather than the hardcoded 40 fps.

Engine's options

* --localuserconf parameter is superceded with --user-conf-dir, and similarily there's "user_conf_dir" config option that directly tells the location of user config file.
* path related config options, such as "shared_data_dir", "user_data_dir" and "user_conf_dir" now support $GAMENAME$ token in path which is resolved to the game's title. The potential use case is to let user set up an absolute path leading to a location they want to store saves and other files in. In such case they might also need to have subdirs per each game there.
E.g. you may put "user_data_dir=C:/All My AGS Saves/$GAMENAME$" to every game config (or into the global AGS config).
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on 13 Sep 2021, 19:28
Audio related

* Rised number of audio channels to 16 (was 8).
* added AudioChannel.Pause() and Resume() functions, and AudioChannel.IsPaused read-only property.


(https://viralviralvideos.com/wp-content/uploads/2015/09/Fuck-yeah-GIF.gif)
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Grundislav on 11 Oct 2021, 04:47
An audio bug: when the game initially loads, the music volume is loud, but when a game is restored, the music volume drops by about 10%.

https://cdn.discordapp.com/attachments/221048075207180288/896953768694910987/volumechange.mp4
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on 14 Oct 2021, 18:54
I'm not sure this is the best place to leave a suggestion, but right now, the only way to change the delay of a view frame is manually in the View editor, and it can get quite cumbersome if for whatever reason you need to change the values for a lot of frames. How feasible would it be to expose the view frame delay property to the script?
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 14 Oct 2021, 21:37
I'm not sure this is the best place to leave a suggestion, but right now, the only way to change the delay of a view frame is manually in the View editor, and it can get quite cumbersome if for whatever reason you need to change the values for a lot of frames. How feasible would it be to expose the view frame delay property to the script?

Delay is already exposed to script, but as a readonly property called "Speed". Making it writeable is mostly a matter of adding this field to savegames, otherwise saving/restoring game will make frame data inconsistent.

But I guess this is also why the view editor needs multiple selection and being able to edit properties from multiple frames at once.
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on 14 Oct 2021, 21:55
But I guess this is also why the view editor needs multiple selection and being able to edit properties from multiple frames at once.

Agree, that would also be a very welcome addition. But I guess it would take more work?
Title: Re: AGS 3.6.0 WIP (Alpha 10) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on 14 Oct 2021, 22:00
But I guess this is also why the view editor needs multiple selection and being able to edit properties from multiple frames at once.

Agree, that would also be a very welcome addition. But I guess it would take more work?

Editor currently does not have any mechanism for this, there might be a default handling available for the PropertyGrid control, but I know nothing about that.
Someone has to research how this works first.