Adventure Game Studio

AGS Support => AGS Engine & Editor Releases => Topic started by: Crimson Wizard on Thu 25/03/2021 02:28:54

Title: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Thu 25/03/2021 02:28:54
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: 14th March 2022


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 9) (https://www.adventuregamestudio.co.uk/forums/index.php?topic=59804.0).


Credits

- SDL2 port mostly done by Nick Sonneveld;
- Improved Android port, and Web/Emscripten port made by eri0o;
- me basically gathered Nick Sonneveld's works together, tidied and fixed where necessary.
+ added more stuff (see below) and some new script commands
+ some stuff added by Alan v. Drake.
+ fernewelten (fixes)
+ panreyes (fixes)


Downloads and instructions

* Full AGS 3.6.0 as installer (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.20/AGS-3.6.0.20-Alpha21.exe)
* Full AGS 3.6.0 as a .zip archive (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.20/AGS-3.6.0.20-Alpha21.zip)
* Android game player (https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.20/AGS-3.6.0.20-debug.apk), aka launcher (APK signed with Debug key), suitable for running any compatible AGS game.


Notable changes related to new backend and ports

Full list of changes now available here (will be posted for the final release on forums too):
https://github.com/adventuregamestudio/ags/blob/v.3.6.0.20/Changes.txt

* 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).
* 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

Editor now requires .NET Framework 4.6 (was 4.5). NOTE: the compiled games DO NOT require .NET to run.

Full Unicode support. Editor and engine can work in Unicode mode, allowing practically any human language. ASCII/ANSI mode is still supported for backward compatibility. See "Text format" option in General Settings. Additionally, translations (TRS) have individual setting. More information on translations is here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59240.0

Improved key input handling, with the purpose for easing unicode input support. This is controlled by the "Use old keyboard handling" option in General Settings: setting it to "false" will use new handling mode with extended features. See "Script API" section below for more information.

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).

Introducing Web/Emscripten port capable of running games in browsers.

Build Android and Web/Emscripten games from the Editor.

Editor supports multiple compressions for sprites, which may be selected in General Settings. Currently available: RLE (old default) and LZW.
Also, there's an option to optimize sprite storage format to reduce disk space whenever possible. This option is separate from compression but may be used alongside for the further effect. It's enabled by default in this version.

Editor supports packing multiple speech voxes, using files in the "Speech" subfolders (e.g. "Speech\french" subfolder will produce "sp_french.vox").
Engine can switch to a different speech vox by a script command (see below).

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.

Engine supports "borderless full-screen window" mode in addition to the real (exclusive) fullscreen.

Engine supports scripts using functions and variables (imported) from any other scripts, regardless of the script module order in the project. These still have to be declared as "import" above their use though.

There's "GUI controls clip their contents" option in the General Settings (enabled by default). This clips texts to the control's rectangle.

Configuration for TTF fonts that let display both common TTFs and ones made specifically for AGS in the past as they were meant to be.
Fixed display of certain TTF fonts which previously had their heights calculated wrongly. This could lead to texts being cut of at the bottom due to the graphical surface being not large 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).

Select script editor's font in the editor's Preferences.

Zoom controls on almost all panels (sprite manager, cursor, inventory item, and so on).

Debug displays, such as showing room mask and character walk paths, are now implemented as non-blocking translucent overlays, allowing you to keep playing the game while they are on. (See "Debug" script command).


New Script API

- Expanded on_key_press callback, now supports two parameters: key code and key modifier flags: on_key_press(eKeyCode key, int mod); where "mod" argument contains key modifiers (ctrl, alt, shift, etc).
- In the new key handling mode on_key_press is called for each actual key press; e.g. combinations like Ctrl+Z will result in two on_key_press calls, one with eKeyCtrlLeft and second with eKeyZ.
- Implemented new on_text_input(int ch) callback which is called when the engine receives a printable character. This callback is essential for handling unicode chars in script.
- Similarily, expanded dialog_options_key_press with the third mod argument, and implemented dialog_options_text_input callback for receiving unicode chars during the custom dialog options state.
- Added eKey constants for Shift, Control and Alt keys.
- Added eKeyMod enum for key modifiers constants.
- String.AppendChar, ReplaceChar and Chars[] property are now working with the unicode characters.
- String.Format("%c") specifier will now be able to print unicode characters.
- Added Game.ChangeSpeechVox() and Game.SpeechVoxFilename, which work in a similar fashion to Game.ChangeTranslation and Game.TranslationFilename respectively.
- DrawingSurface.DrawImage() and DrawSurface() now accept optional source rect coordinates, so you can draw a chosen part of the sprite directly;
Code (ags) Select
DrawingSurface.DrawImage(int x, int y, int spriteSlot, optional int transparency, optional int width, optional int height,
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 (ags) Select
File *f = File.Open("$DATA$/MyDir/myfile.txt", eFileRead);
Code (ags) Select
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-15 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).
- Added Character.IdleAnimationDelay to let control idle view's animation speed.
- Hotspot.Name and Object.Name may now be set in script.
- 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).
- Added new delay parameter to Mouse.ChangeModeView() to let control cursor's animation speed.
- 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.
- Debug(2, 0) command that displayed walkable areas is superceded by Debug(2, n), where "n" is a mask type: 0 - none, 1 - hotspots, 2 - walkbehinds, 3 - walkable areas, 4 - regions. This command also works as a toggle switch, calling it with the same mask index will turn it off.
- Debug(5, n) command that displayed character's walk paths now also works as a toggle switch.


Known problems

...?


Other potential issue

* 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.
* Anything we don't know yet about ....







In regards to building Web version of the game. This only works when you have "Web build component" installed along with the Editor. The new "Web" Build target should become available. If you check it, and rebuild the project, the Editor will deploy necessary files into Compiled/Web folder in your project.

Note that you cannot run index.html directly, it likely won't work. You need to create a web server with these files on it. There is a multitude of ways you can do that. For example I've been testing this using a simple Google Chrome app called Web Server for Chrome (https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en). You may find your own way.

For any questions regarding the Web port please refer to and post in dedicated forum thread:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=59164.0
Title: Re: AGS 3.6.0 WIP (Alpha) - SDL2-based engine for Public Test
Post by: Joseph DiPerla on Mon 29/03/2021 15:05:37
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 Tue 06/04/2021 09:40:53
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 Sun 11/04/2021 20:49:19
Hello.

I have received this error while running a room.
https://imgur.com/byuwNv7 (https://imgur.com/byuwNv7)
[imgzoom]https://imgur.com/byuwNv7[/imgzoom]
Title: Re: AGS 3.6.0 WIP (Alpha 2) - SDL2-based engine for Public Test
Post by: Crimson Wizard on Sun 11/04/2021 21:07:28
Quote from: nightmarer on Sun 11/04/2021 20:49:19
I have received this error while running a room.
https://imgur.com/byuwNv7 (https://imgur.com/byuwNv7)
[imgzoom]https://imgur.com/byuwNv7[/imgzoom]

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 Sun 11/04/2021 22:16:08
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 Sun 18/04/2021 03:51:43
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.


Quote from: nightmarer on Sun 11/04/2021 22:16:08
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 Tue 20/04/2021 08:40:02
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 Tue 20/04/2021 15:06:53
Quote from: nightmarer on Tue 20/04/2021 08:40:02
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 Mon 26/04/2021 21:04:39
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 Tue 11/05/2021 03:14:17
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 (ags) Select

function room_RepExec()
{
atest.Play();
}


game crashes in several seconds.

or more manual:
Code (ags) Select

function on_key_press(eKeyCode key)
{
atest.Play();
}
Title: Re: AGS 3.6.0 WIP (Alpha 4) - SDL2-based engine for Public Test
Post by: Crimson Wizard on Wed 12/05/2021 00:45:38
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 Wed 12/05/2021 15:48:22
@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 Sun 16/05/2021 20:14:13
Quote from: eri0o on Wed 12/05/2021 15:48:22
@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 Sun 23/05/2021 04:20:28
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 Mon 24/05/2021 10:26:01
Quote from: Crimson Wizard on Sun 23/05/2021 04:20:28
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 Mon 24/05/2021 10:39:32
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 Mon 24/05/2021 11:55:14
Quote from: Crimson Wizard on Mon 24/05/2021 10:39:32
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 Mon 24/05/2021 12:29:35
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 Sun 04/07/2021 02:51:20
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 Sun 04/07/2021 03:56:14
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 Sun 04/07/2021 04:16:31
Quote from: Gilbert on Sun 04/07/2021 03:56:14
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.

Quote from: Gilbert on Sun 04/07/2021 03:56:14Or, 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 Sun 04/07/2021 20:31:13
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:

// 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 Mon 05/07/2021 03:35:06
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 Mon 05/07/2021 08:17:07
Quote from: Crimson Wizard on Sun 04/07/2021 04:16:31
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 Mon 05/07/2021 11:48:01
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 Tue 06/07/2021 07:53:47
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.

Quote from: Crimson Wizard on Sun 04/07/2021 02:51:20
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 Tue 06/07/2021 09:40:01
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.


