If you saw my latest Devblog on YouTube then you know I’ve completely recoded World of Zania. A big reason for this was how I wanted to handle the world.
Instead of crafting the world client side and packaging it with the client, I wanted it to be entirely server side. I wanted the entire game world (tiles, objects, walls, npcs, enemies, etc etc) to be kept within chunks in the server, and then streamed to the client as needed!
This was NO easy task. But here’s a break down of how it works.
1. Server Chunks
First I had to make a chunk system that loads objects and tiles, and then also detects changes and saves it. I took my old chunk system which only saved tiles and heavily modified it to also save objects.
This is a screenshot of the chunk system I created. You can find it on the marketplace here: https://marketplace.gamemaker.io/assets/11795/chunks-infinite-world-map
I then made it so the server of World of Zania uses these chunks to load and save the world. It loads a radius of chunks around active players and unloads them when they’re no longer needed. This way the server doesn’t need to have the ENTIRE world loaded, but only what’s needed.
2. Client Receives the World
You might think the server sends the chunks to the clients, but not exactly. The server DOES send the tiles in chunks, but not the objects. Objects are sent based on if the player is nearby, NOT the entire chunk. Obviously, the range is so far the player never notices anything was sent.
3. How is the world crafted?
I’ll do another blog on this. But the world is entirely crafted through the client. A player with admin privilege’s (me) has a world editor and can place/remove tiles, objects, enemies and NPCs real time. This world editor is currently a work in progress. I suppose I’ll also add one on the server side as well.
So why all this? Basically, I never have to give a client an update or patch to change the world, everything is kept within the server.
Why are you making the server in GameMaker?
Honestly? I just want to see how far I can push GameMaker. I know making the server in GML isn’t the best, but, it’ll be fun to see what happens.
When will it be playable to others?
Definitely months from now. Keep following me on Discord, Blog, X and YouTube! I will announce when I do public tests!