Write Better Netcode!
Have you eagerly started a Unity multiplayer project after working through Netcode tutorials that made you feel like this is easy-peasy?
But then you run into inexplicable, random issues. Frustrated, you realize that you haven’t been taught the fundamental concepts of networking.
![Unity Multiplayer Tutorials be like ...](https://codesmile.de/wordpress/wp-content/uploads/2024/07/Rage_guy_why_by_rober_raik-d4cw27e.webp)
Write Better Netcode is a tutorial series that prepares you for actual multiplayer game production. Learn to drive the car and what’s under the hood, not just how to turn the wheel.
Table of Contents
Quick Project History
I originally intended to create the WriteBetterNetcode project as a product for the Unity Asset Store: MultiPal.
Here’s a quick demo of what it looked like when I had all the core features implemented:
When I was about to publish it to the store, I realized / worried:
- It solves pervasive issues few understand they (will) have.
- It will be viewed as a niche first-person shooter template.
- It would be locked away to a few paying users only.
- It would be buried among 80,000 other assets on the store.
- I’ll spend too much time on publishing and marketing tasks.
- I cannot contact customers and they won’t provide feedback.
This then encouraged me to ditch the product and teach the lessons:
![](https://codesmile.de/wordpress/wp-content/uploads/2024/07/user-onboard-1024x762.png)
Point being: I want as many of you to do rad shit!
I also want to be able to do things my way, unrestricted from store requirements and not having to compete with other products.
My long term goal is to build a sustainable income from sharing my work with everyone, rather than working for a single entity where most of my broad knowledge would remain unused, and withheld due to the usual Non-Disclosure and Non-Compete agreements.
I trust you and I hope you value my work and will give back through Patreon! 🙂
Features We’ll Create
The WriteBetterNetcode project will act as a template for competitive and cooperative multiplayer action games.
Gameplay-wise imagine a fast-paced Boomershooter where it’s all about raw gameplay and fun mechanics.
We’ll implement the following features at a minimum:
- First Person, Third Person, and Top-Down camera perspectives
- Arcade-style character controller for all perspectives
- Local splitscreen players join online matches (4×4=16 players)
- Shooting and looting, spawning and killing (the usual)
- Multiple game modes (PvP, PvE, Teams, Singleplayer)
- Requested features (Inventory, Physics, Avatars, Services, …)
The whole project is available for free on GitHub!
What To Expect
Write Better Netcode teaches multiplayer best practices, scales well into production, minimizes bandwidth and cost, and implements unique features not found anywhere else.
Rationale and expert knowledge is provided along the way, specifically when implementing a less straightforward solution to highlight the kinds of disasters we’re avoiding, often with surprisingly little extra effort.
The following overarching concepts are taught:
- How to scale a Netcode project into production
- How to structure your assets and code for a multiplayer project
- How to avoid or handle common Netcode errors and exceptions
- How to make the right choices regarding Netcode features
- How to minimize network traffic and other optimizations
- How to efficiently test your Netcode project
- How to strip code and assets from a dedicated server
- How to account for respectively avoid network latency
- How to integrate Unity Gaming Services and estimate costs
- How to implement commonly requested features
What you won’t get is a hands-holding, every tiny step explained along the way. Nor will you type in the code presented to you – the most ineffective way to learn programming by the way!
I’ll focus on explaining the important parts and explain the rationale, why we’re doing things this way. Sometimes also discussing viable alternatives.
What’s Expected Of You
For a start, you ought to be comfortable with the Unity Editor and C# programming.
I assume you’ve created at least a few game prototypes in Unity and you’re willing to learn what it takes to create a successful multiplayer game.
You should be able to replicate common tasks when I merely paraphrase them. For instance, the instruction install the com.unity.serialization v3.1.1 package shouldn’t block you.
It’s not my goal to replicate all of the project code on the website. The focus will be on the essential concepts and rationale. The details are in the GitHub repository if you need them.
I create many smaller commits with meaningful descriptions to make it easy to look up and analyze changes I’ve made. It would be helpful if you are comfortable with GitHub and be able to read diffs.
![](http://codesmile.de/wordpress/wp-content/uploads/2024/07/Screenshot-2024-07-13-122720.png)
About The GPL License
Please mind the project’s GNU GPL3 license. It’s a copyleft license which means the project can be used as follows:
- Privately, to study and learn.
- Publicly, provided you also publish your entire work in working form to the public under the same GPL3. (*)
- Unrestricted, by becoming a patron.
I trust you and I hope you value my work! 🙂
(*) Note: Most digital store’s terms are in violation of the GPL3 license terms, thus forbidding apps that include GPL3 software.
Let’s Get Started!
Continue reading 2. Project Setup
Return to the Write Better Netcode Overview
Source Code on GitHub (GPL3 License)
Join my Patreon – it’s free! Get the latest updates by email.
Leave a comment below if you have any questions or feedback!
Leave a Reply