Either I'm going insane or...

jaynabonne
I got squiffy installed, along with all its little friends, and I created a "Hello world" squiffy file, and compiled it, and got my "Hello world" HTML page. Yay!

Then I modified the file to add some of the other sample test, compiled it again, and... still "Hello world". I deleted all the built files in that folder, compiled again, and... "Hello world".

So I copied the original squiffy file to a new file in that folder, compiled it, and the new text showed up. I recompiled the original file - still "Hello world". I modified the second file and compiled it, and it had the original (second file) unmodified text. My changes took no effect.

What I see happening (with no explanation) is that once I compile a Squiffy file, it will always compile the same way after that, no matter what I do to the file contents. It's as if something somewhere is remembering the original contents. If I empty the file, I get some sort of index error, but if I then put random text in after that, it goes back to being what it was the first time I compiled it.

Is there some sort of caching going on somewhere?

jaynabonne
It might have to do with the browser (Chrome), but that still doesn't totally explain it to me. If I look in the generated files, I see the new text. So it looks like the compilation is happening. But...

If it always got stuck with the same content, then I'd understand a browser cache issue. What I don't understand is how what is being loaded seems to vary depending on the file I compile, and yet has no relation to the current contents of the file (e.g. testgame.squiffy always gives "Hello world", and testgame2.squiffy always returns the other text, even though they're in the same folder). So it keeps switching. Somehow it knows, as if both the compiled files have been cached, but it loads the corresponding one depending on which source file was compiled last, even though the files no longer have those contents.

Has anyone seen this?

jaynabonne
I think I found it. The "Restart" link makes the page discard its contents and reload anew. And it looks like Squiffy itself is using "localStorage" to cache things based on story id until "Restart" is pressed. So there's my mystery solved.

I'm not sure if that behavior is documented, but it might be good to call it out a bit more! :)

Alex
I've now added a note about this to the new "Using Squiffy" page in the documentation: http://docs.textadventures.co.uk/squiffy/usage.html

I'm wondering if the current behaviour makes sense. My thinking was that an author might want to be able to update their game, and re-upload it somewhere, without killing the game state for anybody who had started playing it.

But now I'm wondering if that will always be desirable - a game author might make a change to their game which is not compatible with existing saved states. And while developing a game, it's a pain to always have to click the Restart link. And it's confusing if you're not expecting it to work that way.

What do you guys think?

The saved state for a game goes into the browser's local storage, using a prefix (which allows multiple games to exist with their own separate states, even if they're served by the same host). The prefix is a hash of the game filename and machine id, so recompiling the same game will still give you the same hash, so it will be using the same local storage. We could change this to use a hash of the game source code instead, with an option for an author to manually set the prefix to be the same as an older hash if they wanted save states to persist between versions. This would require the author to remember to do that though. Hmmmm....

george
I think it makes more sense to erase state on each compile. Maybe I'm not understanding correctly, but if the hash is just the filename and machine ID, why would pushing changes to a production game kill state of games in progress?

jaynabonne
I hadn't really thought about post-deployment updates. I don't know how often that happens with typical game authors, but it is a real possibility to consider. Once I knew about the reload button, it was workable (though an extra step in the edit/run cycle), but it just seemed strange to have that sort of non-updating behavior in a development mode. I'm pondering whether a game author would want to preserve game state while developing the game... I suppose there may be cases for that.

I suppose I'm not helping. :) I was just confused before about why the game wasn't updating when I changed things, recompiled and reloaded the page. I think as long as that's clearly spelled out, it might be ok as is, though I'm sure there will be some who ask "why do I have to do this?"

george
Conventionally in IF development if you want the game in a particular state you load a walkthrough. That seems more flexible to me.

coyotepod
I'm a newbie here, too, and not a programmer. I think I'm experiencing the same thing. I get that Restart restarts the story, but if I make changes in text because of typos or simply to add content, its not refreshed in the game. I can run Preview and its fine, but I want a "reset" button in addition to "restart" I guess. Clearing the browser cache didn't help me.

Thank you and sorry if this has been mentioned before.

This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums