Creating a multiplayer group system
I'm looking into developing a group system for my game but am a little lost. Also as a side note, I'm running a 4.19 source built version of the game with the advanced sessions plugin for using dedicated servers & steam integration.
Here's how I want it to work: Player A walks up to player B and interacts with them, There will then be a confirmation popup on player A's screen asking if they want to invite player B, Then that will trigger a pop up on player B's screen prompting if they would like to join Player A's group.
I'm a little lost on how to communicate between the two players; Currently, when a player presses F there is a line trace which allows the player to interact with various objects in the game.
What I don't know how to do is check if the hit object is a player, & if it is be able to send messages between the interacting player and the player that was interacted.
Also how would I store each players information in array for the actual group itself? Would you get the players unique ID & store that in an array for instance. Or perhaps have a struct for each player's information and then the guild would be an array of player structs.
Any tips or pointers on how to go about doing this would be greatly appreciated.
asked May 20 '18 at 01:33 AM in Blueprint Scripting
My advice would be to use an interface that allows "various objects" to determine how the player can interact with them. Your other player characters would implement that interface, and their "Interact" method (or whatever you decide to name the method in your interface) would contain the code for putting the players into a group together (or presenting the UI to do so).
How you should store the guild is going to largely depend on what you plan to do with it. As far as identifying the players, I tend to avoid the unique ID - I prefer to use credential based identification of other players. This might be based on some misconceptions on my part (I'm still a novice at developing multiplayer games in UE4), but I suspect the unique ID doesn't persist between sessions. Your player's username is something you can expect to remain constant (if you provide them with the ability to change usernames, just make sure you update it everywhere their old username appeared).
Hope that gives you some ideas!
answered Jan 08 '19 at 06:29 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here