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"

APlayerState score doesn't update when Host is far from Clients

So I ran into a weird issue and I'm not able to fix it. So I'm making a multiplayer game. When 2 clients are fighting and the Host is far from them, the score doesn't update. I do the score logic in my TakeDamage virtual function when Health is below 0 and that is wrapped in a HasAuthority() check. So I get the EventInstigator, get the PlayerState from it and increment score. This does not work when the Host is far away. Same with game state variables, they don't update when Host is far away. I can't remove HasAuthority because EventInstigator will be null on Clients and will crash. What am I supposed to do?

Product Version: UE 4.18
Tags:
more ▼

asked Dec 23 '17 at 12:55 AM in C++ Programming

avatar image

Ninja_K
80 5 8

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

1 answer: sort voted first

Hey there, that might be because of the net culling distance. To save on network bandwidth he doesn't send replication commands based on a certain distance.

more ▼

answered Dec 23 '17 at 01:03 AM

avatar image

xlar8or
6k 163 129 305

avatar image Ninja_K Dec 23 '17 at 01:08 AM

Oh yea, should have mentioned. That's what I thought too so I changed the Net Culling Distance on my character class. I made it 20 times the default and it didn't make any difference. There were instances where it will work sometimes when the Host is half way across the map but at the same spot later, it doesn't work. When the Host approaches the 2 Clients fighting, everything suddenly works.

I had an issue before where Clients weren't dying when Host is far away. So I made the Death/Respawn happen outside the HasAuthority check and it works. But I can't do the same for the score logic because of the EventInstigator.

avatar image Jin_VE Dec 23 '17 at 01:25 AM

Did you try enabling "Always Relevant"?

avatar image Ninja_K Dec 23 '17 at 03:21 AM

yes I've done that

avatar image xlar8or Dec 23 '17 at 01:24 AM

I'm not sure, but you might need to increase the net culling distance from the player state blueprint.

avatar image Ninja_K Dec 23 '17 at 03:37 AM

That didn't work either

(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