©WebNovelPub
Lucky Spin: Godly Programming-Chapter 83: Finishing Minecraft
Chapter 83: Chapter 83: Finishing Minecraft
Authors Note: This word count is above than average since it’s too tiring to separate it.
...
He opened his code editor and began assigning responsibilities, line by line, word by word, brick by brick.
Just like a general issuing command, and he was that original, I mean general.
With this the server would own the world. Every tree, block, and biome were generated here.
He built the world generation module, ensuring that chunks were created consistently and only loaded when players approached.
The server would handle the heavy lifting, creating a seamless experience as the world expanded with each player’s movement.
Every detail was planned meticulously, ensuring efficiency and performance.
Next was block control. Players could no longer place or break blocks freely.
So, he wrote a validation script, is that every action had to be approved by the server before being seen by others.
Hence no cheating and no desync.
Then came player tracking. Each position update, jump, or sprint was synced in real time.
If someone moved too fast, the server flagged it. Speed hacks were already dead-on arrival.
Inventory sync followed. Jeff connected item drops, pickups, and crafting results directly to the server, ensuring everything stayed consistent and secure across the multiplayer experience.
So that means no more client-side manipulation every item was earned, not spawned.
Finally, he wired in chat and events. Players could type, and the server would broadcast it to everyone.
Next, he focused on implementing the Client-Server Architecture. He opened the PlayerController.cs script and stared at the logic.
Clients would move their characters, but the server had the final say. So, he used Mirror’s built-in structure.
It was perfect one that is fully under his control.
This setup would ensure smooth communication between the server and clients while maintaining complete control over the game’s mechanics.
...
Csharp
[Command]
void CmdMove(Vector3 position)
{
transform.position = position;
RpcUpdatePosition(position);
}
[ClientRpc]
void RpcUpdatePosition(Vector3 position)
{
transform.position = position;
}
...
The [Command] told the server, hey the client wants to move. The [ClientRpc] told everyone else, this is where that player actually is.
Jeff tested it, and as one client moved, the server confirmed it, ensuring all the other players saw the update.
Lag? absolute zero, and for the cheats? Blocked! Every step, every jump, every swing was validated, approved, and broadcasted by the server.
Jeff leaned back for a moment, taking in the result. The foundation was now solid. The clients could act, but only with permission.
He already had the server build, and the logic was flawless. Next, it was time to make it live.
For early testing, he launched it from his own PC. One terminal window, one command, and the world booted instantly.
But he wasn’t stopping there. He opened a browser, logged into DigitalOcean, and spun up a Linux VPS.
He rented a remote server online that runs 24/7. This allows anyone from anywhere in the world to connect, as long as they have the IP.
Within minutes, he uploaded the server files, set up port forwarding, and secured the firewall. The world was ready to be accessed beyond just his local machine.
The game was now online globally. So, he added a new input field on the main menu.
[ Join via IP Address ]
Anyone could now connect to the server just by typing in the host’s IP. But Jeff didn’t stop there. He wanted to take it a step further.
He opened up the backend and linked RAZi AI to monitor everything like logs, server metrics, and player behavior.
If anything suspicious happened, RAZi would act instantly. It could auto-kick cheaters, spawn mobs in high-traffic areas to keep things interesting, trigger random weather events in low-pop zones to keep the atmosphere alive, and even restart the server if it detected memory leaks.
With RAZi integrated, the server became a dynamic, self-managing entity, responding to the needs of the players in real time while Jeff could focus on refining the game itself.
It was a seamless, intelligent system that made the entire experience run smoother than ever before.
Most games had admin panels, but Jeff had a different vision which is an AI managing the world for him.
And the best part? It worked silently, observing everything without ever being seen, ensuring the game ran smoothly in the background.
Moving on, Jeff opened Unity’s UI editor and stared at the empty canvas. A single-player game was fine, but this? This was the portal to shared worlds.
He dragged in a panel and began designing the layout and that is a clean and responsive type.
Every element was carefully thought out, ensuring that the players would have a seamless and intuitive interface as they explored this new shared world.
At the top, bold white letters appeared.
[Multiplayer Lobby]
Then he added three buttons which are Host Server, Join Server, and Find Server.
For the host server, clicking this would launch the player’s own game as the host.
He wired it to Mirror’s server startup logic and even added clipboard integration so it could copy the player’s IP automatically.
Then the join server next to it, he placed an input field. This is where players could paste someone else’s IP.
A connect button sat beside it, and with one click, Mirror would attempt to join the session.
For the find server? for now, this button was disabled, a placeholder for future functionality when server discovery and listing would be implemented.
Jeff smiled at his progress, satisfied with the smooth interface he was building.
The game was beginning to take shape, and soon it would be ready for players to connect, explore, and collaborate.
He planned to activate it later once he built a master server list. But the placeholder was already in place, ready to display public lobbies sorted by region, player count, and game type.
Finally, Jeff added status text at the bottom.
[Waiting for connection...]
He tested it and as he clicked Host Server, and the world loaded. Next, he opened a second client, typed in 127.0.0.1, and clicked Join.
Boom!
Both players spawned at the same location, and it worked flawlessly. The connection was smooth, the world was live, and Jeff couldn’t help but smile at the progress.
It was official, his multiplayer system was now fully functional.
Jeff knew that hosting the world was only half the job. Now came the delicate part, and that is making sure everyone saw the same thing.
He started with blocks.
Whenever a player broke or placed a block, he made sure the action triggered a [Command] function to send the request to the server.
The server then validated the action and used a [ClientRpc] to update all connected players.
This ensured that everyone saw the changes in real-time, keeping the world consistent across all players.
It was a simple system, but it would be the foundation for everything else that followed.
Next, he tackled player locations and movement. He attached NetworkTransform to every player prefab.
This streamed their position, rotation, and scale over the network, ensuring smooth synchronization of their movements.
Even with 10 players running around, the server didn’t lag a bit.
Everything was running smoothly, with no performance hits, ensuring that multiplayer gameplay felt seamless and responsive.
Looking at this he smiled, totally pleased with how efficient the system was working.
Next, it was Inventory & Health.
He then created a synced class for each player’s inventory using SyncVar for items, and built-in hooks to update the UI whenever changes occurred.
This ensured that each player’s inventory stayed in sync across all clients.
He also used NetworkAnimator to sync swing animations, damage indicators, and deaths across clients.
Now, when someone took damage or ate food, everyone saw it in real-time, creating a dynamic and connected experience for all players.
The world felt alive, with every action being shared and felt by everyone in the game.
So he stretched for a moment feeling a sudden rush of refreshment.
He was surprised that after a total of 2 hours of just like that he wasn’t even feeling uncomfortable. For the stretching? It was just a habit of his.
The code was now done, multiplayer was in and now it was time to test it. With that he ran two instances on the same laptop, one as the headless server, the other as the client. Two players spawned in the same world.
No stutter and no input lag happened, just movement a crisp real time that is mirrored flawlessly across both windows.
And literally it worked seamlessly. The server handled everything with precision, and the gameplay felt as if two separate machines were playing together in perfect sync.
He placed a block on one client and it appeared instantly on the other. He broke it and it was gone in both worlds at the exact same frame.
Inventory changes, chat messages, even simulated damage were all synced in perfect harmony.
Jeff leaned over, watching the server logs update in real-time, a sense of satisfaction washing over him.
Everything was working as expected without any some kind of issue. The multiplayer system was finally live, and it felt like a world was truly coming to life.
Understand that now the multiplayer was complete, it couldn’t stay free forever. Not if he wanted to scale it, support it, and build an actual platform from it.
"It was time to introduce the Premium Multiplayer Package," he stated.
With that he opened a new script and began restructuring the logic.
First, he isolated the core multiplayer features things like basic hosting, joining, and small-group LAN play.
Those would stay free will be accessible to everyone.
Then, he added a premium flag. A simple license file ’premium.key’ that if detected this would unlock the advanced hosting options.
Those options are bigger servers, custom player limits, performance tuning. And eventually mod support and public listing access.
To enforce this, he added a permission check into the game’s startup routine. If a valid premium license file was detected, the modding tools would be unlocked.
Otherwise, they’d stay locked, hidden behind a default message that simply said.
[Upgrade to access advanced features]
...
C#
Editif (File.Exists("premium.key")) { EnableProFeatures(); } else { LockToFreeMode(); }
...
He wrapped all advanced tools in validation gates, separating the pro-tier config files from the standard installation.
Since later he would add Mod Manager menu that will only appear if the license key was found.
Everything toggled cleanly, so even free users could still join modded servers, but only premium users could build them.
Even the server UI got an update for the ’Max Players’ dropdown would cap at 10 by default, unless premium was unlocked.
With that he decided to test it and everything toggled cleanly. So now free users got a taste of the experience.
No duplication exploits, no rubber-banding, and no packet floods. Just some raw, optimized performance.
He then toggled his chunk loading system and walked through different zones. Chunks loaded only when needed and were cleared when players left.
Culling ensured players never rendered what they couldn’t see, further optimizing the experience.
He added a compression layer for network data and because he was a god but not the god, he didn’t test for bugs.
He tested for proof that there were none and the results were absolutely flawless. The system was running perfectly, and everything was operating like clockwork.
Now that all was done and since he doesn’t have a marketplace yet, he needs to do something for the community.
Watching the server logs scroll like clean poetry. With the multiplayer system now flawless. With no lags, bugs, and errors.
With multiplayer as the present and modding would be the future. Since if he ever left this un-updated for so long players would get bored.
So, he will let the player of the host game to make the mod themselves to make the game enjoyable, as he prepared for the marketplace.
Therefore, he opened his editor and created a new folder inside the game directory: /Mods
Then, he launched RAZi and gave it a prompt.
"Scan for local files in /Mods. On startup, load any custom definitions for blocks, mobs, textures, or UI overlays."
With that RAZi parsed the structure instantly, since every time he had free time, he always enhanced RAZi you can say that this AI of his is now five times better than chatgpt.
He then created a mod loader script. Due to that it would scan for .json or .dll files. If they followed the right format, the engine would inject them into the game world.
He defined a few categories, to organize the mod structure, he defined three core file types.
First is mod_block.json for adding new blocks or tools, second is mod_entity.json for custom creatures or NPCs, and lastly mod_ui.json for HUD re-skins or interface modifications.
To demonstrate how it worked, he wrote a simple test mod as an example, showcasing how easily new content could be added to the game through these structured files.
...
json
Edit{ "type": "block", "name": "Glowing Obsidian", "texture": "obsidian_glow.png", "light_level": 15, "break_time": 10 }
...
When he launched the game again, there it was the glowing obsidian. Fully functional it was placeable, breakable and of course craftable.
Next, he added server-side validation is that any modded block or entity had to be present on both the host and client.
That way, no one could cheat by spawning fake items or corrupted mobs. Finally, he added a new tab to the game menu:
[Mod Manager] – Load, unload, or preview active mods.
He could not help but smiled since it was done now.
...
Special thanks to ’Meiwa_Blank👑’ – the GOAT for this month, for the Golden Tickets! Love you, brotha!
Special thanks to ’Devon1234👑’ – the GOAT for this month, for the Gifts! Love you, brotha!