r/raylib • • 15h ago

Moiré Fractal with C, Raylib and GLSL

25 Upvotes

I created a simple moiré fractal using C, raylib and GLSL shaders.

The idea is quite simple: start with two nearby centers and generate concentric circles around each one, gradually increasing their radius.

Then, using the radius as input to a sin function, I generate alternating light and dark values. By applying this to the colors, the two circle patterns interact and produce the characteristic moiré effect.

Complete coding session:

https://youtu.be/7MmUcDiOJDc

Source code:

https://github.com/FractalCodeRicardo/hangover-programming/tree/main/moire-shaders


r/raylib • • 19h ago

Zombie game made with raylib and the programming language C

Thumbnail
gallery
15 Upvotes

**Disclaimer: The project is vibecoded*

The game has 40 000+ lines of code, everything is procedullary generated. Using only 200mb of ram and vram. It is developed on linux and i plan to port it to windows, mac and mobile. A prototype windows port revealed that the full game (folder including exe) only take up 2mb, which baffles me.

The game has it's own level/model/zombie editor, local coop.

I will not talk around the bush, the game is AI coded. It is a kind of passion project of mine, exploring the possibilities of AI, my creativity and how well one can optimize a game.

My favourite part is the gore and gibs system, reminds me of the pipebomb/zombie horde explosion of l4d2.

All screenshots got taken on an lenovo t14s 16gb of ram, ryzen 5 5650, vega 7 igpu, debian 13 gnome.

Game name got redacted because it is not final, yet.

I'm curious for your feedback!

Greetings from germany.


r/raylib • • 17h ago

Aspect - A library based on raylib for creating energy-efficient GUIs in Zig.

9 Upvotes

I got bored, so I decided to write a small library on Zig for creating simple and energy-efficient graphical apps in retained-mode. I used raylib as a base (it’s sufficient for now, and later I might try rewriting it for Vulkan).

Aspect LineChart component demo

You can read more in repository.

At the time of this post, the library is very crude and not suitable for large projects. I only started writing in Zig in September 2026, so the code quality may be poor. In simple terms, library is in early stage of development.

Main goals

I don’t plan to make this anything serious, but I do adhere to a few points:

  • Energy-efficient: A graphics app should use resources only when absolutely necessary, and use them as little as possible. This is why I chose retained-mode, as it significantly reduces CPU load without slowing down the app.
  • Flexibility: The library should allow the developer to customize it as they wish.
  • Lightweight: A minimal graphical app in Aspect can weight ~68KiB.

Built-in components

The library provides a small set of built-in components, some of the most basic ones: Button, TextField (which still doesn’t function as expected, lol), Selection, ColumnChart, Toggler, and so on.

Interesting

This library divides the entire app into several parts (model and functions: reveal, update, build, reflect), allowing for systematization of all app events and flexible interface control.

Supported Zig versions

The library currently relies on Zig 0.17.0.

Supported OS

The library has been successfully tested on Debian Linux and Windows 11.

What’s next In the near future

I’ll try to implement relative positioning, which will reduce the need to worry about setting absolute positions for each component. Naturally, over time I will add/improve the built-in components.

This post has been translated into English using Google Translate. Text was originally in Russian.


r/raylib • • 6h ago

Desktop weather station in Raylib/C

Post image
1 Upvotes

r/raylib • • 1d ago

Dynamic Sky & Day - Night Cycle | raylib-Based Engine

Thumbnail
youtu.be
9 Upvotes

r/raylib • • 2d ago

Using boids as a puzzle game mechanic in my C++/raylib game, Vilinski

14 Upvotes

I originally made Vilinski for a game jam, but I've since expanded it with new types of fairies and blocks.

All fairy movement is based on the boids algorithm. This level, Eros and Thanatos, introduces the combination of green and crimson fairies, which can restore and destroy certain blocks.


r/raylib • • 3d ago

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

39 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).


r/raylib • • 3d ago

The whole story.

31 Upvotes

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


r/raylib • • 3d ago

rGuiIcons, my raygui icons editor, new update with some more features

0 Upvotes

r/raylib • • 4d ago

Coding Dragon Curve fractal using C & Raylib

Thumbnail
youtube.com
4 Upvotes

In this video, I code a Dragon Curve fractal using C and Raylib.

The approach is quite simple:

I take the last point as a pivot, then rotate the remaining points 90 degrees around it. Finally, I connect the new points to create the next iteration of the fractal.


r/raylib • • 4d ago

[Pog] haven't posted in a while here, showing off progress of combat in the game, raylib-cs 8.0

40 Upvotes

Soldiers fight in impulses, try to rest up when tired, skill and weight allows pushing. Soldier might be knocked back and get up.

Still working on impacts and feel.


r/raylib • • 4d ago

The Planewalker's Guild: you can now take torches off the wall and throw them. Including into oil barrels.

6 Upvotes

r/raylib • • 4d ago

Help Decoupling Gameplay From Screen Size

8 Upvotes

I am working on a clone of the arcade game asteroids to learn C and Raylib, but I ran into a problem. If the game is played in different screen sizes, the player can see more space and thus, asteroids might seem like they are spawning too close to them.

How would I go about making the gameplay not/less dependant on the screen size and resolution?


r/raylib • • 4d ago

getting VRAM usage

2 Upvotes

is there a way to get the VRAM usage by my program?


r/raylib • • 5d ago

I just released my forth full game made with raylib on Steam

167 Upvotes

You can check it out on Steam here if you are interested: https://store.steampowered.com/app/4790660/Moose_Builders/

This is my first game that has multiplayer. That has been a really fun experience building.