[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 Tue 06/07/2021 11:15:22
QuoteI 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 Tue 06/07/2021 11:25:40
Quote from: eri0o on Tue 06/07/2021 11:15:22
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 Tue 06/07/2021 13:21:56
QuoteMy 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 Tue 06/07/2021 15:35:52
Quote from: eri0o on Tue 06/07/2021 13:21:56
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 Tue 06/07/2021 15:53:08
QuoteAh 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 Tue 06/07/2021 22:43:13
Quote from: Manu on Tue 06/07/2021 09:40:01
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 Thu 15/07/2021 01:02:15
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 (ags) Select
DrawingSurface.DrawImage(int x, int y, int spriteSlot, optional int transparency, optional int width, optional int height,
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 Thu 15/07/2021 09:36:12
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 Thu 15/07/2021 10:13:50
Quote from: Crimson Wizard on Thu 15/07/2021 01:02:15
- 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 Thu 15/07/2021 10:24:27
Quote from: Laura Hunt on Thu 15/07/2021 10:13:50
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 Thu 15/07/2021 10:27:13
Quote from: Crimson Wizard on Thu 15/07/2021 10:24:27
Quote from: Laura Hunt on Thu 15/07/2021 10:13:50
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 Thu 15/07/2021 10:37:30
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 Fri 16/07/2021 05:14:34
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 Fri 16/07/2021 07:53:08
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 Fri 16/07/2021 08:48:39
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 (ags) Select

Overlay* lastSpeech;

function late_repeatedly_execute_always() {
    Overlay* curSpeech = Speech.TextOverlay;
    if (lastSpeech == null && curSpeech != null) {
         // speech has started
    } else if (lastSpeech != null && curSpeech == null) {
         // speech is over
    } else if (lastSpeech != null && curSpeech != lastSpeech) {
         // speech changed to the next line
    }
    lastSpeech = curSpeech;
}



Waving a speech portrait up and down
Code (ags) Select

#define PORTRAIT_YMIN 5
#define PORTRAIT_YMAX 30
int plast = -1;
int pmove = 1;
function repeatedly_execute_always() {
if (Speech.PortraitOverlay != null) {
if (plast >= 0) Speech.PortraitOverlay.Y = plast;
Speech.PortraitOverlay.Y += pmove;
if (Speech.PortraitOverlay.Y < PORTRAIT_YMIN) pmove = 1;
if (Speech.PortraitOverlay.Y > PORTRAIT_YMAX) pmove = -1;
plast = Speech.PortraitOverlay.Y;
}
}

Title: Re: AGS 3.6.0 WIP (Alpha 6) - SDL2-based engine + Unicode Translations
Post by: Manu on Fri 16/07/2021 17:20:28
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 Fri 16/07/2021 18:36:53
Quote from: Manu on Fri 16/07/2021 17:20:28
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 Sun 18/07/2021 23:15:45
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 Mon 19/07/2021 06:07:53
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 Mon 19/07/2021 07:53:01
Quote from: Mehrdad on Mon 19/07/2021 06: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 Mon 19/07/2021 08:18:02
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 Sun 01/08/2021 03:32:53
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 Mon 02/08/2021 08:06:54
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 Mon 02/08/2021 12:00:38
Quote from: Dualnames on Mon 02/08/2021 08:06:54
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 Tue 03/08/2021 13:20:27
Quote from: Dualnames on Mon 02/08/2021 08:06:54
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 Fri 06/08/2021 12:36:02
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 (ags) Select

// open custom packed file
File *f = File.Open("$DATA$/MyDir/myfile.txt", eFileRead);
// create a dynamic sprite out of a custom packed image file
DynamicSprite *spr = DynamicSprite.CreateFromFile("$DATA$/MyDir/mypic.bmp");
// List all existing resources
ListBox.FillDirList("$DATA$/MyDir/*.*");


You may even use this with regular game files, even though that may be not commonly meaningful (if only for some hacks):
Code (ags) Select

// List all existing rooms
ListBox.FillDirList("$DATA$/*.crm");



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

Code (ags) Select

static DrawingSurface* Hotspot.GetDrawingSurface();
static DrawingSurface* Region.GetDrawingSurface();
DrawingSurface* GetDrawingSurfaceForWalkableArea();
DrawingSurface* GetDrawingSurfaceForWalkbehind();


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 (ags) Select

ds.DrawingColor = 4; // will draw area number 4.


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 Thu 26/08/2021 15:44:16
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 Fri 27/08/2021 06:12:23
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 Tue 31/08/2021 02:21:14
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 Mon 13/09/2021 19:07:52
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 Mon 13/09/2021 19:28:45
Quote from: Crimson Wizard on Mon 13/09/2021 19:07:52
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 Mon 11/10/2021 04:47:23
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 Thu 14/10/2021 18:54:15
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 Thu 14/10/2021 21:37:19
Quote from: Laura Hunt on Thu 14/10/2021 18:54:15
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 Thu 14/10/2021 21:55:55
Quote from: Crimson Wizard on Thu 14/10/2021 21:37:19
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 Thu 14/10/2021 22:00:26
Quote from: Laura Hunt on Thu 14/10/2021 21:55:55
Quote from: Crimson Wizard on Thu 14/10/2021 21:37:19
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.
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sun 31/10/2021 15:53:47
Unfortunately I got very distracted from AGS recently, so this took more time since the last update... but here's the new one.

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

Editor:

* Added "Use graphical font height in game logic" property to the General Settings, that makes your game use real font's pixel height when arranging text and text-based UI elements, as opposed to the nominal font's size. This is important for TTF fonts, because importing them with N point size does not guarantee N pixel height. Unfortunately AGS used to "lie" about their height all those years, which could lead to some fonts not fitting into gui controls right or even have their bottom parts "cut off" when displayed as a speech. Now you may prevent that using this setting.
* Fixed "Use old-style custom dialog options API" was not set when importing pre-3.4.0 projects.
* Fixed comboboxes' drop-down arrows were not painted with the right color from a color theme.

Script compiler:

* Removed 500-characters line limit.

Script API:

* Debug(2, 0) command that displayed walkable areas is superceded by Debug(2, n), where "n" is a mask type: 0 - none, 1 - hotspots, 2 - walkbehinds, 3 - walkable areas, 4 - regions. This command also works as a toggle switch, calling it with the same mask index will turn it off.
* Debug(5, n) command that displayed character's walk paths now also works as a toggle switch.

Engine:

* Support "borderless full-screen window" mode in addition to the real (exclusive) fullscreen.
* Support scripts using functions and variables (imported) from any other scripts, regardless of the script module order in the project. These still have to be declared as "import" above their use though.
* Engine now supports using real pixel height of the TTF fonts when arranging text and UI elements on screen; using nominal import size of the font is used as a compatible mode for the old games.
Note that you may always configure the vertical line spacing using font's LineSpacing property in the editor.
* Engine now ensures that in threaded audio mode the script's AudioChannel's state only changes once the game is updated, and not while the game script is running. This prevents situations when the clip could begin playing before all properties are set in script, or when AudioChannel's properties' values (such as Position) could change while running a game script.
* Character.SetWalkSpeed() is no longer restricted by an arbitrary limit of 50.
* File.ReadRawLineBack() now always reads full line, and not limited to 200 characters anymore.
* Debug displays, such as showing room mask and character walk paths, are now implemented as non-blocking translucent overlays, allowing you to keep playing the game while they are on.
* Engine config now has graphic modes defined as a simplier string options: "[graphics] fullscreen" for the fullscreen mode setup, and "[graphics] window" for the windowed. Fullscreen option can explicitly define a "borderless full-screen window" mode. (See below for the new config explanation; it will be also added to documentation later).
* Fixed engine could crash due to incorrect disposal of resources if its startup was interrupted for any reason.
* Fixed some TTF fonts were not centered correctly and/or cut from below when text is displayed.
* Fixed crash in case there were too many reserved audio channels.
* Fixed new sound panning implementation.
* Fixed character may have incorrect Frame values while turning.

Android:

* Fixed reading of separate game files (not merged with the main AGS game file) from inside the APK.

WinSetup:

* Added "Fullscreen as borderless window" checkbox.




New graphics mode configuration:

Instead of having several detached options that combined would result in a window size definition, there's now only 1 option (per mode) that contains all possible variants in a single string:
* WxH - explicit window size (e.g. 1280x720);
* xS - integer game scaling factor (e.g. x4);
* desktop - use current system's desktop resolution;
** in windowed mode will try to create largest possible resizing window, while keeping game scaling style (max stretch, proportional stretch or max integer multiplier);
* native - use game's native resolution;
* full_window - special option for the fullscreen mode, this means a borderless window covering whole desktop;
* default - currently we default to (this is also a fallback option in case config parsing went wrong):
** in fullscreen mode to full_window;
** in windowed mode to desktop;

In [graphics] section fullscreen mode is defined by the option "fullscreen" while the windowed mode is defined by the option "window".

Config examples:


[graphics]
fullscreen=1280x720
window=x2
game_scale_fs=proportional
game_scale_win=round



[graphics]
fullscreen=full_window
window=native
game_scale_fs=stretch
game_scale_win=round
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Dave Gilbert on Wed 03/11/2021 12:55:41
Hooray! Thanks CW.

I am not sure if this is a bug or not, or if it's specifically related to version 3.6, but I noticed a weird issue when switching between monitors.

I have a two monitor setup. One laptop and a second monitor. I typically have the monitors in "Extend" mode (where the desktop area is spread out between the two) and test my game on my second monitor. If the game is running and I switch from "Extend" mode to "second screen only" mode, the game minimizes itself and won't come back. Clicking on the icon in the taskbar does nothing (although I can still hear the music and sound). I have to open up the task manager to exit out of the game.

I admit this is an unusual case that not many people will deal with, but it is a bit annoying when it comes up.

Anyway, I'm off to play with fonts now!

-Dave
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: greg on Fri 05/11/2021 12:40:59
Thanks for this awesome new build!  The Object.Scaling option and additional audio channels are especially amazing.

When testing out the most recent version of 3.6, I noticed the following:

1. Text within buttons is placed differently in the editor than in the game.  Here’s some text with alignment eAlignMiddleCenter.  (The font is LinLibertine_aBS.ttf, imported at 20 pt.)

https://drive.google.com/file/d/1VYqbj3KUjmCIAcXKTJudgZ33z8IkCJMw/view

It’s worth noting that, when upgrading from 3.5.1 to 3.6, the font had a VerticalOffset of -2, which appeared as -2 in the editor and -4 in the game.  I’ve since set this offset to 0, and it now appears as 0 in the editor and -2 in the game.

2. Calling GetGlobalInt before SetGlobalInt results in a crash.  As my game was loading, I was calling GetGlobalInt(foo) before I’d called SetGlobalInt(foo, bar).  In 3.5.1, there was no error or crash.  In 3.6, there was a crash.  I addressed this by updating my script to set the variable before getting it.  I wanted to report it, though, as it’s a different behavior from 3.5.1.
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 05/11/2021 13:12:05
Quote from: greg on Fri 05/11/2021 12:40:59
1. Text within buttons is placed differently in the editor than in the game.  Here’s some text with alignment eAlignMiddleCenter.  (The font is LinLibertine_aBS.ttf, imported at 20 pt.)

I am currently experimenting with changing something in how TTF fonts work, and latest build unfortunately may contain mistakes. I realized this too late, when it was already posted. In any case it's better to not rely on the font looks right away and wait until the next update, which hopefully will be ready soon enough.

Quote
the font had a VerticalOffset of -2, which appeared as -2 in the editor and -4 in the game

This sounds weird though. But I will look at this as soon as I fix other obvious mistakes.

Quote from: greg on Fri 05/11/2021 12:40:59
2. Calling GetGlobalInt before SetGlobalInt results in a crash.  As my game was loading, I was calling GetGlobalInt(foo) before I’d called SetGlobalInt(foo, bar).  In 3.5.1, there was no error or crash.  In 3.6, there was a crash.  I addressed this by updating my script to set the variable before getting it.  I wanted to report it, though, as it’s a different behavior from 3.5.1.

I will look into this, but just wanted to mention that these functions were deprecated many years ago, today it's recommended to use normal variables in script.
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Matti on Fri 05/11/2021 18:33:55
Nice work! A lot of good stuff in there!
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 06/11/2021 14:47:50
@greg
Quote from: greg on Fri 05/11/2021 12:40:59
2. Calling GetGlobalInt before SetGlobalInt results in a crash.  As my game was loading, I was calling GetGlobalInt(foo) before I’d called SetGlobalInt(foo, bar).  In 3.5.1, there was no error or crash.  In 3.6, there was a crash.  I addressed this by updating my script to set the variable before getting it.  I wanted to report it, though, as it’s a different behavior from 3.5.1.

I tried this, and I cannot reproduce a crash, nor see how exactly it may happen.

Could you give more information, like post the exact script, tell what function do you call the GetGlobalInt from, what kind of crash (were there error messages)?
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: greg on Sat 06/11/2021 16:55:26
Sure, I've appended the crash message below, and I've uploaded the CrashInfo file here: https://drive.google.com/file/d/1WNVKOHaYn9HYax55KrQxvRI79nyY3A82/view?usp=sharing

The functions that called GetGlobalInt(foo) before SetGlobalInt(foo, bar) were called in game_start().  Also, thanks for the heads-up that GetGlobalInt and SetGlobalInt have been deprecated!

Separately, since upgrading from 3.5.1 to 3.6, I noticed that AudioChannel.LengthMs is sometimes returning 0 even when AudioChannel.PlayingClip.ID is not null.  Namely, in the same place in my code, the same log message sometimes prints this:

Code (ags) Select
channel.ID: 3, channel.PlayingClip.ID: 267, channel.LengthMs: 3692

And sometimes it prints this:

Code (ags) Select
channel.ID: 3, channel.PlayingClip.ID: 267, channel.LengthMs: 0

I can reproduce this consistently, but not every time, when I skip the cutscene in which the clip is played.  However, the behavior sometimes occurs (though far less often) even if I don’t skip the cutscene.  (I had the same code in AGS 3.5.1, and channel.LengthMs never returned 0.)

---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00537F70; program pointer is -42, ACI version 3.6.0.10, gtags (78,214)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and contact the game author for support or post these details on the AGS Technical Forum.

in "Interface.asc", line 1001
from "Interface.asc", line 1010
from "Extender.asc", line 587
from "Extender.asc", line 596
from "Extender.asc", line 1090
from "Extender.asc", line 3539
(and more...)
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 06/11/2021 17:38:44
Quote from: greg on Sat 06/11/2021 16:55:26
Sure, I've appended the crash message below, and I've uploaded the CrashInfo file here: https://drive.google.com/file/d/1WNVKOHaYn9HYax55KrQxvRI79nyY3A82/view?usp=sharing

The functions that called GetGlobalInt(foo) before SetGlobalInt(foo, bar) were called in game_start().

From thois crash dump it seems that the last called function was GetWalkableAreaAtRoom. But maybe there was something wrong with either engine or the dump.

Could you post the code around "Interface.asc", line 1001 ?

EDIT: I can confirm that calling GetWalkableAreaAtRoom in game_start will crash the engine. No room is loaded at the time when game_start was called, but it seems this time engine was not able to handle that properly and display a regular error.
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: greg on Sat 06/11/2021 23:31:45
Sure, here's the code.  Line 1001 is the one with "GetWalkableAreaAtRoom(player.x, player.y) != GetGlobalInt(EXIT_WA_ENABLED)":

Code (ags) Select
function exit_hidewalkablearea() {
  if (GetGlobalInt(EXIT_WA_ENABLED) != -1) {  // line 999
    // don't hide walkable area if the character is currently on top of it
    if (GetWalkableAreaAtRoom(player.x, player.y) != GetGlobalInt(EXIT_WA_ENABLED)) {  // line 1001
      RemoveWalkableArea(GetGlobalInt(EXIT_WA_ENABLED));
      SetGlobalInt(EXIT_WA_ENABLED, -1);
    }
  }
}


In 3.6 (but not in 3.5.1), when I call this function before setting SetGlobalInt(EXIT_WA_ENABLED, -1), I get the crash from the dump file.  Now that I'm setting the variable first, I no longer get the crash (because it fails the condition at line 999).

I'd guess the change in behavior here is that 3.5.1 returns -1 for GetGlobalInt(foo) if foo hasn't been set, whereas 3.6 doesn't?  So in 3.5.1, even though I hadn't set the variable, it failed the condition at line 999 and never tried calling GetWalkableAreaAtRoom().

Thanks,
Greg
Title: Re: AGS 3.6.0 WIP (Alpha 11) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sun 07/11/2021 00:35:21
Quote from: greg on Sat 06/11/2021 23:31:45
I'd guess the change in behavior here is that 3.5.1 returns -1 for GetGlobalInt(foo) if foo hasn't been set, whereas 3.6 doesn't?  So in 3.5.1, even though I hadn't set the variable, it failed the condition at line 999 and never tried calling GetWalkableAreaAtRoom().

I never paid attention to this, but just tested in several versions including 3.5.1, and it always returns "0" if called before SetGlobalInt.

Although looking at the engine code, it seems like this global ints array is not properly initialized in program memory at the game start, which in theory means that these values could be anything and must not be relied upon. So, I'm not really sure how they may have any consistent values as shown by tests.
Title: Re: AGS 3.6.0 WIP (Alpha 12) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Mon 08/11/2021 02:27:06
Updated to Alpha 12
(use download links in the first post)

IMPORTANT: I remade one recently added property in General Settings, and unfortunately this conflicts with the previous build (Alpha 11). If you already used that build, here's what you need to do to make your project open in the current version again:
- Open Game.agf in a notepad;
- Search for the line starting as "<UseRealFontHeight>" and delete it. Save the file.

I apologize for this inconvenience.


TTF fonts setup

In this version I implemented a way to configure how TTF fonts are loaded and displayed in AGS. The problem was that AGS historically did some fixups to TTF looks for backward compatibility, but that made some fonts act worse and not position correctly when drawn in game. There are two new properties in the project that let to specify either new and old behavior.

1) "TTF font adjustment" - this property exists in Fonts and may be set individually for each of them; also similar property is in General Settings and sets default value for each new font you add to your game. This property lets you choose between "no changes" and backward compatible TTF fixup called "Resize ascender to the nominal font height".

To clarify a little, what this "fixup" means: the font has ascender and descender parts separated by a baseline. Ascender is parts of letters above baseline, descender is parts below baseline.
In the past AGS forcefully resized ascender to match the font's size. This could lead to ascender becoming larger or smaller. Because AGS draws texts starting with top-left corner, such change would result in text appearing shifted up or down relative to what you'd normally expect.
Now you may disable this behavior. The ability to keep it for the chosen fonts is left because there's a number of TTF fonts around created specially for AGS, possibly taking this weird behavior into account. For these fonts it may be desired to retain this "fixup".

2) "TTF fonts height used in the game logic" - this property exists in "General Settings" and has a global effect on all fonts. It lets you select what value is used as a height of line of text in game: TTF's nominal size (in "points") or real size in pixels. "Nominal size" is a backward compatible choice.

Why there's a difference: TTF are vector fonts, which do not always scale 1:1 to pixels because they must keep letter proportions. So, when you tell AGS to import a font at size 10, the actual pixel size may end up equal to 10, bit less or larger. Historically AGS ignored that fact and always reported text height using the "nominal" size, but that was a "lie".
The best way to check this out is to put some common TTF font on a GUI, and set GUI's height exactly to the font's size. In many fonts you will notice that some letters (usually "q,j,g,y" and similar) will not fit in, sometimes by a noteable amount.

So, now there's a setting that lets you enable using real height. This means that if you do GetTextHeight or GetFontHeight and so on -- it will report correct pixel heights of a text. Also, default font's linespacing is set equal either to the nominal or real height depending on this setting. But linespacing may also always be customized using corresponding Font's property, in the editor ("LineSpacing").


Other changes:

Editor:
- Fonts now have a readonly Family Name field, that lets user see the original name of a font they've imported (if available).

Engine:
- Fixed potential crashes if a room-related API function has been called in "game_start"; this is achieved by having a dummy room placeholder object. Still results of such calls are undefined and should not be relied upon.
- Fixed some TTF fonts could be cut at the bottom when the speech is displayed.

Compatibility
- When running pre-3.4.1 games, anti-aliased TTF fonts display is now corrected (their vertical position was broken).
Title: Re: AGS 3.6.0 WIP (Alpha 12) - SDL2-based engine + Unicode Translations
Post by: greg on Mon 08/11/2021 03:26:00
Thanks very much, CW!  This fixed both the font issue and the hard crash in game_start() I'd been encountering.

Of the issues I'd reported, I'm only still experiencing the flakey AudioChannel.LengthMs issue.  That is, AudioChannel.LengthMs is sometimes returning 0 even when AudioChannel.PlayingClip.ID is not null.  (Details are a few appends down, but if you need further debugging information from me, just let me know.)  Thanks!
Title: Re: AGS 3.6.0 WIP (Alpha 12) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sat 13/11/2021 09:49:42
Great news about this new version !

I hope it will be soon a first 3.6 beta release :)

Good job, keep going ! ;)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sun 28/11/2021 17:28:18
Updated to Alpha 13
(use download links in the first post)


PLEASE NOTE: For the technical reasons Editor now requires .NET Framework 4.6 to run (was 4.5).


Multiple Speech VOX support

Editor now packs alternate speech voxes, by scanning the top-level directories inside the "Speech" folder. For each top-level subdirectory It creates a sp_[name].vox where [name] is the lowercase subdir name.

For example, if you have this in your game project:

- Speech
- - Francais
- - MyLang

The editor will create following voxes:

- speech.vox (with top-level files from the root "Speech" folder);
- sp_francais.vox (with top-level files from "Speech/Francais");
- sp_mylang.vox (with top-level files from "Speech/MyLang");


