Author Topic: Issue : Dialogs skip too fast  (Read 589 times)

NicolaGs

  • Going nowhere fast
    • NicolaGs worked on a game that was nominated for an AGS Award!
      NicolaGs worked on a game that won an AGS Award!
Issue : Dialogs skip too fast
« on: 06 Jan 2018, 13:33 »
Hi,

Some players found a weird bug in my game. It's related to the dialogs : they start to skip instantaneously without any user input after some time playing.

Quote from: a player...
I've tried playing your game, but unfortunately after a while the text all scrolls through very quickly whenever I examine or do any other actions on things. I restarted a couple times and experienced the same thing.

Or visible here, in this walkthrough video : https://youtu.be/o-nvhUfGK9o?t=2244

My question is : has anyone seen the same problem (possible AGS engine bug) or coult it be just my game (bug in my scripts...)?

The game has the option to change the dialogs skip speed (4 choices : from click-to-skip to high speed) but changing this seems to not be of any help.
It was seen only by 2 players... so it may be related to their system.

I don't have any information on the players' system version atm (it's Windows, but don't know the version).

The game runs with latest stable AGS version (3.4.1.11).

Nicolas
My first game : I Want Out!

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #1 on: 06 Jan 2018, 14:19 »
Ok, let me clarify first of all: are you saying that even if you set "skip only by click" mode they still continue to skip that fast?
Does your game feature voice-over? If yes, is there a difference if you turn voice on/off?

E: Checked the rest of the video, it looks like they begin doing that after certain point? Did user alt+tab somewhere during the game? I recall that may cause some keys "stick" in memory so AGS always thinks that a key is pressed.
« Last Edit: 06 Jan 2018, 14:21 by Crimson Wizard »

NicolaGs

  • Going nowhere fast
    • NicolaGs worked on a game that was nominated for an AGS Award!
      NicolaGs worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #2 on: 06 Jan 2018, 14:26 »
are you saying that even if you set "skip only by click" mode they still continue to skip that fast?
Apparently, yes (according to the only feedback I had)...

Quote
Does your game feature voice-over? If yes, is there a difference if you turn voice on/off?
No!
My first game : I Want Out!

NicolaGs

  • Going nowhere fast
    • NicolaGs worked on a game that was nominated for an AGS Award!
      NicolaGs worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #3 on: 06 Jan 2018, 14:33 »
E: Checked the rest of the video, it looks like they begin doing that after certain point? Did user alt+tab somewhere during the game? I recall that may cause some keys "stick" in memory so AGS always thinks that a key is pressed.
Oh, didn't see your edit... Well I'll ask, but it could be that, because, by looking at the video, there's a cut just before the occuring of the bug... So maybe the player took a look at the walkthrough and got back to the game...
My first game : I Want Out!

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #4 on: 06 Jan 2018, 14:37 »
I remember someone posting a possible fix for Allegro 4 on forums before, but apparently I forgot to add it... again.
I will try to find it and see if it's possible to make a patch.

NicolaGs

  • Going nowhere fast
    • NicolaGs worked on a game that was nominated for an AGS Award!
      NicolaGs worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #5 on: 06 Jan 2018, 14:40 »
Thanks for your fast answer, CW!
My first game : I Want Out!

Re: Issue : Dialogs skip too fast
« Reply #6 on: 13 Apr 2018, 22:04 »
Hey, a person found this bug with alt+tab, but it doesn't happen in any computer I own, so I can't reproduce. I also couldn't find the mentioned thread in Allegro forum - I also can only Google on Allegro forum, but from itself I can only look the latest 5 topics...

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #7 on: 13 Apr 2018, 22:45 »
Hey, a person found this bug with alt+tab, but it doesn't happen in any computer I own, so I can't reproduce. I also couldn't find the mentioned thread in Allegro forum - I also can only Google on Allegro forum, but from itself I can only look the latest 5 topics...

It was not on Allegro's forum, it was on this very forum, somewhere in Engine development. I could not find it last time, probably was just skipping it by.

I recall it involved some changes which looked confusing, so I'd rather not apply them automatically without some research first.

Re: Issue : Dialogs skip too fast
« Reply #8 on: 14 Apr 2018, 01:45 »
Ha CW, I found the thread I think you are talking about: this thread here.

