Download

Having trouble wrapping my brain around networking

Basically what I want to do is, have a client spawn an actor, and have other clients be able to see it.

I watched 4/6 of the network tutorial videos, unfortunately he seems to only be performing actions with the server. I am able to spawn objects with the server and the client can see them fine, however I want a dedicated server setup where client are spawning things.

So… Am I supposed to spawn the actor with the client… and… also have the server spawn it? I dunno, like I said, having trouble wrappin’ my brain around it.

Networking is a highly difficult concept to grasp, with that being said you should feel pretty proud that it only took you 4 videos to understand most of what you need. I feel kinda ashamed because everytime I learn the concepts I forget and even now I don’t even know if I know what I’m talking about.

So I created this little video of kinda what I understand to be happening, and hope everyone feels free to correct me on this.

The server is like the big boss, in this particular model of client/server connection the server is responsible for keeping the game alive. The server is also the link from one player to the other. When sending stuff over from player 5 to player 30 for example you ask the server to do it and then he sends something over to player 30. When you want to do something that occurs on everybody’s computer like spawn a weapon, you ask the server to do it and then he’ll decide if that’s ok and tell the rest of the players (himself included) to spawn the weapon.

So to answer your question about whether you should spawn the actor on the client, my guess is no unless you want the object to be hidden from everyone else. Instead have all clients ask the server to spawn things anyone else will see then pass it down the the rest of the players.

One simple way to solve all networking issues that don’t make sense is to switch things around back and forth like a mad man. I mean you only have 3 options really, to run on the current machine, the server and multicast. It only takes a few runs in order to check if something is working on all machines. Another tip is to create a function that handles all spawning of object types on all machines. Then when you forget the networking concepts you can just call that function and expect everything is going to run smoothly.

https://youtube.com/watch?v=2Sii12G6BVo

Here is a file of the project in the video. It’s possible there are duplicates being spawned but if someone can spot that then I guess only then would it be an issue. hahaha

Download Networking example file

Thanks man!

It turns out trying to convert my existing code to have network functionality didn’t work, so I just started from scratch. It works now, but I’m still having issues “grasping” it, if you know what I mean. Your video helped :slight_smile: