Categories
Uncategorized

Fix Corrupt PICO-8 Save Data on Anbernic RG35XX

I’m still loving the Anbernic RG35XX but sometimes thing go wrong and I need to pop the SD card into a computer to delete a file to get some things working again. The OS saves the game state when you close a game, and occasionally with PICO-8 games the save file gets corrupted and you can’t launch the game again until you delete the bad file…

Since there’s a terminal application you could go into that and cd to the correct directory and delete the file, but they keyboard is… well, it’s like a TV remote. Arrow around a keyboard and enter keys one at a time, so there has to be a better way… so I wrote a script.

I just launch SimpleTerminal, and to save keystrokes the script lives right in that directory…

So I type ./fixp8.sh (Or actually just ./fi and then the tab key to autocomplete…

…And then the script runs, and shows some instructions. It also shows the most recently modified file so you can choose to fix it, skip it, or quit the script.

If that file doesn’t belong to the game causing issues, I skip it, and it moves on to the next most recently modified file…

The script only accepts f, s, or q for input. When you are done (hopefully after fixing the bad file) you can quit.

Note that the script doesn’t delete any files, just renames them, in case you “fix” the wrong file. (You can un-fix it easily on a computer by renaming it back. We just add a ~ after the file name.)

I think (and should confirm) that the way the system works, if you launch a game by selecting it and pressing the A button it should try to reload the last saved state, but if you press the Start button, it should start fresh ignoring the save file. It seemed like this didn’t always work… maybe just with PICO-8 games? If you find out, let me know.

In the meantime it’s been really interesting (and a little fun!?) learning how to write and run scripts on this device. I mean, it’s basically Linux. You can even run scripts at startup, and I think I saw that you can get cron installed, which is pretty wild but also not really, because Linux.

(Note: Since I wrote this I found another use case for fixing files, and I’ll follow up with that in another post.)

Here’s the script!

#!/bin/sh

# where the directory is located
# mms for first card, SDCARD for second card
SAVEDIR="/mnt/SDCARD/Saves/CurrentProfile/saves/fake-08/cdata/"

cd "$SAVEDIR"

# we need a way to get only txt files not txt~ files
FILES=`ls -t *txt | head -n 50`

echo ""
echo "This will fix bad P8 save files."
echo "Fix a file, skip it, or quit."
echo "Fix [F], Skip [S], Quit [Q]."
echo ""

for f in $FILES
do
	while true; do
	    read -p "Fix $f? " fsq
	    case $fsq in
	        [Ff]* ) echo "Fixing $f"; echo ""; mv "$f" "$f~"; break;;
	        [Ss]* ) echo "Skipping $f"; echo""; break;;
	        [Qq]* ) echo "Quitting"; echo""; exit;;
	        * ) echo "Please answer F, S, or Q.";;
	    esac
	done
done

Categories
Uncategorized

PICO-8 Favorite Games

I’m going to start off saying I have very little history as a “gamer” when it comes to knowing what the classics are, what came before, and what things are based on. (I don’t even know all the genres.) In many cases I didn’t even read up on these games, I just grabbed the carts and started playing.

All of these games can be found at the PICO-8 web site. I’ve provided links to each below. I play them on an Anbernic RG35XX handheld console, but you can play them on the desktop or in a browser.

A Hat on Time
This game is a blast. It’s a platformer, of which there are many in the PICO-8 world. This is one where you don’t die, or… you do die, over and over again. Unlimited lives! I love that. You need to jump (and swing) over pits and around ash clouds(?) and it’s got simple graphics and minimal colors and it all just works. There are times in this game I get stick and think there’s no way I will go further, but then I figure it out! (Or try 50 times… unlimited lives, remember?)
I give it 8 out of 8 bits!

Barp the Balldragon
First of all, I’m still on the first level! I’m pretty bad at this one, but it’s so damn cute. Barp has some platform work to do, but besides running and jumping be “barps” (burps?) balls at the little creatures who are blocking his way. I’ll keep going on this one or give up. I’m not sure yet.
I give it 5 out of 8 bits!

Captain Neat-O in the Time Nexus
Hey, another platfomer! This one is a rich world with a lot of ground to cover. It’s a tough one, with a lot of creatures and obstacles to get in your way. I’ve put in a good amount of time on this one and more than once I’ve gotten stuck and a little frustrated. It is a fun one though, so I’ll probably keep going.
I give it 5 out of 8 bits!

Feed The Ducks
Okay, this game is wild. You are a cat (bonus points there) and it’s called “Feed The Ducks” so I guess you need to feed some ducks. This one did confuse me a little but I eventually got it. It’s a weird one, but also unique, so it’s a lot of fun. I’m still a little confused by it even after I “won” so I am sure I’ll do it again.
I give it 7 out of 8 bits!

