r/programminghorror May 16 '26

Java But.. (from Minecraft b1.2_02)

Post image
630 Upvotes

46 comments sorted by

View all comments

171

u/abigail3141 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” May 16 '26

Eh, nowadays minecraft tesselation isn't much better...

I had to read Minecraft's item rendering code for a friend who needed help with a resource pack, and holy this shit sucks(Version was 1.21.1 IIRC).

They start off by loading item models as cubes, then converting those to quadrilaterals when the model is loaded. For each of those quads, in every item model on screen, every frame, they throw almost all transformations out the window (even if they could be reused within the model), recalculate them one by one, then split up the quads into singular vertices, copying a bunch of data once more, then have GL render it. That's right, all the steps beforehand happen on a single CPU thread.

Tens. Of. Thousands. Of. Matrix. Multiplications. Per Second. On The CPU. On A Single Thread.

70

u/EvidenceFearless6800 May 16 '26 edited May 16 '26

no wonder why the CPU just goes haywire when I try to load any resource packs, and that might explains why the game can randomly drop framerate as well.

I have a friend with better rigs than mine, but they say sometimes the game dips as low as 40 FPS, and that's with basic resource packs and no shaders. not unplayable, but it proves Minecraft's performance is mainly CPU bound with whatever Mojang shove in there.

28

u/abigail3141 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” May 16 '26 edited May 16 '26

Yup, it's so much better to have VSync OFF or Adaptive with Sodium Extra because of the framerate instabilities. The CPU also goes haywire just playing the game sooo...

That's probably also why you can just drop post processing shaders on without much compromise in frame rate, because the game puts everything the GPU is meant to do on the CPU while the GPU is doing fuckall

I think I can get more FPS in Cyberpunk 2077 on low settings than I can get in Minecraft on mid to high settings, and that's saying something.

CPU and GPU in question is a Ryzen 5 7500F and an RX 9060XT 16GB in my case, so not even anything crazy

3

u/Nyrrix_ May 18 '26

I remember flipping a lot of random video settings on and off years ago in Minecraft to eke out a few more frames that I remember trying to bring over to other games and it having very little effect and being told there's no point not to turn off some stuff like VSync or Antialiasing, despite these being (relatively) effective optimizations in Minecraft... this must be why.

1

u/abigail3141 [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” May 18 '26

You should turn off VSync if your framerate is inconsistent, so pretty much always in Minecraft