Tiny Code Christmas - part 1: making coding fun through constraints and community

2 Jan 2024

Tags: games, lua, retro, tic80

Normally, as someone who codes for a living, xmas is a time for me to down tools and step away from the computer for a bit, spent time with family, spend some time in the workshop and generally not stare at a computer so much. But this last two years I’ve had a lot of fun doing some small amounts of coding for fun. In this and the next post, I’m going to go through what got me doing this, what I learned from it, and why I recommend it to others. But the TL;DR is along the lines of: small regular constrained challenges, community, and exploration.


In an post I wrote a couple of years ago I mentioned in passing the idea of fantasy consoles like TIC80: these are programs that pretend to emulate a retro computer from the 8 or 16 bit era of computing, but remove a bunch of the practical friction in doing so with a real computer from that era. TIC80 for instance let’s you write in Lua, which is a very approachable language for anyone that’s done any sort of programming, doesn’t require you find a CRT or floppy disks, and lets you quickly get up and going writing fun little graphical things in 240x136 pixels and 16 colours. There’s no networking, there’s no 3D, it’s just very basic old-school style computing.

In that earlier blog post I wrote:

I think they appeal to me because they mostly avoid the pitfalls of being just a place for wallowing in computer nostalgia, and exhibit the fun that there is in building software for a more limited domain. I follow a bunch of people building software for Uxn on social media, and there’s just a sense of fun and enthusiasm there for building software that I think is interesting and contagious, particularly as a way to try and make low-level computers more accessible, as they were back in those early days of the personal computer era.

I think that freedom to have fun in this small sandbox is something that encourages experimentation and learning, and the community that then springs from this further reinforces that. Indeed, I got started because of that community aspect: before I tried TIC80 for myself I enjoyed watching the Field-FX Monday night demo streams, where they get four people to code up simple graphical demos live over the course of a couple of hours. It’s super chill: the limitations of the TIC80 system mean you can’t get super nerdy about tweaking graphics card registers or such, and whilst that’ll limit its appear to some I’m sure, I enjoyed watching people with very different levels of experience taking part, and all making something fun. The nice thing also about the simplicity of the system is that it’s fairly easy to follow the coders as they write their demos live (some even put in comments to talk to the audience).

Thus, when I spotted that the same set of people were going to do a sort of challenge-a-day in then run up to xmas, dubbed Tiny Code Christmas, I felt inspired to take part: I knew the platform constraints would make this something that couldn’t get out of hand, but at the same time doing these graphical style demos was something I’m quite rusty at, so there was a chance to learn some new techniques here. I compared it to doing crosswords or similar puzzles when trying to explain it to someone recently: a chance to push yourself a little, but it’s very bounded.


So in the 12 days that followed I had fun taking part, and dipping into that community to share what I’d done and find inspiration and know how in order to do better each time. We did classic old-school demo effects like shader bobs:

and scrolling effects where you move the framebuffer along:

I didn’t really go in for the size-coding aspect, which is where you try to get your code down to as few bytes as possible: having worked in security software I now find I’m somewhat allergic to anything that makes code hard-to-read as a human, but I do understand the appeal of the challenge. You can find the code for all my entries posted here - none of them are that exciting to read, but perhaps serve as an example that you can have a lot of fund with very little code in the correct context, particularly if you’re in a community of others doing the same.

TIC80 really does take a lot of the friction out of coding, which is key if you’re trying to make this an entertaining experience rather than a chore: you write your code in TIC80, hit cmd-R to run it, press escape to get back to your code: so there’s no compiling or having to drop out to the command line etc. The edit-run-retry loop is really short and does a great job at encouraging exploration and experimentation as the overheads of doing so are so low.


Off the back of TCC22 I did two follow up things. LoveByte, the community behind TCC, have their annual competition at the start of February, so I did overcome my size-coding fear and submitted a small 254 byte demo for their newbie section:

This was a re-creation of an effect from the 1993 demo Second Reality which had totally blown my mind back then, and required a fun abuse of the memory map TIC80 provides, as I need to have a second screen of data hidden away to get the effect. I did very poorly in the competition - I suspect recreating a 30 year old effect was not a way to win over the audience who voted on the competition - but I had a lot of fun doing it, particularly taking part in the online demo party itself.


The second thing I did thanks to TCC was spent a little time writing a sort of game-engine, something I’d never got around to doing before. Watching one of the FieldFX byte jams I’d spotted someone making a sort of ISO-metric projection landscape thing using just the simple 2D triangle drawing primative in TIC80, and so I gave that a whirl, learning as I went about how videogames generate landscapes procedurally using techniques like layering (https://en.wikipedia.org/wiki/Perlin_noise):

The joy of something like TIC80 is that its simplicity gives you this constrained enviroment where it’s really easy to start doing this sort of thing. I’d tried to write game like things in the past, but always got quickly overwhelmed by all the possible directions I could take things, and ended up running out of steam and/or free time before I’d managed to build something cohesive - the fact that TIC80 doesn’t let you do a whole bunch of things is an advantage then, keeping me focused on the key bits to the thing I’m trying to build.

But as and when you do want to grow, there are incremental routes from TIC80 that don’t mean you need to start over if you do want to build out a full game say from your TIC80 idea (although, to be clear, plenty of people do publish full games in TIC80). I ended up graduating my little game engine to Love2D, a small Lua based 2D game engine where most of my code would just work with a little bit of renaming of the drawing functions. From that and some sprites I bought from itch.io I wrapped up this little but of fun with a little game engine that made me happy to have spent a bit of time on it:

By the end I had items to collect, simple NPCs, mountains, and sorted occlusion problems. Enough to satisfy my itch before I had to turn my coding attention back to work. One day I’d like to pick this back up and do something with it - I have an idea for building a community based little open world game - but there’s no urgency, and it’s parked in a nice place.


As you can see if you’ve made it this far, TCC 2022 wasn’t just fun for me because it was a coding thing and I’m a nerd, rather it was fun as I promised me a way to have some fun without it being a big drain on my holidays, let me work with a community of nice people via the LoveByte Discord, and inspired me to try a few things afterwards based on that which I’d not otherwise have tried. The barrier to entry to TCC is very low - TIC80 can be downloaded for free, Lua is a super easy language to learn, and the Discord is there if you want to chat to people. Best yet, the challenges are just there, you don’t need it to be christmas to take part, you can do so at your own leisure.

In the next post, I’ll talk about what I did for TCC 2023, where I took it in quite a different direction.

Digital Flapjack Ltd, UK Company 06788544