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"

Proper use of NetDormancy

There are quite a few networked actors in my game and I was getting some high Net Tick Times. when they were checking for relevancy. The answer seemed to be net dormancy. As soon as I implemented it the net tick time dropped and all was good. That is until I went to interact with anything.

It seems that waking up an object is a bit more involved. In my constructor I set my actors to:

 NetDormancy = ENetDormancy::DORM_Initial; 

When I say want to delete a block, I call a server function that deletes the block and that usually replicated down. Now it does not because the channel is dormant.

So instead I call

 if (TargetActor)
 {
         TargetActor->ForceNetUpdate();
         GetWorld()->DestroyActor(TargetActor);
 }

I choose to use ForceNetUpdate because it internally calls FlushNetDormancy and sets the net update time so it should update next tick.

The problem is that this does not seem to wake up the channel. The server always destroys the actor but the client does not. Has anyone successfully used this?

Product Version: UE 4.17
Tags:
more ▼

asked Dec 05 '18 at 02:21 PM in C++ Programming

avatar image

Justin.Dooley
2.1k 104 73 163

avatar image Justin.Dooley Dec 05 '18 at 05:37 PM

So I've been looking into this more and can confirm that my connections are coming out of dormancy.

 FNetworkObjectInfo* NetInfo = Actor->GetNetworkObjectInfo();
 TSet<TWeakObjectPtr<UNetConnection>> DormConnections = NetInfo->DormantConnections;
 TArray< TWeakObjectPtr<UNetConnection>> Connections = DormConnections.Array();
 
 UE_LOG(LogTemp, Display, TEXT("%s has %d Dormant Connections"), *Actor->GetName(), DormConnections.Num());
 for (int i = 0; i < Connections.Num(); i++)
 {
     if (Connections.IsValidIndex(i))
     {
         UE_LOG(LogTemp, Display, TEXT("%s is Dormant"), *Connections[i]->GetName());
     }
 }

Before I call TargetActor->ForceNetUpdate(); I get this output:

 LogTemp: Display: RTile_46 has 2 Dormant Connections
 LogTemp: Display: IpConnection_18 is Dormant
 LogTemp: Display: IpConnection_19 is Dormant

After I call TargetActor->ForceNetUpdate(); and set it to AWAKE It outputs no dormant connections. Seems like a dormant connection is not the problem here. What could it be?

(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