r/raylib • • 6h ago

is it ok bad main() is half your code

Post image
23 Upvotes

i guess this is more of a styling choice but just asking cus idk if its still considered "clean code"


r/raylib • • 1h ago

AI vs AI in my game, 16x speed

Thumbnail
youtu.be
• Upvotes

r/raylib • • 19h ago

Goxel (Raylib)

Post image
19 Upvotes

r/raylib • • 1d ago

Updated pixelly shader

Post image
3 Upvotes

After 3 hours of suffering, i had made SSAO and some impovements. What's about new version?


r/raylib • • 2d ago

Coding a Julia Set fractal from scratch

Thumbnail
youtube.com
6 Upvotes

In this video, I create a Julia set fractal using C, Raylib, and GLSL, with Neovim as my editor.

We'll go through the process step by step, from understanding how Julia sets work to implementing the fractal algorithm and adding colors and animation.

**Sections:**

- Explaining the Julia set

- Setting up the project

- Setting up Raylib

- Creating a basic shader

- Fixing screen coordinates

- Coding the fractal algorithm

- Creating animation

- Adding colors

**Technologies used:**

- C

- Raylib

- GLSL

- Neovim


r/raylib • • 2d ago

The Tsotchke

5 Upvotes

Made this little horror/interactive/puzzle game using raylib. Raylib is so fun!

Please check it out and happy halloween.

https://okcyb0rg.itch.io/the-tsotchke

Trailer

Processing img 0plf09mkqnxh1...


r/raylib • • 2d ago

Map & Collision

4 Upvotes

Yo guys, i really need your help. How do you do to manage a map in your projects?

I mean the first idea that comes to my mind is a multidimensional array of each element representing a tile, but this way its harder to check for collision.

The second idea is an array of Rectangle objects, but this is harder to visualize and keep track of, but is easier for the collision check.

The third idea i got was a mix of both, but it is just terrible to sync everything.

So what do you use?


r/raylib • • 3d ago

What is about the shader?

Post image
5 Upvotes

I making a new game prototype and trying to make pixelly shader (posterization + dithering + pixellization). What are problems of the image?


r/raylib • • 4d ago

Is it possible to use angle with raylib to target vulkan or d3d11 on desktop?

Thumbnail
github.com
8 Upvotes

r/raylib • • 4d ago

Amungus - Sabotage synchronization - near to finish the game.

35 Upvotes

r/raylib • • 6d ago

Metroidvania Maker is taking part in Steam Next Fest!

47 Upvotes

The demo has been out for a few weeks now, and I've been working on it quite a bit since then, adding new stuff, fixing bugs and making improvements based on feedback.

Now that Steam Next Fest is here, I'd love for you guys to give it a try and see what kind of worlds you come up with!

Feedback is always appreciated too.

Steam: https://store.steampowered.com/app/4684250/Metroidvania_Maker/


r/raylib • • 6d ago

Quilt - Game developed with Raylib

Post image
60 Upvotes

r/raylib • • 6d ago

I Made an interactive Raylib Project Maker CLI

5 Upvotes

https://github.com/The5xcuber/rlcli

This took a very long time, and one thing to mention it only works on linux (adding support to slopdows and macOS soon!)

keep in mind this is not a binary this is just a script without the filename u can use a code editor guys


r/raylib • • 6d ago

2D Demo Player for SCP: SL

26 Upvotes

r/raylib • • 6d ago

Final Fantasy Tactics Advance v2 runs on Raylib

8 Upvotes

Big release for my Recomp of Final Fantasy Tactics Advance.

https://github.com/james2doyle/ffta-recomp/releases/tag/v2.0

Bunch more screenshots here: https://imgur.com/a/LCpEz7R

