Interrupting a long-running process

I’m working on a game with the following features:

  • “wait until [time]” and “wait for [person]” actions.
  • a 1 ms wait between turns (using Real-Time Delays) while waiting so that the UI won’t freeze.
  • a separate window (using Flexible Windows) for a progress tracker while waiting.

I’d like to also add a way to interrupt waiting, such as by a keypress, but it’s unclear if there’s an extension out there that will do such a thing – I know of “press any key” extensions, but nothing that will handle asynchronous input. Any ideas?

If no such extension exists, is it technically possible for such an extension to work within the limitation of Inform 6 and Glulx? I’d like to know before I go off and learn a bunch of Inform 6. :grinning:

It is possible (at the I6 level) to say “wait until a keypress arrives or one millisecond passes, whichever comes first.”

It’s probably going to feel pretty different on different interpreters, though. And whether it’s necessary will also vary between interpreters. You could wind up adding more jank with your thousand of 1-ms turns than you save by splitting up your large actions.

Have you seen UI freeze on actual gameplay? Even for multiple turns, that’s difficult, unless you’ve coded something inefficiently.

(To be fair, Inform makes it easy to code inefficiently.)

In any event you might consider user options to switch this feature off.

Then I’m probably coding something very inefficiently. The delay isn’t present on single turns, but 60 turns takes around 3 seconds. So waiting multiple hours (which may happen since the game involves surveillance) is pretty lengthy.

The real culprit I suppose is that I’m simulating the characters as agents that react to their environment and can put off goals in favor of side goals, and come back to the original goal later. Takes passes over two different rulebooks for each player. I’m not sure I know how to code that more effiiciently, other than to simplify the behavior model.