x

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"

Most elegant way to communicate value of TMap between clients?

I recently changed the way I store a certain set of variables from merely a set of int variables to a single TMap<FString, int32> variable. This is a far more elegant way to do what I wanted, so I'm not inclined to go back. However, because of the lack of replication and RPC functionality for TMaps, it broke a certain part of my multiplayer flow.

Basically I just want to do a one-time communication of these variables at the start of the session. It's not necessary to keep them replicated throughout the session.

Before I changed the variables to a single TMap, I used a combination of submitting the int variables from client to server in an RPC and replicating them to make sure everybody had the same values at the start of the game session. However, TMap objects cannot be replicated, and (correct me if I'm wrong) as far as I know, they can't be passed as arguments in an RPC.

So:

  1. How do I send the value of a TMap from a client's GameInstance to the server's GameState?

  2. How do I send the value of a TMap from the server's GameState to a client's GameState?

I can think of some crude ways (for example, sending each key-value pair in an RPC one-by-one and populating the recipient's TMap variable with the inputs, or sending two arrays through a single RPC call and looping through them at the recipient's side to populate the map), but I'd like to know of the most elegant way to accomplish this. What do other people do when they need to do this?

Product Version: UE 4.22
Tags:
more ▼

asked Jun 12 '19 at 05:58 PM in Using UE4

avatar image

Bridgeburners
6 1 3 4

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

0 answers: sort voted first
Be the first one to answer this question
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