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"

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. 

Inventory UI with UMG Networking

Does anyone know how to get this to work over the network?

https://www.youtube.com/watch?v=r4tltrLLVuQ

I would like to use this as a starting point for my inventory but need to get it working over the network before i can really get started.

Thanks

Product Version: UE 4.14
Tags:
more ▼

asked Nov 26 '16 at 12:44 AM in Blueprint Scripting

avatar image

skeetaseasonTV
11 8 12 15

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

1 answer: sort voted first

UMG is not made to work with Unreal's networking feature so simply replicating that is out of the question.

You have to proxy everything through an actor with permission to send RPCs to the server. The easiest one would be your player controller although you could use your pawn or even a different actor altogether.

This actor stores a list of items that you own. You can either have an array of integers that point towards a global list of items or you can have an array of item objects. We will go with the second approach. What you can do now is controlling your inventories on the server and the client separate from each other. You handle all item logic on the server and send RPCs to all clients with the given actor (the server and the client owning our controller in our case). A simple version of such an inventory would look like this:

alt text

An example scenario: Your character finds a lighter and walks into it thereby picking it up. The client ignores this event but the server now calls AddItem with the lighter class on the character's controller. It will then send an RPC to the clients and itself to append an instance of the item to the Items array. We also sent the index to ensure that the array on client and server is always in sync. Now you can follow the tutorial and once the user wants to use the lighter we pass in the index of the lighter within the array to the UseItem function where it will be executed on the server. Done. After every item add or item remove event you can update your inventory widget.

Note that this is a very simple menu system and usually you would want to check if the passed in item index is valid and if the item associated with it can be used at the moment etc. But for demonstration purposes this will do.

If you have any questions just ask ahead.

more ▼

answered Nov 26 '16 at 06:54 PM

avatar image

Schadek
198 6 4 12

(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