Log In  

@edo999

Follow
Follow

Web coder really into retro gaming and big pixels.

Cart [#22119#] | Code | 2016-06-02 | License: CC4-BY-NC-SA | Embed

I looked into animating static background elements using different sprites and came up with this cart.

Has anyone else tried to animate the background this way (that is without parallax scrolling, just animating some background sprites)? If so what approach would you recommend?

P#22121 2016-06-02 17:58 ( Edited 2016-06-03 21:12)

PICO-8 carts exported to HTML won't work on iOS in web app mode (a.k.a full screen web app).
Add the following meta tag to your .html file:

<meta name="apple-mobile-web-app-capable" content="yes">

Open the page in Safari iOS, add it to the homescreen, then launch it from there.

Nothing happens, the execution of PICO-8 doesn't start though it works perfectly well when launched from Safari.

The device I'm testing on, an iPhone 5, is not powerful enough to debug the web page and crashes when I try, so I don't really know what's the problem. I suspect there is a limitation blocking Emscripten somehow, maybe with the eval() function in JavaScript. I know the JIT was (is still?) disabled in webview, but the particularities of the web app mode are not documented.

It's a shame that Apple is doing their best to ruin the HTML5 experience, probably to give the priority to their closed and controlled apps ecosystem.
I'm not an iOS expert, so if you have any idea on how to fix that, please let me know.

P#21423 2016-05-26 19:36 ( Edited 2016-05-27 12:49)

Cart [#20539#] | Code | 2016-05-13 | License: CC4-BY-NC-SA | Embed
2

I made a small demo of a rotating globe. The texture effect works visually.
Feel free to reuse the code to improve it or to make awesome games!

P#20540 2016-05-13 12:49 ( Edited 2016-05-13 16:49)

When compiled to HTML, it was surprisingly easy to inject data inside a PICO-8 cart.

The memory starting at 0x4300 (user data) maps to index 0x10DA1C of the heap in JavaScript. You can get and set the data easily using JavaScript (wait till the cart is loaded):

Module.getValue(0x10DA1C);
Module.setValue(0x10DA1C, 3);

Then read it or set in PICO-8 like this:

peek(0x4300)
poke(0x4300, 3)

I'm using it for a multiplayer game where I want to allow several players selection only when there is an internet connection (I haven't worked on the multiplayer communication yet though).

The user data section is 6912 bytes long, so that's a lot of data for PICO-8.
Potentially this technique can be used to do all sort of really cool things like leaderboard inside the cart, downloadable levels or players, syncing several players together (chat, collaboration games, multiplayer games...).

Caveats:

  • Not sure if the index in the heap will remain stable across releases. Is it even stable across carts? It must be decided by some internal logic in Emscripten.
  • It works only in web mode of course.
  • It works only when embedded in a particular web page.
P#20500 2016-05-12 16:32 ( Edited 2016-05-24 07:58)

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-10-19 15:36 | 0.072s | 4194k | Q:32