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. 

Destroying Foliage Instances In Multiplayer Lag Glitch

I'm working on a multiplayer game and I'm trying to destroy the foliage instance the player is looking at it, so far I have tried these 2 methods: alt text alt text While the first executing the sphere trace on the server & client when destroying, and the second one only executing it on the server (from the event that calls "Remove Foliage Actor") and using that info to remove the instance. Both seem to be very glitchy, first one seems like it works fine in "Play In Editor", but after packaging and trying on an actual dedicated server with players, it seems to randomly not work for the clients (like 50%, just doesn't remove the instance for the clients, for the server it always seems to work).

Please help me figure out how to make it work.

Product Version: UE 4.19
screenshot-4.png (121.6 kB)
more ▼

asked Feb 07 '19 at 12:59 PM in Blueprint Scripting

avatar image

10 2 4 7

avatar image Trefexx Feb 07 '19 at 04:26 PM

You have a myriad of debugging options, have you tried printing out what you're hitting instead? Start pulling off values from the hit result, and handle the case of a failed cast.

Does the foliage have simple collision?

If I had to guess you're probably just not hitting the foliage if you're using a sphere trace. As soon as it hits something the trace will stop. What's to stop it from hitting the ground?

avatar image Tbjbu1 Feb 09 '19 at 02:08 AM

Everything seems to be working correctly. The issue is only in the packaged version of the game. In editor play mode it all works great. The instance just doesn't seem to be getting destroyed on the client. Also, for some reason, after I try to destroy one instance, all the trees around it (and that tree) start to get glitched with the camera, depending on where I look they show or disappear. All of this is only in the packaged version of the game.

avatar image Tbjbu1 Feb 09 '19 at 04:24 AM

UPDATE: I believe my issue is being caused by the amount of foliage instances that I have, before I added all of the foliage to my level everything worked fine. I have about 10k instances of what I'm trying to destroy. I guess it bugs everything out. Any ideas on how to fix this or a workaround?

avatar image Trefexx Feb 09 '19 at 04:57 AM

Disclaimer, i'm not a UE4 wiz, I just like finding stuff that breaks and how to to fix it by figuring out how things work.

I'm going to open the editor and try to replicate what you have set up. I don't know how a sphere trace works outside of the obvious. Unsure how often it does the collision check, but if it were to hit hundreds of the same thing in a single tick then it might break. Or cause an ensure, is there really nothing in your out logs or message log?

Did you try doing a sphere trace by objects instead?

avatar image Trefexx Feb 09 '19 at 07:15 AM

Hey Tbjbu1,

I recreated from the pictures you showed a similar project. Didn't run into any issues in PIE or a cooked build for win64. Did the same trace you did with the foliage instance static meshes, and put about 10,000 of them in the level. Does a trace between two arrows on the main player pawn, and gets rid of any foliage it hits. Maybe it's a replication issue?

avatar image Tbjbu1 Feb 10 '19 at 05:00 AM

Are you testing it with a dedicated server?

avatar image Trefexx Feb 10 '19 at 11:26 AM

No, client is the server in my setup. Which is why I think it's probably related to replication. Not sure what it would be exactly though.

(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