Z8 Memory Overflow

So I have a very, very small stub of a game, and it compiles just fine, and then I include Basic Help Menu by Wade Clarke, and the result is -

Inform 7 build 6M62 has started.
I’ve now read your source text, which is 7469 words long.
I’ve also read Standard Rules by Graham Nelson, which is 42655 words long.
I’ve also read English Language by Graham Nelson, which is 2297 words long.
I’ve also read Basic Help Menu by Wade Clarke, which is 2786 words long.
I’ve also read Basic Screen Effects by Emily Short, which is 2218 words long.
I’ve also read Hybrid Choices by AW Freyr, which is 10405 words long.
I’ve also read Menus by Wade Clarke, which is 18737 words long.

The 7469-word source text has successfully been translated into an
intermediate description which can be run through Inform 6 to complete
compilation. There were 9 rooms and 48 things.
Inform 7 has finished.

C:\IF\Inform 7\Compilers\inform6
-wSDv8 +include_path=…\Source,.\ auto.inf output.z8
Inform 6.33N for Win32 (30th August 2015)
(0): Fatal error: The story file exceeds version-8 limit (512K) by 4096 bytes

Compiler finished with code 1

I am clueless. Any hint on what happened?

Side question: I of course tried to set the settings to “glulx” and it worked then, but my “display the boxed quotation” box wasn’t boxy any more - instead of a black box with white text in it it just displayed some tabbed black on white text (which is the “normal” colour scheme). Any idea how to get my nix text box back under Glulx?

Thanks and kind regards,
Grues

z8 story files have a maximum size of 512 kilobytes. (Earlier z-machine versions have an even lower limit.) That’s actually enough to accomodate a very large game if the game is written in a more efficient language like Inform 6 or ZIL, but it won’t get you very far in Inform 7. To see why, try compiling this minimal I7 program to z8:

"Test"

Foo is a room.

The resulting story file is 381k, almost 75% of the maximum size. This shows that the Standard Rules alone (which of course are included automatically in every Inform program) take up most of the allowed space in a z8 file. When you add all those extensions, it’s not surprising that you’re quickly running out of space. There’s a reason I7 games are usually compiled to Glulx, which is effectively unlimited in size (not technically true, but it’s not a limit you’re ever going to hit). Those that are compiled to Z-machine have to be quite small.

Unfortunately, this answer doesn’t sit well with your other question. I’ve tried to find a good solution for boxed quotations in Glulx, and as far as I’ve been able to discover, there simply isn’t one. I’m not happy about this either, because I love the aesthetic effect.

If you have your heart set on old-style boxed quotations, as far as I know, your options are:

  1. Make your code smaller. This may require eliminating some features/rooms from your game, or it may mean using fewer extensions.

  2. You can also try editing the source code for the extensions to eliminate features you’re not using. If you do this, you’ll probably end up breaking things, and will have to do some experimenting to see what works.

    First review the documentation on installed vs. project-specific extensions, and make sure your project has its own copy of the extension to which you can make your changes. If anything goes wrong, you can roll back to the original version.

  3. In the same way, it’s possible to edit the Standard Rules—for example, if there are no NPCs in your game, you could shave off some kilobytes by cutting out the rules for communicating with NPCs. I mention this possibility for completeness’s sake, but if you do this, you will regret it.

    The Standard Rules are located in your I7 installation folder (e.g. Program Files/Inform 7 if you’re on Windows) in Internal/Extensions/Graham Nelson/Standard Rules.i7x. Don’t touch this file or you’ll screw up your whole Inform 7 installation. Make a project-specific copy of it. When you realize a bunch of things have quietly broken for no clear reason, you can always restore the original Standard Rules by simply deleting your project-specific edited copy.

  4. Depending on the size of your game, all of these measures may be inadequate. In that case, the only way to stick with the Z-machine is to learn Inform 6, Dialog, or ZIL, and start all over.

2 Likes

That was comprehensive. Thanks! I’ll go Glulx then, with a heavy heart - but I think I’ll use little pictures to introduce the chapters.

1 Like

If you write:

Use OMIT_UNUSED_ROUTINES of 1.

Then it will reduce the size of the compiled file and it may allow you to compile to the Z-machine.

But if the game continues to grow, it’ll only postpone moving to Glulx.

1 Like

I can’t remember what exactly Inform is doing for box quotations in Glulx, but it’s probably possible to get something closer to the Zcode version. At the very least you could match what interpreters like Parchment, Gargoyle, and Lectrote do, because they all implement the Z-Machine using Glk.

After the How do I display text in a box (like Photopia)? thread a few months ago, I figured there should be a good text box extension and I have much of one written: Text Box extension preview. But it might still be a while before it’s out. (Putting some text in a box is easy when you assume it just fits; figuring out a sensible fallback when it doesn’t gets more complicated.)

2 Likes

(If anyone wants to check out the Text Box extension without any need for concern of being distracted by silly details like documentation, feel free.)

Couldn’t you just do a fixed-spacing quotation in ASCII?

To boxquote:
	say fixed letter spacing;
	say "_______________[line break]";
	say "|    QUOTE    |[line break]";
	say "| -by person  |[line break]";
	say "---------------[line break]";;
	say variable letter spacing.
	
When play begins:
	boxquote.

That doesn’t look perfect, but it gives a boxed quote.