Build: 4.5.1 Source (SHA: ad428a) - I’ve noticed these warnings since 4.3/4.4
I would like to know how to prevent disconnects associated with various LogNet and LogNetTraffic errors and warnings. I decided to include all of the errors and warnings I’ve come across while simulating a high latency environment because I suspect they’re all somewhat related. I feel like there are some safeguards I should be using in my code that I’m not. I have been carefully reading the UT codebase and haven’t found much difference between my own, but it’s entirely possible I’m missing things.
Warning and Error messages
I typically don’t see these messages in PIE/dedicated with no latency simulation or low latency simulation. They tend to appear when I increase ping and packet loss likelihood (I’m using clumsy to simulate latency: clumsy, an utility for simulating broken network for Windows Vista / Windows 7 and above).
Here are the various messages I’ve encountered:
- “Received bunch before connected”
- “Received non-control bunch during login”
- “History overflow forcing history dump”
- “Received unreliable bunch before open”
The “Received bunch before connected” message seems to be associated with the connection being closed. I’m not sure why this happens but my initial reaction was to make early Actor RPCs (eg, called in BeginPlay) unreliable
, especially multicasts, as they could potentially be called on a connection that wasn’t ready(?). This is conjecture on my part, I haven’t dug into the code behind these messages enough to understand their causes.
What I’m doing
I noticed in the UT codebase that the UTPlayerController
will check IsLocalPlayerController()
before dispatching input to its UTCharacter
. I applied the same pattern in my codebase, so now the KalimpongPlayerController
checks IsLocalPlayerController()
before doing something like MyPawn->AimRight()
, etc.
I also noticed that the UTCharacter
will check IsLocallyControlled()
before applying the input. I’m now doing the same in my codebase; e.g., in ::ReleaseProjectile()
my pawn checks IsLocallyControlled()
before issuing the release call to its attached projectile launcher.
I’m sending as few RPCs as I can get away with and as infrequently as possible. The biggest payload I send over the wire is two FVector_NetQuantize100
arguments and an Enum
. I don’t recall issuing any RPCs as a result of Tick() on any actor. Almost all of my RPCs are reliable. I have a few NetMulticast RPCs that are reliable that mostly deal with pawn destruction.
What I would like to know
- What are the best practices around sending RPCs? Should more of mine be
unreliable
? They seem to warrant reliability. - Should I avoid reliable
NetMulticast
RPCs? - Should an RPC always be scheduled with a Timer or a Delay? Similarly, is it okay to call RPCs as a direct result of player input? I noticed that the
UTCharacter
uses a struct for deferring the StartFire/StopFire events instead of just immediately telling the Server, and the Tick() function handles applying the input (I think I recalled that correctly but I don’t have the code handy at the moment). - What do these warnings and errors mean and how can I guard against them? I want to ensure players won’t get kicked immediately upon joining a server, or have their connection closed abruptly during the game, but I’m not sure which techniques to avoid and which to apply.
I’m happy to provide code if more detail is needed. Thanks for taking a look!