Player Subsystem for multiplayer game

reisandbeans
Mon, 22 Jan 2024 23:45:43 +0000
Multiplayer & Networking

Hello everyone. I have a question about subsystems and multiplayer games.

I started my own game a while back (at the same time I started learning Unreal Engine, so feel free to point out if I’m on the wrong direction or my understanding about something is fundamentally incorrect).

I was creating some of the game systems (such as QuestManager, Inventory, etc) as LocalPlayerSubsystems because
1 - It really helped me keep things organized
2 - Subsystems have a lifetime that aligns more with what I want - for example, I don’t want to have to recreate/reload the quest state when player switches levels

But then I started facing issues when introducing support for multiplayer, since LocalPlayerSubsystems are coupled to LocalPlayers and I wanted this systems to exist on the server for each player.
So I then switched to storing these things as actor components on the player state and all that, but the lifecycle thing really bothers me. I know I can copy from the old player state to the new when switching levels, but that seems a bit… unnecessary - all I wanted is for a couple of things to be preserved when switching levels, but on a per player fashion.
As an example of what I’m trying to achieve, consider a game like Borderlands or Diablo, where you have co-op support and each player has their own inventory.

So my question is: are there alternatives I didn’t consider? Maybe something like creating my own subsystem?

1 post - 1 participant