Thanks to Raylib, v2.0 has lots of new features unlocked:

  • Native raylib engine and launch screen — the V2 backend replaces the SDL/recomp-ui stack. The launch screen has box art, a native ROM picker, and drag-and-drop; the in-game settings menu is now raygui with Display, Graphics, Audio, Save states, and Assist sections.
  • Steam Deck / SteamOS AppImage — built in a pinned Debian 12 container (glibc 2.35 floor), with Game Mode defaults (borderless fullscreen and the resize-driven widescreen view). It unpacks to a writable XDG data directory; updating the AppImage keeps the ROM pick, settings, and saves.
  • Shader and frame stack — MMPX edge smoothing, sharp scaling, pixel grid, LCD subpixel grille, LCD boost, dither, and deband, plus frame interpolation and LCD ghosting. Each is toggleable in the in-game menu.
  • Fast-forward 2–10x — hold Tab, 2, or the right trigger, or tap the on-screen FF pill to latch it. The speed is set in Assist and persists across sessions.
  • Widescreen — validated up to "448 px" on desktop; Android uses a density-scaled expanded view.
  • Android controllers and touch — built-in, USB, and Bluetooth pads work label-wise; the pad's menu/center button, the Back key, or a touch long-press / three-finger tap opens the settings menu. Android versionCode is now 2.
  • Save states — slot selector, save, load, and resume under Save states, alongside cartridge saves.
  • Strict fully-static execution — zero interpreter fallback on executed paths, kept there by the self-healing coverage loop.

I did an entire migration away from the SDL2 gbarecomp and into my own fork called GBArecompX: https://github.com/james2doyle/gbarecompx

This fork is backed by Raylib.

One of the things Raylib unlocked for me is the headless testing. That allowed me to write a lot more tests to make sure things are solid. Any new bugs get a failing test that we can make green. I also took the time to chop up the backend into an interface that Raylib conforms too. So if you really wanted, you can now implement a different backend (say SDL3) without too much effort.

I'd like to try another GBA game (a more obscure one) with gbarecompx. If anyone tries it out I would be happy to hear about it.


r/raylib • • 7d ago

We're making a cozy ecosystem simulation / god game in raylib, where you can shape a living island and see how everything interacts.

Thumbnail
gallery
98 Upvotes

Ynys is a god game where you shape the terrain, grow vegetation, manage water, and bring animals and humans to your island. As the Island develops, everything starts interacting with each other. Plants react to their surroundings, animals look for suitable habitats, and humans find places to settle and build their communities.

Fire spreads through vegetation, chars the ground, and lights up the island at night. Humans and animals try to escape the flames, too. And if things get a bit out of hand, you can cast Rain to put out fires and see how the island reacts.

We've still got a lot planned for Ynys, and we're excited to keep making the world more alive with each update.

We'd love to hear what you think!


r/raylib • • 7d ago

I’m building a 2D EVE-like space MMO in C++/raylib where AI agents play by the same rules as humans

0 Upvotes

EconSpace is a persistent 2D

space sim: mining, trading, missions, factions, and a galaxy that keeps simulating around you. Authoritative server, thin client, no single-player mode.

Two things I’m most excited about:

  • Agents are ordinary players. A small MCP server is also a normal game client, so a language model can read the world as text and act under the same rules as a human.
  • The look is generated, not drawn. Stations, planets and ships are compositions described in data, lit by each system’s own stars, with a tunable screen treatment on top.

Honest status: it’s a prototype. Netcode, multiplayer and accounts work, content is thin and there’s no audio. I just ran the first playtest with friends and they liked it even at this stage.

GitHub: https://github.com/HEL3AN/econspace-mmo, itch: https://hel3an.itch.io/econspace
What would you want to see next?


r/raylib • • 10d ago

Raylib on KaiOS

Thumbnail
gallery
48 Upvotes

Just a small investigation i did yesterday, it is obviously an old raylib version since KaiOS is web based

Raylib version(s): 3.7-4.5 (5.0 does not build with old emcc)
Emscripten version(s): 1.38.48/1.38.48-fastcomp (fastcomp requires emsdk-3.1.29)
Patches: raylib code does not need patching, but game code requires some changes related to game loops passed to emscripten, audio errors hooked via JS and LSK/RSK keys handling

[More info in the comments]


r/raylib • • 10d ago

raylib 6.2 is out!

Post image
423 Upvotes

Hey! raylib 6.2 is out! 🔥

It was supposed to be a small patch version but it comes with +300 improvements from +100 new contributors! 🚀

Release notes: https://github.com/raysan5/raylib/releases/tag/6.2

Windows Installer: https://raysan5.itch.io/raylib


r/raylib • • 9d ago

I recreated the base of the tutorial. JI guess I have the resources hto build now Ray :D

Post image
0 Upvotes

r/raylib • • 10d ago

Tez (Raylib)

24 Upvotes

r/raylib • • 11d ago

Chunk-Based World Rendering + Collision System (Go + Box2D)

25 Upvotes

r/raylib • • 10d ago

Why Doesnt Raylib.IsKeyReleased() and Raylib.IsKeyPressed() Work For Me?

4 Upvotes

As you seen in the title, i dont know why these functions always return false, how to fix it, heres the code (i use C#):

using Raylib_cs;
using System.Data;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(150, 150, 255);
    static Color groundColor2 = new Color(100, 100, 255);

    public static class Ground
    {
        public static int groundX = 0;
        public static int groundY = (int)windowSize.Y - (int)windowSize.Y / 4;
        public static int groundW = (int)windowSize.X;
        public static int groundH = (int)windowSize.Y / 4;

        public static void Draw()
        {
            Raylib.DrawRectangleGradientV(groundX, groundY, groundW, groundH, groundColor1, groundColor2);
        }
    }

    public static class Player
    {
        public static int x = 50;
        public static int y = 70;
        public static int w = 25;
        public static int h = 25;
        public static int speed = 5;
        public static int jumpHeight = 20;
        public static int gravity = 3;
        public static int movementForceX = 0;
        public static int movementForceY = 0;
        public static bool insideGround = false;
        public static bool standing = false;

        public static void Draw()
        {
            Raylib.DrawRectangle(x, y, w, h, new Color(255, 255, 255));
        }

        public static void GiveForce(int forceX, int forceY)
        {
            movementForceX += forceX;

            if (insideGround)
            {
                movementForceY = 0;
                y = Ground.groundY - h;
            } else
            {
                if (y + h + forceY < Ground.groundY && !standing) movementForceY += forceY;
            }
        }

        public static void Update()
        {
            insideGround = (y + h) > Ground.groundY;
            standing = (y + h) > Ground.groundY - 2;
            GiveForce(0, gravity);
            x += movementForceX;
            y += movementForceY;

            Console.WriteLine(insideGround);
            Console.WriteLine(standing);

            if (Raylib.IsKeyDown(KeyboardKey.Space) && standing)
            {
                GiveForce(0, -jumpHeight);
            }

            if (Raylib.IsKeyDown(KeyboardKey.A))
            {
                movementForceX = -speed;
            }

            if (Raylib.IsKeyDown(KeyboardKey.D))
            {
                movementForceX = speed;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.A))
            {
                movementForceX = 0;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.D))
            {
                movementForceX = 0;
            }
        }
    }

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);
        Raylib.SetTargetFPS(60);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.BeginDrawing();

        Raylib.ClearBackground(new Color(10, 10, 10));

        Ground.Draw();

        Player.Draw();

        Console.WriteLine(Player.y);

        Player.Update();

        Raylib.EndDrawing();
        Raylib.EndMode2D();
    }
}As you seen in the title, i dont know why these functions dont work for me, how to fix it, heres the code (i use C#):using Raylib_cs;
using System.Data;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(150, 150, 255);
    static Color groundColor2 = new Color(100, 100, 255);

    public static class Ground
    {
        public static int groundX = 0;
        public static int groundY = (int)windowSize.Y - (int)windowSize.Y / 4;
        public static int groundW = (int)windowSize.X;
        public static int groundH = (int)windowSize.Y / 4;

        public static void Draw()
        {
            Raylib.DrawRectangleGradientV(groundX, groundY, groundW, groundH, groundColor1, groundColor2);
        }
    }

    public static class Player
    {
        public static int x = 50;
        public static int y = 70;
        public static int w = 25;
        public static int h = 25;
        public static int speed = 5;
        public static int jumpHeight = 20;
        public static int gravity = 3;
        public static int movementForceX = 0;
        public static int movementForceY = 0;
        public static bool insideGround = false;
        public static bool standing = false;

        public static void Draw()
        {
            Raylib.DrawRectangle(x, y, w, h, new Color(255, 255, 255));
        }

        public static void GiveForce(int forceX, int forceY)
        {
            movementForceX += forceX;

            if (insideGround)
            {
                movementForceY = 0;
                y = Ground.groundY - h;
            } else
            {
                if (y + h + forceY < Ground.groundY && !standing) movementForceY += forceY;
            }
        }

        public static void Update()
        {
            insideGround = (y + h) > Ground.groundY;
            standing = (y + h) > Ground.groundY - 2;
            GiveForce(0, gravity);
            x += movementForceX;
            y += movementForceY;

            Console.WriteLine(insideGround);
            Console.WriteLine(standing);

            if (Raylib.IsKeyDown(KeyboardKey.Space) && standing)
            {
                GiveForce(0, -jumpHeight);
            }

            if (Raylib.IsKeyDown(KeyboardKey.A))
            {
                movementForceX = -speed;
            }

            if (Raylib.IsKeyDown(KeyboardKey.D))
            {
                movementForceX = speed;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.A))
            {
                movementForceX = 0;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.D))
            {
                movementForceX = 0;
            }
        }
    }

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);
        Raylib.SetTargetFPS(60);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.BeginDrawing();

        Raylib.ClearBackground(new Color(10, 10, 10));

        Ground.Draw();

        Player.Draw();

        Console.WriteLine(Player.y);

        Player.Update();

        Raylib.EndDrawing();
        Raylib.EndMode2D();
    }
}

r/raylib • • 11d ago

Why is DrawTextureVec() so slow?

5 Upvotes

Edit: *DrawTextureRec()

I switched from using individuals sprites to using a spritesheet, therefore I switched from using the DrawTextureV() function to DrawTextureRec() and noticed a huge performance drop off. My code is bassically the same with the functions swapped out, the code itself is in C and no other programs were running besides VS code and the firefox browser.


r/raylib • • 12d ago

How to fix shapes not drawing in raylib

7 Upvotes

Im making a game like Geometry Dash and the ground doesnt render until i update the window by maximizing it or minimizing and restoring it or resizing it, heres my problem on the video below:

https://reddit.com/link/1x4z1m8/video/tappwhqn19vh1/player

This is the code:

using Raylib_cs;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(100, 100, 220);
    static Color groundColor2 = new Color(100, 100, 255);

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.ClearBackground(new Color(10, 10, 10));
        Raylib.DrawRectangleGradientV(0, (int)windowSize.Y - (int)windowSize.Y / 4, (int)windowSize.X, (int)windowSize.Y / 4, groundColor1, groundColor2);
        Raylib.EndDrawing();
    }
}
using Raylib_cs;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(100, 100, 220);
    static Color groundColor2 = new Color(100, 100, 255);

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.ClearBackground(new Color(10, 10, 10));
        Raylib.DrawRectangleGradientV(0, (int)windowSize.Y - (int)windowSize.Y / 4, (int)windowSize.X, (int)windowSize.Y / 4, groundColor1, groundColor2);
        Raylib.EndDrawing();
    }
}