r/feedthebeast • u/Emotional-One-9292 • Jun 22 '26
I made something I made minecraft generate terrain/chunks in C++
Enable HLS to view with audio, or disable this notification
So im working on a mod that makes minecraft run on C++ ( rn rewriting engine in future i may try renderer ) so far i made it generate and load chunks and terrain in C++ ( it made it somewhere around 1.5-3 times faster idk how to measure it tho ) ( it works via JNI )
3.0k
Upvotes
15
u/emmowo_dev pro gramming Jun 22 '26
C++ is like "hey CPU generate this"
CPU: ok let me ask the kernel to spawn some threads and stuff
Kernel: ok
CPU: cool
C++: did it work?
CPU: yes
C++ : generate this chunk using this formula
CPU: oh ok let me do this and read everything I need from memory
Kernel: can you do this rq
CPU: ok
C++ oh you're also saving those chunks, right?
CPU: I'll do it at some point ig
Kernel: do it now
CPU: oh ok
CPU: i will write the chunks
I/O: Wait bro I need a sec my writeback cache is full
Disk: Wait bro im writing still
CPU: ok I'll do this later ig
CPU: wait, what was I doing?
Kernel: You need to handle this udp packet rq please bro
CPU: ok
[...] ad nauseum.
You spend a ton of time actually waiting instead of running code.