From the thread, the available options were:
 - using only mouse to skip text ;
 - modifying alleg-allegro/src/win/wkeybd.c , to remove the section with /* ignore special Windows keys (alt+tab, alt+space, (ctrl|alt)+esc) */ ...  (I don't think we need to prevent alt+tab from being handled in game if it isn't handled... So removing kind makes sense, but I can't understand why this would work ) ;
 - letting go (lot's of games don't play well with alt+tab and people are usually fine?) .

Edit:

I went with using only mouse to skip text. This solves the problem.
« Last Edit: 28 Apr 2018, 18:42 by eri0o »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #9 on: 30 Apr 2018, 15:03 »
- modifying alleg-allegro/src/win/wkeybd.c , to remove the section with /* ignore special Windows keys (alt+tab, alt+space, (ctrl|alt)+esc) */ ...  (I don't think we need to prevent alt+tab from being handled in game if it isn't handled... So removing kind makes sense, but I can't understand why this would work ) ;

I'd look into this at some point, but the fact that it does not reproduce at all times makes testing problematic.

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    •  
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: Issue : Dialogs skip too fast
« Reply #10 on: Yesterday at 16:00 »
I found a very hacky way to fix this problem.

I ran the debug window (activated by pressing "`") while alt-tabbing in and out of the game until the problem manifested itself. When it did, I noticed that the debug window reported that an "on_key_press 399" command was being activated over and over again. So the reason why the dialog keeps skipping is because the game thinks a key is being pressed continuously. Pressing ANY key on the keyboard fixes the problem.

So I did a very hacky solution.

1 - I created a GUi that contained a single text message: "Game Paused. Press any key to continue." I named it "gUnpause".
2 - I added this bit of code under "function on_key_press" in the global script:

Code: Adventure Game Studio
  1.   if (keycode == 399)
  2.   {
  3.     if (gUnPause.Visible==false)
  4.     {
  5.       gUnPause.Centre();
  6.       gUnPause.Visible=true;
  7.     }
  8.   }
  9.   else if (gUnPause.Visible==true)
  10.   {
  11.       gUnPause.Visible=false;
  12.   }
  13.  

This "pauses" the game if the bug gets activated (which only happens about 1/5 of the time), and then forces the user to press a key to continue the game. SUPER hacky, but in lieu of an alternate solution this does the trick. Hopefully this bug will get fixed one day!

edit: Another solution is to use the command:

Code: Adventure Game Studio
  1. Speech.SkipStyle=eSkipMouseTime;

This prevents keyboard input from moving dialog forward. Although having a key constantly being pressed in the background could produce other bugs.
« Last Edit: Yesterday at 16:12 by Dave Gilbert »

Re: Issue : Dialogs skip too fast
« Reply #11 on: Today at 05:24 »
Below is my little code to workaround if you are using Speech.SkipStyle=eSkipMouseTime; to allow skip dialog with the space bar.

Code: Adventure Game Studio
  1. bool acceptKeyWasPressed;
  2.  
  3. void repeatedly_execute_always(){
  4.   if(IsKeyPressed(eKeySpace)){
  5.     if(!acceptKeyWasPressed){
  6.       Mouse.Click(eMouseLeft);  
  7.     }
  8.     acceptKeyWasPressed = true;
  9.   } else {
  10.     acceptKeyWasPressed = false;  
  11.   }
  12. }
  13.  
Add spoiler tag for Hidden:
---

I tried to follow the code but I still don't fully get how getch() from allegro or ags substitute standard c getch. I think that every key press passes through the record part of ags even if you are not recording, since record.h is everywhere and getch is redefined for rec_getch() in Engine/ac/record.cpp, and under it my_readkey() is called. And below it's how it generates the 399 code (defined as AGS_KEYCODE_ALT_TAB).

Code: C
  1. int my_readkey() {
  2.     int gott=readkey();
  3.     int scancode = ((gott >> 8) & 0x00ff);
  4.  
  5.     if (gott == READKEY_CODE_ALT_TAB)
  6.     {
  7.         // Alt+Tab, it gets stuck down unless we do this
  8.         return AGS_KEYCODE_ALT_TAB;
  9.     }
  10. ...
  11.  

readkey() is defined in allegro-4.4.2/src/keyboard.c, where it calls ureadkey(), that reads from a buffer, key_buffer. I don't understand how this buffer is filled. I don't understand how allegro-4.4.2/src/win/wkeybd.c comes into the mix. I have a feeling that alt+tab, since it is ignored by wkeybd.c function, but is considered in readkey, is somehow getting set as pressed, but the release event is lost, so in the boolean key array that marks if the key is pressed or not, it's kept marked true, which is pressed. My fix would be finding this array and everytime ags window receives focus (returning from alt+tab) all keys would get release. Unfortunately, I can't really understand this code so I don't know where the fix should be.