Log In  

I'm currently working on an improved version of P.Craft (save system, a boss, a few new items ...) by using the multi-cartridge system. So I have a menu cart, a main cart and some others, and I switch between them with load() or cstore() a cart and use reload() to get it's data from another cart. It's a pretty great system to go beyond the usual limitations of Pico 8, while still having some constraints.

I noticed a major issue once exported in HTML : the carts are kept in the browser cache or local storage and aren't updated when I make a new export.
So if I change one of the cart I export (except the starting cart), the changes are not visible in Chrome, my usual browser (because I already viewed an older version), but are in Firefox, my secondary browser (because it's the first time I'm opening the file).
I tried changing the exported .html filename, changing the cartdata() name or various javascript tricks, but none of that worked.
The only way I found right now is to change the names of each carts I export, and then it works correctly. The browser is forced to get the new version, as he doesnt find the carts in his cache/local storage.

Has someone already noticed that issue, and is there another work around ?

Also secondary question, is there a way to post a multi-cartridge game on the BBS properly for it to work in the browser and splore ? I suppose I could post each cart separately and people would have to download all of them for it to work. I could maybe test if the cart system is working or not, and display a useful error message explaining that it will only work if you download all the carts.

P#44603 2017-09-25 15:42 ( Edited 2017-10-06 20:42)

yep I stumbled upon this problem: https://www.lexaloffle.com/bbs/?tid=29586
you can reset the thing by removing the "local storage" in the cookie menu (left of the url bar)

note that firefox resets that data on a simple page refresh, while chrome, opera and edge will keep it indefinitely, across a browser restart or system reset (didn't try clearing caches, tested on windows10).

I had made a cart to test it (cstores data on a side cart):

Cart #44070 | 2017-09-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1


move cross around,
press (o)/[z]/[c] to save and reset
cross should stay where you left it
move around, reset from menu
cross is back where you saved it

P#44637 2017-09-26 11:51 ( Edited 2017-09-26 16:13)

Thanks, I'm glad I'm not alone on this issue. It's interesting that it only happen in Chrome. By going in the "developer tools" in Chrome, you can see exactly what carts are in the cache. They have a time stamp, so I suppose they should be updated if you make a new version, but they aren't.
Resetting the localstorage is nice when you are working on a project, but once the project is out, there is only the name changing to be sure that all players get the refreshed cart. You can't really ask them to go clear the cache.
I will make new tests when I can.

P#44656 2017-09-27 03:15 ( Edited 2017-09-27 07:15)

it also happens in opera and edge. I think the firefox way makes more sense, so it may be a bug/overlook that'll eventually get fixed?

in any case I'd say don't self-cstore a cart, you'll lose your original content. if you use cstore as a side-cart save, with a dirty word or checksum, then you are in control.

P#44657 2017-09-27 05:11 ( Edited 2017-09-27 09:11)

Thanks for the detailed reports both of you -- this should be resolved in 0.1.11

I've switched to a different scheme for storing data when carts don't have access to the local drive (running from the bbs via splore or html, and via exported binary or html):

  • When data is cstore()'ed, it is saved as a separate 'patch' that is named as the hash of the original cart's content.
  • When load()ing or reload(), the patch is applied if it exists, but otherwise the original is loaded.

This means that exporting a new version of a cart can't possibly pick up any cached data lying around. These are internal details -- if everything works perfectly then hopefully future users won't need to know about this :)

> Also secondary question, is there a way to post a multi-cartridge game on the BBS properly for it to work in the browser and splore ?

It's unlikely multicarts will ever be fully supported on the BBS the same way they are in exporters. But it will at least be possible to daisy-chain carts together -- loading another bbs cart and running it with an optional parameter string. The long-term goal is to get a web of carts going with something similar to hyperlinks between them. The first step (being able to LOAD() a bbs cart from a running program) will be available in 0.1.11.

P#44948 2017-10-06 14:08 ( Edited 2017-10-06 18:08)

@zep:

"It will at least be possible to daisy-chain carts together -- loading another bbs cart and running it with an optional parameter string. The long-term goal is to get a web of carts going with something similar to hyperlinks between them. The first step (being able to LOAD() a bbs cart from a running program) will be available in 0.1.11."

This has so many wonderful possibilities.. Just like the archaic CHAIN command in old preinstalled BASIC languages.

P#44950 2017-10-06 16:11 ( Edited 2017-10-06 20:11)

@zep:

Sounds awesome. I hope we see 0.1.11 soon. You're coming close to completely missing your 2017 copyright notice opportunity. ;)

P#44953 2017-10-06 16:42 ( Edited 2017-10-06 20:42)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 12:50:07 | 0.012s | Q:26