UEHelpers Improvements for Dedicated Servers #688
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UEHelpers rework goes in the third round with new experience, now testing it on a dedicated game server.
Description
On a server first player controller instance appears only once a player has joined the server.
Therefore,
GetPlayerController
returns an invalid object, as doGetWorld
andGetWorldContextObject
, which were dependent on the player controller.I immediately run into the problem that I need a valid WorldContext/World while there are no players on the server.
I've changed the
GetWorld
to get the UWorld from the UGameInstance which always exist and returns the same UWorld player controller, but I left GetPlayerController code as fallback, in case a UGameInstance couldn't be found.The
GetWorldContextObject
now returnsGetWorld
.I will port some of my mods to make them compatible with the server and see if I can find more things to improve. Maybe even some new functions to help mod a server.
Testing
Slightly improved version of the lua code from before.
Result without a player on the server
Result with a player on the server
Result in client main menu
Result in client in game