Pezna Story Engine: Update 1 – Stack Overflow Error in Loops, and a New GUI

Stack Overflow Error in Loops

Update 2 fixed this problem with the introduction of while-loops.

Currently, in PSE, there are no while-loops. To imitate a while loop, you would need to use an if-statement with goto and label statements. For example:

label start
if (num < 50):
    num += 1
    goto start
end if

I thought that something like this would be sufficient for everyone’s needs, but while running some tests yesterday I discovered a problem with this code:

infinite-loop1

After creating and exporting a story, you load the story file into your game using a runtime library. It reads the exported file, and let’s you navigate through the story. Because of the way I created the Java library, with recursive function calls, a stack overflow error was produced after about 2000 loops. This was because it never had a chance to “return”. I then replaced the recursive function calls with a loop, but a stack overflow error now occurred after about 4000 loops. This happens because of the way “goto” statements are implemented. Explaining everything in text is going to be difficult, so I’ll just leave it at that.

To solve this problem, I’m going to have to create while-loops in PSE, so that users do not have to use gotos to make loops. I’ll still look for a way to solve the problem with if-statement loops, but if there is no practical solution, I’ll simply discourage people from making loops with ifs, labels, and gotos (at least, loops with over 4000 iterations).

New GUI

I’ve worked on the GUI a lot in the last 2 days. When compiling and running a story within PSE, a new window would appear with the Run Console. Not anymore. Now, the Run Console is below the text editor.

The current look of PSE's GUI.

The current look of PSE’s GUI.

The panel on the left is the variable panel. It shows all the variables within the game, and their history (what values they previously held).

The panel to the right of the text editor will be the auto-generated flowchart that will help you visualize the flow of your story.


Leave a Reply

Your email address will not be published. Required fields are marked *