Engine supports switching to a different speech vox anytime. To order so, there's a new script function Game.ChangeSpeechVox(string name), where you pass the "[name]" part of the vox filename. E.g. if you have sp_francais.vox then do Game.ChangeSpeechVox("francais"). For default speech.vox pass empty string. The new readonly property Game.SpeechVoxFilename returns current vox name. This works in similar fashion to the functions that control translations.

Note that speech vox selection is not tied to the current text translation in any way, so you may switch both text and voice to the same language, or switch them to different languages to have e.g. French voice-over with English text.



Other changes:

Editor:
- In the "Import TTF" dialog added a choice to import the size closest to the given pixel height (because TTF's point size does not 1:1 correspond to the size in pixels).
- Default config is now saved also when the game is run in debug mode (F5). This ensures that the test run is using the latest Default Setup, if the user's config has not been created yet.
- Editor no longer errors on empty translations when compiling the game.
- Editor now exports values of the string type Custom Properties to translations.

Engine:
- Engine no longer bails out with error if the chosen translation cannot be loaded on startup.
- Fixed previous music was not gradually lowering volume when crossfading (regression in 3.6.0).
- Fixed game window becoming non-resizing after switching from fullscreen (regression in 3.6.0).
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Sun 28/11/2021 23:32:28
Hello all.

Any update about the PNG compression for this new version?

Regards.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Sun 28/11/2021 23:52:42
BTW I see at the beginning of my game that the black background, which it was blac at 3.5.1 now is pink.
After that everything is fine.
Any reason for that?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sun 28/11/2021 23:56:36
Quote from: nightmarer on Sun 28/11/2021 23:32:28
Any update about the PNG compression for this new version?

If you mean changing the compression method for the game sprites, there were no actual plans for this within 3.6.0.

EDIT: ags currently has a ready support for LZW compression which is used with room backgrounds for some reason. It might be curious to experiment also using this with sprites (optionally, if certain setting is on) and see what compression ratios it can achieve and what will be a perfomance impact.

Quote from: nightmarer on Sun 28/11/2021 23:52:42
BTW I see at the beginning of my game that the black background, which it was blac at 3.5.1 now is pink.
After that everything is fine.

Do you mean the room's background, or before the first room fades in? Does this depend on the graphics driver selection?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Mon 29/11/2021 11:46:39
Quote from: Crimson Wizard on Sun 28/11/2021 23:56:36
Quote from: nightmarer on Sun 28/11/2021 23:32:28
Any update about the PNG compression for this new version?

If you mean changing the compression method for the game sprites, there were no actual plans for this within 3.6.0.

EDIT: ags currently has a ready support for LZW compression which is used with room backgrounds for some reason. It might be curious to experiment also using this with sprites (optionally, if certain setting is on) and see what compression rates it can achieve and what will be a perfomance impact.

Our sprites are 1,6 GB and our acsprset file is 3,4 GB. It is a shame that our game is going to be so huge in disk space.

Quote from: Crimson Wizard on Sun 28/11/2021 23:56:36

Quote from: nightmarer on Sun 28/11/2021 23:52:42
BTW I see at the beginning of my game that the black background, which it was blac at 3.5.1 now is pink.
After that everything is fine.

Do you mean the room's background, or before the first room fades in? Does this depend on the graphics driver selection?

There where is empty background before it was black, and now it is pink/purple. This purple screen starts as soon as there is a fade in. Maybe it is showing the alpha layer as purple, when it should be invisible.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Mon 29/11/2021 12:06:00
Quote from: nightmarer on Mon 29/11/2021 11:46:39
There where is empty background before it was black, and now it is pink/purple. This purple screen starts as soon as there is a fade in. Maybe it is showing the alpha layer as purple, when it should be invisible.

Is the "fade" layer itself purple, or something behind it? Do you use standard fade effect, or other methods, like gui with changing transparency?
Could you record a video of what is happening?
Do you know approximately since which build this started?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Mon 29/11/2021 14:32:20
Not sure from which build started, but I will provide you a video.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Tue 30/11/2021 02:10:07
Quote from: nightmarer on Mon 29/11/2021 14:32:20
Not sure from which build started, but I will provide you a video.

Actually, I've been testing some of my own games, and it looks like similar thing happen if you have a room without any imported background, then there's a 320x200 magenta rectangle drawn instead of regular black one.


Meanwhile, I made an experimental build that lets select a "LZW" compression for sprites:
https://www.dropbox.com/s/d51t7xnmnwfkzh8/ags-3.6.0--experiment-spritelzw.zip?dl=0
it replaces regular "Compress sprites" option to "Sprite compression type", which has None / RLE (current) / LZW.

Could you check that out and see what difference does this make to your game sprites? I tried this with my games, but the effect was kind of small (but my largest sprite file is around 15 mb).
NOTE that it's best to use this on a side copy of a project, not the main one.

If this does not help much then I may look into adding Deflate (compression used by PNG) or else.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Tue 30/11/2021 23:35:10
Tried the 3 sprite file compression settings on one of my latest project.

Filetype sprites before importing into ags: png,
largest being still pretty small: 35,5 KB (36.369 bytes)

Game:
Resolution: 640x480, 32-bit true-colour
Total sprites: 1855 / 90000
acsprset.spr filesize: 63,2 MB

Results after compile:
None: game.exe filesize: 550 MB (576.947.304 bytes)
LZW: game.exe filesize: 138 MB (144.977.308 bytes)
RLE: game.exe filesize: 105 MB (110.966.094 bytes)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Wed 01/12/2021 00:48:19
Quote from: arj0n on Tue 30/11/2021 23:35:10
Game:
Resolution: 640x480, 32-bit true-colour
Total sprites: 1855 / 90000
acsprset.spr filesize: 63,2 MB

Results after compile:
None: game.exe filesize: 550 MB (576.947.304 bytes)
LZW: game.exe filesize: 138 MB (144.977.308 bytes)
RLE: game.exe filesize: 105 MB (110.966.094 bytes)

Could you post sizes of acsprset.spr after changing compression and compiling, not full game.exe?
Also, do you have an estimate on the total size of source sprites?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Wed 01/12/2021 17:49:02
Quote from: Crimson Wizard on Wed 01/12/2021 00:48:19
Could you post sizes of acsprset.spr after changing compression and compiling, not full game.exe?
Also, do you have an estimate on the total size of source sprites?

sure:

source sprites: 2.352 png files; 6,03 MB (6.328.527 bytes)

Sprite file compression:
None: acsprset.spr filesize: 475 MB (498.297.296 bytes)
LZW: acsprset.spr filesize: 63,2 MB (66.327.300 bytes)
RLE: acsprset.spr filesize: 30,8 MB (32.316.086 bytes)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Wed 01/12/2021 18:34:23
Quote from: arj0n on Wed 01/12/2021 17:49:02
source sprites: 2.352 png files; 6,03 MB (6.328.527 bytes)

Sprite file compression:
None: acsprset.spr filesize: 475 MB (498.297.296 bytes)
LZW: acsprset.spr filesize: 63,2 MB (66.327.300 bytes)
RLE: acsprset.spr filesize: 30,8 MB (32.316.086 bytes)

This is horrendous...

Anyway, it's curious how LZW is twice as worse in your case, because in the hi-res 32-bit game I tested LZW was around 2% better than RLE:
raw: 14238 KB, RLE: 2693 KB, LZW: 2650 KB.
I'd wish to see other various projects tested, as results will likely depend on the amount of graphic detail and colors in a single sprite. But for now LZW does not seem worth adding, unless someone finds a project that displays better results with it. I suspect it may be best for larger photorealistic images.

Meanwhile, there are 2 more methods I am planning to add for this experiment, one is PNG's deflate algorithm, and another is basically to store sprites as indexed images whenever possible (if the total number of used colors is 256 or less). Latter has been suggested couple of years ago and i've been keeping that in mind for a while. Indexed format may in fact be used combined with other compression for even bigger effect.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Wed 01/12/2021 21:51:58
Quote from: Crimson Wizard on Tue 30/11/2021 02:10:07
Quote from: nightmarer on Mon 29/11/2021 14:32:20
Not sure from which build started, but I will provide you a video.

Actually, I've been testing some of my own games, and it looks like similar thing happen if you have a room without any imported background, then there's a 320x200 magenta rectangle drawn instead of regular black one.


Meanwhile, I made an experimental build that lets select a "LZW" compression for sprites:
https://www.dropbox.com/s/d51t7xnmnwfkzh8/ags-3.6.0--experiment-spritelzw.zip?dl=0
it replaces regular "Compress sprites" option to "Sprite compression type", which has None / RLE (current) / LZW.

Could you check that out and see what difference does this make to your game sprites? I tried this with my games, but the effect was kind of small (but my largest sprite file is around 15 mb).
NOTE that it's best to use this on a side copy of a project, not the main one.

If this does not help much then I may look into adding Deflate (compression used by PNG) or else.
I'm afraid it didn't change the size of the asprset.spr. Do I need to do anything or just run it?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Wed 01/12/2021 22:06:36
Quote from: nightmarer on Wed 01/12/2021 21:51:58
I'm afraid it didn't change the size of the asprset.spr. Do I need to do anything or just run it?

You need to choose a "Sprite compression" in General Settings. I dont remember if saving is enough, so perhaps rebuild the game to be sure. The "RLE" is standard compression, "LZW" is a new choice added.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Wed 01/12/2021 22:28:05
Ok I see, what it needs to be changed.
LEH 3.481.618 KB - I had this one selected
LZW 2.934.687 KB
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Wed 01/12/2021 22:31:54
Quote from: nightmarer on Mon 29/11/2021 14:32:20
Not sure from which build started, but I will provide you a video.
BTW I sent you the videos through Discord
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 02/12/2021 01:37:26
Reuploaded the experimental version with the new method that stores 16-bit and 32-bit images as 8-bit with palette so long as they have below 257 different colors in them.
https://www.dropbox.com/s/d51t7xnmnwfkzh8/ags-3.6.0--experiment-spritelzw.zip?dl=0
This new method is called "Indexed" for short.

My own test results vary depending on the game's graphic style. In the game with good quality antialiased sprites the effect is barely noticeable (reduces size by 10%) as most sprites have >256 colors with varying alpha channel values; but in the game with "old-school" pixel graphics it's comparable to RLE.
Might try another version of indexed image store where alpha channel is saved separately, which may significantly reduce the number of color variations and fit them into the 8-bit palette.

Also would need to make it possible to combine "indexed" format with other compressions (e.g. Indexed + RLE or Indexed + LZW).
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Thu 02/12/2021 09:00:23
640x480, 32-bit true-colour
Total sprites in project (F2):   1855 / 90000
source sprites: 2.352 png files; 6,03 MB (6.328.527 bytes)

Sprite file compression:
None: acsprset.spr filesize: 475 MB (498.297.296 bytes)
Indexed: acsprset.spr filesize: 118 MB (124.652.814 bytes)
LZW: acsprset.spr filesize: 63,2 MB (66.327.300 bytes)
RLE: acsprset.spr filesize: 30,8 MB (32.316.086 bytes)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 02/12/2021 12:12:11
Quote from: arj0n on Thu 02/12/2021 09:00:23
640x480, 32-bit true-colour

Sprite file compression:
None: acsprset.spr filesize: 475 MB (498.297.296 bytes)
Indexed: acsprset.spr filesize: 118 MB (124.652.814 bytes)

Well, it looks like it saved virtually all of your 32-bit sprites as indexed 8-bit, reducing size 4 times as expected :).
But yes, this is maximum of what it can do, so for better results it has to be combined with the other compression types.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Thu 02/12/2021 12:37:13
Given all sprites in my test do have below 257 different colors in them, this seems like a good result to me already :)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Thu 02/12/2021 17:23:37
320x200, 32-bit true-colour
Total sprites in project:   35703 / 90000
PNG folder: 1,61 GB (1.734.822.663 bytes)

Sprite file compression:
None: acsprset.spr filesize: 8,77 GB (9.425.965.010 bytes)
Indexed: acsprset.spr filesize: 7,66 GB (8.229.703.633 bytes)
LZW: acsprset.spr filesize: 2,79 GB (3.005.119.147 bytes)
RLE: acsprset.spr filesize: 3,32 GB (3.565.176.753 bytes)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Thu 02/12/2021 21:35:51
That's quite a different result, nightmarer.

My 32-bit background sprites seem to have a max amount of only about 17 different colors in them.
When looking at your 'indexed' compression result, I suspect your sprites have a higher amount of different colors?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Thu 02/12/2021 22:19:13
I guess that our sprites are pretty colored :)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Thu 02/12/2021 22:23:02
 (nod) (laugh)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 03/12/2021 02:49:22
Here's a new experimental build:
https://www.dropbox.com/s/d51t7xnmnwfkzh8/ags-3.6.0--experiment-spritelzw.zip?dl=0

PLEASE NOTE: you may will have to make a new clean copy of your project to open in this build, because experimental settings changed again. Also do full rebuild at least once to ensure sprite file is recreated with correct settings.

* Can select "Indexed bitmap" method separate from the compression, which allows to mix these. The new option in settings is called "Save sprites as indexed bitmaps when possible" (True/False, default is True). So you may do both "Save sprites as indexed bitmap..." and some compression (None / RLE / LZW).
* The "indexed bitmap" method now does two attempts: first tries to make 256-colored palette with alpha, if failed then tries to make palette without alpha and if second succeeded then writes an indexed bitmap with an accompanying alpha channel. This essentially stores 32-bit sprite in 16-bit: less efficient but may still give x2 decrease in size if lucky.
* Slightly improved RLE compression, may do better by like couple % (not too important, but should mention this).



Quote from: arj0n on Thu 02/12/2021 21:35:51
My 32-bit background sprites seem to have a max amount of only about 17 different colors in them.

BTW, is there a reason why your game is not 8-bit? In your old game remakes you might be able to only use 1 set of sprites and change actual palette to emulate palettes from various systems.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Fri 03/12/2021 09:09:56
Quote from: Crimson Wizard on Fri 03/12/2021 02:49:22
BTW, is there a reason why your game is not 8-bit? In your old game remakes you might be able to only use 1 set of sprites and change actual palette to emulate palettes from various systems.

Normally I do use the palette change for such old game indeed.
But this time it wasn't an option because:
There are several differences like the location and shape of mirror, lamp & nightstand for example:
Spoiler

[imgzoom]https://dam1976.home.xs4all.nl/AGS/Mortville/diff/1amiga.png[/imgzoom]
[imgzoom]https://dam1976.home.xs4all.nl/AGS/Mortville/diff/2atari.png[/imgzoom]
[imgzoom]https://dam1976.home.xs4all.nl/AGS/Mortville/diff/3DOSEGA.png[/imgzoom]
[close]

But when I tried to go for an 8bit version for my project, I failed to get a normal result for the room bg after importing an 8bit version of the background sprite.
Here a test using a new clean project importing a 8bit room bg image:
Spoiler

[imgzoom]https://dam1976.home.xs4all.nl/AGS/Mortville/diff/8bit_import.png[/imgzoom]
[close]

AGS basic settings:
Spoiler

[imgzoom]https://dam1976.home.xs4all.nl/AGS/Mortville/diff/8bit_import_settings.png[/imgzoom]
[close]

Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Fri 03/12/2021 10:29:19
Quote from: Crimson Wizard on Fri 03/12/2021 02:49:22
Here's a new experimental build:
https://www.dropbox.com/s/d51t7xnmnwfkzh8/ags-3.6.0--experiment-spritelzw.zip?dl=0

