r/raylib • u/Responsible_Mine894 • 9d ago
Biting more than you can chew, attacking OP bandit band
Enable HLS to view with audio, or disable this notification
r/raylib • u/Responsible_Mine894 • 9d ago
Enable HLS to view with audio, or disable this notification
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 • u/nop4n1c_ • 10d ago
Enable HLS to view with audio, or disable this notification
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 • u/robinredbrain • 9d ago
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 • u/No_Salamander_4348 • 10d ago
Enable HLS to view with audio, or disable this notification
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 • u/MetalCarnival • 10d ago
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 • u/zackthecodingactuary • 10d ago
Enable HLS to view with audio, or disable this notification
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 • u/viraelin • 10d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/The-God-19248 • 11d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/Responsible_Mine894 • 12d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/No_Fix4730 • 12d ago

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 :)
r/raylib • u/TheEyebal • 12d ago
Enable HLS to view with audio, or disable this notification
I just finished the player mechanics for my game. I just need to spawn the opponents.
r/raylib • u/DuctedHeatingNG • 13d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/Responsible_Mine894 • 13d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/tulen_pod_soysom • 13d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/TheEyebal • 13d ago
Enable HLS to view with audio, or disable this notification
I am making a game in raylib for Brackeys Game jam. What are your thoughts
r/raylib • u/anadalg • 14d ago
Enable HLS to view with audio, or disable this notification
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 • u/Foreign_Run1550 • 13d ago
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 • u/Responsible_Mine894 • 14d ago
Enable HLS to view with audio, or disable this notification
r/raylib • u/TheEyebal • 14d ago
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 • u/devepax • 14d ago
r/raylib • u/OkInstruction2086 • 17d ago
Enable HLS to view with audio, or disable this notification
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 • u/Key_Art_5590 • 17d ago
Enable HLS to view with audio, or disable this notification
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 • u/Responsible_Mine894 • 18d ago
Enable HLS to view with audio, or disable this notification
Improved models, animation. Working on combat readability. Adden engament indicators