Aimlessly Going Forward

blog by Tomas Sedovic

Dose Response 0.5.2

A few releases of Dose Response came out that I hadn't blogged about. Dose Response is an open-world roguelike where you play an addict.

I have spent way too much time on this game (especially considering how simple it actually is) and so the last couple of months were focused on polish and getting it through the finish line.

Despite having an absolute ton of things that could be added, I'm calling the gameplay more or less finished. The only thing I plan to add (other than game balance) is a better visual representation of the endgame section.

But all of my work now is focused on making the game more accessible to the players. That means writing help screens, main menu, save/load functionality (the game is so small it doesn't really need it, but I want to implement it anyway), potentially mouse support (no promises though!), etc.

This included something I've been avoiding for a really long time -- font handling. Until now, Dose Response always rendered all text aligned to the square grid: one letter per square.

This works great for the game map:

Dose Response game map

But not so much for actual text:

Dose Response grid-aligned help page

I could have tried something like finding a half-width font for the text parts and be done with that, but I wanted to implement all this properly at least once to understand what goes into font rendering.

It was quite possibly the hardest thing I did. Dose Response uses OpenGL directly, so there was already a huge increase in complexity when I switched from a nice roguelike library to that. But font rendering is another level on top.

You have to implement your own word-wrapping, calculating the text / paragraph width and height, alignment (left/right/center), etc. It was crazy.

But here's the final result:

Dose Response readable help page

Much more readable. And since I wanted to do it properly, here's a test rendering of a variable-width font (the one above is fixed width):

Dose Response variable-width text

This is just to verify the code works, but yeah.

You can download Dose Response for Windows, Mac and Linux from the project page or play it directly in the browser.

Tomas Sedovic on 30 January, 2018