There is a new version of the forums ready for testing. Please post here if you're willing to help test! We could also use the help of coders!

Author Topic: AGS 3.6.0 WIP (Alpha 21) - SDL2-based engine + Unicode support  (Read 23486 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!
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.
« Last Edit: 17 Mar 2022, 13:28 by Crimson Wizard »

So this means...Pedro in Japanese?

Stranga

  • Check out my games via my website link!
    • I can help with making music
    • I can help with story design
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: ShowHide

Happens with all listboxes and dialogue


This happened when I tried navigating the dialogue options via keyboard, never ran into it in the previous alphas only 3.6.0.20



My Dialogue Script:
Spoiler: ShowHide
Code: Adventure Game Studio
  1. // new module script
  2.  
  3. //int dlg_opt_color = ;
  4. int dlg_opt_acolor = 2047;
  5. int dlg_opt_ncolor = 65535;
  6. int DlgCursorPos = 1;
  7.  
  8. import int  KeyUp[2];
  9. import int  KeyDown[2];
  10. import int  KeyLeft[2];
  11. import int  KeyRight[2];
  12. import int  KeyAction[2];
  13. import int  KeyBack;
  14. import int  KeyMenu;
  15. import int  KeySprint[2];
  16. import int KeyInventory[2];
  17.  
  18.  
  19. function dialog_options_get_dimensions(DialogOptionsRenderingInfo *info)
  20. {
  21.   // Create a 200x200 dialog options area at (50,100)
  22.   info.X = 30;
  23.   info.Y = 100;
  24.   info.Width = 256;
  25.   info.Height = 256;
  26.   info.ActiveOptionID = 1; // set to first option
  27. }
  28.  
  29. function dialog_options_render(DialogOptionsRenderingInfo *info)
  30. {
  31.   btnCoverUp.Visible = true;
  32.   DialogOpen = true;
  33.   //info.Surface.Clear(dlg_opt_color);
  34.   int i = 1,  ypos = 24,  xpos = 0;
  35.   // Render all the options that are enabled
  36.   while (i <= info.DialogToRender.OptionCount)
  37.   {
  38.     if (info.DialogToRender.GetOptionState(i) == eOptionOn)
  39.     {
  40.       if (info.ActiveOptionID == i)
  41.       {
  42.         btnPointer.SetPosition(xpos+26, ypos+95); //Cursor Position
  43.         info.Surface.DrawingColor = dlg_opt_acolor;
  44.       }
  45.        else
  46.        {
  47.         info.Surface.DrawingColor = dlg_opt_ncolor;
  48.        }
  49.      
  50.       info.Surface.DrawStringWrapped(5, ypos, info.Width - 10,
  51.       eFontfntSnatcher, eAlignLeft, info.DialogToRender.GetOptionText(i));
  52.       ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontfntSnatcher, info.Width - 10);
  53.     }
  54.     //aClick.Play();
  55.     i++;
  56.   }
  57. }
  58.  
  59. function dialog_options_key_press(DialogOptionsRenderingInfo *info, eKeyCode keycode)
  60. {
  61.   switch (keycode)
  62.   {
  63.   case KeyUp[0]:
  64.   case KeyUp[1]:
  65.   aCursor.Play();
  66.     // check all options upwards until found an active one
  67.     for (int next_opt = info.ActiveOptionID - 1; next_opt >= 1; next_opt--)
  68.     {
  69.       if (info.DialogToRender.GetOptionState(next_opt) == eOptionOn)
  70.       {
  71.         info.ActiveOptionID = next_opt;
  72.         break;
  73.       }
  74.     }
  75.   break;
  76.   case KeyDown[0]:
  77.   case KeyDown[1]:
  78.   aCursor.Play();
  79.     // check all options downwards until found an active one
  80.     for (int next_opt = info.ActiveOptionID + 1; next_opt <= info.DialogToRender.OptionCount; next_opt++)
  81.     {
  82.       if (info.DialogToRender.GetOptionState(next_opt) == eOptionOn)
  83.       {
  84.         info.ActiveOptionID = next_opt;
  85.         break;
  86.       }
  87.     }
  88.   break;
  89.   }
  90.  
  91. if(CanPress)
  92.   {
  93.     switch(keycode)
  94.     {
  95.       case KeyAction[0]:
  96.       case KeyAction[1]:
  97.       aSelector.Play();
  98.       DialogOpen = false;
  99.       btnPointer.Visible = false;
  100.       btnCoverUp.Visible = false;
  101.       info.RunActiveOption();
  102.       break;
  103.     }
  104.   }
  105. }
  106.  
  107. function dialog_options_repexec(DialogOptionsRenderingInfo *info)
  108. {
  109.   btnPointer.Visible = true;
  110. }
  111.  
  112.  
  113.  
  114.  

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'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?
« Last Edit: 19 Mar 2022, 02:19 by Crimson Wizard »

eri0o

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!
« Last Edit: 19 Mar 2022, 02:47 by eri0o »

Stranga

  • Check out my games via my website link!
    • I can help with making music
    • I can help with story design
@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: ShowHide

My text box is a label.


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


@eri0o I'll get to work on a small build for you to test soon :)

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

Quote
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
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?
« Last Edit: 19 Mar 2022, 03:41 by Crimson Wizard »

Stranga

  • Check out my games via my website link!
    • I can help with making music
    • I can help with story design
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: ShowHide


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

Quote
So, 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

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

Quote
Do 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

EDIT:
Quote
Strangely 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: ShowHide
Code: Adventure Game Studio
  1. function ReplaceFontOnAllGUIs(int old_font, int new_font)
  2. {
  3.   int i = 0;
  4.   while (i < Game.GUICount)
  5.   {
  6.     ReplaceFontOnGUI(gui[i], old_font, new_font);
  7.     i++;
  8.   }
  9. }
  10.  


Yep! That's definitely the problem! Still not sure how to fix it, unfortunately.
Found it:
Spoiler: ShowHide
Code: Adventure Game Studio
  1. function ReplaceFontOnGUI(GUI *g, int old_font, int new_font)
  2. {
  3.   int i = 0;
  4.   while (i < g.ControlCount)
  5.   {
  6.     Button *b = g.Controls[i].AsButton;
  7.     if (b != null)
  8.     {
  9.       if (b.Font == old_font)
  10.         b.Font = new_font;
  11.     }
  12.     Label *l = g.Controls[i].AsLabel;
  13.     if (l != null)
  14.     {
  15.       if (l.Font == old_font)
  16.         l.Font = new_font;
  17.     }
  18.     ListBox *lb = g.Controls[i].AsListBox; //HERE!
  19.     if (lb != null)
  20.     {
  21.       if (lb.Font == old_font)
  22.         lb.Font = new_font;
  23.     }
  24.     i++;
  25.   }
  26. }
  27.  
« Last Edit: 19 Mar 2022, 05:01 by Stranga »

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!
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
« Last Edit: 19 Mar 2022, 12:34 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!
@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).