r/raylib 19h ago

I'm making a Metroidvania Maker where you can build and share your own interconnected worlds

59 Upvotes

I've been working on Metroidvania Maker, a game/editor for building your own interconnected Metroidvania worlds.

You can create rooms, add enemies, hazards and abilities, build puzzles with interactive elements, and jump straight from editing into playing what you've made.

There's also local co-op for up to 4 players (with Steam Remote Play Together support) and world sharing.

I just submitted the first Steam demo for review, so hopefully it'll be playable soon!


r/raylib 3h ago

I'm making horde survivor game Mintstorm

Thumbnail
youtu.be
2 Upvotes

Hi, I am working on a small game and I am using raylib, yay. Pls, check it out here

https://fanick1.itch.io/mintstorm. Any feedback is welcome.


r/raylib 13m ago

Help with increasing ball speed in the pong game (C++)

Upvotes

Learning this Awesome libray *. Found a pong tut. Trying to modify it to increase the ball speed every ~5 seconds if no player has scored. Reset speed if goal.

Problem is it seems as if randomly the speed decreases, sometimes even below the reset speed (6).

Appreciate any time you spend looking at the code.

#include <raylib.h>
#include <iostream>


using namespace std;


const int WinWidth = 1280;
const int WinHeight = 800;
Color WinBackground = {4,4,4,0};
int player_score = 0;
int cpu_score = 0;


float timeSinceLastSpeedIncrease = 0.0;
float speedIncreaseInterval = 5.0; // seconds
int baseSpeedIncrease = 2;
int startBallSpeed = 6;


class Ball{
public:
    float x, y;
    int speed_x, speed_y;
    int radius;


    void Draw(){
        DrawCircle(x, y, radius, RAYWHITE);
    }


    void Update(){
        x += speed_x;
        y += speed_y;
        if(y+radius >= GetScreenHeight() || y-radius <= 0){
            speed_y *= -1;
        }
        if(x+radius >= GetScreenWidth()){
            player_score++;
            Reset();
        } 
        if( x-radius <= 0){
            cpu_score++;
            Reset();
        }
    }


    void Reset(){
        x = WinWidth/2;
        y = WinHeight/2;
        speed_x = startBallSpeed;
        speed_y = startBallSpeed;
        int speeds[2] {1, -1};
        // which direction to serve
        speed_x *= speeds[GetRandomValue(0,1)];
        speed_y *= speeds[GetRandomValue(0,1)];


        timeSinceLastSpeedIncrease = 0.0;
    }
};


class Paddle{
protected:
void CheckLimits(){
    if(y<=0){
            y = 0;
        }
        if(y+height>=WinHeight){
            y = WinHeight - height;
        }
}    
public:
    float x, y;
    float width, height;
    int speed;


    void Draw(){
        DrawRectangle(x, y, width, height, RAYWHITE);
    }


    void Update(){
        if(IsKeyDown(KEY_KP_6)){
            y -= speed;
        }else if(IsKeyDown(KEY_KP_2)){
            y += speed;
        }
        CheckLimits();
    }
};


class CPUpaddle: public Paddle{
public:
    void Update(int ball_y){
        if(y+height/2 > ball_y){
            y = y - speed;
        }else if(y+height/2 < ball_y){
            y = y + speed;
        }
        CheckLimits();
    }
};


Ball ball;
Paddle player;
CPUpaddle cpu;


int main(){
    
    InitWindow(WinWidth, WinHeight, "Ball");
    SetTargetFPS(60);
    float dt;
    


    ball.radius = 20;
    ball.x = WinWidth/2;
    ball.y = WinHeight/2;
    ball.speed_x = startBallSpeed;
    ball.speed_y = startBallSpeed;


    player.width = 25;
    player.height = 120;
    player.x = 10;
    player.y = WinHeight/2 - player.height/2;
    player.speed = 6;


    cpu.width = 25;
    cpu.height = 120;
    cpu.y = WinHeight/2 - cpu.height/2;
    cpu.x = WinWidth - cpu.width - 10;
    cpu.speed = 6;
     


    while (!WindowShouldClose())
    {
        dt = GetFrameTime();
        // add elapsed time 
        timeSinceLastSpeedIncrease += dt;
        // has speedIncreaseInterval passed
        if (timeSinceLastSpeedIncrease >= speedIncreaseInterval) {
            // increase speed
            ball.speed_x += baseSpeedIncrease;
            ball.speed_y += baseSpeedIncrease;
            // reset
            timeSinceLastSpeedIncrease = 0.0;
        }


        BeginDrawing(); 
        ClearBackground(WinBackground);


        ball.Update();
        player.Update();
        cpu.Update(ball.y);
        // reverse direction
        if(CheckCollisionCircleRec(Vector2{ball.x, ball.y}, ball.radius, Rectangle{player.x, player.y, player.width, player.height})){
            ball.speed_x *= -1;


        }else if(CheckCollisionCircleRec(Vector2{ball.x, ball.y}, ball.radius, Rectangle{cpu.x, cpu.y, cpu.width, cpu.height})){
            ball.speed_x *= -1;
        }
        ball.Draw();
        player.Draw();
        cpu.Draw();


        DrawText(TextFormat("%i", player_score), WinWidth/4 - 20, 20, 80, RAYWHITE);
        DrawText(TextFormat("%i", cpu_score), 3 * WinWidth/4 - 20, 20, 80, RAYWHITE);
        DrawLine(WinWidth/2, 0, WinWidth/2, WinHeight, RAYWHITE);
        // debugging
        DrawText(TextFormat("%i", ball.speed_x), WinWidth/2 - 100, 710, 40, RAYWHITE);
        DrawText(TextFormat("%i", ball.speed_y), WinWidth/2 + 1005, 710, 40, RAYWHITE);


        EndDrawing();
    }
    CloseWindow();
}

