Squeezing a game into z8

I’m developing a game using the Android beta version of Inform 7. It only seems to allow z8 as the output format, but I’ve already successfully developed a game - Iceweb - using it.

The current game is close to completion, but I seem to have hit a size limitation. The compile finishes with the report below, and I wonder whether I could squeeze a little more capacity out of the z8 format. Obviously, I could actually chop some of the game out, but I’m hoping there’s some re-balancing of resources I can do.

The 13518-word source text has successfully been translated into an
intermediate description which can be run through Inform 6 to complete
compilation. There were 36 rooms and 114 things.
++ 100% (Finishing work)
++ Ended: Translation succeeded: 36 rooms, 114 things
Inform 7 has finished.
Inform 6.33N for Linux (20th August 2014)
###########################################

File “auto.inf”; Line 59920 # Error: An array must have between 1 and 32767 entries

Array Flex_Heap -> MEMORY_HEAP_SIZE + 16;
#############################################################
In: 1 source code files 76285 syntactic lines
68088 textual lines 2527650 characters (ISO 8859-1 Latin1)
Allocated:
10078 symbols (maximum 50000) 23440609 bytes of memory
Out: Version 8 “Extended” story file 1.171016 (496K long):
27 classes (maximum 200) 201 objects (maximum 1499)
216 global vars (maximum 233) 29076 variable/array space (maximum 1500000)
106 verbs (maximum 255) 566 dictionary entries (maximum 5000)
193 grammar lines (version 2) 258 grammar tokens (unlimited)
115 actions (maximum 200) 45 attributes (maximum 48)
38 common props (maximum 62) 47 individual props (unlimited)
166033 characters used in text 140890 bytes compressed (rate 0.848)
0 abbreviations (maximum 64) 2991 routines (unlimited)
75078 instructions of Z-code 45274 sequence points
60624 bytes readable memory used (maximum 65536)
507768 bytes used in Z-machine 16520 bytes free in Z-machine
Compiled with 1 error and 1882 suppressed warnings (no output)
Completed in 16 seconds
Compiler finished with code 1.

I think that MEMORY_HEAP_SIZE scales up with the number of dynamic data structures in the game. So use fewer lists and texts.

I realize that advice is practically useless. Inform just isn’t optimized for the Z-machine any more. You could try going back to release 6G60, but that has its own problems.

1 Like

What about:

“Use memory economy.”

I didn’t see that mentioned in your post.

I don’t believe that affects MEMORY_HEAP_SIZE. The question is not describing a general “out of RAM” situation, but a case where MEMORY_HEAP_SIZE exceeds 32768 so it can’t form a valid Z-machine array.

(The game may well have run out of RAM also, but the I6 compiler doesn’t get that far.)

Well, since it was an easy option, I tried Use Memory Economy, and appear to have been given a lifeline. I’ll hastily draw the game to a close.

The Android beta doesn’t do Release mode, but I can always do the release on pc. I imagine that’ll be more compact than the dev mode with debug.

I’ll try to be less generous with text, but I always feel that the soul of int fiction is its text.

Thank you both for your hints!

The sheer amount of (static) text, in terms of number of characters, isn’t much of a problem: it can be compressed fairly efficiently, and is stored in a part of memory with very generous limitations. Same with the number of rules in your code. So cutting down your descriptions shouldn’t be necessary.

The problems come up with the number of dynamic text objects, what used to be called “indexed text”. Same with dynamic lists.

Ah, thanks, draconis. I missed that point, though zarf actually made it clear!