Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How To Get some player info from all clients, store it on the server, then give a copy to all clients?

I have some sort of a lobby set and I want the players to be able to call the GameMode which has a list of all Player Controllers connected where the GameMode can then get the player info (struct) from all the Player Controllers, put it in an array, then give it back to all players so they can display the info on the HUD

I tried everything I could think of but I can't get it to work, I only get the server's Player Controller info over and over again. I'm sure that the Connected Player Controllers Array is set right and working, Sure that the Player Info is also set up properly, working and replicated

if you can provide example code as well, that would be generous of you as I'm still a beginner in networking

Product Version: UE 4.12
more ▼

asked Aug 17 '16 at 08:11 PM in C++ Programming

avatar image

25 11 13 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey aa1000,

The GameMode is going to only exist on the server. You can send information from the GameMode to all of the clients but clients wont be able to access the GameMode; unless they have a server side version of the class, such as a PlayerController.

If you want to replicate something to all clients from the GameMode, you can try something like:


 UFUNCTION( server, reliable, WithValidation )
 void ServerSendInfo( MyInfo *Info );


 bool AMyGameMode::ServerSendInfo_Validate( )
     // If you want to have a condition to be met in order for this to replicate, add here
     return true;
 void AMyGameMode::ServerSendInfo_Implementation( MyInfo *Info )
      for( FConstPlayerControllerIterator Controller = GetWorld()->GetPlayerControllerIterator(); Controller; ++Controller)
          AMyPlayerController *MyController = Cast<AMyPlayerController>( *Controller );
          if( MyController )
               MyController->ClientRecieveInfo( Info );


 UFUNCTION( client, reliable )
 void ClientRecieveInfo( const MyInfo *Info );
 MyInfo *LocalInfo;


 void AMyPlayerController::ClientRecieveInfo_Implementation( const MyInfo* Info )
     LocalInfo = Info;
more ▼

answered Aug 17 '16 at 09:26 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 17 127

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question