How to check player in multiplayer?

In multiplayer, how do I check which player is shooting/hitting etc.?
For example, Player 1 gets hit until health decrements to 0, then Player 2 (shooter) gets kill+1.
I do know about replicated variables and game itself is working in multiplayer, I just have no idea how to diversify between players.

Hi TK3D. There is a lot to explain with this question. Honesty, there are many ways that this can be handled. I think best way to learn would be to use an example. Fortunately, Epic gave us an example multiplayer FPS shooter called “Shooter Game”. Here is documentation on it. There is also entire project for “Shooter Game” that can be downloaded from the ‘Marketplace’. You can look through that project and see how they do it. They have “instant hit” weapons as well as “projectile” weapons.

I think this is in c++ but I’m not sure.

There might be other projects in the “Marketplace” that have example blueprint code that you can use to better understand multiplayer interaction.

In short, server will use the Instigator variable in some built in functions for Take Damage. So you “Shoot” from Player A who sends the “Shoot” request to server where it is handled. server does the “Shoot” stuff for Player A and determines that bullet hit Player B. server now has a reference to Player A and Player B and can tell them to do what they need to… take damage, increase points, show player they “hit” someone, etc. server handles it then replicates results to clients in one of many ways, depending on your implementation.

I would highly recommend looking through code/blueprints of some of existing projects to get a better idea. I also think there are multiplayer tutorial projects for blueprints in example projects as well.

Hopefully this will get you on your way to understanding interaction between players a little better.

Thanks for example. I already looked at shooter expample project but unfortunately it’s in C++.
Using instigator for managing damage works. I still have a lot of questions about networking stuff but for now, I’ll experiment a bit with that new information.

Apologies if you’ve seen these already. Based on fact you said you understand replication already you might have seen them.

I did, they were very helpful :slight_smile:
At moment I’m stuck at trying to get a kill count working. Do you have any ideas/pointers for me?

Another good project to reference is Couch Knights. It may take a bit to dig through it and understand how it works, especially because it uses two pawns per player and it’s set up as an Oculus game, but it is entirely blueprint and is essentially a multiplayer game. Good luck!

Thanks, I will have a look.

I looked at Couch Knights project and while it does have some interesting features I can learn from like caching and restoring physic assets positions, unfortunately it doesn’t have a kill count system or even an interface.

majority of that stuff will be stored in players PlayerState class and the GameMode class. server can manage player stats through the PlayerState and replicate those stats to client players to be handled there.

Exactly what I was hoping for…all that stuff is already there :smiley: Thanks for pointing me in right direction again.