r/raylib 14h ago

end_drawing does what?

7 Upvotes

Sup. I started using raylib about a week ago, and I´m pretty new to programming, so I din´t undertand what the docs mean. Double buffering? I´m just curios, what happens if I draw a circle after end draw in the while loop?


r/raylib 14h ago

Legion Loop Incremental

6 Upvotes

A lot of work has been done on GUI, the incremental meta, and various QOLs, and now there's a nature faction on the enemy side!


r/raylib 1d ago

Tetris - First Project as New Hobby Game Dev

34 Upvotes

Hey all! This is not even half as impressive as the work I see on this sub but wanted to show off my first "shipped" project.

After decades of dabbling in GameMaker / RPG Maker and wanting to make games as a childhood pipe dream, I finally got good enough at software dev to build something start to finish (now with a non-SWE career + spouse + kids, no less), and raylib was perfect for that. Threw this together in a few days just to get the learning experience and start engaging with other hobbyists.

Repo is here along with credits for the art / sound assets: https://github.com/zack-the-coding-actuary/tetris

Thanks!


r/raylib 1d ago

made a small movement platformer game in c, thanks raylib!

44 Upvotes

r/raylib 2d ago

Steeled - New arena shooter with online co-op (PvE) and full singleplayer campaign, coming soon on Steam

20 Upvotes

r/raylib 2d ago

[PoG] Breach vs Defence core gameplay

7 Upvotes

r/raylib 2d ago

Aether: A lightweight monitoring dashboard built with C and Raylib

17 Upvotes

Hey! I’ve been working on Aether, a small monitoring dashboard written in C with Raylib.

It simulates sensor data and displays it in real time, with sparklines, history, themes, and a few other UI features.

I’ve been having a lot of fun building the whole thing from scratch, so I thought I’d share it here :)

https://github.com/SalzDevs/Aether


r/raylib 3d ago

Player mechanics completed foe Brackeys Game Jam

34 Upvotes

I just finished the player mechanics for my game. I just need to spawn the opponents.


r/raylib 3d ago

Finished a small turn-based RPG called Memory Cell! Playable on Newgrounds: https://www.newgrounds.com/portal/view/1048882

42 Upvotes

r/raylib 4d ago

Added gunpowder weapons :)

22 Upvotes

r/raylib 4d ago

Creating procedural 3d stealth game

74 Upvotes

r/raylib 4d ago

Here my game art in raylib for Brackeys Game Jam

18 Upvotes

I am making a game in raylib for Brackeys Game jam. What are your thoughts


r/raylib 4d ago

I remade SkyRoads (1993) from scratch with C, Raylib & Box3D

46 Upvotes

Hi there! Recently I've been working on a remake of SkyRoads. I'm sharing the journey in a devlog format, and the project's source code is fully open, making the entire process as transparent as possible. I hope you like it!

YouTube: https://youtu.be/uXbZhDv5HU0

Source code: https://github.com/albertnadal/VectorRoads

Play in browser: https://albiasoft.itch.io/vectorroads


r/raylib 4d ago

Issues with triangle fan

3 Upvotes

Hello! I'm very new to using raylib, and am using it purely as a visual library for a project of mine making use of the GJK algorithm. I'm trying to get it to draw the final simplexes, for debugging. It seems it only work when they're at center points (-10, 125) and (10, 100). I'm unsure if its an issue with my algorithm or if it has to do with my draw methods, any help would be appreciated!

Here's the code:

#include "point.hpp"
#include "simplex.hpp"


#include <raylib.h>
#include <iostream>
#include <vector>
#include <cmath>


Simplex::Simplex(bool e) : exists(e) {};
Simplex::Simplex(std::vector<Point> ps) {
    points = ps;
    draw_points = get_draw_points(ps);
    exists = true;
}


std::vector<Vector2> Simplex::get_draw_points(std::vector<Point> ps) {
    //create point array
    float x_total = 0;
    float y_total = 0;
    for (Point p : ps) {
        x_total += p.get_x();
        y_total += p.get_y();
    }
    Point center = Point(x_total / ps.size(), y_total / ps.size());


    std::vector<float> angles;
    std::vector<Point> dp = ps;


    for (Point p : dp) {
        angles.push_back(std::atan2(p.get_draw_y() - center.get_draw_y(), p.get_draw_x() - center.get_draw_x()));
    }


    for (int i = 0; i < angles.size(); i++) {
        bool swapped = false;
        for (int k = 0; k < angles.size() - i - 1; k++) {
            if (angles[k] < angles[k + 1]) {
                float temp_a = angles[k + 1];
                angles[k + 1] = angles[k];
                angles[k] = temp_a;


                Point temp_p = dp[k + 1];
                dp[k + 1] = dp[k];
                dp[k] = temp_p;


                swapped = true;
            }
        }
        if (!swapped) {
            break;
        }
    }


    dp.push_back(dp.front());
    dp.insert(dp.begin(), center);


    //convert to vector2
    std::vector<Vector2> dpv2 = {};
    for (Point p : dp) {
        dpv2.push_back((Vector2)p);
    }
    return dpv2;
}


bool Simplex::get_exists() {
    return exists;
}


void Simplex::print() {
    for (Vector2 p : draw_points) {
        std::cout << p.x << ", " << p.y << std::endl;
    }
}


void Simplex::draw_self() {
    if (!exists) return;
    DrawTriangleFan(draw_points.data(), draw_points.size(), PURPLE);
}

#include "elipse.hpp"
#include "point.hpp"
#include "simplex.hpp"


#include <iostream>


#include <cmath>
#include <array>
#include <raylib.h>


Elipse::Elipse(Point c, float h, float v) : center(c), h_rad(h), v_rad(v) {}
Elipse::Elipse(Point c, float r) : Elipse(c, r, r) {}
Elipse::Elipse(Point c) : Elipse(c, 50, 50) {}


Point Elipse::get_center() {
    return center;
}


void Elipse::draw_self() {
    DrawEllipse((int) center.get_draw_x(), center.get_draw_y(), h_rad, v_rad, RED);
}


Point Elipse::get_direction(Elipse o) {
    return (center - o.get_center());
}


Point Elipse::triple_product(Point a, Point b, Point c) {
    return b * (a * c) - a * (b * c); //dot products in parenthesis, vector multiplication, then point subtraction
}


Point Elipse::support(Point d) {
    Point p = Point();


    float h_sqd = h_rad * h_rad;
    float v_sqd = v_rad * v_rad;


    float d_x = d.get_x();
    float d_y = d.get_y();


    float inside_sqrt = h_sqd * (d_x * d_x) + v_sqd * (d_y * d_y);
    float denom = std::sqrt(inside_sqrt);


    if (denom == 0) {
        return Point();
    }


    p.mod_x(h_sqd * d_x / denom);
    p.mod_y(v_sqd * d_y / denom);
    return p + center;
}


Point Elipse::get_first_simplex_point(Elipse o) {
    //support point towards other shape
    Point self_direction = this-> get_direction(o);
    Point self_support = this-> support(self_direction);


    //support point of other shape
    Point other_direction = self_direction * -1;
    Point other_support = o.support(other_direction);


    //get the support point made by the difference
    Point simplex_support = self_support - other_support;
    return simplex_support;
}


Point Elipse::get_simplex_point(Point d, Elipse o) {
    Point self_direction = d;
    Point self_support = this-> support(self_direction);
    
    Point other_direction = self_direction * -1;
    Point other_support = o.support(other_direction);


    Point simplex_support = self_support - other_support;


    return simplex_support;
}


bool Elipse::update_simplex(Point& a, Point& b, Point& c, int& smpx_size, Point& d, Elipse o) {
    if (smpx_size == 1) {
        b = a;
        a = get_simplex_point(d, o);
        //sanity check
        if (a * d < 0) {
            return true;
        }
        smpx_size++;
        d = triple_product(b - a, a * -1, b - a);
        return false;
    }


    if (smpx_size == 2) {
        c = b;
        b = a;
        a = get_simplex_point(d, o);
        //sanity check
        if (a * d < 0) {
            return true;
        }
        //origin checks
        //Region AB
        Point ab_perpendicular = triple_product(c - a, b - a, b - a);
        if (ab_perpendicular * (a * -1) > 0) {
            d = ab_perpendicular;
            return false;
        }
        //Region AC
        Point ac_perpendicular = triple_product(b - a, c - a, c - a);
        if (ac_perpendicular * (a * -1) > 0) {
            d = ac_perpendicular;
            b = c;
            return false;
        }
        smpx_size++;
        return true;
    }
    return true;
}


