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"

Please fix the actor 'Replicates' flag one way or another

A dev might want to move an AActor or APawn in the server and expect to see the movement reflected in the remote clients. He checks the 'Replicates' flag, moves the actor/pawn on the server and then spends hours trying to figure out why it didn't do anything on the remote clients.

I see many posts about this in these forums, never with an answer or explanation, and many people wasting hours and hours of development time because the feature they see listed in the documentation doesn't really exist. Certainly not as advertised.

If I'm supposed to propagate the actor's movement to remote clients through an RPC, or the feature only works with Blueprints (haven't tried it), that should be on the docs. If Epic intends to only support people using a UCharacterMovementComponent or ACharacter for actor movement, that should be there as well.

Sometimes people say, "but with ACharacter you get client-side prediction" which is saying Epic's way is the only way and to hell with modular design (isn't the point of components to adhere to modular design?). ACharacter is a total mess of random features, functions, and voodoo values stirred into a soup of chaos. If I want to use AActor to get rid of a lot of that bloat and crap that I'm not using and adhere to clean modular designs, I shouldn't be penalized for it.

Here's a sample test if you're curious: A Simple AActor - NOT ACharacter, NO UCharacterMovementComponent- with the replication flag on and which moves itself on the server. Result: The actor moves on the server but not on the remote clients. I.E. The 'Replicates' flag does nothing, as far as devs can see.

alt text

alt text

Header:

UCLASS() class TESTPROJ_API ATestRepActor : public AActor { GENERATED_BODY()

 public:    
     ATestRepActor();
     virtual void Tick( float DeltaSeconds ) override;
     float TestTime;
 };

CPP:

 ATestRepActor::ATestRepActor()
 {
     PrimaryActorTick.bCanEverTick = true;
     TestTime = 3.0f;
 }
 
 void ATestRepActor::Tick( float DeltaTime )
 {
     Super::Tick( DeltaTime );
     if (Role == ROLE_Authority)
     {
         TestTime -= DeltaTime;
         if (TestTime <= 0.0f)
         {
             TestTime = 3.0f;
             FVector Temp = GetActorLocation();
             Temp.X += 10.0f;
             SetActorLocation(Temp);
         }
     }
 }


Product Version: UE 4.9
Tags:
setup1.jpg (27.4 kB)
setup2.jpg (40.1 kB)
more ▼

asked May 17 '16 at 07:41 AM in Bug Reports

avatar image

rantrod
1.5k 47 47 213

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

So I commented everything out that wasn't just the simple move-the-actor-in-the-server-tick from the whole project. Ran it, and it worked. I thought, "great, now I can add everything back in one-by-one until it breaks again and I'll see what was wrong".

I added everything back in one-by-one, testing after each addition. I ended up adding everything back in, and it still working. Same.Exact.Code. My conclusion is that it was a BS UE4 actor corruption crap like it's happened to me so many times in the past. Too many to count by this point.

more ▼

answered May 18 '16 at 08:10 AM

avatar image

rantrod
1.5k 47 47 213

(comments are locked)
10|2000 characters needed characters left

You did not call Super and replication functions:

 AMyActor::AMyActor()
     :Super()
 {
     PrimaryActorTick.bCanEverTick = true;
     TestTime = 1.0f;
     SetReplicateMovement(true);
     SetReplicates(true);
     bAlwaysRelevant = true;
 }

Video

more ▼

answered May 17 '16 at 10:38 PM

avatar image

mpo
573 23 13 46

(comments are locked)
10|2000 characters needed characters left

This isn't a bug, bReplicates (the variable for the box you're ticking) will set the actor to replicate, then you can declare variables with a UPROPERTY(Replicated) to have them replicate from the server to clients (never in reverse), or call RPCs to and from the server with a UFUNCTION(Reliable/Unreliable, Server/Client, WithValidation or not).

However I will agree that the documentation really is terrible. There are some really handy slides to read through and bookmark for reference here if you haven't already: http://www.slideshare.net/JoeGraf1/ue4-networking

The wiki also has some handy pieces on it such as this one: https://wiki.unrealengine.com/Replication

Good luck!

more ▼

answered May 17 '16 at 10:50 AM

avatar image

Vaei
576 27 24 50

avatar image rantrod May 17 '16 at 06:42 PM

It's a bug because if you set that variable for the intention of replicating changes in location for the actor made on the server, nothing happens - nothing is replicated. Replicating properties, which is what you're talking about, could have its own flag or doesn't need that flag anyway because you have to reimplement GetLifetimeReplicatedProps which should do the job on its own just fine.

avatar image Vaei May 17 '16 at 07:11 PM

It is working as intended, you're implying it should simply replicate every single thing and that would hurt a lot of developers and their games, it's setup like this for optimization. Unreal engine is an engine in which you can make a game rather than a preset made for you and an engine needs to draw the line between providing functionality and making the game for you because the later takes away control from the developers. It needs to work the way it currently does for optimisation.

avatar image rantrod May 17 '16 at 09:59 PM

You're saying that if I have Replicates on and Replicate Movement on and nothing actually replicates, that it's NOT a bug? hmm...not sure if I agree with that.

avatar image Vaei May 17 '16 at 10:06 PM

You can have an opinion on how you think it should work, but until that's it's intended purpose it's not a bug and that's not up to an opinion.

I linked you to some learning material and I suggest you use it because you wont make games following that mindset.

avatar image rantrod May 17 '16 at 10:29 PM

I do appreciate you tried to help and the link looks great. I'd rather have pages I can read which I can go through much quicker than a video. I do disagree about this topic with you but I appreciate people responded.

Not to be argumentative, but I also disagree with "you wont make games following that mindset". I've found the opposite to be true. People who ignore issues other people create end up drowning in other people's work. If I order a ham sandwich and I get turd-on-a-plate, it's in my right to complain. They can say, "we didn't say it would be an actual ham sandwich, that just a name we picked", but you'd be doing everyone a favor by asking them to rename it or sell an actual ham sandwich.

avatar image Vaei May 17 '16 at 11:12 PM

We are talking in sandwiches now? Alright then.

And if a store sells custom made sandwiches and one person says they should only do ham sandwiches because they can't be bothered specifying their options then everyone else loses.

You're that one person right now.

That's a slide, not a video.

(comments are locked)
10|2000 characters needed characters left
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