r/raylib • • 19h ago

The whole story.

24 Upvotes

Rain, snow, shine, or disappearing in a cloud of powder – the show must go on.


r/raylib • • 15h ago

I published my Raylib + C# game on Steam - Hack 42: Typing Incremental

21 Upvotes

Hi everyone, I've been working on this little game in C# and Raylib for about 9 months and finally pushed the release button on Steam last week.

It's a mixture of an incremental game and a typing game where you hack computers to fight the bad guys. It's quite short but still quite fun (1,5 to 3 hours, depending on your typing speed). If you are interested: https://store.steampowered.com/app/4622190/Hack_42_Typing_Incremental/

Kotaku featured it as the indie of the week: https://kotaku.com/hack-42-incremental-typing-game-review-indie-of-the-week-steam-pc-2000758839

Some thoughts on using Raylib and C# for this:

  • For the type of game I've been working on Raylib was a really good fit. It's really easy to get started, because the API is so easy to pick up. And it also covered all the needs of my game that go a bit beyond the basic usage:

    • off-screen rendering
    • custom shaders for bloom, CRT, etc.
    • text rendering + glyph info for animated text
  • C# had no Raylib bindings that supported compiling to web (at least at the time I've looked, maybe things have changed in the meantime). So I've build my own, turned out to be pretty straight forward.
  • C# has hot code reload and if you structure your code to be reloadable the Raylib + C# combo allows for really nice fast iteration.

Some general thoughts on programming small games without game engines:

  • Keep things simple, depending on your game you probably don't need an ECS, or any entity system at all. I've just used scene structs that hold the game state and have corresponding update/render functions that I dispatch to from the game loop via a switch statement. That made things easy to understand and debug. I did not miss a generalized entity concept at any time.
  • Invest a bit of time into making UI programming comfortable if your game has a lot of it. I've build my own immediate mode GUI with an automatic layout system (basically my own crappy version of https://github.com/nicbarker/clay). It took a lot of time initially but made programming UI way more bearable!
  • Have a set of animation helpers to easily add juice to your game:

  • On a similar note: having an easy way to spawn particles is pretty handy too. Most of the particles in my game are just spawned by a simple Spawn(position, velocity, scale, color, lifetime, delay, rotation, sprite) function.
  • If it fits the style of your game invest time into making reusable and composable text animations (mine are heavily inspired by Balatro), it brings a bit movement into your static UI screens.
  • Pack all your sprites into an atlas and have an easy way to draw them. For smaller games like mine a single atlas is enough and you never have to worry about texture switching when drawing a lot of sprites. I'm packing them at runtime using a simple and fast algorithm (just a naive row packer) so that I don't need to have a build step.

Also one thing to watch out for and that caught me by surprise in the last moment: Microsoft decided to block my executable shortly before the release with its "Smart App Control". There is seemingly no way to know why exactly a given executable is getting blocked. I've had to shell out about 130€ for a certificate to sign my executables (a very painful process btw).