Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. Networking in Unreal
  2. Types of Servers
  3. Dedicated Servers
  4. This is something you see for MMO’s and more competitive Multiplayer games. This is when none of the clients is the server, but the server is done by the Company. It has it’s positives, as the connection is no longer dependent on the connection quality of the Host. The Server does not have to run its own client version of the game, and is just there to handle data. The Creators also have full control of the server.
  5. Local Server
  6. This is a server that runs on one of the clients. It is easier to setup than a dedicated server, and does not require maintenance by the developers. It is the Server that we will be using for our game, as it will be a lot easier to manage, setup, and playtest.
  7. Server-Client Relation
  8. The Networking in Unreal looks something like this. In our game we have 4 Players, one of which will also act as the Server. So we have 1 server, that plays the game, and 3 clients. So how does the interaction between these work?
  9. So for example, if we want to spawn the player, who does what? The server needs to decide if the Player should be spawned, then every client needs to spawn the player individually. If only the Server spawned the player then the clients would not be able to see it, if only the client spawned the player then the other clients wouldn’t know about it.
  10. This is because you do not want clients to talk directly to each other. All Information and decision making has to go through the server. So say the player wants to interact with something. Then the client handles the Input and sends the event to the server, the server than checks if that interaction is possible, and if so sends the action to all the clients.
  11. Replication
  12. Replication is the system that Unreal uses to make Networking a lot simpler. Replication allows us the call certain events on all Clients, only server and more options.
  13. Not Replicated
  14. This is the default setting in Unreal for Events. It is only run on the Client that calls it, not replicated anywhere. This is useful for UI Elements that are only run on the client.
  15. Multicast
  16. When called from the server this event will be called on all the connected clients. This is very useful for spawning actors, teleporting characters etc.
  17. Run on Server
  18. This is a very useful replication function. If this is called on the client than the event is send to the Server where it will be executed. After the client handles input it can then send that to the Server to sort out and then send a Multicast event back.
  19. Run on Owning Client
  20. Actors can have Clients as their owners. If this event is called, then it is only called by the client that owns that actor. This is less useful in Local Servers, because the server doesn’t run this event. Which makes multicast the preferable option most of the time.
  21. Variable Replication
  22. Each Variable can be replicated. If enabled the variable will be replicated to all the clients. So if the Variable is changed on the server, it will be changed on all the Clients.
  23. Calling Replicated Events
  24. Some odd behavior I have noticed is when you call a Multicast event. Not only is that event run on all clients, but the rest of the event where it is called from continues on all clients. So on the image below if we have 4 Players, RunOnServer is called once, MultiCasting1 is run 4 times, MultiCasting2 is run 16 times.
  25.  
  26. This has caused some mysterious issues, as our team was not aware of this until much later. On startup one of the events when a player joins was called 38 times.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement