I am very new to Multiplayer and Unreal in general. SO far I have learned a lot but I still feel lost sometimes.
The issue I am having is figuring out the logic in handling spawned characters in multiplayer.
I figured out how to create players then spawn a character and attach it to a controller and an assortment of other cool stuff. However I am still lost on how to detect player and character in certain situations.
For example. If I spawn the SAME character for every player, that is no problem, all the script is setup with casts and links to “Character1”.
But if I try to get silly and spawn a different character for each player created I get issued.
When I try to trigger overlap events, I cant get the overlap to figure out which character triggered it or is the “Other Actor” in the overlap.
I tried doing branch checks on overlaps with checking of the “Other actor” == “Character1” or “Character2” or “Character3” etc. but each cast was failing. It only worked if the “other Actor” was directly connected to the cast itself.
How would I implement the logic of knowing which character the player is using?
I tried using the same Character using the same skeleton, but using a different mesh, and that was failing hard because the meshes from Mixamo don’t use the “EXACT” Skeleton. So the meshes would look all weird. Ultimately I would have to probably create a “SHELL” Character Blueprint with a Custom Skeleton and have ALL my meshes work with that 1 skeleton and set Skeletal Mesh on each character spawn.
Something I learned when doing multiplayer is not to use the Get Player Character nodes. The index values are for local play apparently (correct me if I’m wrong).
You may want to look into using “Is Locally Controlled” for branch checks. Also look into Remote Procedure Calls (RPCs) - Page 59 in Cedric’s compendium.
Hang in there, you’ll get the hand of it. It can take a great deal of effort (and logic) to get the same functionality working for multiplayer than in singleplayer.
This video is another great resource if you haven’t watched it already! https://www…com/watch?v=09yWANtKmC8
Something I learned when doing multiplayer is not to use the Get Player Character nodes. The index values are for local play apparently (correct me if I’m wrong).
You may want to look into using “Is Locally Controlled” for branch checks. Also look into Remote Procedure Calls (RPCs) - Page 59 in Cedric’s compendium.
Hang in there, you’ll get the hand of it. It can take a great deal of effort (and logic) to get the same functionality working for multiplayer than in singleplayer.
This video is another great resource if you haven’t watched it already!https://.com/watch?v=09yWANtKmC8[/QUOTE]
Thanks so much!!!
I have to look into the locally controlled and RPC logic, THANKS!
Create a parent character class “MyCharacter”. Put everything you need for the character in that class. Variables, Input Handling, struct configs etc. When it’s finished create a “child class derived from MyCharacter” for each new character. Modify/Set variables, configs, skeletal mesh etc.
On overlap, hit, etc cast to the Parent Class (MyCharacter).
If you extend the child class and need access to the extended variables, functions etc you can use get class -> get display name -> switch on string, then cast accurately. This tends to get messy, so it’s best to have everything needed in the parent.