[Bug]: GS story page button event handling can be very unresponsive #10393
Labels
component: AI/Game script (squirrel)
This issue is related to Squirrel (Scripting language)
enhancement
Issue would be a good enhancement; we accept Pull Requests!
Version of OpenTTD
13-ish
Expected result
GS story page can have push buttons.
These emit GS events on click.
The expectation is that these events are handled ~instantly, as normal in UIs.
Actual result
Because GS event processing is on a sequential queue, there can be significant delay in handling the button click events when the queue contains other events.
If the button event handler then causes commands to be issued, this will introduce a further delay due to 1-command-per-tick execution model for GS.
Even without trying pathological cases (very large maps, very large number of commands etc), the delay in responding to story book buttons can be many real-world seconds.
This is a compounding problem, as the natural human response to button latency is to click again, many many times. Which of course adds more events to the queue.
Additionally in some cases the game state will have changed by the time the button event is handling, leading to invalid results, nonsense results, or surprise clowns.
I don't propose a specific implementation, but ideas include:
Steps to reproduce
Write a GS that handles story book button events, and then issues commands in response to the events.
Click the buttons a lot.
Observe latency.
I can provide a test GS for this if helpful.
The text was updated successfully, but these errors were encountered: