A few months back, I started this cart and then basically abandoned it after I realized I was quickly approaching the token limit (~1500 left). There are a lot of ideas in this WIP, and it was a pretty good learning experience. I almost made a proper game in the process.
If anyone thinks completion is worthwhile, I'd welcome suggestions for a purpose behind the gameplay. That was one thing I never really got around to! :3
The more projects I start, i've been finding it harder and harder to keep track of all my little copy-paste pico-8 code snippets. I've had a burning desire to use require(), so I could organize and reuse my code in modules, but there's no mechanism in pico-8 that let's you do this.
It's also a bit manual and tedious to browse through and repurpose code in other people's carts since there's several steps involved.
To try and solve these issues, I just published a tool called p8. It manages dependencies and makes it easy to share code across projects. It does so by injecting external dependencies into a cartridge and polyfilling a global require(), which allows you to import these modules from your project's entry point.
Does anyone else have major problems with managing their code as their projects grow? How do you keep track of your snippets? What's your process for using code other people wrote?
Recently, I got really tired of writing buggy code with prinths scattered everywhere to try and figure out what the hell was going on. So, I created a way to test your carts while they run. It gives you output on the command line that looks something like this:
Hopefully, it's not too difficult to install/use. I mimicked mocha's API at a high-level.
I'd love to hear what you think if anyone decides to try it out. You can also download the cart and take a look at the code for more info. There's fairly detailed documentation on Github:
Also, feel free to comment on this thread with questions or hmu on twitter. Cheers!
I just came across moonscript the other day. It's a sort of coffeescript-esque language that compiles to Lua. It has a lot of nifty features -- including arrow functions, which is what sold me.
So I wrote a tool that allows you to watch a .moon file and pipe it into the lua part of a .p8 cartridge. It's not thoroughly test and probably only works on OS X, but I've been personally enjoying writing moonscript in Sublime Text 3 and watching PICO-8 automatically reload on save :)
I'll drop the link here in case anyone finds it useful or intriguing: PICOMOON
Alas, the simplicity really does set me back in one category -- persisting data.
It seems like looking at the manual and some carts, the main method is to write binary data to a memory address with peek/poke/memcpy/memset. As a JS guy, I've worked with plenty network protocols and IO between filesystems, databases, and APIs, but when it comes to working directly with binary data and using memory addresses, I'm kind of lost. I've rarely encountered a situation that required me to use bitwise operators or manipulate binary values directly.
That being said, I have looked around the BBS and attempted to find something to guide me on this quest to save the game state. I've seen a couple of threads (like this one) and downloaded a few carts like Shodo and Picodachi to see how it's done. Despite my best attempts to grok the concept, it's very difficult to understand the following:
1) Which memory addresses to use and how to prevent writing over previously written addresses. 0x5fc0-0x6000 seems like the sort of default range. But what are the intermediary addresses?
2) Determining the proper number of bytes required to save an arbitrary number/string/boolean and determining how many to read back.
3) How you'd go about using converting variables into binary before write and back again upon read.
4) If there's a feasible way to convert and store functions or tables as well.
I'd really appreciate any advice, tutorials, carts or code snippets that could help me wrap my head around how all this works in Picoland. Thanks! :)