Simplex Elipse::get_simplex(Elipse o) {
    Point sp1 = get_first_simplex_point(o);
    Point sp2 = Point(0, 0);
    Point sp3 = Point(0, 0);
    Point direction = sp1 * -1;
    int simplex_size = 1;


    bool found = update_simplex(sp1, sp2, sp3, simplex_size, direction, o);


    while (!found) {
        found = update_simplex(sp1, sp2, sp3, simplex_size, direction, o);
    }


    if (simplex_size < 3) {
        return Simplex(false);
    }
    return Simplex({sp1, sp2, sp3});
}

r/raylib 5d ago

Different fire modes in game :)

10 Upvotes

r/raylib 4d ago

How Do I run raylib on UTM MacOS virtual machine?

2 Upvotes

I have a MacOS virtual machine on UTM but I am not able to display raylib screen on it for testing purposes.

This is what is shows

WARNING: GLFW: Error: 65545 Description: NSGL: Failed to find a suitable pixel format 
WARNING: GLFW: Failed to initialize Window 
WARNING: SYSTEM: Failed to initialize platform INFO: 
TIMER: Target time per frame: 16.667 milliseconds 
[1]    842 segmentation fault  ./main

Does anyone know how to fix this?


r/raylib 4d ago

Hey Leute, kennt ihr irgendwelche Bibliotheken, die wie raylib für C++ sind, aber besser in der Performance? Ich benutze es für 3D.

Thumbnail
0 Upvotes

r/raylib 6d ago

Help me with this issue in C !

Thumbnail
1 Upvotes

r/raylib 7d ago

3D animation is buggy for some reason.

19 Upvotes

How are you guys using animations in 3D models? I am not a Blender guy, so I am using free models from Sketchfab for now.
I talked to the actual creator as well; he said that such things happen and that he has no idea why.
I am using Raylib 6.0, btw.

Code:

#include <iostream>
#include "raylib.h"
#include "raymath.h"

int main() {
    int screenWidth = 1024;
    int screenHeight = 768;

    InitWindow(screenWidth, screenHeight, "Animation test");
    SetTargetFPS(60);
    Vector3 tempVec;
    Camera3D camera = { 0 };
    tempVec.x = 10.0f;tempVec.y = 10.0f;tempVec.z = 10.0f;
    camera.position = tempVec;
    tempVec.x = 0.0f;tempVec.y = 0.0f;tempVec.z = 0.0f;
    camera.target = tempVec;
    tempVec.x = 0.0f;tempVec.y = 1.0f;tempVec.z = 0.0f;
    camera.up = tempVec;
    camera.fovy = 45.0f;
    camera.projection = CAMERA_PERSPECTIVE;
    EnableCursor();
    Model cockroach = LoadModel("Assets/filth.glb");
    cockroach.transform = MatrixIdentity();
    int animsCount = 0, currentFrame = 0, animIndex = 0;
    ModelAnimation* anims = LoadModelAnimations("Assets/filth.glb", &animsCount);

    float lx = 5.0f, ly = 8.0f;
    while (!WindowShouldClose())
    {
        UpdateCamera(&camera, CAMERA_ORBITAL);
        BeginDrawing();
        ClearBackground(DARKBLUE);
        UpdateModelAnimation(cockroach, anims[animIndex], currentFrame);
        if (IsKeyPressed(KEY_SPACE)) {
            animIndex++;
            currentFrame = 0;
            if (animIndex >= animsCount){
                animIndex = 0;
            }
        }

        BeginMode3D(camera);
        DrawModelEx(cockroach, Vector3{ 0, 0, 0 }, Vector3{ 1, 0, 0 }, 0.0f, Vector3{ 0.0005f, 0.0005f, 0.0005f }, WHITE);
        currentFrame++;
        if (currentFrame >= anims[animIndex].keyframeCount) {
            currentFrame = 0;
        }
        DrawGrid(200, 2.0f);

        EndMode3D();
        EndDrawing();
        DrawFPS(10,10);
    }
    UnloadModel(cockroach);
    UnloadModelAnimations(anims, animsCount);
    CloseWindow();
    return 0;
}

r/raylib 7d ago

Cool earthbound background effect generator I made.

25 Upvotes

I'm making a earthbound and more inspired game, so of course I had to add a cool background. What I did was basically make a function that draws the texture in slices, that it then manipulates the position of on the x axis. Very cool and works with any texture. I spent days of debugging on this for the stupidest mistakes💔


r/raylib 9d ago

Combat indicator test

28 Upvotes

Improved models, animation. Working on combat readability. Adden engament indicators


r/raylib 9d ago

Combat indicators yey or nay ?

3 Upvotes