Feel free to ask any questions about the development of the game.


r/raylib • • 5d ago

autobahn (Raylib)

Post image
31 Upvotes

r/raylib • • 5d ago

Another question about artificial intelligence.

7 Upvotes

I just watched a video about how "times are changing," and I’d like to hear your take:

In the past, using AI felt like hiring interns people who barely understood the subject and that was the quality of the result you got. Today, AI seems to have improved significantly. Perhaps tomorrow, you might want your own version of GTA; you blink, and TADA it’s there, perfectly optimized and tailored to your exact specifications. In a few months, people might actually prefer AI-generated products, while looking down on anything crafted by hand.

So, what do you a C++, Rust, Zig, or C# developer who has built your own game engine (or the infrastructure to run your game) think about this? Do you plan to keep working without AI, use it solely as a learning tool, or lean into it to have AI do all the job?

Edit 0:

Sure, creating a video game as long as it’s a hobby you enjoy and find fun is a good thing.

Do you think the transition from ASM to C (or another programming language) is similar to what we might see next? What will a developer look like in 10 years? Will they be using Markdown editors? Will artificial intelligence truly be treated as a tool rather than a replacement? Or will we simply disappear from the field and end up becoming fishermen, chefs, or something else entirely?

Edit 1:
I’ve just read several news items about AI and watched a number of videos featuring AI developers and workers, and I feel much more at ease. It’s clear to me that AI isn’t a profitable business there are heavy losses, it consumes a massive amount of electricity, and there’s a constant need to upgrade equipment and GPUs.


r/raylib • • 5d ago

New GUI and content, as well as updated gameplay for my autobattler.

28 Upvotes

r/raylib • • 6d ago

I made a shooting game about bouncing lasers.

55 Upvotes

You can play it in your browser: https://aren227.itch.io/beyond-the-wall

Also Github repo available: https://github.com/aren227/beyond-the-wall-client (C++)

Thank you!


r/raylib • • 7d ago

My First Raylib Game - Snake

Post image
72 Upvotes

r/raylib • • 6d ago

Drawing textures randomly works and doesn't when trying to render a linked-list of elements

4 Upvotes

I'm trying to make a toy image editor using Raylib and C++ and ran into this problem.

When I try to render the layers of my project, there's a chance that they just wouldn't render at all, and yes the textures are loaded in.

I have a Canvas class that holds a reference to the first element of the linked-list where the layers of the project are. This class also has a method to add a new element to the list.

Canvas::Canvas(int width, int height){
    rt = LoadRenderTexture(width, height);
    rec =  {0.0f, 0.0f, (float)width, (float)(-height)};
} 

void Canvas::AddLayer(LayerObject* newLayer){
    if (newLayer == nullptr) {
        std::cerr << "[WARNING] Trying to add a null layer\n";
        return;
    }

    if (layers == nullptr) {
        layers = newLayer;
        return;
    }
    
    LayerObject* it = layers;
    while (it->next != nullptr){
        it = it->next;
    }
    it->next = newLayer;
    it->next->prev = it;

}

void Canvas::DrawLayers(){
    BeginTextureMode(rt);
        ClearBackground(WHITE);
        LayerObject* it = layers;
        while (it != nullptr){
            it->Draw();
            it = it->next;
        }
    EndTextureMode();
}

// ...

I'm suspecting that the Add() method is the culprit, but when I use the Add method in the constructor for debugging purposes, it works completely fine and renders the layer 100% of the time.

I tried checking to see if the DrawLayers() method was the culprit but printing how many layers the loop rendered turned out fine.

Here are some important methods of my RenderLayer

RasterLayer::RasterLayer(Vector2 position, const char* path){
    texture = LoadTexture(path);
    position = position;
    size = (Vector2){(float)texture.width, (float)texture.height};
}

void RasterLayer::Draw(){
    // TODO: add rotation
    //       add cropping
    //       use DrawTexturePro
    DrawTexture(texture, position.x, position.y, WHITE);
}

Any help would be appreciated. Thanks!


r/raylib • • 6d ago

how do i load a texture unto a wall in c# raylib?

0 Upvotes

i have insane trouble with this and i cant seam to do it, can anyone share the code or a tutorial on how to do this? would be appreciated, also i use the latest version of raylib.


r/raylib • • 7d ago

I made a lightweight shader helper for raylib 3d - RSF3D

Post image
17 Upvotes

Hi everyone!

  • I have been working on RSF3D (Raylib Shader Forward 3D), a lightweight, easy-to-use that helps to add lights, fog, and skybox.
  • Features:

    • Blinn-Phong and Gouraud.
    • Point, directional, spot lights.
    • Linear, exponential and exponential squared fogs.
    • Skybox.
  • My goal is to provide a simple helper for games, educations, simulators,... without bringing a complicated rendering.
  • GitHub: RSF3D - Nam-python

I'd love to hear your feedback, suggestions and ideas for improvements!

Thanks!


r/raylib • • 8d ago

Classic 2048 game variant I made in C and Raylib.

Thumbnail
gallery
27 Upvotes

Move tiles with the arrow keys. Matching tiles can merge, and a merge can trigger further merges in the same move: for example, 2 2 4 8 becomes _ _ _ 16 directly in a single right click rather than _ 4 4 8.

Other tiles can block movement and merging. For example, 2 4 2 _ becomes 2 4 _ 2 instead of _ 2 4 2 as the end 2 blocks preceding 2 4 from sliding to the right, while 4 8 _ _ becomes 4 _ _ 8 instead of _ _ 4 8 as 8 blocks 4 from sliding to the right.

check out the code on github.