indexed bitmaps true
none: 118 MB (124.645.394 bytes)
rle: 9,24 MB (9.693.772 bytes)
lzw: 16,0 MB (16.871.106 bytes)

indexed bitmaps false
none: 475 MB (498.297.296 bytes)
rle: 29,5 MB (31.035.907 bytes)
lzw: 63,2 MB (66.327.162 bytes)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 03/12/2021 14:16:40
Quote from: arj0n on Fri 03/12/2021 10:29:19
indexed bitmaps true
none: 118 MB (124.645.394 bytes)
rle: 9,24 MB (9.693.772 bytes)
lzw: 16,0 MB (16.871.106 bytes)

IIRC your raw sources were 6 MB, so indexed bitmaps + RLE give a pretty close result?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: arj0n on Fri 03/12/2021 15:28:53
Correct.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Sat 04/12/2021 19:19:53
Hello.
Here my files.

indexed bitmaps true
none: 7,41 GB (7.966.279.437 bytes)
rle: 3,23 GB (3.476.975.790 bytes)
lzw: 2,61 GB (2.811.194.259 bytes)

indexed bitmaps false
none: 8,77 GB (9.425.965.010 bytes)
rle: 3,31 GB (3.555.361.792 bytes)
lzw: 2,79 GB (3.005.119.147 bytes)
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 04/12/2021 19:40:15
Ah well, I see that indexed format does not help alot in your situation (effect is only noteable without extra compression).

Probably I'll add these new compression choices first, and then after check if the deflate (png's) compression will work any better.

At least LZW saves about 0.7 GB compared to RLE already.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: TheNewSon on Fri 10/12/2021 00:25:07
Any ETA for the stable release?

I'm so looking forward to adding all 9 languages into one single build for my prototype!!  :grin:
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: nightmarer on Sun 19/12/2021 11:26:53
Any news about how the 3.6.0 is going to be released? I'm longing to change from 3.5.1 and enjoy the new features included.
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Tue 28/12/2021 18:59:36
Hi there !

Is the 3.6 version of AGS will allow to do something with the "length" of ListBox Items ? As far as I know, there is no option to "cut" the text, it always go outside the list box.

Of course, it could be perfect that AGS "remembers" the full length of the item, even if it's displayed not fully in the listbox. For scripting reasons, it could be nice ;)

Something like that is possible ?
Title: Re: AGS 3.6.0 WIP (Alpha 13) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Tue 28/12/2021 20:11:47
Hello.
Quote from: Baguettator on Tue 28/12/2021 18:59:36
Is the 3.6 version of AGS will allow to do something with the "length" of ListBox Items ? As far as I know, there is no option to "cut" the text, it always go outside the list box.

Of course, it could be perfect that AGS "remembers" the full length of the item, even if it's displayed not fully in the listbox. For scripting reasons, it could be nice

TBH I only recently realized that it's happening for some reason, never paid much attention to this before, I guess.

To be clear, none of the gui controls in AGS seem to clip their textual contents, and buttons only clip the image when certain property is set.
This is not right, afaik any normal GUI system clips the control contents to its size. I think it's possible to make this change for 3.6.0, maybe even unconditionally, because it looks weird. Unless someone has an idea of a good use case for non-clipping the text (which cannot be solved by also adding a label somewhere).
Of course this will have nothing to do with the actual text property, the clipping is a drawing operation that does not change the control's data but only affects its look.



Also, I'm sorry for not answering earlier -
Quote from: TheNewSon on Fri 10/12/2021 00:25:07
Any ETA for the stable release?
Quote from: nightmarer on Sun 19/12/2021 11:26:53
Any news about how the 3.6.0 is going to be released? I'm longing to change from 3.5.1 and enjoy the new features included.

I believe that the main bulk of changes is already complete (in fact it has much more than I initially planned, considering it also has a new render, audio & input backend based on SDL2). And I know that at least few people already made or are making their games with this (I recall seeing a 3.6.0 game in the AGS database).

But it's difficult to say when exactly the "final" release will be. Some of the new features may require polishing, and the version needs more testing overall.
Unfortunately the developers team is really small (there are like 2-4 people working at irregular times, and not all of them are working on this exactly version), so the only realistic solution is if the AGS community participates in testing.
I do regularily use the engine to run the games (not make ones), so may notice if some issue stands out, but frankly don't know how "stable" overall this is, and have to also rely on what other people report.

There are several known problems in 3.6.0, after fixing which I may release it as "Beta" to encourage more use and testing.
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 30/12/2021 02:16:48
Updated to Alpha 14
(use download links in the first post)

Contains all the changes from 3.5.1 Patch 6 (https://www.adventuregamestudio.co.uk/forums/index.php?topic=59656.0).

PLEASE NOTE: For the technical reasons Editor now requires .NET Framework 4.6 to run (was 4.5).


Editor
- Added "Sprite file compression" option in General Settings, replacing "Compress the sprite file" option. The new option allows a selection of compression algorithm used for sprites. Currently supported: None, RLE (old default compression) and LZW.
- Added "Enable sprite storage optimization" option to the General Settings, that permits the editor to repack sprites in a different storage format, reducing their disk size whenever possible. This option may be used alongside with the sprite compression. Note that this does not change how the sprites work in game.

NOTES: RLE compression is best for the games with simple graphics without much detail. LZW works better than RLE when the graphics are detailed, especially with anti-aliasing etc.
"Enable sprite storage optimization" is best for games with low-res "old-school" gfx which use relatively small number of individual colors. Games with anti-aliased sprites with alpha channel will benefit less from this (or not at all). Having this option enabled does not have any consequences if sprite storage cannot be optimized, these sprites are simply stored as default, so it's okay to keep this enabled at all times (unless your tests show that game loading times became longer because of this).

Engine
- Fixed default black room backgrounds were displayed as magenta / "magic pink" (regression).
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: FanOfHumor on Thu 30/12/2021 06:51:35
Does this version have 16 sound channels now?
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Manu on Thu 30/12/2021 10:19:10
Thanks again for the amazing work! I wish I knew more about Windows/.net programming to be able to help you.

One question, do you think it will ever be possible to customize the font size of the editor UI? Not the code editor, because you can zoom in/zoom out, but the right panel (Explore project and Properties) would be extremely useful!
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 30/12/2021 12:38:15
My plan in regards to 3.6.0 is currently this:

1. Fill in most noteable gaps in existing functionality; fix known issues with the base features, etc.
2. Release 3.6.0 as Beta version, and encourage people to use and test it more.
3. While in Beta stage, look if there are feature requests that are significant and don't require much changes to implement, and maybe do some.

For some time I hoped to bring 3.6.0 to almost finished state before the New Year, but somehow I got distracted and did not work much during the autumn months... So now I do not want to prolong its development further. It's been worked on roughly for 13 or 14 months now, so it's time to wrap up.



Quote from: Pajama Sam on Thu 30/12/2021 06:51:35
Does this version have 16 sound channels now?

Yes, it does for a while. All the additions to 3.6.0 are mentioned in the first post (a little disorganized list, but I will make a proper one soon).

Quote from: Manu on Thu 30/12/2021 10:19:10
One question, do you think it will ever be possible to customize the font size of the editor UI? Not the code editor, because you can zoom in/zoom out, but the right panel (Explore project and Properties) would be extremely useful!

Sorry, I cannot really tell, this is something to plan ahead and think through. Editor currently supports "color themes" (File -> Preferences -> Editor appearance -> Color themes), which recolor all controls. So I suppose similar method could be used to alter fonts everywhere. But we need to ask those who were working on this last time, maybe they have certain plans already (Chamber of Fear (persn on github) and Alan v. Drake).

Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Dave Gilbert on Thu 30/12/2021 16:32:30
This is SO GREAT! Thanks, CW.

One small thing I noticed. You incorporated this feature  (https://www.adventuregamestudio.co.uk/forums/index.php?topic=59418.0) where you can resize the sprite images in the sprite tab (which is fantastic!), but it's not implemented in the view tab as well. The test that eri0o created in the thread contained both. Is it possible to include the view loop resizing as well?
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 30/12/2021 16:59:15
Quote from: Dave Gilbert on Thu 30/12/2021 16:32:30
One small thing I noticed. You incorporated this feature  (https://www.adventuregamestudio.co.uk/forums/index.php?topic=59418.0) where you can resize the sprite images in the sprite tab (which is fantastic!), but it's not implemented in the view tab as well. The test that eri0o created in the thread contained both. Is it possible to include the view loop resizing as well?

Ah, right, this was suspended because it also included the "sound" icon, but there has been an argument about how this icon should be positioned.
But it must be possible to only add the zoom controls alone for now. I'll try do that on the next update.
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Dave Gilbert on Fri 31/12/2021 20:23:00
Yay! Thanks so much. I wasn't aware about a sound icon, but I found the thread and that also sounds extremely useful!
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: FanOfHumor on Sat 01/01/2022 05:17:50
I wanted to suggest a script that can modify a sound as the game is running.
Such as-

Code (ags) Select

function object_AnyClick()
{
   Sound.Pitch=-or+ number;
}

or
Code (ags) Select

function object_AnyClick()
{
   Sound.FadeIn=-or+ number;
   Sound.FadeOut=-or+ number;
}

or
Code (ags) Select

function object_AnyClick()
{
   Sound.Reverse=true;
}

Do you think these things could be useful in some way. Or is this already a module or plugin?

By the way what you did with resizing in the sprite tab is fantastic.Now people with poor eyesight"like my brother" can make games that were impossible for them to see to make.

I would also like to suggest making the scripting text size adjustable in prefrences.
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 01/01/2022 06:26:02
Quote from: Pajama Sam on Sat 01/01/2022 05:17:50
Code (ags) Select

function object_AnyClick()
{
   Sound.FadeIn=-or+ number;
   Sound.FadeOut=-or+ number;
}


By "fade" do you mean volume? You may adjust the volume from the channel returned from Play function.
Code (ags) Select

AudioChannel *chan = aSound.Play();
...
// later
...
chan.Volume += 1;


More info in the manual: https://adventuregamestudio.github.io/ags-manual/AudioChannel.html


Quote from: Pajama Sam on Sat 01/01/2022 05:17:50
I would also like to suggest making the scripting text size adjustable in prefrences.

Scripting text may be changed with Ctrl + Mouse Wheel, the only problem at the moment is that it does not save, so you have to do it every time.
I guess it should be possible to save the script font size in user settings.
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: FanOfHumor on Sat 01/01/2022 15:58:08
I just forgot that you could fade sound that way but the main ones I was talking about were pitch and reverse.Another good thing would be the ability to set the sound file at more amplitude than the original.I know that volume control is available now but this is limited to the original clips volume.
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Manu on Mon 03/01/2022 14:30:05
Quote from: Crimson Wizard on Thu 30/12/2021 12:38:15
Sorry, I cannot really tell, this is something to plan ahead and think through. Editor currently supports "color themes" (File -> Preferences -> Editor appearance -> Color themes), which recolor all controls. So I suppose similar method could be used to alter fonts everywhere. But we need to ask those who were working on this last time, maybe they have certain plans already (Chamber of Fear (persn on github) and Alan v. Drake).

Yes, font size as part of the color themes would be ideal! Maybe, if it's easier, you could try to build an experimental/alternative version that uses by default a bigger font size (maybe 4px or 6px more) and see what happens?
If you need a beta tester, I'm here. thank you!

Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Dave Gilbert on Tue 18/01/2022 15:12:23
Hello! I upgraded from 3.6.0.12 (alpha 13) to 3.6.0.13 (alpha 14). My game loads, compiles, and runs just fine. However, when I added some sprites to sprite editor, I got this error on saving:

(https://i.imgur.com/Qxz5bP2.png)

I kept a backup so I could revert back to 3.6.0.12. But any help is appreciated!
Title: Re: AGS 3.6.0 WIP (Alpha 14) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Tue 18/01/2022 15:38:34
Quote from: Dave Gilbert on Tue 18/01/2022 15:12:23
Hello! I upgraded from 3.6.0.12 (alpha 13) to 3.6.0.13 (alpha 14). My game loads, compiles, and runs just fine. However, when I added some sprites to sprite editor, I got this error on saving:

So, ^ this is a bug found in the latest 3.6.0 build, it was reported just recently, and I will be releasing an update soon.

It happens whenever you are changing sprites in your game and then try to save.
Title: Re: AGS 3.6.0 WIP (Alpha 15) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Tue 18/01/2022 17:00:20
Updated to Alpha 15
(use download links in the first post)

Contains all the changes from 3.5.1 Patch 7 (https://www.adventuregamestudio.co.uk/forums/index.php?topic=59683.0).

PLEASE NOTE: For the technical reasons Editor now requires .NET Framework 4.6 to run (was 4.5).


Editor:
- Added "GUI controls clip their contents" option to the General Settings. Enabled by default in the new projects, this clips texts to the control's rectangle.
- Added zoom controls for the Cursor, Inventory Item and View panes.
- On the View pane the frames having set delay and linked sound will be now indicated with icons.
- Fixed potential exception that may occur when trying to save a modified spritefile (regression since 3.6.0.13).

Engine:
- Added "--sdl-log" command line option for setting up SDL2 library output verbosity. The engine log config now has a new "sdl" group meant for SDL2 messages.
- Fixed potential crash on startup which happens if no audio device was found.
- Fixed number of problems with OGV Theora playback (stuttering and freezing video).
- Corrections to switching graphic mode between windowed and fullscreen.

Android:
- Fix single game launcher not starting (regression since 3.6.0.13).
- AGS Player now searches for the games using proper detection (ported fix from 3.5.1 where it was applied to an older version of the game launcher).
- In AGS Player added "Browse" button to the game folder selection, which opens default system file picker.
- AGS Player now searches for games recursively, in all the subfolders.
- Fixed AGS Player crashing if no android.cfg was present in the games dir.

WinSetup:
- Fixed "Fullscreen as borderless window" checkbox was not actually working.
Title: Re: AGS 3.6.0 WIP (Alpha 15) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Thu 20/01/2022 12:58:34
Great Job Crimson Wizard and the developer team !

It seems that the 3.6 can be considered as a beta version, now ? Or should we wait a bit more time ?

The new features are very interesting :)

Any way to have the "GUI Controls clip their content" option available individually ? Or is it for all GUI Controls ?
Title: Re: AGS 3.6.0 WIP (Alpha 15) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 20/01/2022 13:07:58
Quote from: Baguettator on Thu 20/01/2022 12:58:34
It seems that the 3.6 can be considered as a beta version, now ?

Almost, I guess; i'd like to wait until we have Android and/or Web build available from the Editor (eri0o is working on that afaik).

Quote from: Baguettator on Thu 20/01/2022 12:58:34
Any way to have the "GUI Controls clip their content" option available individually ? Or is it for all GUI Controls ?

It is for all GUI in game.
Personally I believe that it should be a normal default, as it is in any common GUI frameworks, as far as I am aware. But the option exists for backward compatibility, e.g. if you import an older project where you'd like to keep existing looks.

In theory it is possible to have per-control option too, not much things have to be added by the way, as such option already exists, but is only used by the Button with image (known as ClipImage property).
The reason I did not do that right away is because I believe that would complicate game desig; such beavior already introduces separate idea of control's visual dimension different from the one defined by the X,Y,Width,Height.
There may be few situations where a user may want to have a text going outside a button, for example, but I think that may be solved by having both button and label combined.
In any case, I'd rather wait and see if there are any issues with the current option, as we may always add per-control option if there's no way around that.
Title: Re: AGS 3.6.0 WIP (Alpha 15) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Thu 20/01/2022 18:35:01
Great !

The function to built for Android inside the Editor will be a very nice feature !!

I plan to go on the 3.6 very soon with my game.
Title: Re: AGS 3.6.0 WIP (Alpha 15) - SDL2-based engine + Unicode Translations
Post by: eri0o on Thu 20/01/2022 19:06:40
Once I get it a little prettier I will open a topic in the Editor board to ask feedback with test builds.

Spoiler
(https://i.imgur.com/xKPOvNc.gif)
[close]
Title: Re: AGS 3.6.0 WIP (Alpha 15) - SDL2-based engine + Unicode Translations
Post by: Mehrdad on Fri 21/01/2022 06:20:01
It's FANTASTIC @eri0o   !!!
I can't wait for it  8-0
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 21/01/2022 13:06:00
Only few days later, I must post an update fixing another annoying bug found just now.

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

IMPORTANT: If you were using 3.6.0 before, then you may receive a warning about your project spritefile containing "leftover" data which will be cleaned up now. That is normal, kind of (see below). That does not delete any actual sprites from the game project itself, only fixes the compiled "acsprset.spr"


Editor:
- Fixed sprites were never deleted from spritefile, only had their references deleted from the project (NOTE: this bug exists at least since Alpha 9 (https://www.adventuregamestudio.co.uk/forums/index.php?topic=58976.msg636638997#msg636638997)).
- Editor now cleanups spritefile on game load, identifying any data not referenced by the project and marking it for deletion.

Engine:
- Updated SDL_Sound lib to recent version, this is purely internal change but it's unknown if this will lead to anything noteable in particular.



Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sun 23/01/2022 13:47:47
Also I had an idea about Listboxes : should it be possible to have a feature that when you click on a listbox, if you just clicked on the already selected index, the listbox gets Listbox.SelectedIndex=-1 ?

It should be a nice native effect. What do you think ?
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Tue 25/01/2022 17:29:13
Also, sorry for the double-post, but I think this question has been asked a thousand times, but if possible, could we imagine a compatibility for AGS managing the PNG files like it manages BMP files ?

Creating DynamicSprites from PNG files out of the game, things like that. Would be perfect, with the alpha canal, will make the life easier for dynamicsprites with transparent backgrounds :)
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Grundislav on Fri 28/01/2022 03:10:50
Quote from: Crimson Wizard on Fri 21/01/2022 13:06:00
Engine:
- Updated SDL_Sound lib to recent version, this is purely internal change but it's unknown if this will lead to anything noteable in particular.

Unfortunately this seems to have brought back the annoying issue that was in the previous audio system.

Let's say you have INTRO.OGG and LOOP.OGG, and code it so one plays immediately after the other for a seamless transition:
Code (ags) Select

CurrentMusic = aIntro.Play();
SetGameOption(OPT_CROSSFADEMUSIC, 0);
CurrentMusic = aLoop.PlayQueued();


But there is a very small hiccup when switching tracks. Sometimes it's more noticeable than others, but the problem had been completely resolved in an earlier version of this alpha.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 28/01/2022 03:12:52
Quote from: Grundislav on Fri 28/01/2022 03:10:50
Quote from: Crimson Wizard on Fri 21/01/2022 13:06:00
Engine:
- Updated SDL_Sound lib to recent version, this is purely internal change but it's unknown if this will lead to anything noteable in particular.

Unfortunately this seems to have brought back the annoying issue that was in the previous audio system.

Does this happen with any random clips? I may test with the older library version, or make test builds for others to try.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Grundislav on Fri 28/01/2022 04:51:00
It happens with any music track, and has been happening since at least version 2.72.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 28/01/2022 04:54:30
Thing is, that SDL_Sound library is not participating in playing the sounds, but only in loading (decoding) them. So if anything affected this was elsewhere.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: eri0o on Fri 28/01/2022 09:41:16
The gap between songs tracking bug is this one: https://github.com/adventuregamestudio/ags/issues/501

@Grundislav, can you make a tiny test game that reproduces? I tried to make one, and I am not sure if I was hearing it or not, but when I recorded the sound being output with Audacity, I didn't saw the hiccup, which I was able to actually see in a previous version. If you could point an alpha version that had no hiccups would be interesting too

Anyway, rolling back SDL_sound in case it's the culprit it should be easy. I updated because it brought compatibility with 32bit wav files and fixed some minor issues. But as CW said we only use it for decoding.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on Fri 28/01/2022 12:34:05
Quote from: Grundislav on Fri 28/01/2022 04:51:00
It happens with any music track, and has been happening since at least version 2.72.

Does it happen only with mp3 files, or also with ogg and wav? If it's only a problem with mp3, it might be an issue of the format itself, not AGS, since mp3 encoding always creates a tiny "gap" at the end of the file (https://en.wikipedia.org/wiki/Gapless_playback#Compression_artifacts).

(For more info: https://sound.stackexchange.com/questions/8916/mp3-gapless-looping-help)
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Grundislav on Fri 28/01/2022 14:28:47
I use Oggs, so it’s not the issue with MP3s. Also I was assuming it was because of the SDL_sound update, but I’m probably wrong on that. If it helps, the version of the alpha I tested where the issue was not present was alpha 10. Is there an archive of previous versions where I can download alpha 10 again to make the test games for comparison?
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 28/01/2022 14:45:04
Quote from: Grundislav on Fri 28/01/2022 14:28:47
I use Oggs, so it’s not the issue with MP3s. Also I was assuming it was because of the SDL_sound update, but I’m probably wrong on that. If it helps, the version of the alpha I tested where the issue was not present was alpha 10. Is there an archive of previous versions where I can download alpha 10 again to make the test games for comparison?

Certainly, we have all the releases on github:
https://github.com/adventuregamestudio/ags/releases

specifically 3.6.0 alpha 10:
https://github.com/adventuregamestudio/ags/releases/tag/v.3.6.0.9

The downloads are attached at the end of the post, under "Assets".
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Grundislav on Fri 28/01/2022 16:45:18
Great, thank you!

Here is an archive with several tests for 2 tracks. All notes provided in the readme.txt.

https://www.dropbox.com/s/vayozljgedx3rx0/AudioTests.zip?dl=0 (https://www.dropbox.com/s/vayozljgedx3rx0/AudioTests.zip?dl=0)
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Fri 28/01/2022 22:44:09
Sorry to post it here, but maybe it needs to be fixed in the new 3.6 coming...

I encounter this problem : when I press "enter", it generates something that would be done by pressiong CtrlK or something like that (a combination of 2 keys, but NOT the "enter" key).

I have no "if (keycode==eKeyenter)" in my "on_keypress" function... And I don't ever know if "enter" key can be used like that.

Any idea about it ? Which value has the enter key ?
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 28/01/2022 23:19:12
Quote from: Baguettator on Fri 28/01/2022 22:44:09
I encounter this problem : when I press "enter", it generates something that would be done by pressiong CtrlK or something like that (a combination of 2 keys, but NOT the "enter" key).

It's a known issue that eKeyCtrlM has the same code as Enter/Return.
This may be noticed by comparing their values in the key codes table in the manual: https://adventuregamestudio.github.io/ags-manual/ASCIIcodes.html

The workaround is to additionally test if ctrl is pressed as
Code (ags) Select

if ( IsKeyPressed(eKeyCtrlLeft) ||  IsKeyPressed(eKeyCtrlRight) )
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sat 29/01/2022 08:09:52
Oh, I see ! But is there a way to fix it ?

EDIT : eKeyCtrlLeft and eKeyCtrlRight don't exist... Have they got another name in AGS ?

EDIT 2 : so I just used their ASCII code (405 and 406) instead, but there are no "enum value" for them in my version (3.5.1)

EDIT 3 : in the same "theme", is "eMouseWheelNorth" and "eMouseWheelSouth" should work with a tactile pad of a PC ? (I don't know the english name for that, but you know, the tactile zone where your fingers can simulate the mouse, like for a smartphone. Scrolling can be done by using two fingers).
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 29/01/2022 15:00:16
Quote from: Baguettator on Sat 29/01/2022 08:09:52
Oh, I see ! But is there a way to fix it ?

Probably won't do this for 3.5.1, as it's a rare problem and there's a workaround (posted above). We may look if it's possible to improve in 3.6.0 version.


Quote from: Baguettator on Sat 29/01/2022 08:09:52
EDIT 3 : in the same "theme", is "eMouseWheelNorth" and "eMouseWheelSouth" should work with a tactile pad of a PC ? (I don't know the english name for that, but you know, the tactile zone where your fingers can simulate the mouse, like for a smartphone. Scrolling can be done by using two fingers).

I don't know. But we recently received a bug report that touch pad does not register some command for the right click on Linux in 3.5.1, and later this was confirmed to work in 3.6.0. Perhaps you could test in 3.6.0 to see if it works there.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sat 29/01/2022 15:53:10
OK, will see in 3.6 !

And what about the ekeyCtrlLeft and ekeyCtrlRight ? Have they been deleted ?
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 29/01/2022 16:04:42
Quote from: Baguettator on Sat 29/01/2022 15:53:10
And what about the ekeyCtrlLeft and ekeyCtrlRight ? Have they been deleted ?

They have been added in 3.6.0, were not declared earlier. The values themselves should be valid in earlier versions.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on Sat 29/01/2022 21:13:13
I'm not sure if this is an issue with 3.6.0 or with all versions of the engine, so I'll mention it here.

When importing ttf fonts, it seems that the engine is mixing up px (pixels) and pt (points).

I have a font that is 11x11 pixels (this one (https://opengameart.org/content/lanapixel-localization-friendly-pixel-font)), however, when I import it, AGS says it has a point size of 11 and thus a pixel height of 14:

(https://i.imgur.com/oIl46fx.png)

However, this is incorrect because as mentioned above, the pixel size is 11, which corresponds to a point size of 8. This happens with other fonts too, e.g., if I have a font with a nominal size of 9px, AGS will say it's 9pt, etc.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 29/01/2022 22:26:32
Quote from: Laura Hunt on Sat 29/01/2022 21:13:13
I have a font that is 11x11 pixels (this one (https://opengameart.org/content/lanapixel-localization-friendly-pixel-font)), however, when I import it, AGS says it has a point size of 11 and thus a pixel height of 14:

(https://i.imgur.com/oIl46fx.png)

However, this is incorrect because as mentioned above, the pixel size is 11, which corresponds to a point size of 8.

Please check the value of "TTF font adjustment" property?
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on Sat 29/01/2022 22:37:20
Quote from: Crimson Wizard on Sat 29/01/2022 22:26:32
Please check the value of "TTF font adjustment" property?

In my example above, it's set to "Resize ascender to the nominal font height". If I switch it to "Do nothing", the Font Height field changes to 13.

That's the only thing that changes; the point size field still displays "11 pt".
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 29/01/2022 23:14:35
Quote from: Laura Hunt on Sat 29/01/2022 21:13:13
However, this is incorrect because as mentioned above, the pixel size is 11

I'm not certain if I understand this. AFAIK the TTF is not supposed to have a fixed pixel size itself, its pixel size depends on the point size it's used at, as well as some characteristics.
In the description it sais "font is designed to be displayed at 11px and multiples thereof", but afaik that does not mean that "the font is 11px".
Where may I see the information about point size 8 corresponding to 11px?

AGS asks for the size you want to import the font at, and it's the "Point size" property it displays.

UPDATE: I've read a bit about this, and apparently AGS editor uses "Point" term incorrectly there. I think it's meaning is rather "Import size", as in something that user requested.
TBH this specific may be due to how the importing process works with the library that we're using.

It also might be that the new "import ttf" dialog is also wrong, and should be designed differently. As an option it may be reversed to its old looks if it was more correct.

On a side note, testing this font in 3.2.1 produces same results as 3.6.0, judging by the font looks (when importing with same size parameter).

UPDATE 2: Running under debugger, i can see that when the font is imported with the size "11", its data sais "size 11x11". However the font rendering library calculates final size by summing "ascender + descender", which results in a higher height (13). AGS uses this reported number to show as "Font Height".
What puzzles me further is that under the same circumstances the actual size of letters on screen (tested by screenshot) could be 14px (capital letters).
Perhaps, 11x11 is some kind of a control size, not directly related to particular letter(s).
I wish I knew more about TTF fonts.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on Sun 30/01/2022 08:21:55
Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35
I'm not certain if I understand this. AFAIK the TTF is not supposed to have a fixed pixel size itself, its pixel size depends on the point size it's used at, as well as some characteristics.
In the description it sais "font is designed to be displayed at 11px and multiples thereof", but afaik that does not mean that "the font is 11px".

Right, but pixel fonts like this one are not "real" true type fonts; rather they are more like bitmap fonts saved as ttf for convenience and for wider compatibilty than a strict bitmap font format. But they are only meant to be rendered at very specific sizes (i.e., the "native" size the characters/glyphs were designed at, and integer multipliers of that, just like any pixel art in general).


Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35Where may I see the information about point size 8 corresponding to 11px?

Here, for example: https://simplecss.eu/pxtoems.html



Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35It also might be that the new "import ttf" dialog is also wrong, and should be designed differently. As an option it may be reversed to its old looks if it was more correct.

It could be an option, yes. So far, the "Import at font's point size" option hasn't done anything for me in most cases. How does AGS calculate the font's point size anyway, given that, as you said above, a true vector font doesn't really have a specific/default point size?


Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35
UPDATE 2: Running under debugger, i can see that when the font is imported with the size "11", its data sais "size 11x11". However the font rendering library calculates final size by summing "ascender + descender", which results in a higher height (13). AGS uses this reported number to show as "Font Height".
What puzzles me further is that under the same circumstances the actual size of letters on screen (tested by screenshot) could be 14px (capital letters).
Perhaps, 11x11 is some kind of a control size, not directly related to particular letter(s).

Yes, I found that confusing too. I'm assuming that 11x11 is simply saying that every character by itself fits in a 11x11 cell, but of course, this is not the same as the total font height when we take the tallest characters + descenders into account. But at least this confirms that AGS is calculating the total font height correctly as 14 (when the "resize ascender" option is active). This is making me think that maybe AGS is indeed doing things correctly, and it's the font designers who are failing to account for the real total height of their fonts by reporting only the "cell size".
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sun 30/01/2022 15:34:23
Quote from: Laura Hunt on Sun 30/01/2022 08:21:55
Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35It also might be that the new "import ttf" dialog is also wrong, and should be designed differently. As an option it may be reversed to its old looks if it was more correct.

It could be an option, yes. So far, the "Import at font's point size" option hasn't done anything for me in most cases. How does AGS calculate the font's point size anyway, given that, as you said above, a true vector font doesn't really have a specific/default point size?

I think there may be a misunderstanding too. "Import at font's point size" also uses the number field, it tries to import the font at the typed size. But it uses "point" term incorrectly, as it seems. So the correct title would be "Import at this font's size".
The difference between two these options is that the first option imports at the size given by user, and the second searches for the font size that results in particular full font height (ascender + descender).
I may either remove the second option if it's not useful, or reorganize fields to make it more clear that both options use the number field.


Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35But at least this confirms that AGS is calculating the total font height correctly as 14 (when the "resize ascender" option is active).
Erm, this particular option is a backward compatibility feature, and is meant mostly for fonts which made specifically for AGS in the past. Because ascender is resized to match the demanded font size, this option may result in font glyphs being drawn lower, adding vertical space above the letters.

The problem with 3.6.0 is that it still uses unmodified templates from 3.5.*, and therefore when you create your games all the properties are adjusted for importing these older projects.
We need to update the templates to have the recommended settings for 3.6.0, with "resize ascender" off, and other changes.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on Sun 30/01/2022 17:50:52
Quote from: Crimson Wizard on Sun 30/01/2022 15:34:23
Quote from: Laura Hunt on Sun 30/01/2022 08:21:55
Quote from: Crimson Wizard on Sat 29/01/2022 23:14:35It also might be that the new "import ttf" dialog is also wrong, and should be designed differently. As an option it may be reversed to its old looks if it was more correct.

It could be an option, yes. So far, the "Import at font's point size" option hasn't done anything for me in most cases. How does AGS calculate the font's point size anyway, given that, as you said above, a true vector font doesn't really have a specific/default point size?

I think there may be a misunderstanding too. "Import at font's point size" also uses the number field, it tries to import the font at the typed size. But it uses "point" term incorrectly, as it seems. So the correct title would be "Import at this font's size".
The difference between two these options is that the first option imports at the size given by user, and the second searches for the font size that results in particular full font height (ascender + descender).
I may either remove the second option if it's not useful, or reorganize fields to make it more clear that both options use the number field.

Oh. Oh! Yeah, that wasn't clear to me at all, I thought only the second option used the number field.

Quote from: Crimson Wizard on Sun 30/01/2022 15:34:23
Quote from: Laura Hunt on Sat 29/01/2022 23:14:35But at least this confirms that AGS is calculating the total font height correctly as 14 (when the "resize ascender" option is active).
Erm, this particular option is a backward compatibility feature, and is meant mostly for fonts which made specifically for AGS in the past. Because ascender is resized to match the demanded font size, this option may result in font glyphs being drawn lower, adding vertical space above the letters.

The problem with 3.6.0 is that it still uses unmodified templates from 3.5.*, and therefore when you create your games all the properties are adjusted for importing these older projects.
We need to update the templates to have the recommended settings for 3.6.0, with "resize ascender" off, and other changes.

Yes, I had the impression that "resize ascender" was the new option and "do nothing" was the backwards-compatible one. All clear now.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Wed 02/02/2022 19:19:40
PROBLEM !! :)

I installed the 3.6 last version, and I encountered a problem using the ReadRawLine function.

I use this function to read some attributes for characters and custom things players can create to play with in the game. So I read these informations in a .txt file, and store that in a struct.

I have to read this line :

0;NomVéhicCréé0;null;null;null;0;25;25;25;25;55;35;10;10;90;10;null;0;null;0;null;0;0;

and it crashes !

I debugged the situation and found that, using this function, it meant that :

String s=File.ReadRawLineBack();
Display(s);
// Displayed : "0;NomV"

It seems that "é" was causing an error in the ReadRawLineBack function. I changed into the .txt file and replaced all the "é" with "e", and it worked perfectly.

Any idea what's happenning ? It was NOT happenning with the 3.5.1 version I used before :)

EDIT : was the limit of 199 removed for the ReadRawLineBack function ? I thought that yes, but I'm not sure...

EDIT 2 : just managed to launch the game with the 3.6, and I found that scrolling with the finger pad works perfectly ! (it was one of my previous questions).
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 03/02/2022 01:33:30
Quote from: Baguettator on Wed 02/02/2022 19:19:40
It seems that "é" was causing an error in the ReadRawLineBack function. I changed into the .txt file and replaced all the "é" with "e", and it worked perfectly.

Any idea what's happenning ? It was NOT happenning with the 3.5.1 version I used before :)

Yes, this is a bug in 3.6.0, any letter with code above 127 will be mistakenly treated as an end of file. We have this recorded, and it will be trivial to fix.

I should note just in case, that if the letter is a "unicode" one (code above 255), and text is saved as UTF-8, this expected to be read normally (after this bug is fixed), as it reads byte by byte, but the string will only be correctly displayed if the engine works in the Unicode mode. Currently it may only be switched to this mode by the use of translation options; if you use translations and it has a utf-8 encoding option set, as explained in the thread: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59240.0

Quote from: Baguettator on Wed 02/02/2022 19:19:40
EDIT : was the limit of 199 removed for the ReadRawLineBack function ? I thought that yes, but I'm not sure...

Yes, it should be mentioned in the Changes log: https://github.com/adventuregamestudio/ags/blob/master/Changes.txt

Quote from: Baguettator on Wed 02/02/2022 19:19:40
EDIT 2 : just managed to launch the game with the 3.6, and I found that scrolling with the finger pad works perfectly ! (it was one of my previous questions).

Nice, this is very good to know that SDL2 works better in this regard.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Thu 03/02/2022 20:10:16
Does that mean that I need to put this :

// Text encoding hint
//#Encoding=UTF-8
// Source text encoding hint
//#GameEncoding=UTF-8

At the top of my translation file, then save the file where I have to read something using the ReadRawLineBack function in UTF-8, and then it will work as expected ?
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 03/02/2022 21:20:05
Quote from: Baguettator on Thu 03/02/2022 20:10:16
Does that mean that I need to put this :

At the top of my translation file, then save the file where I have to read something using the ReadRawLineBack function in UTF-8, and then it will work as expected ?

You need to have that translation active, for the engine to display the UTF-8 text.
Create and compile translation normally, you don't have to save the file somewhere else.


On a separate note, we're currently conducting experiments to see how easy that would be to make the Editor itself work and save data in unicode mode. If it worked, then users won't have to rely on translations.
There are preliminary tests that give a hope it's possible, but this may take a while to integrate, so no promises for now.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Thu 03/02/2022 21:26:29
OK, but the ReadRawLineBack function is used in another .txt file, not the one for the translation. So are we talking about the same thing ?

Sorry if I misunderstand you, english is not my 1st language :(
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 03/02/2022 21:36:48
Quote from: Baguettator on Thu 03/02/2022 21:26:29
OK, but the ReadRawLineBack function is used in another .txt file, not the one for the translation. So are we talking about the same thing ?

There are two separate problems.

1. ReadRawLineBack had a mistake that made it cut the line if a utf-8 character is met. Now this is fixed, you may download the patched editor here:
https://cirrus-ci.com/task/5287098419773440

2. Displaying the UTF-8 characters on screen. This is not directly related to ReadRawLineBack, but related to the data it read.
Engine will only display UTF-8 characters on screen if it works in "unicode" mode and you provide a proper unicode font.
There's currently only one way to switch engine to "unicode" mode: it is to enable translation that has "//#Encoding=UTF-8" in it.
Title: Re: AGS 3.6.0 WIP (Alpha 16) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Thu 03/02/2022 21:46:34
Perfect ! It works great !! Thanks a LOT :)
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 04/02/2022 06:59:38
Updated to Alpha 17
(use download links in the first post)

Synced with AGS 3.5.1 - Patch 8.

New changes:

Editor:
- Added Web/Emscripten build target support (requires "Web build component" installed). See below for brief instructions.
- Added Character.IdleAnimationDelay property to let setup idle view's animation speed.
- Added Cursor.AnimationDelay property to let setup cursor's animation speed.
- Rooms created from a Blank template will now have default background of a game's resolution.
- Editor no longer prevents exporting string arguments from Get/SetTextProperty calls to TRS file.
- Fixed Custom properties' default values were not exported to translation.

Script API:
- Hotspot.Name and Object.Name may now be set in script.
- Added Character.IdleAnimationDelay to let control idle view's animation speed.
- Added new delay parameter to Mouse.ChangeModeView() to let control cursor's animation speed.

Engine:
- Fixed AudioChannel.Speed not working.
- Fixed AudioChannel.PositionMs now resetting when the repeating clip rewinds.
- Fixed File.ReadRawLine() failing at character values >127.
- Fixed potential crash on room load if the walkable area mask contained color values above the supported range.
- Fixed loading savegame made before 3.6.0 was crashing due to incorrect audio channels initialization.

Web / Emscripten:
- Initial port release.




In regards to building Web version of the game. We do not provide necessary files in installation yet, so you'd have to download them yourself for now. They may be found attached to any release on github starting with v3.6.0.16, the archive is called "emscripten.zip". For instance, the current one is: https://github.com/adventuregamestudio/ags/releases/download/v.3.6.0.16/emscripten.zip

Go to your Editor's program folder, create a new subfolder inside called "Web". Unpack emscripten.zip there (unpack fully, there are several archives inside for technical reasons, we will fix this later).
You should now have 4 files there:
- ags.js
- ags.wasm
- index.html
- my_game_files.js

Now when you have this, run the Editor and open your project. The new "Web" Build target should become available. If you check it, and rebuild the project, the Editor will deploy necessary files into Compiled/Web folder in your project.

Note that you cannot run index.html directly, it likely won't work. You need to create a web server with these files on it. There is a multitude of ways you can do that. For example I've been testing this using a simple Google Chrome app called Web Server for Chrome (https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en). You may find your own way.

For any questions regarding the Web port please refer to and post in dedicated forum thread:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=59164.0
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Laura Hunt on Fri 04/02/2022 07:15:21
Quote from: Crimson Wizard on Fri 04/02/2022 06:59:38
Updated to Alpha 17
(use download links in the first post)

- Added Character.IdleAnimationDelay property to let setup idle view's animation speed.
- Added Cursor.AnimationDelay property to let setup cursor's animation speed.
- Rooms created from a Blank template will now have default background of a game's resolution.
- Editor no longer prevents exporting string arguments from Get/SetTextProperty calls to TRS file.
- Fixed Custom properties' default values were not exported to translation.

Yesss I already said this on Discord, but thanks again for these fixes/additions! :)

I have a very tiny additional suggestion to make. In the header of the .tra file, there are some lines with instructions as to how to use the various parameters:

Code (ags) Select
// The normal font to use - DEFAULT or font number
//#NormalFont=DEFAULT
// The speech font to use - DEFAULT or font number
//#SpeechFont=DEFAULT
// Text direction - DEFAULT, LEFT or RIGHT
//#TextDirection=DEFAULT
// Text encoding hint
//#Encoding=UTF-8


However, "Text encoding hint" doesn't have any instructions, so new users won't know which options can be used here (I myself sometimes forget if I should write ASCII or ANSI there). In order to make it more user friendly, could it be amended to something like this?

Code (ags) Select

// Text encoding hint - UTF-8 or ASCII
//#Encoding=UTF-8


Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Fri 04/02/2022 20:49:56
Hey !

Is it possible to manage in-game the windowed mode ? It could be pleasant to decide in-game to switch from full screen to windowed mode and vice-versa, or adjust the size of the windowed mode.
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: eri0o on Fri 04/02/2022 21:09:12
Use alt+enter to alternate between windowed and Fullscreen mode. On windowed mode it's possible to resize the window by clicking on the window borders and resizing. It will obey what you set about the sizing behavior on Winsetup/acsetup.cfg (proportional, stretch, ...)

Through script it should be System.Windowed (https://adventuregamestudio.github.io/ags-manual/System.html#systemwindowed) property.
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sat 05/02/2022 19:15:19
Thanks ErioO !

Also, I just thought about something I encountered before, and maybe it could be changed in new versions of AGS : now, the maximum number of parameters in a function is 14. Could this limit be removed/pushed away ? It could be useful :)

EDIT : also new suggestion : would it be possible and technically possible to have a text in a label that uses different fonts ? Also for ListBox Items in different colors ? It could be useful ;) But I don't know if it's technically possible in AGS ?
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: eri0o on Sat 05/02/2022 21:08:17
It should not be needed to push more than 14 parameters in a function. The usual approach is to simply build and object (managed struct) and then pass this managed struct to the function.
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sat 05/02/2022 21:15:06
Hmm... I can't vizualize your solution. How could it "increase" the number of parameters in a function by passing a struct ?
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 05/02/2022 22:08:32
Quote from: Baguettator on Sat 05/02/2022 21:15:06
Hmm... I can't vizualize your solution. How could it "increase" the number of parameters in a function by passing a struct ?

You can put multiple variables in a managed struct and pass the instance of that struct as 1 parameter. There may be other solutions, depending on the situation: what the function is for, how do you use it, maybe it can be replaced with just a struct and setting struct members instead? But this is a general scripting topic.

Quote from: Baguettator on Sat 05/02/2022 19:15:19
EDIT : also new suggestion : would it be possible and technically possible to have a text in a label that uses different fonts ? Also for ListBox Items in different colors ? It could be useful ;) But I don't know if it's technically possible in AGS ?

It's currently possible to script your own label or list box that uses several fonts and colors, with DrawingSurface and DynamicSprite functions.
In theory it's possible to implement some kind of a "rich text" control in the engine too, for example one that draws text using html-like tags, but that's a serious work that requires some good design decision first. We have already planned to wrap 3.6.0 version up, and now working towards finishing priority major features. The other features added were ones that cover problems that are too inconvenient for scripting and simple enough to do quickly in the engine at the same time.
If there's an actual interest in such engine feature, you may post it in the engine suggestions forum section, or our issue tracker on github.
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: eri0o on Sat 05/02/2022 22:43:11
Hey, I would like to suggest two modifications on the top post

Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Sat 05/02/2022 22:54:27
Quote from: eri0o on Sat 05/02/2022 22:43:11
Hey, I would like to suggest two modifications on the top post

Should be done now.
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sun 06/02/2022 15:34:12
Quote from: Crimson Wizard on Sat 05/02/2022 22:08:32
You can put multiple variables in a managed struct and pass the instance of that struct as 1 parameter. There may be other solutions, depending on the situation: what the function is for, how do you use it, maybe it can be replaced with just a struct and setting struct members instead? But this is a general scripting topic.

I really don't understand how a managed struct can replace several function parameters, but the thing is I created functions to place some tokens in a map (like a tabletop game), and sometimes 1 function is to set the different possibilities of placement for 1 token. So, for each possibility, I need to tell which tile, which x coordinate of the tile, and which y coordinate of the tile. 3 parameters per possibility. In this case, my function can get only 4 possibilities. Of course I can set up a way to stock these possibilities, then recall the same function with other parameters and increase the number of possibilities, that's what I did. But it could be useful to have a greater limit. Or maybe I'm wrong ?

Quote from: Crimson Wizard on Sat 05/02/2022 22:08:32
It's currently possible to script your own label or list box that uses several fonts and colors, with DrawingSurface and DynamicSprite functions.
In theory it's possible to implement some kind of a "rich text" control in the engine too, for example one that draws text using html-like tags, but that's a serious work that requires some good design decision first. We have already planned to wrap 3.6.0 version up, and now working towards finishing priority major features. The other features added were ones that cover problems that are too inconvenient for scripting and simple enough to do quickly in the engine at the same time.
If there's an actual interest in such engine feature, you may post it in the engine suggestions forum section, or our issue tracker on github.

Hmm seems complicate for me to do so. Is there any module for that kind of things, existing for the 3.6 ? Or any method to do the same ?

Also, I already mentionned it, but got no answer : I don't know if it's a problem, but it's a bit annoying for me : in my struct to manage the maps in my game, I have plenty of functions to set up the map. I have a huge function that creates the chosen map (with if/else conditions). The problem is that when my function becomes to big, and if I write something like that :

Code (ags) Select
function Cartes::Create(int c)
{
  this.PlaceTokenA(
  // the PlaceTokenA function has parameters like "int tile, int x, int y, int rotation" etc...
}


Normally, when I hit the "(", AGS shows me the order of the parameters below the editor's text. But it doesn't if the function is too big (I think after a hundred or so lines long). It's a bit annoying because sometimes I have to look in the script in which order are the parameter of the function (like PlaceTokenA), it's a lost of time. Any idea why it happens ? Is it possible to correct it ?
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: eri0o on Sun 06/02/2022 15:39:31
@Baguettator, I am sorry but this is very offtopic, if you want help with the design you should ask in the advanced technical forum.
Title: Re: AGS 3.6.0 WIP (Alpha 17) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Sun 06/02/2022 15:50:30
Sorry, I didn't thought about it. Excuse me for that...

But I think this is not offtopic : I don't know if it's a problem, but it's a bit annoying for me : in my struct to manage the maps in my game, I have plenty of functions to set up the map. I have a huge function that creates the chosen map (with if/else conditions). The problem is that when my function becomes to big, and if I write something like that :

    function Cartes::Create(int c)
    {
      this.PlaceTokenA(
      // the PlaceTokenA function has parameters like "int tile, int x, int y, int rotation" etc...
    }

Normally, when I hit the "(", AGS shows me the order of the parameters below the editor's text. But it doesn't if the function is too big (I think after a hundred or so lines long). It's a bit annoying because sometimes I have to look in the script in which order are the parameter of the function (like PlaceTokenA), it's a lost of time. Any idea why it happens ? Is it possible to correct it ?

For me, it's a problem, like a problem of memory or I don't know what...
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Mon 07/02/2022 14:14:50
Updated to Alpha 18
(use download links in the first post)

I had to post another update early, because there was a critical bug found in the Alpha 17, related to audio playback.

New changes:

Editor:
- The new Editor's Preferences dialog now features several tabs, including "Advanced" with a property grid. There's nothing special there yet (it just repeats all the same options in the table format), but this will be used later to add certain settings for Android build, etc.
- Added Room.BackgroundAnimationEnabled property to let have disabled animation on room load.
- Renamed font's "Point Size" property to just "Font Size", because AGS historically used wrong term in regards to this value.
- An attempt to enhance new "Import TTF dialog", making it easier for users to understand the import method selection.

Engine:
- Fixed potential crash occuring randomly when the audio playback starts (regression in 3.6.0.16).



Quote from: Baguettator on Sun 06/02/2022 15:50:30
I don't know if it's a problem, but it's a bit annoying for me : in my struct to manage the maps in my game, I have plenty of functions to set up the map. I have a huge function that creates the chosen map (with if/else conditions). The problem is that when my function becomes to big, and if I write something like that :
<...>
Normally, when I hit the "(", AGS shows me the order of the parameters below the editor's text. But it doesn't if the function is too big (I think after a hundred or so lines long).

This sounds like a autocomplete bug; we may open a bug report for that. Autocomplete is known to have number of problems in AGS...
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Baguettator on Mon 07/02/2022 19:22:15
Thanks Crimson for your answer ! Indeed, it could be SO NICE to have the autocomplete working well, at least for my situation... Let me know :)
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: eri0o on Wed 09/02/2022 11:34:17
On the top post it's written
QuoteKnown problems

* AudioChannel.Speed property is not working at the moment.
But you have fixed this already CW.
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Stranga on Fri 18/02/2022 06:57:35
Hello everyone,

I have a strange bug when saving and loading a game.

If I have a room with a background with more than one frame and save it, when it loads the background animation just plays. Now, I figured that I can now turn off background animations via the room setting, however, I was working with day/night cycles, and if I save at night and load it's day (or background frame resorts to default which I think is 0). Basically, it's not saving room background frames (Not sure if this is affecting other frame animations, haven't tested it with views yet)


I'm not sure if this is an actual bug and I have to code it some other way, just thought I'd report it just in case.
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Fri 18/02/2022 13:35:40
Quote from: Stranga on Fri 18/02/2022 06:57:35if I save at night and load it's day (or background frame resorts to default which I think is 0). Basically, it's not saving room background frames (Not sure if this is affecting other frame animations, haven't tested it with views yet)

Looks like a bug.
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Stranga on Wed 02/03/2022 06:09:01
Thanks for the update and fix CW  :-D

I also found this, not sure if it's a bug either but when running custom dialog options via scripting I get these errors:
Spoiler
(https://i.imgur.com/iIJdfHr.jpg)
(https://i.imgur.com/50vF8IW.jpg)
(https://i.imgur.com/5zatMt7.jpg)
[close]

the first one is in Turkish, which just seems to show some displacement of the letters and the other two are Russian which doesn't show up at all, I've tried a few different fonts with Russian but still, the same result.
The rest of the GUI and regular text seems to work fine :)
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Wed 02/03/2022 08:20:01
Quote from: Stranga on Wed 02/03/2022 06:09:01
I also found this, not sure if it's a bug either but when running custom dialog options via scripting I get these errors:

I cannot answer this question without knowing more details - what script you have, which fonts you have, and so on.
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Stranga on Wed 02/03/2022 23:33:18
Quote from: Crimson Wizard on Wed 02/03/2022 08:20:01
I cannot answer this question without knowing more details - what script you have, which fonts you have, and so on.

My apologies, here's the script:
Spoiler
Code (ags) Select

// new module script

//int dlg_opt_color = ;
int dlg_opt_acolor = 30719;
int dlg_opt_ncolor = 65535;
int DlgCursorPos = 1;

import int  KeyUp[2];
import int  KeyDown[2];
import int  KeyLeft[2];
import int  KeyRight[2];
import int  KeyAction[2];
import int  KeyBack;
import int  KeyMenu;
import int  KeySprint[2];

import bool CanPress;

function repeatedly_execute()
{
  btnDialogCursor.Visible = false;
  btnOptionsBox.Visible = false;
}

function dialog_options_get_dimensions(DialogOptionsRenderingInfo *info)
{
  // Create a 200x200 dialog options area at (50,100)
  info.X = 30;
  info.Y = 50;//50
  info.Width = 256;
  info.Height = 256;
  info.ActiveOptionID = 1; // set to first option
}

function dialog_options_render(DialogOptionsRenderingInfo *info)
{
  //info.Surface.Clear(dlg_opt_color);
  int i = 1,  ypos = 24,  xpos = 0;
  // Render all the options that are enabled
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (info.ActiveOptionID == i){
       
          btnDialogCursor.SetPosition(6, ypos+42); //Cursor Position
          btnDialogCursor.Animate(5, 0, 5, eRepeat);
      }
       else
       
        info.Surface.DrawingColor = dlg_opt_ncolor;
        info.Surface.DrawStringWrapped(5, ypos, info.Width - 10,
        eFontfntDefault, eAlignLeft, info.DialogToRender.GetOptionText(i));
        ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontfntAll, info.Width - 10);   
    }
    aMenuSelector.Play();
    i++;
  }
}

function dialog_options_key_press(DialogOptionsRenderingInfo *info, eKeyCode keycode)
{
  switch (keycode)
  {
  case KeyUp[0]:
  case KeyUp[1]:
    // check all options upwards until found an active one
    for (int next_opt = info.ActiveOptionID - 1; next_opt >= 1; next_opt--)
    {
      if (info.DialogToRender.GetOptionState(next_opt) == eOptionOn)
      {
        info.ActiveOptionID = next_opt;
        break;
      }
    }
  break;
  case KeyDown[0]:
  case KeyDown[1]:
    // check all options downwards until found an active one
    for (int next_opt = info.ActiveOptionID + 1; next_opt <= info.DialogToRender.OptionCount; next_opt++)
    {
      if (info.DialogToRender.GetOptionState(next_opt) == eOptionOn)
      {
        info.ActiveOptionID = next_opt;
        break;
      }
    }
  break;
  }
 
if(CanPress)
  {
    switch(keycode)
    {
      case KeyAction[0]:
      case KeyAction[1]:
        btnDialogCursor.Visible = false;
        btnOptionsBox.Visible = false;
        btnPopUp.Visible = false;
        btnPopTalk.Visible = false;
        info.RunActiveOption();
      break;
    }
  }
}

function dialog_options_repexec(DialogOptionsRenderingInfo *info)
{
    btnOptionsBox.Visible = true;
    btnDialogCursor.Visible = true;
}
[close]

Here's the font I am using too: https://opengameart.org/content/lanapixel-localization-friendly-pixel-font (https://opengameart.org/content/lanapixel-localization-friendly-pixel-font)
The game is keyboard-only based so I used the custom choice scripting found in the manual. I also use this same font with other languages too and it works fine with them.
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Crimson Wizard on Thu 03/03/2022 01:15:23
Quote from: Stranga on Wed 02/03/2022 23:33:18
Here's the font I am using too: https://opengameart.org/content/lanapixel-localization-friendly-pixel-font (https://opengameart.org/content/lanapixel-localization-friendly-pixel-font)
The game is keyboard-only based so I used the custom choice scripting found in the manual. I also use this same font with other languages too and it works fine with them.

I will make some tests, but something I noticed in the script:
- calling GetTextHeight you use eFontfntAll, but
- calling DrawStringWrapped you use eFontfntDefault.

What's the difference between these fonts, could you double check that this is correct?
Title: Re: AGS 3.6.0 WIP (Alpha 18) - SDL2-based engine + Unicode Translations
Post by: Stranga on Thu 03/03/2022 02:10:11
That was the problem! Thanks, CW! I can't believe I missed that  :-[ Everything works fine now  :-D

Edit: the difference was that "Default" was the AGS font I was using during the development "All" was the one that contained the customer symbols and such for different languages
Title: Re: AGS 3.6.0 WIP (Alpha 19) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Thu 03/03/2022 08:39:14
Updated to Alpha 19
(use download links in the first post)

New changes:

Editor:
- Finally, full Unicode support right in the Editor. Script, game properties and so on, support any human language. Note that you have to use proper Unicode fonts for this to work correctly.
To upgrade your game to unicode mode, goto General Settings and check the "Text format" option. Changing it will convert game files and resave the project. If you had only basic latin text - nothing should change; this is mostly done in case you had other languages in your game. After we update templates, unicode mode should be default for all the new projects.
ANSI mode is still supported, mostly in case you're upgrading an old game and wish to stick to old fonts.
- Upgraded script editor to Scintilla 3.21.1 and ScintillaNET 3.6.3. This was done for easier unicode support. I don't think anything has changed feature-wise, but keep an eye for regressions.
- Added Android build target support (requires "Android component" installed).
More info on building for Android is here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59772.0
- Removed game Cursors hard limit (was 20), fwiw.
- Fixed few editor panes were not opening correct help topics in F1.

Engine:
- Added "--clear-cache-on-room-change" command-line arg (and similar config option).
- Fixed OGV Theora videos positioned incorrectly if they have certain sizes or aspect ratios.


I think we're now done with major features in this version. In order to move to Beta stage, we only need to update game templates, because they are still upgraded from 3.5.1, and some options are set to backward compatible values at start.
Title: Re: AGS 3.6.0 WIP (Alpha 19) - SDL2-based engine + Unicode support
Post by: eri0o on Thu 03/03/2022 11:46:14
The web component is now in too (as part of the installer), so it's not necessary to link it separately in the main page anymore.

I think during beta we will also be writing the missing manual pages, updating script API changes in documentation.
Title: Re: AGS 3.6.0 WIP (Alpha 19) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Fri 04/03/2022 16:57:34
Unfortunately found two bugs in Alpha 19:
- When converting text format (in General Settings) all your scripts should be closed, otherwise the editor may crash;
- In script editor deleting multiple lines at once (with selection) may cause crash.

Both are fixed in this temp build:
https://cirrus-ci.com/task/6570224085368832

I will be releasing a proper update too soon.
Title: Re: AGS 3.6.0 WIP (Alpha 20) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Sun 06/03/2022 15:17:11
Updated to Alpha 20
(use download links in the first post)

Had to make new update soon, to fix couple of problems found since the last update.

New changes:

Editor:
- Fixed crash when changing game encoding if any script window is open (since 3.6.0.18).
- Fixed script editor "random" errors when deleting multiline selection (regression in 3.6.0.18).

Compiler:
- Support hexadecimal number literals (32-bit max). May be used anywhere where regular decimal numbers are used.
Code (ags) Select

int a = 0xFFFFFF00;
int b = 0x01234567;
int c = 0xabcdefab; // both capital and small x and a-f letters are supported
int d = 16 + 0x10; // means 16 + 16


Engine:
- Removed limit of simultaneous Button animations (was 15).
- Removed limit of Character followers (was 30) (was not demanded, but because why not).

Full list of changes is available here:
https://github.com/adventuregamestudio/ags/blob/master/Changes.txt
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Mon 14/03/2022 18:59:07
Updated to Alpha 21
(use download links in the first post)

We are working to complete the unicode support in this version, and also fixing some issues found since the last update.
We still have to prepare updated game templates, imho this is the last thing remaining before announcing 3.6.0 Beta.

New changes:

Editor:
- Added "Use old keyboard handling" option to the General Settings (Backwards compatibility section), which lets select between classic key press handling and new one meant for easier unicode chars support in scripts. See below for more information on this new mode.
- Select script editor's font in the editor's Preferences.
- Fixed some editor's panes do not update previews on property changes (regression since 3.6.0.19).

Compiler:
- Support for the unicode character literals.

Script API:
- Expanded on_key_press callback, now supports two parameters: key code and key modifier flags.
- In the new key handling mode on_key_press is called for each actual key press; e.g. combinations like Ctrl+Z will result in two on_key_press calls, one with eKeyCtrlLeft and second with eKeyZ.
- Implemented new on_text_input(int ch) callback which is called when the engine receives a printable character. This callback is essential for handling unicode chars in script.
- Similarily, expanded dialog_options_key_press with the third mod argument, and implemented dialog_options_text_input callback for receiving unicode chars during the custom dialog options state.
- Added eKeyMod enum for key modifiers constants.
- String.AppendChar, ReplaceChar and Chars[] property are now working with the unicode characters.
- String.Format("%c") specifier will now be able to print unicode characters.

Engine:
- Update engine's sound config to match new SDL2 backend, allow to choose specific sound driver.
- Allow to choose output graphics driver for software mode in config.
- Fixed engine was handling buffered key presses one at a game frame, could cause delayed reaction to the key input (regression in 3.6.0).
- Fixed engine switching to ASCII mode when changing to default translation, even if the game is compiled in unicode mode.

Winsetup:
- Updated sound config, removing obsolete settings.

Full list of changes is available here:
https://github.com/adventuregamestudio/ags/blob/master/Changes.txt
Description of the current engine config:
https://github.com/adventuregamestudio/ags/blob/master/OPTIONS.md




In regards to the key input changes. There are two things.

1. Regardless of the handling mode (see below), the on_key_press function now supports the second parameter: key modifiers. It stores current key modifiers (ctrl, shift, alt, etc) as bit flags. The reason for introducing this parameter is that because the key presses are buffered between game frames, using IsKeyPressed does not always correspond to each handled key. Having an actual "mod" parameter ensures that you can know which modifiers were on when this particular key was pressed.

NOTE: the "int mod" is an optional parameter, and may be omited from the function. It will work correctly even with 1 parameter (eKeyCode).

The list of key mods:
Code (ags) Select

enum eKeyMod
{
  eKeyModShiftLeft,
  eKeyModShiftRight,
  eKeyModShift,        // this means: any shift
  eKeyModCtrlLeft,
  eKeyModCtrlRight,
  eKeyModCtrl,         // this means: any control
  eKeyModAltLeft,
  eKeyModAltRight,
  eKeyModAlt,           // this means: any alt
  eKeyModNum,        // numlock
  eKeyModCaps         // capslock
};


These are not normal enums, but bit fields, which means that you should not use regular comparison with them (like "if (mod == eKeyModCtrl)"), but bit field check instead: "if (mod & eKeyModCtrl)".
Code (ags) Select

function on_key_press(eKeyCode key, int mod) {
    if (key == eKeyQ && (mod & eKeyModCtrl)) { // this tests for ctrl + Q
    }
    if (key == eKeyF1 && (mod & eKeyModAlt)) { // this tests for alt + F1
    }
    if (mod & eKeyModNum) { // this tests if num lock was on when this key is pressed
    }
}


2. The new key handling mode, it's enabled by setting "Use old keyboard handling" in Backwards compatibility (General Settings) to false (this will be the new game default after we update game templates).

What is the difference between old mode and new mode?

Old mode is a backward compatible input handling mode, where
* lone mod keys (Ctrl, Alt, Shift) are not passed further into the engine nor script;
* key + mod combos are merged into one key code for the on_key_press callback: e.g. eKeyCodeCtrlA key codes;
* on_text_input script callback is NOT called.

New mode is:
* all keys are passed into the engine and on_key_press script callback as-is, one by one; e.g. if you press Ctrl + Z, then you get two on_key_press calls, one for Ctrl and another for Z argument..
* on_text_input script callback receives printable characters, which may be used to handle unicode chars typed by the player correctly.

There's a new compiler macro "NEW_KEYINPUT_API" which may be tested using #ifdef and #ifndef to know which mode is set when the game is run. This is mostly useful to the script module writers.

Examples of new mode script
Code (ags) Select

function on_key_press(eKeyCode k, int mod) {
    if (k == eKeyV && (mod & eKeyModCtrl)) {
         // player pressed Ctrl+V, paste the copied text into your custom text control
    }
    if (k == eKeyAlt) {
         // player pressed either Alt
    }
}

function on_text_input(int ch) {
    // player pressed some keys, which formed a printable character
    // this may be either ASCII char, or Unicode char, depending on the game mode
    lblTextField.Text = lblTextField.Text.AppendChar(ch);
}
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Andrea1992 on Wed 16/03/2022 06:00:16
Hi, I tried the latest alpha and in some rooms I get this error, I tried to isolate the room functions and interactions, but makes no differnce.
Any guidance on how to debug it? thanks
(https://i.ibb.co/DgNSWtG/Capture.png) (https://imgbb.com/)
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: eri0o on Wed 16/03/2022 08:48:07
@Andrea1992, You mean you only get these errors in some rooms, but not others?

Trying to narrow down where it could be the problem in AGS, some questions:
Other than this I would ask, if possible, if you could share the room .crm file - a dm is fine.
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Andrea1992 on Wed 16/03/2022 12:20:21
Yes, I only get these errors in some rooms.
There aren't multiple background frames in these rooms (Most of the other rooms have multiple backgrounds though, but they're working fine)
There aren't walk behinds.
The room setting "ShowPlayerCharacter" is set to False for these rooms. They are close ups to show details of some objects and some have animations.

The error happens as soon as I change to these rooms.
Here you can download the .crm files of a couples of rooms with the error.
https://ln5.sync.com/dl/fe4035540/b4fwh9cr-a6khtsp6-5cz5e5dg-7ek279rh (https://ln5.sync.com/dl/fe4035540/b4fwh9cr-a6khtsp6-5cz5e5dg-7ek279rh)

Thanks!
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Wed 16/03/2022 13:58:31
@Andrea1992, "Program pointer +204" indicates a stage during loading the room, when engine prepares walkable areas and walk-behinds.
Unfortunately, checking these rooms alone, and importing them into another game, does not reproduce the problem.

Do you remember what was the previous version of AGS you were using where you did not have such errors?
Is it acceptable for you to PM a full compiled game for a test?
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Andrea1992 on Wed 16/03/2022 17:34:36
I made the game with AGS 3.5.0.24
I have PM a link to the game.
Thanks.
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Wed 16/03/2022 20:52:55
@Andrea1992, it appears to be some older bug which I could not fix correctly. It happens when you move from the room with several backgrounds to room with less backgrounds.
Here's the build that should have this fixed:
https://cirrus-ci.com/task/5214597316608000
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Andrea1992 on Thu 17/03/2022 00:44:39
Thanks Crimson, the build fixed the problem. So, when you update to alpha 22 or beta,  will the fix be included? or will I have to use a different ags build?

Also, the game freezes sometimes. There is a cutscene in one of the rooms with fewer backgrounds and when I tried to escape it, it freezes the game completely. (This is when you talk to the girl outside the house)

Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Thu 17/03/2022 02:26:07
Quote from: Andrea1992 on Thu 17/03/2022 00:44:39
Also, the game freezes sometimes. There is a cutscene in one of the rooms with fewer backgrounds and when I tried to escape it, it freezes the game completely. (This is when you talk to the girl outside the house)

Could you tell the number of the room and what do i have to do to reproduce the problem? I never played your game before.
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Andrea1992 on Thu 17/03/2022 04:03:20
Room 5,
To get there, from the bedroom (initial room) go outside using the door, then talk to the girl that arrives (only character in that room). This sends you to the room 5, where the cutscene esc problem occurs,
thanks
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Thu 17/03/2022 12:11:16
Quote from: Andrea1992 on Thu 17/03/2022 04:03:20
Room 5,
To get there, from the bedroom (initial room) go outside using the door, then talk to the girl that arrives (only character in that room). This sends you to the room 5, where the cutscene esc problem occurs,
thanks

Ok I finally found the actual cause for this, it happens when you have WaitMouse/Key(-1) in the middle of the cutscene. Engine does not handle -1 (infinite timeout) properly when skipping the cutscene.

EDIT: again, the fixed temp build:
https://cirrus-ci.com/task/5993769815244800

Quote
So, when you update to alpha 22 or beta,  will the fix be included?

Yes of course.
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: heltenjon on Thu 17/03/2022 18:57:55
So this means...Pedro in Japanese?
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Stranga on Sat 19/03/2022 00:13:56
I've encountered a problem with translations in list boxes and dialogue options displaying symbols rather than being translated, not sure if a bug or my mistake but here's what I'm referring to:

Screenshots:
Spoiler

Happens with all listboxes and dialogue
(https://i.imgur.com/P4KIjB7.jpg)

This happened when I tried navigating the dialogue options via keyboard, never ran into it in the previous alphas only 3.6.0.20
(https://i.imgur.com/PsBMCZA.jpg)

[close]
My Dialogue Script:
Spoiler
Code (ags) Select

// new module script

//int dlg_opt_color = ;
int dlg_opt_acolor = 2047;
int dlg_opt_ncolor = 65535;
int DlgCursorPos = 1;

import int  KeyUp[2];
import int  KeyDown[2];
import int  KeyLeft[2];
import int  KeyRight[2];
import int  KeyAction[2];
import int  KeyBack;
import int  KeyMenu;
import int  KeySprint[2];
import int KeyInventory[2];


function dialog_options_get_dimensions(DialogOptionsRenderingInfo *info)
{
  // Create a 200x200 dialog options area at (50,100)
  info.X = 30;
  info.Y = 100;
  info.Width = 256;
  info.Height = 256;
  info.ActiveOptionID = 1; // set to first option
}

function dialog_options_render(DialogOptionsRenderingInfo *info)
{
  btnCoverUp.Visible = true;
  DialogOpen = true;
  //info.Surface.Clear(dlg_opt_color);
  int i = 1,  ypos = 24,  xpos = 0;
  // Render all the options that are enabled
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (info.ActiveOptionID == i)
      {
        btnPointer.SetPosition(xpos+26, ypos+95); //Cursor Position
        info.Surface.DrawingColor = dlg_opt_acolor;
      }
       else
       {
        info.Surface.DrawingColor = dlg_opt_ncolor;
       }
     
      info.Surface.DrawStringWrapped(5, ypos, info.Width - 10,
      eFontfntSnatcher, eAlignLeft, info.DialogToRender.GetOptionText(i));
      ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontfntSnatcher, info.Width - 10);
    }
    //aClick.Play();
    i++;
  }
}

function dialog_options_key_press(DialogOptionsRenderingInfo *info, eKeyCode keycode)
{
  switch (keycode)
  {
  case KeyUp[0]:
  case KeyUp[1]:
  aCursor.Play();
    // check all options upwards until found an active one
    for (int next_opt = info.ActiveOptionID - 1; next_opt >= 1; next_opt--)
    {
      if (info.DialogToRender.GetOptionState(next_opt) == eOptionOn)
      {
        info.ActiveOptionID = next_opt;
        break;
      }
    }
  break;
  case KeyDown[0]:
  case KeyDown[1]:
  aCursor.Play();
    // check all options downwards until found an active one
    for (int next_opt = info.ActiveOptionID + 1; next_opt <= info.DialogToRender.OptionCount; next_opt++)
    {
      if (info.DialogToRender.GetOptionState(next_opt) == eOptionOn)
      {
        info.ActiveOptionID = next_opt;
        break;
      }
    }
  break;
  }
 
if(CanPress)
  {
    switch(keycode)
    {
      case KeyAction[0]:
      case KeyAction[1]:
      aSelector.Play();
      DialogOpen = false;
      btnPointer.Visible = false;
      btnCoverUp.Visible = false;
      info.RunActiveOption();
      break;
    }
  }
}

function dialog_options_repexec(DialogOptionsRenderingInfo *info)
{
  btnPointer.Visible = true;
}



[close]
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Sat 19/03/2022 00:42:53
Quote from: Stranga on Sat 19/03/2022 00:13:56
I've encountered a problem with translations in list boxes and dialogue options displaying symbols rather than being translated, not sure if a bug or my mistake but here's what I'm referring to:

I recall dialog options worked before, did this new error appear after some changes, or engine update, or with another language?

Is the given translation saved in UTF-8 and has "Encoding" set in TRS? Does it use correct font that has necessary characters?

Does the same language/font work everywhere else, e.g. on labels, speech etc?
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: eri0o on Sat 19/03/2022 02:30:07
I managed to reproduce the mentioned crash and noted down a way to reproduce here with a minimal game: https://github.com/adventuregamestudio/ags/issues/1582

I could not reproduce the mentioned issue with the translation though. Stranga, if you could make a tiny example game of the mentioned issue with symbols and translations it would be helpful!
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Stranga on Sat 19/03/2022 03:32:03
@Crimson Wizard

The error code is something new as I loaded a backup on 3.6.0.17 and the dialogue navigation works fine, however, the text is still not being translated in list boxes and dialogue, everything else works fine (labels, buttons e.c.t).
Example of labels working fine:
Spoiler
(https://i.imgur.com/TospHNp.png)
My text box is a label.
[close]

UTF-8 Encoding has been  set in the TRS file, I also tested it with another font but it still shows the same symbols

Example:
Spoiler
(https://i.imgur.com/qkmjhYA.jpg)
[close]

@eri0o I'll get to work on a small build for you to test soon :)
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Sat 19/03/2022 03:37:57
The temp build with a keyboard fix may be downloaded here:
https://cirrus-ci.com/task/5721016642043904

please tell if it fixes the key input.

But i don't yet know what is wrong with translations. I'll have to think more about it, or wait for your small test game.

QuoteI loaded a backup on 3.6.0.17 and the dialogue navigation works fine, however, the text is still not being translated in list boxes and dialogue
So, if I understand correctly, translation in dialog options did not work in 3.6.0.17 too?

I remember that previously you had issue with some languages, but they were fixed?
https://www.adventuregamestudio.co.uk/forums/index.php?topic=58976.msg636644048#msg636644048

Do you use same font as on labels there, or a different one?
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Stranga on Sat 19/03/2022 04:24:55
Ok, temp build fixes keyboard issue, great! :)

Strangely when I started a fresh empty game and make a list box and a dialogue both with translated lines they worked. However, when I made a game out of a template they didn't work, I compared both versions' TRS files and didn't find any differences, both had UTF-8 encoding on them. Strangely I changed the Text Format under general settings to UTF8 and it worked?
Screenshot:
Spoiler
(https://i.imgur.com/XkpdSZC.png)
[close]

However, this didn't work on my game, only on the test game so there's isn't much for debugging.

QuoteSo, if I understand correctly, translation in dialog options did not work in 3.6.0.17 too?
That's correct, it didn't work on that version either

QuoteI remember that previously you had issues with some languages, but they were fixed?
https://www.adventuregamestudio.co.uk/forums/index.php?topic=58976.msg636644048#msg636644048

I thought that would've been the case but it seems to still show those symbols when I applied that particular fix to this problem.

QuoteDo you use the same font as on labels there, or a different one?
Yes, everything has the same fonts.

Something is telling me that it may be an issue with my scripting somewhere. I'll look into it further but here's the test build I quickly made: http://www.fileconvoy.com/dfl.php?id=gd863cb389b33e2171000418743282b849981e52b80 (http://www.fileconvoy.com/dfl.php?id=gd863cb389b33e2171000418743282b849981e52b80)

EDIT:
QuoteStrangely I changed the Text Format under general settings to ASCII then back to UTF8 and it worked?
Only the dialogue worked not the listbox

BREAKTHROUGH: I think I found the problem, the list box fonts are not changing when I change translations

I'm using this script to change all fonts in game but it seems to be missing listboxes:
Spoiler
Code (ags) Select

function ReplaceFontOnAllGUIs(int old_font, int new_font)
{
  int i = 0;
  while (i < Game.GUICount)
  {
    ReplaceFontOnGUI(gui[i], old_font, new_font);
    i++;
  }
}
[close]

Yep! That's definitely the problem! Still not sure how to fix it, unfortunately.
Found it:
Spoiler
Code (ags) Select

function ReplaceFontOnGUI(GUI *g, int old_font, int new_font)
{
  int i = 0;
  while (i < g.ControlCount)
  {
    Button *b = g.Controls[i].AsButton;
    if (b != null)
    {
      if (b.Font == old_font)
        b.Font = new_font;
    }
    Label *l = g.Controls[i].AsLabel;
    if (l != null)
    {
      if (l.Font == old_font)
        l.Font = new_font;
    }
    ListBox *lb = g.Controls[i].AsListBox; //HERE!
    if (lb != null)
    {
      if (lb.Font == old_font)
        lb.Font = new_font;
    }
    i++;
  }
}
[close]
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Sat 19/03/2022 12:04:05
Quote from: Stranga on Sat 19/03/2022 04:24:55
Strangely when I started a fresh empty game and make a list box and a dialogue both with translated lines they worked. However, when I made a game out of a template they didn't work, I compared both versions' TRS files and didn't find any differences, both had UTF-8 encoding on them. Strangely I changed the Text Format under general settings to UTF8 and it worked?

According to the plan, the game should switch to UTF-8 mode if active translation is UTF-8, even if the game itself has the Text Format set to ascii.
I will double check that this works.

EDIT: Ok I found and fixed two more recent bugs...
1. if game was ASCII, but translation UTF-8, then the translation keys were incorrectly loaded, so translation could not be performed
2. winsetup did not list translation names properly (did not cut ".tra" extensions from them)

Temp build with fixes will be available here when the building process is complete (about 20-30 mins after me posting):
https://cirrus-ci.com/task/4630726241943552
Title: Re: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support
Post by: Crimson Wizard on Mon 21/03/2022 00:22:15
@Stranga, i opened a 3.6.0 Beta thread: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59842.0
let's continue discussing problem there (i will lock this thread soon).