Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Almost Done Upgrading to SDL3

Last time, I reported that I was still working on migrating my code to SDL3 for a Major Update(tm) for my strategic leaf-raking business simulation game, Toytles: Leaf Raking.

I continued the work this past week.

Sprint 2025-MJ_4: Preproduction

In progress:

  • Update SDL2 to SDL3

At some point, I finally fixed the last compile error, and I was able to run the game, and I was surprised at how well it Just Worked(tm).

Well, I found an issue with the mouse cursor not being where I expect it to be if I change the size of the window. I’ll figure this issue out later, but I suspect it has to do with the game being at a “logical” set of dimensions but scaling the rendering without scaling the mouse cursor’s position.

And I also don’t have text and audio.

Toytles: Leaf Raking - running but without text

Toytles: Leaf Raking - running but without text

I am using the library NFont, and it hasn’t been updated in years, which means it doesn’t have an SDL3 update yet.

So I commented the use of the library out of my code, which explains why there is no text rendering to the screen.

And the audio is missing because SDL_mixer is so different from before that I have to figure out how to change my code to use it.

Within a day, though, I got text back. Originally I thought I would just remove NFont and try to use SDL_ttf directly, but instead I did the work to migrate NFont to SDL3 myself.

Toytles: Leaf Raking with text again

I even submitted a pull request for my changes to NFont in case the library does get updated one day.

Which just leaves SDL_mixer updates. So far I am initializing it with MIX_Init() and creating a Mixer object, but I am also no longer initializing it the way I did before with a frequency, number of channels, and chunk size.

I know I need to load sound effects and music into SDL_Audio objects, and I know that to play them that they should be set to Tracks.

What was nice about SDL_mixer v2 was that if I wanted to play on an open channel and not care about the particular channel I played a sound on, I could just use a channel ID of -1. It is possible to play and SDL_Audio file once, and it will be assigned to an internal track, but it doesn’t let me set the audio to loop or do any other effects I might want, so the fire-and-forget option isn’t ideal.

So I’m trying to figure out if there is a mechanism to do something similar with SDL_mixer v3, or if there is a better approach to playing sounds on tracks.

But I expect I’ll have sound effects implemented soon, and then I just have to fix a few issues like that mouse cursor issue I mentioned above, and then I’ll have Toytles: Leaf Raking running with SDL3.

And then the real update work can start.

Thanks for reading, and stay curious!

Want to learn about future Freshly Squeezed games I am creating? Sign up for the GBGames Curiosities newsletter, and download the full color Player’s Guides to my existing and future games for free!