Console #134 -- Interview with Leo and Cedric of Sprig - an open source game console
Featuring Act, Leptos, and Sprig
🤝 Sponsor - PostHog
With PostHog's open-source analytics platform, customer data never has to leave your infrastructure.
Featuring product analytics, session recording, feature flags, heatmaps, experimentation, and more - all available for free!
The best part is everything is seamlessly integrated, so you can spend less time configuring different tools and more time getting valuable insight into user behavior.
Browse through open source projects on OpenSourceHub.io, add your project to get more exposure and connect with other maintainers and contributors!
Act helps you run your GitHub Actions locally.
language: Go, stars: 32202, issues: 76, last commit: 6 days
Leptos is a full-stack, isomorphic Rust web framework leveraging fine-grained reactivity to build declarative user interfaces.
Sprig is a game console where every user is a creator. It can only be obtained by building a tile-based game in the web-based game editor and shipping it in the community gallery. It's made by Hack Club.
Join thousands of other open-source enthusiasts and developers in the Open Source Hub Discord server to continue the discussion on the projects in this week's email!
Hey Leo, and Cedric! Thanks for joining us! Let us start with your background. Where are you from, how did you learn to program, and what languages or frameworks do you like?
Cedric: I grew up stuck out in the woods with my two little brothers in Catawba, Virginia. I would come up with games and stories to entertain them, and that sort of just became who I was. I stumbled across Codecademy in 5th grade and started turning my stories into text based games. When I sit down to make a game to this day, I imagine playing it with my little brother.
What is Hack Club?
Leo: Hack Club is a global network of teenage technology enthusiasts who are learning to program by making things they care about and sharing them with others. Some teens in the network participate by running local clubs at their high schools or by attending those club meetings, for others they participate by helping maintain or build our open-source projects. Through our work, we spread the values that technology is an expressive thing which should be joyful and playful.
Cedric: Hack Club is a non-profit organization whose mission is to support teenagers in tinkering with technology. They do this through their online community and a global network of school clubs.
What is Sprig?
Leo: Sprig is a handheld console that you build yourself and which you can only get by contributing a game to its game gallery as an open-source contribution. The pithy line is that it’s a console where every player is a creator. Right now we only send Sprigs (for free) to teenagers because that is the core demographic that Hack Club serves. But the online game editor and gallery is available to everyone. If someone other than a teen really wanted a Sprig console they could fairly easily make their own because it’s all open source (of course!).
Why was Sprig Started?
Leo: Sprig started about a year ago when trying to figure out how to help beginner Hack Clubbers learn how to code transition from just studying language features to focusing on projects they were excited about building which they could understand.
In the Fall of 2021, I made a variety of small projects like an interactive editor for a small music programming language, or a simple programmatic drawing environment, and it culminated in a web-based game making tool with a simple 2D physics engine. The physics engine ultimately evolved into a discrete tile engine which seemed to make it much easier for people to focus on making games rather than individual game mechanics. We wanted to help inspire people to follow through with their projects and came up with this idea of giving away consoles which could play games they make after they shared them with the community. We designed the console so people could build it themselves and also reuse the components as a hardware development kit.
We sometimes call the model “you ship, we ship”. We don’t want to be arbiters weighing and measuring people to determine which opportunities we’ll make available to them so instead of asking people to apply for hardware we just give everyone a chance to express their earnest interest by just getting to work. Then we support whoever resonates with it.
Sprig is a type of microworld. It’s a concept developed by one of the father’s of educational technology, Seymour Papert. Papert popularized the idea that people learn best by building things they care about and sharing them with others. He called this pedagogical philosophy constructionism. A microworld is a place for exploring a specific set of ideas by using them to create things. You can learn more about how our work at Hack Club tries to realize these ideas in technological tools in this talk I gave for the Topos Institute.
How has your experience been developing the game engine?
Leo: It’s been a blast. Designing construction kits is one of my favorite things to do. A good API introduces people to a set of ideas which seem simple but which can be composed in expressive ways. Projects end up being unique but having a shared character to them. The most interesting part of building an engine is figuring out what mental model to encourage and what building blocks to provide which fit the model. Then you get to implement it!
Can you tell us more about the hardware?
Leo: Originally we were planning to use a Raspberry Pi Zero but due to chip shortages they just weren’t available on the timeframes we needed them on. Sprig ended up being a much more interesting project to work on having to deal with the constraints of a microcontroller. The Pico also improved the development kit nature of the hardware. Including parts and manufacturing costs each Sprig is about $100 to produce.
Because the whole project is open-source we used open-source tools to design the PCBs. Arguably open hardware isn’t really open if you can’t work with the designs in open software. One of my long running hobby projects has been trying to make open source PCB design more accessible with web-based programmatic board design tools. After designing the boards we manufacture them in China at a board house (in our case ALLPCB). The process is actually pretty accessible to learn and you can order boards for tens of dollars. A somewhat more environmentally friendly alternative for prototyping them though is to cut the boards from copper yourself and stuff them by hand with solder and tweezers.
Why are Sprigs not sold? Why are there only 430 of them?
Leo: The fact that it can’t be bought makes the device special for teenagers. A lot of teenagers don’t have much money or ways of earning it. We want to encourage them to spend time exploring their curiosity so it makes more sense to incentivize that over activities which afford them the opportunity to buy something.
Our aim is to inspire people to learn by making, so we use the hardware to incentivize that. There are 430 specifically because Tom Preston-Werner funded the project for his reverse 43rd birthday gift, but our hope is for Sprig to be a project that continues running in the years to come. As a nonprofit, we rely on the generosity of donors to make Hack Club and open source projects like Sprig free for teenagers. Our finances are 100% transparent at bank.hackclub.com/hq and anyone can donate at hackclub.com/donate.
What was the most surprising thing you learned while working on Sprig?
Leo: I’m not sure it was surprising but it’s always delightful to discover that there are a number of 13 year olds out there who will tremendously impress you with their skill and enthusiasm to contribute to a project like this. We have such contributors from Colorado to Brazil who are spending time everyday helping with the project and making it their own. At first I reviewed every single game that came in meticulously myself. After I discovered a few people with special enthusiasm for the project were quite active in assisting others I asked them to become maintainers/reviewers as well. They beat me to every game which came in! The Hack Clubber in Colorado started making every game which someone could suggest to him and found a number of bugs in the engine (some of which he took the initiative to fix himself!). The one in Brazil began to translate the whole system into Portuguese so he could share it with his countrymen. Young people spend so much time trying to prove themselves worthy of opportunity, part of the beauty of open-source is you just open things up and get to see how people run much farther than you would have imagined possible.
Cedric: I had to do a lot of surfing through the Raspberry Pi Pico forums to figure out how to manage flash memory from C without a file system, etc. and you can learn all sorts of neat things from the people there. I was investigating one issue on the device and found a forum post where someone was talking about how a related bug actually bricked their washing machine.
It was a moment that made me think, “wow, this thing that feels super niche and kinda useless is actually ubiquitous and super important.” It made me laugh later when we posted Sprig to Hacker News and someone told me I was wasting my life playing with “kid shit” like Raspberry Pis. I wonder if his washing machine has this bug.
Did you run into any limitations while working on Sprig? How did you overcome them?
Cedric: One example that I can think of is that the Sprig’s screen is 160x128, and the typical way to do software rasterization is to iterate through all of your sprites in the game and write their pixels into a buffer that’s big enough to hold all the pixels in your screen. But even with 16-bit color, the buffer for the screen ends up taking up like 40kb of RAM, which is entirely too much of the Sprigs’ 256kb total. So I employed a trick I learned from Inigo Quilez’s website when I was writing shaders for games, and rewrote the renderer such that it takes an X, Y for a pixel and indexes into the map and other relevant data structures and returns what color that pixel should be. Then, we didn’t need a 40kb buffer to store the pixels in because we could stream the pixels directly to the screen.
Which is your favorite game that's built using Sprig?
Leo: That’s like picking a favorite kid, haha. I really like the games that have simple mechanics but are just a blast to play. Sometimes when testing games I ended up spending an hour just playing levels that hooked me. Some games that felt that way for me were Pipes Puzzle and Penguin Slide.
Cedric: It was quite fun optimizing the C version of the engine that runs on the Pico so that it could run Omay’s Game of Life implementation without being unusably laggy. I usually statically allocate as much as I can in my C code because it’s simple and efficient, but I actually had to go back and dynamically allocate a bunch of the engine’s internal data structures just for that game so it could scale up to the number of tiles that his Game of Life implementation used and not crash.
Where do you see the project heading next?
Leo: Sprig is still just getting out there into the world. My hope is to see more games come in, more Sprigs go out, and more teenage developers hop into the project more deeply by helping with the repo. I think the web editor for Sprig will have the longest life of the project. The game engine itself is quite separable from the hardware and is easy to maintain. Hopefully it will help people make delightful little projects for years to come. Taking a step back I see Sprig as part of a larger project in developing a library of public good technology. More specifically technology to help people learn through creativity with computers.
Cedric: We’ll maintain Sprig to keep it operational for everybody, but as for what’s next … bear with me.
I think that if you know what you want to make, then you can find a game engine or library or OS/browser API that you can use to make that thing, if you’re determined enough. What people need is to know what to make. I think that is Sprig’s contribution; by being very limited, it gives you little suggestions, little hints about what you could do. Oh, I have tiles, oh I can push them around, hmm … and then the game ideas just sort of present themselves. Sokoban! Cellular Automata!
Because Sprig is so limited, because it’s not trying to be everything to everyone, it can actually be finished. Then Hack Club can keep trying new ways to help people figure out what they’re trying to make. That’s what’s next. That’s the best way to learn to code, you know, just trying to make something. Actually, if there’s not anything you’re trying to make, why even learn to code, right?
How do you balance your work on open-source and your school?
Cedric (age 19): I was never super worried about school. I barely graduated highschool. I was salaried working for Hack Club on this project, but even when I was in highschool, writing code was always more interesting to me, so I just did that. I’m not an edgelord; I feel like I’m supposed to say here that this wouldn’t work for everyone … but actually, I’m not going to. Follow y’alls’ dreams with reckless abandon, y’all. Don’t let nobody stop you.
Leo: I’m out of school and work full-time as an open-source developer at Hack Club. I also maintain a number of personal projects (mostly digital fabrication tools) which I develop with other researchers in the field. Some of them are used in courses at MIT and Harvard so I often have extra maintenance work when semesters start up but I welcome it because it means the tools are finding an audience.
What do you plan to do after graduating Hack Club?
Leo: I think this question is more relevant to our younger contributors. Hack Club is my full time job. In future projects I’d like to introduce young people to a broader set of technology. Right now when people think about tech they think of a small number of Silicon Valley and internet companies. There are lots of resources to learn web development because that’s where the jobs are. But becoming expressive with technology involves learning lots of other skills too.
Cedric: I started writing code because I wanted to make games. I got sidetracked along the way helping people make game engines and programming languages and things like that, and it was fun and I learned a lot, but the biggest thing I learned was … what I really want hasn’t changed. I still want to make games I can play with my little brother. So I’m moving to Mexico where I can live off of my savings for a good chunk of time and just sort of isolate myself and spend a lot of time doing this thing that really calls to me, make these games. Nothing else really matters to me right now, haha.
Want to join the conversation about one of the projects featured this week? Drop a comment, or see what others are saying!