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

Started by Crimson Wizard, Thu 25/03/2021 02:28:54

Previous topic - Next topic

Baguettator

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

Crimson Wizard

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.


Crimson Wizard

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

Laura Hunt

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

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



Baguettator

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.

eri0o

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

Baguettator

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 ?

eri0o

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.

Baguettator

Hmm... I can't vizualize your solution. How could it "increase" the number of parameters in a function by passing a struct ?

Crimson Wizard

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.

eri0o

Hey, I would like to suggest two modifications on the top post


  • Clearly explain when saying the Editor requires .NET, that it's just something the developer needs, but not for people who will be playing the game. Also, for people in Windows 10 and forward, you already have .NET preinstalled.
  • Remove the SDL2.dll download from there, since it already comes with both the archive and the installer. It may confuse people as if it's a requirement - it's, but it's already packed with the Editor and it will already pack it in the Windows games when needed.

Crimson Wizard


Baguettator

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

eri0o

@Baguettator, I am sorry but this is very offtopic, if you want help with the design you should ask in the advanced technical forum.

Baguettator

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

Crimson Wizard

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

Baguettator

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

eri0o

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.

Stranga

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.

SMF spam blocked by CleanTalk