Mosaic Puzzles in Zig / Sokol

I’ve implemented a simple version of ‘Mosaic’ puzzles in Zig / Sokol.

gameplay

Motivation: I’d heard a lot of good things about Andre Weissflog’s Sokol libraries, and wanted to check them out. For me, the best way to learn the basics of a library is to make something from scratch in it. And so, as an exercise / test case, I made a small puzzle game from scratch in Zig / Sokol.

Post-project thoughts: Sokol (and its Zig-bindings) lives up to the hype. While I’ve barely touched the surface of the library, for my use cases / programming style, I can see myself using it years into the future. While there’s a place in my heart for Raylib, I’ll be using Sokol over Raylib from now on.

People outside of the systems-language programming community don’t even know what a huge deal it is that, on my Linux machine, I can run zig build -Dtarget=x86_64-windows, copy the .exe to my PC and have the game just run!

AI Non-usage notice: At NO stage whatsover during the development of this project were any LLMs used. All of the code was either written by me or by Weissflog. (The project begun by adapting Weissflog’s triangle.zig file in sokol/examples; nearly all of the code in the Sokol libraries was authored by Weissflog.)

We have all seen embarrassing examples of half-assed “projects” made with LLMs posted to this forum. This needs to stop. Expecting other people to spend their time reading, let alone thinking about, output generated by LLMs is highly offensive.

12 Likes

Very nice, feels like reverse minesweeper! I don’t know if you’re aware, but @floooh (the author of sokol) is a very active member of this community

It would be cool to have a web version of this to try it out without having to download anything, as far as I’m aware sokol supports compiling for emscripten

Thanks! Indeed, I’m keen to check out what the Sokol desktop app to Sokol webpage process is like / involves, hopefully it’s simple (inasmuch as anything web-related is simple!)

I saw that Floooh’s Pacman implementation has an easily accessible WASM port, I plan to check that out next.

I also want to check out tracy, and now have a simple graphical program with which to profile. I might end up writing a blog or two about it.

1 Like

I am using this quote from now on. Thanks!

1 Like

Cool stuff :slight_smile:

PS: for web experiments I’d currently recommend the stable Zig version 0.15.2, there’s some hickup in the wasm32-emscripten target currently which breaks the sokol-zig web builds: Wasm32-emscripten builds fail linking because of pthread dependency - #3 by floooh

I have a gut feeling that the Zig nightly is currently entering one of its unstable moon phases again :wink:

2 Likes