Download

[Please Help Me] Questions regarding Multiplayer in Blueprints

Hello community, please help me with this…

For the past few weeks I’ve been reading everything I could about multiplayer, watching videos and such, but I’m still stuck in the development of my game.
So I’ll list here all the questions I couldn’t find an answer or just couldn’t figure out the explanations/documentations.

What am I trying to do?
My game is basically a big arena where mages fight to death in a deathmatch style.

What do I need?
The Players join a game and chooses his/her team, element and spells (each selection have its own widget),
and after selecting all this things, the game spawns a mage for him/her, and they all go to battle. THATS IT!

So… pretty simple, but believe it or not, I’ve spent about 2 weeks trying to make this work and with no success.

To the questions then:

Where is the best place to create the widgets for selecting Teams, Elements and Spells for my player? In the Game Mode? Is in the Player controller? Inside the Pawns? Honestly, I’ve changed the way this widgets are created so many times, but the clients always get bugged.

Where is the best place to store this values (Team, Element choice, spells choices)? In Player State? Player Controller? Player Pawn? I started storing this values in the Player Controller, but it seems that Player Controller don’t replicate, so I tried using the Player State, but working with it is just a pain and I can’t find any info/docs about it.

How can I properly update my clients through Game State and Player State or Vice-Versa? Working with this two has been really painfull to be honest, the documentation says you should use game state and player state that replicates, to have clients updated, but I can’t just figure out HOW, I can’t find nothing about this anywhere, how to use it or what does it need to work…

Where should I use/cause/receive Damage? Event Any Damage seems to exist in almost every class, but I’ve read that damage should be only calculated/registered server side, so what am I supposed to do?

How can I properly destroy actors? Same as the damage, “only the server should destroy actors, otherwise the clients won’t know about it”… HOW to do this then? Another case where the is no information about it and what you should do to make things work properly.

Sorry if I look mad writing this, its because I AM! I started making this game just for fun, to start things up as a game designer, but Oh My! I’m regreting the decision to make a multiplayer game so hard…

Just for reference, Ive basically copied all the setup from this vídeo on how to setup multiplayer with steam [https://www.youtube.com/watch?v=6RlYegIkN0Y]
And everything in this video just works fine, no problems here… the problems start when I try to control when and where the pawns are spawned, and to create their widgets so the players can select their teams, elements and spells.

So please community, I beg you! Please tell me what to do, I’m so tired of working on this game with no success, but I promissed myself I would ask for help before giving up.

Thank you.

I’m a beginner as well, but I’ve had luck doing similar things over the past few months so I’ll try to give you at least some thing to base on. I had many similar questions a few months ago and not a lot of answers. Please note that there are many ways to do, pretty much everything. What I’ll write most likely won’t be the most efficient or professional solution to these things. It won’t be very detailed either, I might post screenshots of my stuff if that helps.

You could even do that in the character blueprint itself. For example, in my current game, I have a seperate widget for menus and such stuff. When I press my “pause” or “menu” button, I simply call my widget from my character blueprint with a cast and let it take over while the player presses buttons or sets some things in the “menu”.

What issues are you having with PlayerStates? Basically, you can think of PlayerState as a replicatable version of each PlayerController.

One incredibly (in my opinion) useful thing is the default “PlayerArray” variable in the GameState blueprint. Throw it into a foreachloop and you’ll get all the currently connected players. Or to be more exact, you’ll get their PlayerStates.

Here I send a reference for each playercontroller over to their PlayerState so I can easily contact the playercontroller any time I need from the playerstate.

Here I keep a reference of all my player controllers, gotten from their PlayerStates in “my game state” blueprint.

All my players stats is kept in their PlayerState (at least until I save it). It keeps a reference for score, classes, locations, etc.

A “destroy actor” node in the character blueprint for example. You could also do it in the game mode if you’re keeping a reference there to your characters.

I’m doing it with a “destroy actor” node in my character blueprint. I don’t remember if I had the event triggering it set to “run on server” on replication, but it wouldn’t hurt to try I guess.

Depends on where you keep that stuff I guess. I’m storing my health variable in player states, once a character fires on another, the collision gets broken and I get the hit of the “other actor” and simply cast to him by how much his health should decrease. Once it reaches a certain threshold he’s dead and gets destroyed eventually. Very simple stuff. Ofcourse I run some of the events on server etc.

I use both my game/my game state to spawn actors. I load locations/transform variables from my save game and then create new instances of those characters based on the recipe (location, class, etc) i saved.

I feel your pain and could use answers to many of the same questions. I recently downloaded the Multiplayer Systems blueprints by eXi on Marketplace and he has some really good info in there. I’m working to get my game set up in his system and it’s super slow going since I only sort of understand what’s happening, but his stuff seems really well thought out and might be a good place to learn how to use the different framework blueprints.

For spawning, I’ve tried that same tutorial you linked to and it never worked for me since I’m doing a card game and want pawns in specific places every time. eXi’s system had a better way of doing it that I had to alter a bit, but seems to work pretty well for me. Basically, scrap the player starts and make a simple blueprint to use as a spawn point. Place that in the world where you want players to spawn and then in your Player Controller, run a ForEach getting the spawn points and spawn your character to that location/rotation. In the Spawnpoint BP, you just need a bool to indicate if it’s been used or not then when you spawn, check that so the next guy doesn’t use it. His goes deeper to save that info for respawns and such, but that’s the general gist. I do mine slightly different since I have my pawns already placed in the world, I just possess them rather than spawn them.

PM if you have questions on that part anyway and good luck with all the rest. :slight_smile: