For the past months, I have been online-offline with the mod, occasionally working on it and not working on it. However, I managed to rewrite the entire mod in that time period to be more optimized and more manageable in the future.
The problem with the older version was that it was unmanageable, in a code sense, and slow in game. You see, it was a prototype and I didn’t care too much about how good the code was, I just wanted something out. This worked for a couple of months until the memory started corrupting out of nowhere. I didn’t want to deal with that, so I rewrote the mod, this time with a plan.
The plan was to somewhat keep the old version’s structure, but start using the safer C++ way of dealing with data (STL) from this point on.
As for the slow in-game performance, I started looking into OpenGL instancing, which makes the GPU’s work easier by uploading the graphics data before rendering it. I also went to render as few polygons as possible, but the current implementation is less than stellar.
The second problem was the networking. Half-Life works in a standard server-client model, meaning that the server updates the client periodically of the current game status so it doesn’t get out of sync. Of course, the old implementation was bad. Like really bad. For every block, it sent its description in 13 bytes. For reference, Half-Life only allows 3990 bytes out of the server every second. That method would take 216 seconds to fill one chunk!
The solution that came into my mind is to divide up the positions into different rows and chunks, so for every 16 blocks in a row, it would send their chunk’s position first, then the row’s position, and then the blocks’ types and relative positions in the row. This method is much more faster than the previous method, but it still takes 32 seconds at best to fill a chunk.
For some reason, I hesitated to use compression for networking, but since the previous method was really bad, I tried out ZSTD. It worked much better, only using ~200 bytes for one chunk, which prompted a maximum of 20 chunks per second at best!
I’m not gonna lie to you, this is kind of an early access version, as in it still has some bugs that really need stamping out. But I didn’t want you to wait, and I wanted to start this season with a release as soon as possible.
Gameplay is very rudimentary, you can only place, break and shoot blocks and explore. Like, that’s it. No stepping sounds, the water is arbitrary, and the physics are totally unrealistic and annoying, and the graphics are unreliable. Unbelieveable, but it still can carry on at least 10 minutes of gameplay, if dedicated, 15 minutes.
I didn’t test multiplayer yet, and the code is not written to host multiplayer games, so don’t try it.
To give yourself blocks, you have to press Y on your keyboard and the enter /give <block id> into the chat. You should fill in the <block id> area with a block type number or a block name. Here is a chart of all of the block names and numbers which you can type in <block id>:
There are also some special keybindings in this version of the mod
Left Ctrl: Crouch
Left Mouse Button: Break blocks/Fire
Right Mouse Button: Place blocks/Use
Here is some sample gameplay of the mod:
It’s only for Windows
I plan to release multiple, improved versions in this month, including heaps. I really want to start including survival elements into the mod, so stay tuned!
Half-craft official discord server for updates:
See you soon!!!