2 pointsby zeta01342 hours ago1 comment
  • roshiya2 hours ago
    Curious which part ended up being the hardest to fit into PICO-8's limits code size, art, or music?
    • zeta0134an hour ago
      By far the most irritating limitation is code size. This is a fantasy console, but the Lua VM is compressed into some sort of bytecode stream with a hard limit on the number of "tokens" (basically whole words) in the code. This leads to some oddities, like "e.pos.x" being 5 tokens, while "e.pos_x" is only 3.

      My usual platform is NES, and I've got a pretty good handle on how to optimize assembly language to squeeze code down to size, but I haven't really developed that intuition for pico8's Lua implementation. The final version of the game uses 7989/8192 tokens altogether. It just barely squeaks by!

      There are some minification tools I could have run, and I think with hindsight there are some architectural changes and code habits I could develop to make this slightly less of an issue. In practice, I'm now learning picotron instead. (It's got actual widescreen! Much more practical for modern displays, I think.)