ISOL8: Build & Isolate
Supposedly ISOL8 is an original arcade game inspired by old-school games like *Jezzball* and *Qix*. I have no clue so I’ll believe that. You press the two buttons to make vertical or horizontal lines dividing the screen or sections of the screen based on the lines you’ve made. You need to isolate all the bouncing balls. This is a timing and puzzle(?) game, and it’s a fun low-stakes play.
I give it 7 out of 8 bits!

Murder, Death, Chill
I asm typically not a fan of shooting games, but this one is just so simple and (well, short when I’m playing it) I fire this one up pretty often. You basically move left and right a bit and have to keep shooting (either left or right) when the bad guys come at you. It sounds so simple, and it is! Sometimes simple shooting is all it takes for a good game. Super fun shooting effects dress up the otherwise simple background. (Note: My screenshot is terrible, but the game is not.)
I give it 5 out of 8 bits!

Upward
All you can do is jump. Straight up. You can’t even move left or right (on your own). The graphics are simple, the concept is simple, but it just works. This is another game where timing is critical, and you need to map out your moves before you make them. Oh, besides jumping straight up you can also suicide yourself to start over on a level, which I’ve done many, many times. It gets progressively more difficult, so it’s a great challenge with such a minimal game.
I give it 6 out of 8 bits!

Thanks for reading! This was a fun list to make. The goods news is, I have a lot more games I really like! That means there will be a part two coming soon!

Categories
Uncategorized

PICO-8 Game Development System (and Ecosystem!)

So the Anbernic RG35XX (and GarlicOS) sent me down a rabbit hole of searching for games, and somehow I came across PICO-8. The simplest explanation is that PICO-8 is a fantasy console for making, sharing and playing tiny games and other computer programs. To expand on that, it’s a virtual machine and game engine created by Lexaloffle Games. It is a fantasy video game console that mimics the limited graphical and sound capabilities of 8-bit systems of the 1980s.

One of the reasons I got the RG35XX is that I wanted to disconnect from the computer and phone and just focus on something (in this case, playing games) and while playing Tetris (again) and discovering (for the time) all sorts of old Game Boy games is a blast, PICO-8 is something special. These are my observations about PICO-8 and games made with it.

PICO-8 games tend to focus on game play and not flashy graphics. Some games are simple, some are complex. Some are recreations of old games and some are new (?) ideas that haven’t been done before.

There’s a community of people sharing what they make. I wanted to say “people” and not “game developers” because while people who make games might be “game developers” I think there are also just regular people who like making games and sharing them and might not think of themselves as “game developers” in the traditional sense of a “software developer”. The Lexaloffle BBS is basically a feed of “hey, here’s a new game I finished, or I’ve been working on, or my progress so far” and you can check stuff out.

You can play the PICO-8 games in a web browser, and they all seem to be free of ads. You don’t need to visit an app store, pay for a game, give it permission to read all sorts of information about you… you don’t even need to sign up for an account or enter a credit card.

I started doing web development in the mid-1990s and “view-source” was how we learned things. PICO-8 has view-source! You can click the little ‘code’ button and see the code. You can copy and learn from the code, and modify it, and fix it, and… it’s refreshing to be able to do that.

`For the RG35XX there is not an official way to run the real PICO-8, but there’s Fake-08, which has the goal of making PICO-8 games run on platforms that aren’t officially supported. So you won’t see Fake-08 for Windows, macOS, Linux, Raspberry Pi, or for the web. It just fills the gaps left by Lexaloffle.

As you may have guessed when I mentioned the view-source thing above, I have already dabbled with writing code in PICO-8. I don’t know that I’ll ever actually release anything, but hey, it is bringing fun back to programming for me. (For anyone who has written code for themselves/for fun, and for others/for work, you probably know what I mean.) When I was a kid in the 1980s I tried writing an adventure game on the Apple ][+ completely in BASIC. It was fun at first but quickly became frustrating as the lines of code added up and what I wanted to do surpassed my programming abilities of the time. I could probably totally write that game with PICO-8 today.

I should mention that the Anbernic RG35XX may not be the ideal handheld console for PICO-8 games. There are handhelds that can run the official version of PICO-8 (instead of Fake-08) and you just need to load the Raspberry Pi version onto the device. (PICO-8 is $15 for the official runtime, but if you consider you get access to thousands of games it seems like a deal.) Some handhelds also have wifi, which means you can run splore which is basically a browser (or “app store”) for games. You can also run splore in the browser or desktop version of PICO-8 and it’s the best way to check out a zillion games to see what you like.