0 votes
by (420 points)
Hey all, I'm starting to get a little worried about reaching engine limitations. Since I don't actually know what said limitations are, it might not be a concern at all, but, I thought I'd ask just in case...

The actual file size for my game is over 4.5 MB, and I expect that to continue growing as I'm working on a new data-intensive feature for my game. That leads me to my next question...

I'm building a rather large widget right now. It's already over 3,000 lines, and by the time it's done I'd expect it to be well past 10,000 or even 15,000. While I can technically break the widget into multiple passages, that'll cause some organizational headaches.

Right now the game is running fine, but should I worry about breaking anything? Just passed 500,000 words and 3.5m characters.

1 Answer

+1 vote
by (159k points)
There are no hard-wired limitations on how many Passages can be in or how large in file-szie a story HTML file can get, except those set by the end-user's web-browser / operating system / machine.

Generally in programming if a single Widget / Macro / Function is more than say 50 code lines long (excluding comments) it is a sign that there may be a design issue with it's implementation.

eg. trying to do too many things within a singe code unit.

The fact that you have a single Widget with over 3000 lines in it leads me to believe that it needs to be refacted.
by (44.7k points)

Yeah, basically this.  I found this post, where back in 2012 some guy tested the maximum file size for text files in a browser, and he didn't start hitting problems until around 35 MB.  The only game I'm aware of that's had file size problems was the final release of "Stranded", which was 83 MB (mostly due to embedded images).  So you're nowhere near a problematic size.

As for your widget, I also agree that if you're at thousands lines of code for a single widget, then you're doing something wrong, or at the very least, dangerous.

You should break that down into smaller chunks which are maintainable.  Having all that code in one widget makes it more prone to breaking, and worse, it makes it much more difficult to test and debug.  Also, you can have more than one widget in a single passage, so it shouldn't be an organizational issue if you break it up a bit into separate widgets.  You might also want to turn some parts of the widget into JavaScript functions, if you have pieces of code which are repeated within that widget, but don't themselves translate well into a widget form.

So, your HTML file size is nowhere big enough to be an issue yet, but you really want to avoid putting too much strain on any single widget, macro, or function, otherwise it's going to be messy when something goes wrong.

Hope that helps and I enjoy your game!  :-)