inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
4.12k stars 492 forks source link

Don't allow inklecate to get stuck in an infinite loop #453

Open joethephish opened 6 years ago

joethephish commented 6 years ago

This is primarily for Inky, not sure play mode is actually used by anyone in inklecate!

When you enter some ink that accidentally gets into an infinite loop, it hangs and makes your computer go slowly. Two things we should do:

  1. Use ink's new async mode in the inklecate play mode to limit the amount of processor that it can take up, allowing the thread to sleep periodically. (e.g. allow 30ms chunks, then sleep for a bit?) This will slow down ink processing a bit for stories with complex processing though.
  2. Set a time out, after which time it generates an error that can be viewed in Inky. e.g. 10 seconds?
lunarcloud commented 5 years ago

I've had to kill the process due to accidentally doing circular logic. This would be super nice if circular logic or "I'm working too hard on this" could be detected and errored before that happens.

joningold commented 5 years ago

Note that you can sometimes "break" the loop by breaking your ink - stick a rogue { in somewhere, for instance. inky will recompile - after some time, possibly - and then the replay will fail, the loop will stop, and you'll be able to fix the cause of the loop.

On Mon, Jan 14, 2019 at 10:00 PM Sam Sarette notifications@github.com wrote:

I've had to kill the process due to a typo. This would be super nice if circular logic or "I'm working too hard on this" could be detected and errored before that happens.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/inkle/ink/issues/453#issuecomment-454177939, or mute the thread https://github.com/notifications/unsubscribe-auth/AA40ozFNCq4JgJ5n9DAd6GUd6gGwGCUbks5vDP3igaJpZM4Vp_O_ .