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"

What i should replicate?

Hi, i'm confused about network replication. What I realized is that if a variable is replicated, it is synchronized between the server and the client. Now for example i've start to make an inventory system that have an array which contain structs stored as "Items". I should replicate the inventory the array or both?

At my current point i'm frustrated because if i run some function "OnServer" i cant see any changes on clients. If i run in "multicast" variables isn't synchronized.

There some guidelines to follow? If screen is needed i can post it

Product Version: Not Selected
Tags:
more ▼

asked Dec 27 '14 at 01:15 PM in Blueprint Scripting

avatar image

Komahz
199 11 14 22

avatar image RAVaught Dec 27 '14 at 05:16 PM

Screen is not needed so much as a better explanation of what you are actually trying to accomplish. Replication is one of those things that will vary dramatically between games and implementations. For example, if you are making an RPG and you have a stat system, you might replicate the player stat integers, but not the names, choosing instead to store the names locally so that there is less traffic over the network.

Their is a very good tutorial on the Unreal Engine Youtube channel that talks a great deal about the ins and outs of replication, including which types are best to use in which scenarios.

avatar image Komahz Dec 27 '14 at 08:39 PM

Thanks RAVaught. For example, a multiplayer chat. I have a gamestate class that store an array of strings. With UMG when i type something, this will be added to the array in gamestate and propagated to all clients. So:

Client 1 > Server > Client1, Client2, Client3, Client5...

What i've achivied is only the server part (when i type somethings from server window). The function is replied to clients. But if i type from client, the function it's not propagated.

This is my setup Of UMG alt text

avatar image RAVaught Dec 28 '14 at 11:33 AM

Ok, I see a couple of things here, most of which are hard to tell from a single screen shot, so let me ask you a few questions and see where it gets us.

  1. Where is the event Client Add Entry being called? I see the client bind event, but not the event call to client add entry. This stands out as uniquely different from your server code, which has the event call but no event bind.

  2. Where are there variables that you are trying to replicate? You have precisely 0 variables in this graph. Obviously, you don't want to pass an array of strings every time, just the string as a parameter, so I see no need to actually replicate anything in this instance. If you replicated the array of strings, it would try and pass the entire array at every update (I think) which could quickly consume a lot of bandwidth.

  3. Why aren't you using a Switch has Authority? Ideally, you would use a Switch Has Authority node after the Switch on ETextCommit. The server branch would update the StateMachine and the remote branch would update the local users window. Not only would this prevent a potential vulnerability, but it would also give you an entry point for any other types of checks you wanted to do.

  4. (Not A Question, but a suggestion) I've found CastTo nodes to be rather problematic. I would create an Interface Blueprint that is implemented by your game state object, and call the interface message instead of using the cast.

Hope this helps, Tony

(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