Blog Layout

Devlog #5: Building, again

183:924032007 • 6 October 2023

Erectin' a dispenser.

Download



Finally, players can build together. In this update, I implemented player building and destruction into the game, all of course synced across the network. Lovely.


How does it work?


The system is built off of the deterministic nature of the world generation system: from the same starting conditions, any number of clients will always generate the same world. The beauty of this is that I don't actually need to have the server/host generate all the chunks, then send the data to all the clients, as is the case in a certain other block game. Instead, I just need to store the individual modifications made and send those instead.

As an example, when a player breaks a block, in the Bad System it goes like this:

  • Player breaks a block
  • Server fetches the entire chunk data (32768 blocks)
  • Server sends the entire chunk across the network.
  • Client decodes the entire chunk (again, 32768 blocks.)

However, in my system it goes like this:

  • All clients generate a chunk. Given the same seed, this will be the same chunk. During generation, if any previous block modifications are found these will be applied.
  • The player breaks a block.
  • The server tells everyone this one block has been modified.
  • Clients generate the chunk.

Like all things, this is a trade-off. As you might be able to tell, the second system uses less bandwidth however at the extent of CPU usage. It's more intensive on the processor to have to re-generate the chunk every-time - though to a modern CPU, it's still child's play. However, to me this system is worth it due to the huge amounts of data being saved. This makes it much better suited to the player-hosted architecture used in Build Fight, as I have no guarantee or realistic expectation that the host will be running anything other than a below-average spec PC on below-average WiFi. I think I've managed to strike the right balance here between system and network performance.


Play it now! Build dicks! Etc!


Up next: storing block data, with the primary purpose of being able to destroy blocks gradually rather than instantly.

by 183:924032007 20 November 2024
Game is not cancelled, don't worry.
by 183:924032007 6 November 2023
I still love you, itch.io
22 October 2023
Featuring explosives. 
by 183:924032007 19 October 2023
A lot.
by 183:924032007 19 October 2023
I am speed.
by 183:924032007 3 October 2023
Plus, Unity VS My Soul. 
by 183:924032007 26 August 2023
We're gonna need a bi gger CPU.
by 183:924032007 15 August 2023
Ok, it still looks like a Minecraft clone. Trust the process.
by 183:924032007 15 August 2023
That's right, I'm making video games.
by 183:924032007 27 June 2023
We've been here before.
More posts
Share by: