engledow.me

TBC

game dev

In tidying up my corner of the interwebs, I put together a list of projects that I've worked on over the years. One of those is Falsoyd. I commented "I don't know if it even compiles on modern systems". Of course, that stuck in my head and inevitably I had to try...

Hoooo boy.

It has been a long time since I wrote anything in my once-favourite language, C (or C++). A GitHub search suggests it's been around 10 years. Fortunately, I had no intentions of really fixing any coding problems - just getting Falsoyd to run by brute force :D

git clone git@github.com:stilvoid/falysoyd
cd falsoyd
make
...
sdl-config: command not found
fatal error: 'SDL_mixer.h' file not found

Oh yeah, this was all SDL. Oh well, I'm sure that's still around!

brew install sdl
Warning: Formula sdl was renamed to sdl12-compat.

Ok well, it turns out SDL1.2 is looong deprecated but some kind person has written a compatibility library for SDL2 so that should all work quite nicely...

make
fatal error: 'SDL_mixer.h' file not found
brew install sdl_mixer
Error: sdl_mixer has been disabled because it is deprecated upstream! It was disabled on 2024-02-07.

If only I had tried this 6 months ago ;) After a quick look, SDL2_mixer seems to have the same API as in SDL1.2 so I'll nab the header file from there, include it in my CFLAGS, and link to SDL2_mixer in addition to the SDL1.2 (compat) library. What could possibly go wrong?!

make
...
src/map.h:35:6: error: cast from pointer to smaller type 'int' loses information
        p.x=(int)x;
            ^~~~~~
src/map.h:36:6: error: cast from pointer to smaller type 'int' loses information
        p.y=(int)y;

Ooh, an actual bug. Forgot to dereference some pointers. I wonder how that ever worked before. Well, it's an easy fix!

make
...
g++  src/world.o src/audio.o src/score.o src/bonus.o src/shot.o src/sprite.o src/ship.o src/alien.o src/main.o -o src/falsoyd `sdl-config --libs` -lSDL2_mixer

It compiled! That was unexpectedly easy. I was anticipating some nastiness with mixing SDL1.2 and SDL2_mixer.

(I glossed over a lot of compiler warnings in that "..." btw. Don't ignore your compiler warnings, folks!)

My fingers began to tremble (they didn't) as I nervously (I wasn't) typed ./src/falsoyd...

A screenshot of Falsoyd

It runs! I played it for a little while. Remembered how terrible it was and committed a branch with my changes. That'll do for now. Itch scratched.

Now I'm clearly going to have to make Falsoyd 2 in Löve, Pico-8, or Picotron ;)