HLAPI Confusion and Dedicated Server Best Practices

Sorry if this is all really newbie but I’m still trying to figure out the new networking system and there still aren’t many resources online about it.

Ok so one of the idea’s behind the new networking HLAPI is ‘the same code should work for both the client and the server’, which baffled me at first but I went through the docs and tutorial anyway expecting it’d make sense, but it’s still confusing the hell outta me. It’s a lot like what I expected, marking certain things as server only, client only, both, (also I assume it’s possible to specify only certain clients at a time), but the thing I’m having trouble grasping is that a) the client and server are the same project that will build with the same resources even though each only ever needs certain resources, and b) the HLAPI seems to rely on any game object that need some kind of synchronization being the same exact game object on both client and server.

Another thing about the whole ‘same code works for client and server’ thing: Throughout the tutorials and docs the only reason the same code works is because you’re literally scattering if statements all throughout your code checking if the instance is currently the client or the server and executing different code accordingly. You’re still using different code for the client and server, you’re just putting them in the same script and surrounding each with if statements. I mean we could’ve already been doing that before but we don’t really because it’s just messy and inefficient. How is this an improvement? What am I missing here?

It might make some sense to network like this if the server is a player host, but for a dedicated server, isn’t doing it like this just going to be extremely inefficient? Since the client and server are the same project, and also use many of the same objects but only the parts that particular side of the network needs, isn’t the excess just going to hog resources for no reason?

For example, the server doesn’t need to render any graphics, but because the HLAPI is designed to have the server and client use the same objects, all the server objects will have graphics by default, which I have to specify to turn off individually only for the server for every graphical object in the game.

Another example is the majority of game logic. Normally the client would send input commands to the server and the server would process with game logic and then send the resulting outputs back to the client (and other clients). The client doesn’t need any game logic, with perhaps the exception of some prediction. The client only needs code for getting and sending input and receiving and handling output. However the SyncVar only works for variables of the exact same script. Which means I can’t have a variable on a client script and a variable on a different server script share the same SyncVar. The client or server needs the same gameobject with the same exact scripts including the ones that only the other should ever need (I think this is how it works). My clients have a bunch of game logic code that they don’t need that I have to specify not to use.

I hope this doesn’t sound too ranty, I’m expecting I’m just not using the HLAPI properly. How should I organize separate client and server code and still keep things synchronized? Maybe I should only be using command and RPC calls with a middle man and ignore sync vars entirely? I have no idea what the best options are for this.

Join the cry for the dedicated server library for uNet. It’s on the roadmap, but getting bumped down. We need it, along with latency smoothers like prediction, interpolation, etc.

0.0 I thought I just couldn’t figure it out yet. I was wondering why the tutorials had no interpolation. :s Where do I go to join the cry and bump it up?

Idk if I should continue developing with this or not in the mean time… :confused:

I’m deving a dedicated server using the llapi only, but I’d still rather have the functionality built into uNet, rather than bodging it. Wish we could hurry them up a bit.

Yeah i guess I’ll use the LLAPI then…

Damn I really thought the HLAPI would have all this already. Oh well.

Do you still use network identities and network transforms at least or no?

I have my own system for network entities, and am working on a method for prediction/interpolation - but it’s hard going. These are the things I want to see built into uNet for LLAPI and HLAPI users.

Oh my goodness. Now it makes sense. Before I decided to use unet, I read up on some game networking concepts and had the mindset that I was making a multiplayer game with a dedicated server. No wonder I’ve had so much trouble with the HLAPI so far.

However, I don’t have time to learn LLAPI and I don’t want to switch game engines. I know you’d have to butcher it, but could there be a way to kill all rendering on the “server client” and have it automatically host new games after they end? Then I wouldn’t have to redo all my past 3 months of work…

If anyone has any brilliant ideas, I’m open to suggestions. Guess I’ll see if Unreal has any good networking options… insert cry face here

…? Google, are you listening?

3577907--289060--Screen Shot 2018-07-27 at 9.56.38 AM.png

With my HLAPI you can do a dedicated server without the same set of code.
You can build a server project and a client project separetly.

Just add CLIENT or SERVER symbol to your projects.

You can use it for free, or just pick up some code and make your own things ^^.