Notes on Multiplayer
- Shift F1 to toggle between multiplayer views
- Game Instance :
Game instance created when game starts and lasts until that game executable closes, persisting across level changes and joining sessions etc.
Game instance is only aware of its own executable. Does not have any connection between server and clients. Lives only on the client.
- Authoritative actor, live normally on the server.
- Actor Role and RemoteRole ; https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/Roles/index.html
- Server has the authoritative gamestate https://docs.unrealengine.com/en-US/Gameplay/Networking/Overview/index.html
- Automatous Proxy : which is an actor on a network client that is controlled by a user on that client.
- Simulated Proxy : see https://answers.unrealengine.com/questions/897406/autonomous-proxy-meaning.html
- BP Setting Replicate
- BP Repnotify : When variable is changed, function is fired to tel al clients that something has changed. In the example only the server can changes the variable health at the clients
- BP setting Replicate Movement.
- BP setting Conditional Property Replication
- With projectile, the client has authority over the projectile and sends a message to the server. So the other clients now a projectile is coming.
- Healthbar is set at Character!
- Hud, animation, particle systems, physics, sound effects does not replicate
- Replicating Functions in Blueprints There are 3 primary types of replicated functions: Multicast, Run on Server, and Run on owning Client. Multicast functions should be called on the server, where they are executed, and then forwarded automatically to clients. Server functions are called by a client and then only executed on the server. Client functions are called by the server and then only execute on the owning client.
Is for example used with weapons.
- Weapon is set at character
- Spawn and Destroy an Actor with Blueprint Set owner and instigator to self.
- Server and Client RPC Server RPC is called on the client an executed on the server.
Client RPC is called on the server and executed on the client. Multicast RPCs are designed to be called from the server, and then executed on the server as well as all currently connected clients.
- Problem with Multicast over repnotify is that Multicast happens in game. So if a player join later, no adjustments are made.
- Actor Relevancy and Priority Works with NetMulticast function
- Is Server or Switch on Has Authority Does not work with dedicated server, because dedicated has no screen?
- Is Locally Controlled, Could be used to not receive a multicast.
- Get Remote Role enum ENetRole ROLE_None, ROLE_SimulatedProxy, ROLE_AutonomousProxy, ROLE_Authority, ROLE_MAX,
- Property Specifiers Transient : Property is transient, meaning it will not be saved or loaded
- Get Instigator (aanstichter)
- Get Instigator Controller
- When building a custom event at graph replicates, you can choose where the function will run
- RPCs (Remote Procedure Calls) Are functions that are called locally, but executed remotely on another machine (separate from the calling machine).RPC functions can be very useful and allow either the client or the server to send messages to each other over a network connection. By default, RPCs are unreliable. To ensure that an RPC call is executed on the remote machine, you can specify the Reliable keyword:
- With a reliable function, it will keep sending messages to the remote until it gets conformation that the message is received. Caveat is that when nu conformation is received, the buffer overflows and the connection will get lost.
- When unreliable? Particle effects, sounds , movement (goes per tick)
- Kick players from the system by deleting the player controller
- Player controller is replicated out off the box. Only exits on client and server. Direct communication between 2 player controllers on different clients is not possible
- Network Multiplayer Fundamentals
- Unreal documentation
- Quick Start C++
- Compendium Cedric Neukirchen
- Tom Looman
VR Expansion Plugin