Now that I’ve had a chance to work with the UE4 C++ gameplay side for a few years, I feel like the gameplay code would be a lot easier to learn if there were more liberal use of checks, specifically relating to online multiplayer. For example, in our game code if a function is intended to be authority-only, we’ll outright assert it at the top of the function:
This not only helps to catch a lot of multiplayer bugs, but also helps document the intended purpose of the function, making the gameplay code a lot easier to understand. I was a little surprised by how much of the engine C++ gameplay code relied on header comments or didn’t have any comments at all to indicate the purpose of a function or a variable in relation to online multiplayer. Obviously UPROPERTY and UFUNCTION can help document intended purpose for functions, but there are plenty of raw C++ functions and variables in there with limited documentation. I imagine if someone at Epic went through and concreted some assertions, they’d probably catch a lot of bugs with it.