I made this game for TweetTweet Jam 6, the premise of which is that you have to make a game the size of two tweets or smaller (560 characters)

In the end it took about half a day from start to finish. I wanted something that could look reasonably impressive/high effort, but obviously took up a fairly small amount of code, so I pretty quickly settled on using cos/sin maths to generate some interesting shapes that would rotate around each other. From there it was a pretty quick jump to having them be orbiting planets.

It was pretty clear from the outset that I wasn't really going to be able to even loosely approximate the maths for applying force to orbiting objects and the results of that, so again, it was a pretty natural step to move to a significantly more straightfoward interpretation, which initially just let you raise and lower your always circular orbit and rotate through that orbit. Then it was trivial to just apply the usual DX shenanigans to give them both axes some momentum, (though they were and remained completely independent of each other). Add to that a fuel counter and you have... something?

So I'd set up some orbiting planets, a bit of RNG initialisation gave each planet some individual attributes, made sure that they largely avoided lining up in obvious patterns and made each time you reset the game create a new alignment! Great! At this point the only thing missing was to add a basic goal and loop; the obvious thing was to have the player manoeuvre around the system and collect something, which I could then also wrap up in the fuel meter! So bam! You've got a game loop of flying around grabbing fuel, not crashing and it all ties nicely into the little narrative about losing your fuel reserves. All I had to do was add an entity that would also fly around, albeit a little more predictable, and respawn with a new pattern when you picked it up.

Up to that point was the easy part. By this point I was feature complete and pretty much no bugs, BUT 1000 chars deep into code... I needed to cut it pretty much in half to make the limit... This was the painful part. There are quite a few ways to do this in Pico that I went through
  1. Variable names can be one character long, so once you're at this stage and readability becomes a little less important. So 'Speed' can become 's' etc. I went through all 26 letters of the alphabet doing this and just had enough
  2. The same can be done with functions that you reuse. Define 'c=circlefill' and you can just write c everytime you need to draw a circle. The more times you draw a circle, the more space you save.
  3. Some shorthands can be used, e.g. an if, then, end, statement can have the then and end parts chopped off if you format it correctly.
  4. At the expense of readability, you can stack lots of bits together on one line and not break anything, even if there's no spacing e.g. x=1y=2z=3. This doesn't work for everything, but it really helps to crunch those final few characters down
  5. Once I'd exhausted all the simple tricks, I had to either make some sacrifices or rewrite some stuff more efficiently. Some rewriting did help a little but ultimately I had to give up a few things. First was 60 fps. Using flip()goto only works at 30fps, but takes a fair few more characters than using the built in _update60, _draw, _init functions. Second was better collision. The cheapest collision I could get was testing the colour of the pixels at the player's location. If another object overlaps it the colour changes and a collide occured. I had this applying to both the tip and the tail of the player line which felt pretty good. Ultimately I needed the tokens and 1 pixel collision worked well enough. At one point I also reduced the player to just a single pixel, but it felt awful. Removing the line being aligned to the planet made it much much harder to judge your relative velocity. One more thing that went was the orbital ring. This was simply a wring centered around the sun passing through the player, so you could see your entire future orbit based on your current height. It was a very useful tool and made things a lot easier to judge, but it wasn't essential, and I could tweak other things (fuel use etc) to keep the difficulty stable.


It took a lot of pain, but eventually I managed to cleave it down to exactly 460 characters. This didn't leave enough for full strings to display fuel and score, so I had to settle for POW for fuel and nothing for score, its obvious in context anyway.

I'm pretty happy with it overall, especially for a half-day's work. There's some obvious improvements to be made, but for such a small and compact thing, its an effort I'm very pleased with. I might return to the concept at a later date, maybe on Pico8 again or NES. I'd love to be able to try and expand it, add some sound effects/music, and do some more tinkering with faking orbital mechanics in more detail. Lots of maths to read up on!

(naturally right after I uploaded it I realised that in my code culling frenzy, I'd culled the code that reset the game if you ran out of fuel. OOPS. Fortunately, looking at the code instantly revealed quite a few spots I'd missed in the last few hours, and I gained enough tokens to put the code back AND land smack dab right back on the limit!)