Jibble

Author Topic: AGS 3.6.0 WIP (Alpha 12) - SDL2-based engine + Unicode Translations  (Read 9540 times)

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
AGS 3.6.0 - Alpha - for Public Test

ACHTUNG!
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: 8th November 2021


Preword

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

NOTE: contains all the changes from AGS 3.5.1 (Patch 4).


Credits

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


Downloads and instructions

* Full AGS 3.6.0 as installer
* Full AGS 3.6.0 as a .zip archive
* SDL2.dll (v2.0.12) for Windows (just in case it's missing)

* Android game player, aka launcher (APK signed with Debug key), suitable for running any compatible AGS game.
* Android native libs, for building your own signed game APK.


Notable changes related to new backend

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.11/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).
* New rewritten Android game player (aka "launcher"). Suitable for building for Google Play and similar stores, can read game assets from the android-specific packages (apk, aab).
* Removed AVI/MPEG video support (may be temporary...). The main reason is that in the old engine they were implemented using Windows-only DirectX interface and Allegro 4 was already providing access to these. SDL2 does not, and it may be an extra hassle to recreate them. So this is under question now.
* For similar reasons removed support for DirectX-related functions in plugin API. I'm afraid this will break some older plugins that require DirectDraw and similar things. Direct3D plugin maybe will continue working as it wants Direct3D renderer, and that is still present.


Other Notable engine/editor changes

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

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

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.

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

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

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


Expected problems

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

« Last Edit: 08 Nov 2021, 02:02 by Crimson Wizard »

Joseph DiPerla

  • Joseph DiPerla, Adventure Game Creator Wannabe!
    • I can help with backgrounds
    • I can help with characters
    • I can help with play testing
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
Nice. I will give this ago within the next couple of days. Thank you all!
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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.

Hello.

I have received this error while running a room.
https://imgur.com/byuwNv7

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
I have received this error while running a room.
https://imgur.com/byuwNv7


Does this room open well in the editor? If so, can other engine (like 3.5.1) run same game?

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.
« Last Edit: 11 Apr 2021, 22:18 by nightmarer »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Updated to Alpha 3, this is just to include latest fixes and changes from AGS 3.5.1. New download links in the first post.


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

Sorry, I did not have a chance to reply. I don't think I will be able to do much without game itself. Can I get a copy to test?

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

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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

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.

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!

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
Heads up regarding the memory issue: there's definitely a memory leak in this version, and it seems to be related to audio (found out by disabling certain functions in the engine code).

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

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

game crashes in several seconds.

or more manual:
Code: Adventure Game Studio
  1. function on_key_press(eKeyCode key)
  2. {
  3.         atest.Play();
  4. }
  5.  
« Last Edit: 11 May 2021, 03:50 by Crimson Wizard »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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.

eri0o

@Potajito, do you still have the crash when alt+tabbing?

@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!

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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.
« Last Edit: 23 May 2021, 04:22 by Crimson Wizard »

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:


When creating a new project, either new or from a template.

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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)?

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.

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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
« Last Edit: 24 May 2021, 12:44 by Crimson Wizard »

Crimson Wizard

  • Local Moderator
    • Lifetime Achievement Award Winner
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Crimson Wizard worked on one or more games that won an AGS Award!
    •  
    • Crimson Wizard worked on one or more games that was nominated for an AGS Award!
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.