Category: netcode
-
Netcode bugs

While working on my network equipment code I noticed some strange behavior as I kept killing my clients and reconnecting them. After restarting my clients it felt… sluggish when reconnecting, like it was taking many ticks for the client to actually login. This spiraled into finding quite a few bugs.…
-
More netcode fun

5 months, 5 months I’ve been working on fixing my netcode. I finally understand what you have to do to get a decent deterministic simulation between clients and servers. In my defense on why this took so long, I’ve been spending a lot of time playing the Blue Prince and…
-
Client Desyncs, Mostly Solved

I am cautiously optimistic that my client desyncs are (mostly) solved. Boy has it been a wild ride. I started this endeavor 3 months ago as I first noticed my client was slowly unable to hit another player that should have been within the range of the collision sphere. I…
-
Small Progress, Big Frustrations

I have been working on client rollback physics for ~ checks notes ~ THREE months now. I have never worked on the same problem for this long. I finally made a semi-small breakthrough this weekend, only to be hit with another problem. Before we get into the details of what…
-
Groking epoll
Well, things aren’t going as planned, while I’ve implemented about 90% of the rollback code, I’m finding that the servers and clients are getting desync’d way more than they should be. Looking over the logs I’m seeing the server process client packets at strange times. This made me go back…
-
Custom Movement, Inputs, and Compression
Input Today’s topic will be about how I plan on transmitting input/movement data to the server. Before we dive in, let’s discuss some constraints we have and some fundamentals. At first I was planning on sending a series of ‘actions’ and magnitudes. Where magnitudes would be the amount of yaw…
-
UDP Reliability Part 4 (Resending)
This will be my last post on UDP Reliability for a while, even though it technically is incomplete. Honestly, I’ve done enough work on it that I need to move onto something else to keep my interest in this project up! I left off where I wanted the game system(s)…
-
Using Valgrind to Find and Fix Memory Leaks
I’ll admit, I’m still very new to C++, even though I’ve worked on and off with it over many years. It’s different when you are sitting down and writing a large scale program than just writing small tools or reviewing other peoples tools/code. I wanted to make sure after I…
-
std::function, Lambda and Testing
While I begin to wrap up porting reliable.io from C to C++ for my PMO library, I wanted to touch on a quick testing technique I’ve used in Go for quite some time, which I realized I can also use in C++. Go interface{}, Mock Functions and Tests In Go…
-
UDP Reliability Part 3 (Reliable Endpoints to PMO)
While translating reliable.io’s endpoints to C++ I quickly came to the realization that I will need to properly implement the messaging system. Right now it’s kind of spread out all over the place (in the socket thread, the main loop, and inside of flecs systems). To make the system cleaner…
-
UDP Reliability Part 2 (Porting reliable.io)
Welcome to the second part of getting UDP reliability into my engine. Now with connections complete, I need a way of tracking sequence ids between packets and store histories and all that jazz, but it turns out someone already did the hard work for me!. Of course I am talking…
-
UDP Reliability Part 1 (Connections)
I’ve started working on the reliability layer of PMO. Good place to start is with the concept of “connections”. Since we are dealing with UDP, this isn’t really a thing, as each packet is independent. I plan on building the entire reliability layer inside of flecs’ systems, queries and observers.…
-
Floating points, Movement, and Quantization
Now that my library works in UE5, and I can communicate over the UDP socket to my server, it’s time to take a look at getting objects moving. As a refresher, clients send only their inputs and some additional metadata to the server. It’s usually a Really Bad Idea to…
-
RIO then IOCP then just plain old Winsock2
Wow windows networking is.. not straight forward. For those of you who have never had the “joy” of working with them, I recommend you keep it that way. For Windows I only really need the client netcode to work, which means I don’t really need high performance socket handling code.…
-
Finally, encrypted communications!
Phew, it’s been quite a week trying to get server/client communications working. I now have a much better understanding of FlatBuffers. An added bonus is that certain aspects of modern C++ are starting to make sense now. Before we dive into how I’m structuring my messages, let’s look at the…
-
Switched to epoll, but need reliability!
When I started this project I thought I had a decent understanding of what I need (and I still kind of do). What I didn’t understand is how quickly I’d need to have certain systems implemented. Last time I posted I had authentication working, but the code wasn’t really “doing”…
-
Architecture Improvements
Architecture changes Over on mastodon (you know, where all the cool people hang out), June from Redpoint Games reached out to me with an alternate and much better design for dealing with client encryption keys. By the way, check them out if you need matchmaking code, trust me that stuff…
-
Some client encryption design thoughts
My goal was to get libsodium integrated, but I quickly realized I need more systems. For one, I need an LRU cache for storing client keys. Our clients will need to prove they are legitimate before we enqueue their packets, the only way we can do this is if we…
-
40k packets
Simplifying the server code I wasn’t too happy with the results from the last post, also there’s a lot of magic going on with uvw/libuv. I’m not a fan of magic. So I ripped it all out and decided to go back to basics (sort of). I wanted to try…