Ever wondered how wonderful it would be to port Minecraft to the GoldSrc engine? Well, now it exists! The gameplay should be similar to the alpha/beta versions of Minecraft, so block placing/breaking, health, crafting, smelting, and mobs are going to be in the mod

Post news Report RSS Half-Craft: Infinite blocks, Discord

In this article I will summarize the events of how I got infinite blocks working, provide a link to a Discord server, and a link to the mod.

Posted by on

Hey!

So firstly I want to announce that now this mod has a Discord server so you can get the latest news about the mod and chat about Half-Life and life in general! Click this Discord icon to get the invite!


So, what has been going on in the last 20 days? Well, it was mostly figuring out how to get pass the GoldSrc entity limit. I have been using individual entities for blocks, which was the simplest thing to implement at that time, however, it presented me with a maximum 8192 block limit. If you are confused, picture this: a single chunk in Minecraft has 256*16*16=65536, and even if we were to fill that up to the quarter, it would be 16386 blocks! This is going to be a problem, so I started implementing an independent subsystem for chunks and blocks. I also needed to implement custom drawing routines on the clientside.
Everything went fine until I encountered a bug at the last moment which prevented the cube to be properly rendered. It took me a couple of hours to realize that OpenGL asked for a horizontal FOV, and GoldSrc worked with a vertical FOV. I was pissed by the sheer amount of not documenting code properly in GoldSrc already, but this was the worst case. This took me a week to finish due to high school also being a thing.

Yeet

Problems rose up again as I was implementing the networking for the blocks. The base for this networking system is the message system that GoldSrc generously provides with, but it's less generous with the buffer size limits.

This was the message that the game spit out to the console when the message buffer overflowed


See, I was sending a message every time when I spawn a block. This instantly filled up the message buffer when I filled up a single 16*16*16=4096 space. My solution? Create a queue which GoldSrc point entity would empty by a certain amount every time the game looped. This again took a week to finish, but it was worth it and you can see the result in this screenshot.
I was planning to write a new article a few days ago when I realized: Should I implement physics? I said yes, and yet again implemented another system for the physics system that GoldSrc uses. GoldSrc uses C for the physics, while the rest of the code is C++, so this lead to me removing the entire system altogether and physics still doesn't work. Since I was planning ahead in my block system before, I could easily add in new blocks, so I added in 15 blocks into the game and made the world look like dust in the summer sunlight.

Btw, this is actually really slow to render (10FPS) and the background doesn't refresh

As a last thing to add, I will link a Youtube video that shows the current performance of the networking and the drawing system

See you later guys :))))

Comments
Guest
Guest

This is very interesting, especially the use of entities instead of using brushes. Do you plan on maybe implementing "ray-casting" for lack of better works, to only render blocks the camera can touch with "rays". So you can unload models and reduce the amount of geometry in view? Asuming all of the above, unless you've already done something similar.

Reply Good karma Bad karma+4 votes
b4n4n4 Author
b4n4n4

Yes, I am planning to do a similar optimization. It's basically frustum culling and ray casting so only those blocks render that matter. Frustum culling will determine which chunks are in view. The rays will shoot out a ray to the player from those blocks that touch air (including blocks in caves) at the server side and if they intersect a non-non-air block, the block is not going to be sent to the client. Kinda complicated but I think this will definitely give a performance boost in both the client side (less things to draw) and the server side (less things to check in collision detection).

Reply Good karma+3 votes
Magic_Nipples
Magic_Nipples

Nice to see you danced around the old limits of Goldsrc. Similar to what the guest below said, I'd be great to get ray casting in to improve the performance now.

Reply Good karma Bad karma+4 votes
Dune_Jumper
Dune_Jumper

The graphics are blocky lel

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Half-Life
Game
Half-Life
Creator
b4n4n4
Contact
Send Message
Release date
Mod watch
Follow
News
Browse
News
New
Post news
Report
Report
Share
Related Games
Half-Life
Half-Life First Person Shooter