So I didn't post in 3 months, which is an unusual amount of time to be off. It can mostly be attributed to demotivation and winter break, since optimization is hella boring and I don't want to do anything during the break. However, I got back into business and I have some impressive stuff to show to you guys.
Hiring (for free)
To make this notice clear, I decided to put it here. If you are proficient in C++, know what you are doing, and want to volunteer for this project, then hit me up on Discord in DM (b4n4n4#3701), or in the channel #hiring at the server down below.
Alright, so to set it straight, I have been and am using unefficient ways to generate chunks, render the game, and store chunks. You see, all of the chunks get generated at the initialization. This is quite bad, since the player most likely won't visit all of them.
The second problem is rendering the blocks. Blocks are just cubes, 8 vertices, 6 faces, they are not that big. They are easy to render for the GPU if their number is around 100-200. However, if I create 10000-20000, it easily becomes a big load for the GPU, since the PCI bus bottlenecks the GPU and the driver overhead is really high. Enter the VBO. It's an object on the GPU that only needs to be uploaded twice and is rendered everytime the game asks to. However, the calls still have PCI and driver overhead, so the FPS gets stable, but not stable enough to be 60 FPS.
The memory problem, for me, is the most fascinating one. The problem here is that the (sub)chunks in the memory get stored no matter if they have something in them or not. The VBOs of blocks have a similar problem, and I resolved this by creating a new object everytime it had something unique in it (this could partially be called Copy-on-Writing (COW) btw, which is heavily used in the memory management of some OSes). This made Half-Craft needing 500 MB of memory to 100 MB of memory for a 256*256 pregenerated world. For the VBOs, this further stabilized FPS.
I added 28 new blocks, most of them are from the alpha game, but not the textures, which are from the 1.* games. 16 of them are wool, the rest is just miscellaneous blocks. I added them because hecks and shits and giggles, and I didn't want this update to look so empty on the outside.
I also added some things which I thought didn't belong to any common category. Here are they:
- The default weapon is the hand (as demonstrated in the picture above).
- The sound that the stepping makes is 50% Windows XP Error Sound and 50% Minecraft Grass stepping. Yeah, I came up with this one randomly lol on one morning.
- Block breaking no longer works (due to the Copy-on-Writing mechanism).
I really want to improve on:
- World generation of the world, like add trees, beaches, oceans, just general Minecraft stuff.
- the Crafting part of Minecraft, as I don't want to bother with that later.
- Optimizations? Meh, I think I will do them later on, however, I really want to try to optimize the VBOs even further by grouping the cubes into large VBOs.
TL;DR about the article
Discord server if you want to talk with me:
Until then, cya later in a few months :))))))))))))))))))))))))