------------------------------------------------------------------------------- Well, this version definitely had me scraping every little inefficiency I could think of to save tokens. There's still a lot that can be saved, but right now I'm pretty much fighting against the token limit to try and add more and more features. Stats: tokens: 7885 / 8192 chars: 48853 / 65535 compression: 97% To start, I had to start doing variable recycling for scenes. Because the dot operator counts as a token, it's more efficient to keep data on the global namespace than to utilize containers. Because of this, scenes are using generic variables like "sc_1" through "sc_7" at the moment. As a strangely positive consequence, my game runs much more efficiently and uses a lot less CPU. I was originally concerned about doing it this way, but it turns out that I have a lot of RAM to spare. I think PICO-8 allows up to 2048 KB? The game's debug stats seem to show that I'm only using 250 KB or something. I'm watching my code sort of merge into a less elegant but more efficient style. It's more efficient to use expressions than branches, but it's still good to use functions instead of GOTO branching. as far as I know. It doesn't save any tokens to GOTO branch if I recall. Because comments affect the compression percentage of the cart, most of them have been removed. I'm expecting the code to become less readable as time goes on, but I'll have a good amount of knowledge about the code I've written for each section. Anyway, in this version, the first (non-killable) enemy is seen! There's bats flying around the place now, but I have to fix the fact that they'll fly off the edge of the map because their position doesn't wrap around like the player's does. If I set their solid flag to true, I can ride on them! It was turned off in this version, however. There is another actor that was made, but it's indistinguishable from the foreground tiles it represents. I've added pots to the game, which eventually will be breakable in order to get stuff like healing items and game currency. They will respawn like enemies do when you change vertical layers, so it may be an efficient way to farm things you will need. You may also notice in this version that a very weird noise plays when you step on spikes or lava. This was me testing harmful tiles while making sure that they don't hurt the player if they're still standing on the ground. The noise still plays when you're standing NEXT to spikes though, so I have to fix that. So far I haven't needed to sacrifice any of the content I've made for the game so far. I've only needed to compress their information or made their modules more efficient. I'll need to find clever ways to beat the token limit, which is my current adversary in development. Maybe I can implement a tiny string parser which can ease the load? It will cost CPU to add an interpreter on top of an interpreter (Lua) but if it means saving valuable tokens, then I'll start working on one. Cheers! - Goober ------------------------------------------------------------------------------- |
P#81152 2020-08-25 06:39
[Please log in to post a comment]