Sign in

Mattias Gustavsson

@mattiasg.bsky.social
1.2K followers 730 following 340 posts

Hobby game dev, making retro style games: mattiasgustavsson.itch.io and public domain C libs: github.com/mattiasgustavsson I write about things at mattiasgustavsson.com Feel free to DM me about anything

PostsRepliesMedia
Mattias Gustavsson @mattiasg.bsky.social · 31/07/2026
Finally made a browser version of what is probably the best game I’ve made: mattiasgustavsson.itch.io/extrication
mattiasgustavsson.itch.io
Extrication by Mattias Gustavsson
A small point-and-click style adventure game.
074
Mattias Gustavsson @mattiasg.bsky.social · 31/07/2026
Check out Yarnspin, my free, open source, game engine for story games: mattiasgustavsson.itch.io/yarnspin
mattiasgustavsson.itch.io
Yarnspin by Mattias Gustavsson
The Story Telling Engine
0115
Mattias Gustavsson @mattiasg.bsky.social · 11/02/2026
Here's a pretty efficient quicksort implementation in macro form for C. It being a macro means the compare function can be inlined instead of being through a function pointer. Code is a horrible macro mess, but it works gist.github.com/mattiasgusta...
gist.github.com
Sort macro for C
Sort macro for C. GitHub Gist: instantly share code, notes, and snippets.
080
Mattias Gustavsson @mattiasg.bsky.social · 03/02/2026
Is there a good online community (discord or whatever) for disussing specifically C programming (and only C programming), without being centered around a specific codebase? And to be precise, hand coded C, not AI generated or vibe coded. Got any tips for such spaces?
475
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 22/01/2026
I wrote a bit about my plans for Audio capabilities, for my fantasy console "Pixie Game System". Would love to hear your thoughts on it: github.com/mattiasgusta...
github.com
Audio · mattiasgustavsson pixie_game_system · Discussion #3
So, I thought I'd try to lock down the audio capabilities of the console. This is my current thinking, not 100% locked down, but leaning pretty heavily towards it There are three separate "sound ch...
1102
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 07/01/2026
For the fantasy console I'm making, "Pixie Game System", I have a first complete spec for the CPU opset. You can read more about it here: github.com/mattiasgusta...
github.com
The CPU · mattiasgustavsson pixie_game_system · Discussion #2
I think I have mostly finished the specification for the opset of the CPU for this. The full documentation can be found here https://github.com/mattiasgustavsson/pixie_game_system/blob/main/docs/pg...
2182
Mattias Gustavsson @mattiasg.bsky.social · 22/01/2026
I wrote a bit about my plans for Audio capabilities, for my fantasy console "Pixie Game System". Would love to hear your thoughts on it: github.com/mattiasgusta...
github.com
Audio · mattiasgustavsson pixie_game_system · Discussion #3
So, I thought I'd try to lock down the audio capabilities of the console. This is my current thinking, not 100% locked down, but leaning pretty heavily towards it There are three separate "sound ch...
1102
Reposted by Mattias Gustavsson
The Bishop Of Hobb-ins @fishwithlasers.bsky.social · 10/01/2026
we’ve got somewhere to stay after the fucking place flooded again, just a room tho, I’ve just managed to pack the bare minimum and I’m skint beyond words. I am so sorry, this has all gone to shit. Can anyone help with emergency survival funds? www.paypal.com/paypalme/ret... ko-fi.com/robfearon
paypal.com
Pay Emma Fearon using PayPal.Me
Go to paypal.me/retroremakes and type in the amount. Since it’s PayPal, it's easy and secure. Don’t have a PayPal account? No worries.
1948
Mattias Gustavsson @mattiasg.bsky.social · 07/01/2026
For the fantasy console I'm making, "Pixie Game System", I have a first complete spec for the CPU opset. You can read more about it here: github.com/mattiasgusta...
github.com
The CPU · mattiasgustavsson pixie_game_system · Discussion #2
I think I have mostly finished the specification for the opset of the CPU for this. The full documentation can be found here https://github.com/mattiasgustavsson/pixie_game_system/blob/main/docs/pg...
2182
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 04/01/2026
I've created a repo for it on github, and I will use the "discussions" feature to talk about it: github.com/mattiasgusta... If you are interested in the project, or want to contribute ideas or even code, feel free to join the discussions :)
github.com
mattiasgustavsson pixie_game_system · Discussions
Explore the GitHub Discussions forum for mattiasgustavsson pixie_game_system. Discuss code, ask questions & collaborate with the developer community.
161
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 04/01/2026
Last year, I started prototyping a fantasy console, but didn't really get it off the ground the way I'd hoped. This year, I want to really make some headway, and move from prototyping to start working on it properly. I've named it "Pixie Game System"
"Pixie Game System" in white-on-black badge on top of rainbow lines
1182
Mattias Gustavsson @mattiasg.bsky.social · 04/01/2026
Last year, I started prototyping a fantasy console, but didn't really get it off the ground the way I'd hoped. This year, I want to really make some headway, and move from prototyping to start working on it properly. I've named it "Pixie Game System"
"Pixie Game System" in white-on-black badge on top of rainbow lines
1182
Mattias Gustavsson @mattiasg.bsky.social · 31/12/2025
This past year has, without a doubt, been the toughest year ever for both my wife and me. I do feel hopeful about the year to come, and we do believe the worst is behind us. I hope all of you will get a great 2026.
0150
Mattias Gustavsson @mattiasg.bsky.social · 16/12/2025
implementing a custom codegen backend for TCC is tricky...
040
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
I am excited to share this new single-header C library I have been working on for a while now: vecmath.h, a comprehensive vector/matrix math library for graphics/games/3d. It allows you to write vector math code in C that looks like this:
410923
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
I tried my hand at making a video codec. I didn't know the first thing about video codecs when I started, so was quite fun to learn about the concepts and how to implement them. I packaged the result in a stb-style, single-file header-only lib, < 2500 loc with no dependencies.
58421
Mattias Gustavsson @mattiasg.bsky.social · 01/11/2025
what are the worst things about the modern day internet?
330
Reposted by Mattias Gustavsson
BΞRNH∆RD @schelling.bsky.social · 11/10/2025
Got back into using the video editing features of Blender to make a trailer for some of my open source shenanigans - Announcing: DOSBox Pure Unleashed 🥳 www.youtube.com/watch?v=t4q8...
youtube.com
DOSBox Pure Unleashed
YouTube video by Psyraven
1186
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
The single header lib also includes source code for an encoder utility and a playback app (both which makes use of other single header libs), behind conditional compile switches (ifdefs). Instructions for how to build them can be found at the top of the file.
021
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
The code is public domain, and available here github.com/mattiasgusta... For most uses, you are probably better off using a real codec. But for something small, simple, self-contained with no dependencies, this might fit the bill.
github.com
181
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
The videos in the examples are compressed with my "default" setting, which makes them quite small, with ok-ish quality. On "max" they are more like dvd in size/quality. I focused on avoiding temporal aliasing, and I think i pulled that off quite well.
111
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
All in all, it seems like my quality/compression is maybe around dvd quality (?), so not in the same league as modern codecs (but attempting that would start to infringe on patents, so I don't particularly want to go down that route).
161
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
Here are two sample video snippets: mattiasgustavsson.com/wasm/fmv.html mattiasgustavsson.com/wasm/fmvdl.h... (both are displayed with my CRT filter, because that's how I am most likely to be using this myself, but it can be toggled with F9).
131
Mattias Gustavsson @mattiasg.bsky.social · 31/08/2025
I tried my hand at making a video codec. I didn't know the first thing about video codecs when I started, so was quite fun to learn about the concepts and how to implement them. I packaged the result in a stb-style, single-file header-only lib, < 2500 loc with no dependencies.
58421
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 01/08/2025
Round a uint32 up to the nearest power-of-two value: gist.github.com/mattiasgusta...
gist.github.com
pow2_ceil.h
GitHub Gist: instantly share code, notes, and snippets.
191
Mattias Gustavsson @mattiasg.bsky.social · 01/08/2025
Round a uint32 up to the nearest power-of-two value: gist.github.com/mattiasgusta...
gist.github.com
pow2_ceil.h
GitHub Gist: instantly share code, notes, and snippets.
191
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
If you're looking for a vector math lib for C (or C++) check it out github.com/mattiasgusta... If you do take a look, please let me know what you think about it - getting feedback is a big part of the reward releasing libraries like this, and I spent a lot of time and effort on it
github.com
0111
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
It's been tested on windows, mac, linux and web-assembly, using msvc, clang, gcc and tcc (tiny c compiler).
161
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
It is not trying to be the most optimized library, not using any SIMD intrinsics or assembly code, just straightforward, fully portable, simple implementations of a large number of math functions.
171
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
It has a large set of functions, as it attempts to implement most of what you get in shader languages like HLSL and GLSL, and also most of the utility functions from libraries like D3DX in DirectX.
161
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
Even though it is primarily designed as a C library, I have also tried to make it fairly nice to use from C++, conditionally adding operator overloads and constructors, but it is not trying to be idiomatic "modern C++" in any way.
161
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
Here is the library: github.com/mattiasgusta... Now, you get the best ergonomics if you use it with clang compiler in C11 or later, as it makes (optional) use of C11 _Generics and clang vector type extension, but it doesn't require either to work.
github.com
1113
Mattias Gustavsson @mattiasg.bsky.social · 21/07/2025
I am excited to share this new single-header C library I have been working on for a while now: vecmath.h, a comprehensive vector/matrix math library for graphics/games/3d. It allows you to write vector math code in C that looks like this:
410923
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
And I wrote about the inspiration for the Yarnspin engine here: mattiasgustavsson.com/the-adventur...
mattiasgustavsson.com
The adventure games that inspired Yarnspin
Yarnspin is my story-telling game engine, designed to be very easy to use, and it can run as a local build or in your browser.  It is completely free (public domain) and you can find it here: Yarns...
131
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
The engine also includes an editor for adjusting images, implemented using a custom basic imgui system. I've written a bit about it here: mattiasgustavsson.itch.io/yarnspin/dev...
152
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
This is what my dev environment looks like when I'm making a game in Yarnspin. I use notepad++, with a custom color scheme, with the "folder as workspace" to get a tree view for both scripts and image files. And with keyboard shortcuts for run/compile and go to error.
292
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
The custom script language for Yarnspin is made to be simple, and without a lot of notation or complex syntax. Mostly it's just specifying images and text to display, listing options to choose from and where they lead to
181
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
It was made in about a week, using my Yarnspin game engine, which is written in plain C using only stb-style single header libraries github.com/mattiasgusta...
github.com
GitHub - mattiasgustavsson/yarnspin: A simple story-telling game engine
A simple story-telling game engine. Contribute to mattiasgustavsson/yarnspin development by creating an account on GitHub.
161
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
You can play it for free here: mattiasgustavsson.itch.io/neon-lies I think it's one of the best games I've ever made 😀
mattiasgustavsson.itch.io
Neon Lies by Mattias Gustavsson
A Cyberpunk Adventure
1135
Reposted by Mattias Gustavsson
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
I'd like to talk a bit about this a game I made, all done in plain C, using only single header libraries, and it runs in the browser too. It's called "Neon Lies" and it's a retro-futuristic cyberpunk story in a William Gibson style setting.
46819
Mattias Gustavsson @mattiasg.bsky.social · 09/07/2025
Does the idea of making a game in plain C, without using an off-the-shelf engine, appeal to you, but you don't really know how to go about it? Here's "Repair/Rearm", a game I made using only a handful of single-header libraries, but without an engine,it's just the game code doing only what's needed
2345
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
I'd like to talk a bit about this a game I made, all done in plain C, using only single header libraries, and it runs in the browser too. It's called "Neon Lies" and it's a retro-futuristic cyberpunk story in a William Gibson style setting.
46819
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
"dos-like" is a mini-engine/framework I made a couple of years ago. It makes it easy to make games and other things with a 90s MS-DOS look and feel, but using a modern C compiler and running on Windows, Linux, macOS and in the browser using WebAssembler.
46818
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
Here is one of the first single-header libs I wrote, for reading and writing .ini files github.com/mattiasgusta... I like .ini files because they are so simple and easy to understand and edit even for non-technical people. Sure, they are not as capable as, say, json/xml. That's ok.
github.com
230
Mattias Gustavsson @mattiasg.bsky.social · 29/06/2025
Here is another small single-header library that I use all the time: frametimer.h In the basic case, it just measures the delta time between frames, using high precision timers on all platforms. But, it can also lock to a specific fps, and uses very high precision timers to wait
250
Mattias Gustavsson @mattiasg.bsky.social · 04/06/2025
Updated my app.h C library to support standard gamepads, for both windows, osx/linux and wasm. There's a web build here for trying it: mattiasgustavsson.com/wasm/gamepad... Library can be found here: github.com/mattiasgusta... I also updated the app.h template project: github.com/mattiasgusta...
191
Mattias Gustavsson @mattiasg.bsky.social · 03/06/2025
My app.h library is sorely missing gamepad support. But not for long 🙂
050
Mattias Gustavsson @mattiasg.bsky.social · 10/04/2025
Know what’s great? Good old .ini files. Very easy to understand and edit, even for non-programmers. Here’s my single-header C library for reading and writing .ini files. One of the first single header c libs I wrote, and I still use it all the time 🙂 github.com/mattiasgusta...
github.com
1162