Multiplayer
LOADING SCREEN SYSTEM FOR UNREAL ENGINE 4 Update 1.05 (Oct 25, 2018) - NETWORK REPLICATION
For the full Documentation click here What’s New? Oct 25, 2018: Submitted Version 1.05 This version adds Network Replication, i.e. Multiplayer capabilities. Required Setup Some minor changes to Player Controller and Game Mode are necessary.
Use the provided BP_LSS_MP_Controller and BP_LSS_MP_GameMode
or - Reparent your existing Player Controller and GameMode to those classes
or -
Add Blueprint Interface "BPI_LSS_ClientToServer" to your Player Controller and GameMode.
Add Components: "BPC_ClientServerCOM" to GameMode and "BPC_LSS_PawnManager" + "BPC_LSS_ActorPool" to Player Controller.
Manually move nodes from BP_LSS_MP_Controller to your existing controller (9 events in total) and from BP_LSS_MP_GameMode to your GameMode (2 events).
Refer to map "15_PawnHandling_Map” for examples. HiRes Preview Screenshot: https://i.imgur.com/Pnw0HcX.jpg
Limitations Does not support Client connection to existing world on Server (e.g. dedicated server with a persistent world). Clients need to be already connected while Server initializes loading of levels. The way UE4 works, Clients connecting to an already loaded world on the server will load that world before the LSS can take any action. In such a situation it is highly recommended to set up seamless travel (Game Mode setting) and a default transition level (Project Settings).
Examples The project features 3 example maps with sample setups. One setup uses ServerTravel with 3 separate levels (Host/Join, Lobby, Game Level), the other implements everything in one Single Root, the 3rd is a barebones simplified example.
Single Root
Map: \Maps\Multiplayer\SingleRoot\Map_MultiplayerExample
When opened, the map will display two buttons, Host and Join.
You should Host on one instance of the game and Join on any others.
The host button executes the command "open LOBBY?listen", the Join button "open 127.0.0.1" to connect to the server.
LOBBY will display a Launch Game button and number of connected clients to the Host and a Ready button to the clients. The Launch Game button activates the Loading Screen System level transition on all clients. Once all clients have finished loading, the Server will receive (an optional) "Press key to continue" prompt. When accepted (or if not set in the first place), all clients will close their loading screens and fade into the loaded level.
ServerTravel
Map: \Maps\Multiplayer\ServerTravel_Map_MP_ServerTravel
This setup differs in such a way, that instead of starting the level transition in LOBBY a ServerTravel command is initiated instead, traversing into a third level, which then immediately starts a LSS transition as soon as all clients have traveled to the new level.
When using ServerTravel, all PlayerController, PlayerState, GameMode, and GameState instances are preserved.
This example should be run in Standalone mode, as execution in PIE (Play In Editor) might not work as expected. To test this example, launch 2 (or more) separate instances of a Standalone game by right-clicking your Project file (outside the editor, e.g. in Windows Explorer) and selecting "Launch game".
Simple
Map: \Maps\Multiplayer\Simple\Map_Map_MP_Simple_ROOT
A simplified setup with no lobby or Host / Join options. Can be run in Editor with auto-connect enabled in advanced launch options.
Player Pawn Selection The built in Pawn Handling feature (see example map number 15) is designed as an extension to the GameMode's "Default Pawn Class" setting and allows it to work in streaming level (not available by default) and with a per level choice for the class. The feature does not, however, allow for per player changes to the pawn being spawned by default. Such additional options might come in a future update, for the time being, automated pawn handling can be overridden using the GameMode event: BPI LSS Change Pawn.
This event will be executed at the start of a transition as well as at the end, once for the Loading Screen pawn (show on start and hide at the end of a transition) and for the Game Pawn (hide on start and show at the end of a transition). If you override the execution of the node connected by default, you can replace it with your own logic to determine what kind of pawn to spawn at that point - the event's input will provide the name of the map as well as an enumerator with the current state (show game pawn, hide game pawn, show transition pawn, hide transition pawn).
Changes
Pawn Handling Component moved from LSS Actor to Player Controller
Actor Pool Component moved from LSS Actor to Player Controller
Added "LSS Activate" and "LSS Play" nodes. The LSS Actor can now be set up with a level and loading screen in its details and stay dormant when "Active" is disabled. Running either of the new nodes will trigger a level transition with the current settings.
TODO
Servertravel setup
Select pawn class (1st vs 3rd person)
Select pawn material (add material variants to 1st person)
Add "prioritize player controller settings" to level settings
Read lobby settings (pawn class and material variant) on start
Added "Variant Parameters" to Pawn Handling settings (map settings) that can be used to alter the appearance (or any other features) of any spawned pawn / character class which implements the "BPI_LSS_PawnHandling". This feature can be easily expanded on to change material parameters, a skin or parameters of the character without selecting a different class, e.g. two players in multiplayer would possess a Third Person Character pawn, one blue one red. "Variant Parameters" accepts a case insensitive string which will be send to the spawned character in a blueprint interface event - this identifier then can be applied however the user sees it fit.
in the example content it is being used in the form of "=;=" sending multiple parameters with each a value. The example shows how to parse the input and will apply it to alter several features of the pawn without altering its class.
See example implementation in: "\Content\LSS_LoadingScreenSystem\DemoContent\ThirdPersonBP\Blueprints\BP_LSS_ThirdPersonCharacter"
Root (not connected)
Menu -> UI:Host/Join -> Open Level as Server or Client
Root (Connected)
Lobby
Powerful Level Transition Suite and Level Streaming Framework. Multiplayer support with Lobby and Character selection examples. Loading Screens with Progress Percentage indication and interactive Loading Screen scenes. Many example maps included, everything commented and showcased to be both, easy to integrate as well as a learning experience.
ISSUES:
Spawn Pawn - class is currently taken from map settings, should account for pc override
make sure input override is optional GameMode should implement own BPI with main LSS events rather than Change Pawn Move Change pawn from BPI Client Server to Pawn Handling Lobby level does not get unloaded on clients
finish adding events to gm
consider removing bpi events to gm and replacing with dispatcher bindings
save transition state as enum, allow joining players to receive pawn based on enum
Can't move pawns in loading screen (probably def settings)
Cursor enabled during game on client (maybe on server too)
Fade Actor uses old splash
[fix: project did not compile properly] Client does not possess character
Disconnects after a while with no possessed pawn
[fix: params were not sent to PC server side] Clients' game pawn does not apply params correctly
Char selection on client does not apply material (glow does work)
[fix: pawn class was not set in PC] Game Pawn fails to init on server when clients present
[fix: rep_notify still needs to be set on server]Character appearance does not replicate from client to server
Character appearance from server to client seems to apply on second toggle
On join, check if game in progress, request pawn spawning
Level Settings need to be copied to clients (test portal actor)
Control rotation doesnt seem to apply on client
Changes
Reorganized content of "UI" folder into subfolders.
Moved nodes controlling Example Menu (Level Selection ESC/Tab Menu) from Player Controller to HUD actor to enable the menu when the new Multiplayer PlayerController is selected.
Last updated
Was this helpful?