AGS 3.6.0 WIP (Alpha 20) - SDL2-based engine + Unicode support

Started by Crimson Wizard, 25 Mar 2021, 02:28

« previous - next »

Crimson Wizard

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.

Crimson Wizard

Ok, I fixed the broken speech bug, and reuploaded Alpha 6 version, please download again.

Crimson Wizard

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

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

#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;


I receive this exception when I try to save the game with editor.

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

Crimson Wizard

Quote from: Manu on 16 Jul 2021, 17:20
I receive this exception when I try to save the game with editor.

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:

Crimson Wizard

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


Quote from: Mehrdad on 19 Jul 2021, 06:07
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:

Crimson Wizard

Fixed links.

I created downloads with the wrong folder, but since it's an alpha version I'd leave it as it is perhaps.

Crimson Wizard

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.


Does AGS struggle with audio being cut now, with SDL being implemented?
No more military army stuff. I'm alive and back.

Crimson Wizard

Quote from: Dualnames on 02 Aug 2021, 08:06
Does AGS struggle with audio being cut now, with SDL being implemented?

Do you have a sound clip or a game for a test?


Quote from: Dualnames on 02 Aug 2021, 08:06
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.

Crimson Wizard

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

// 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

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

// List all existing rooms

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

Code: ags

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

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


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.

Crimson Wizard

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

Has all fixes from AGS 3.5.1 - Patch 3.



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.


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.


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

Crimson Wizard

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.


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!

Crimson Wizard

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.


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

Laura Hunt

Quote from: Crimson Wizard on 13 Sep 2021, 19:07
Audio related

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


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

SMF spam blocked by CleanTalk