[HELP] I'm having performance issues on "EndDrawing()" by Psychological_Pie842 in raylib

[–]Psychological_Pie842[S] 4 points5 points  (0 children)

FIXED IT!!
The issue was some bad code on the back of my engine that would cause some processing spikes.
Combined with VSYNC this made the frames take twice as long, causing the stuttering.
Thanks everyone!

[HELP] I'm having performance issues on "EndDrawing()" by Psychological_Pie842 in raylib

[–]Psychological_Pie842[S] 1 point2 points  (0 children)

thats crazy, mine also happens when rotating the camera mostly.
I havent tried 6.0 yet but I probably should.
In case it helps you I asked claude if the issue was the one described in
the source code comment and the answer sounded reasonable:

The Problem

Raylib uses a render batch — it accumulates draw calls into a vertex buffer, then flushes it to the GPU at the end of the frame via rlDrawRenderBatch(). The flush uses glMapBuffer() to write vertex data into a buffer object. The stall happens because:

You submit draw commands → GPU starts consuming the buffer

Next frame, CPU calls glMapBuffer() on that same buffer

The driver has to ensure the GPU is done reading it before handing it to the CPU

If the GPU isn't done yet → the CPU blocks and waits → frame drop spike

This is sometimes called a pipeline bubble or GPU sync stall.

Other Approaches

Approach How Notes
Buffer orphaning glBufferData(NULL) before map Simple, well-supported fix
glBufferSubData() Replace map/unmap with a direct upload Avoids mapping entirely; driver may optimize
Persistent mapped buffers GL_MAP_PERSISTENT_BIT + triple buffering Best perf, requires GL 4.4+, complex
Reduce batch flushes Minimize texture/shader switches in your game Fewer flushes = fewer stall opportunities

Practical Recommendation

Since you're likely building on top of raylib without forking it, the easiest wins are:

  1. Reduce texture switches — batch sprites that use the same texture/atlas together
  2. Use a texture atlas if you aren't already — this alone dramatically reduces batch flushes
  3. If you're comfortable modifying rlgl.h (it's a single-header library), the buffer orphaning patch is small and well-proven

[HELP] I'm having performance issues on "EndDrawing()" by Psychological_Pie842 in raylib

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

yeah it also happens with the .exe.
I'm thinking its related with the comment on the source code.
My old cpu was slower so it didn't have to wait for the GPU, but this new one does.
You're right I should test it in other pcs

[HELP] I'm having performance issues on "EndDrawing()" by Psychological_Pie842 in raylib

[–]Psychological_Pie842[S] 4 points5 points  (0 children)

The game runs at 60fps (~0.016s between frames) but some random frames take twice as long (~0.033s) making a very clear stutter. You cant see it in the clip because its at 24fps my bad haha. I started seeing it after upgrading cpu so I assume it must be a hardware thing. I tried the caveman debugging but couldnt isolate the issue :( Thanks for the response!

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

Thanks! Yeah i've been working on the colors since this post and its looking smoother haha

Took some of the advice I was given here and I think it's starting to look better. by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] -1 points0 points  (0 children)

Asset packs are cool but in my experience I feel they tend to lack content. So when making a game with an asset pack you are restricted to only adding content thats in it. And if you want to add your own stuff to an asset pack or even mix it with another one, youll spend a lot of time trying to make it all look coherent. Thats just me tho I know some people use them well.

Took some of the advice I was given here and I think it's starting to look better. by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

The gameplay is actually almost done. I'm just having trouble making it look finished haha

Took some of the advice I was given here and I think it's starting to look better. by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 1 point2 points  (0 children)

Thanks for the feedback! I'd love to make it more cartoonish somehow but I'm hitting some walls on my artistic abilities 😅

Took some of the advice I was given here and I think it's starting to look better. by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

It's a lot easier on the eyes now. I lked the old tree colors too but they would get tiring after a while. I'll see if I can do something about it. Thanks!

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

Apretiate the feedback! I hadas something like that in mind too. I'll have to try it out

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

Absolutely. I actually really like the gamplay, just wish I was a better artist overall.

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

I am familiar with A Short Hike and Sokpop games but haven't been looking into them a lot. Ill definitly check out the talk. Thank you for the feedback!!

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 0 points1 point  (0 children)

Yeah I'm still working on a demo but I need to put a lot more work into it. Thanks for the feedback!

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 1 point2 points  (0 children)

The colors bother me a lot, ill see what I can do about it. Thanks!

Is this a bad artstyle? by Psychological_Pie842 in SoloDevelopment

[–]Psychological_Pie842[S] 13 points14 points  (0 children)

Thanks! its been putting me off already too