Running the engine in a background thread

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links:
Roody Yogurt's Hugo Blog:
The Hugor interpreter by RealNC:

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Posts: 1854
Joined: Wed Mar 07, 2012 4:32 am

Running the engine in a background thread

Post by RealNC »

I've made some long overdue and very extensive changes to Hugor. Previously, games were running in tandem with the rest of the interpreter. When the game was executing code, the interpreter froze until the game returned control back to it.

This resulted in some rather ugly behavior. The most notable one was that a game could cause the interpreter to freeze indefinitely. For example, running this hugo code:

Code: Select all

while true { }
means the interpreter hangs since it waits forever for the loop to finish.

I've now rewritten some large parts of Hugor so that the game is running in the background, in its own thread. This allows the interpreter to keep running at all times, even if the game itself freezes, so that it's possible to quit normally without having to kill the process from the task manager. It also made it easier to get rid of the high CPU load during the "delay/read key" loop for "more" prompts (the issue mentioned in the other thread) since screen repaints are now easier to deal with.

The downside is that I might have introduced new bugs. I hope not. But it would be nice if you could use this new build if you intend to play any Hugo games and report any new weirdness that shows up: ...

Posts: 2070
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Awesome, I'll get to playing with this right away!

Post Reply