LocusReplicationGraph icon indicating copy to clipboard operation
LocusReplicationGraph copied to clipboard

How to using RepGraph to a BP project by myself ?

Open xiaoaq opened this issue 6 years ago • 22 comments

Hi, Locus, I'm sorry to disturb you again. Should I using BasicReplicationGraph.h if my project base classes are not in C++, since I can't set routings unless the bases are in c++ , right? And how much percentage can be optimize if only BasicReplicationGraph is used in BP project ?

xiaoaq avatar Mar 06 '19 04:03 xiaoaq

It doesn't matter your base class is BP or not. you can set whatever you want in the LocusReplicationGraph inherited blueprint. image

But your project should not be BP only because plugin itself is c++

locus84 avatar Mar 06 '19 05:03 locus84

Do I need to care about switching between different levels(or worlds)? If not, I can add all the classes that need to be added in level to ReplicationPolicySettings/ReplicationInfoSettings at once?

xiaoaq avatar Mar 06 '19 09:03 xiaoaq

No you don't need to care about scenes. It's bound to NetDriver so the setting will be valid across network scenes. Yes, just add your classes there.

locus84 avatar Mar 06 '19 09:03 locus84

Got it! If the ReplicationPolicySettings/ReplicationInfoSettings is not set up, the plugin implements the basic functions, like BasicReplicationGraph, right? If so, will it be significantly optimized?

xiaoaq avatar Mar 06 '19 09:03 xiaoaq

It depends, But I strongly recommend you to tweak those settings as low as possible, and expend further later on when needed.

locus84 avatar Mar 06 '19 10:03 locus84

When GetChecked my own class, will throw exception, like 'No ClassInfo found for BP_A_Gun_C'. const bool bClassIsSpatialized = IsSpatialized(ClassRepNodePolicies.GetChecked(ReplicatedClass)); image

xiaoaq avatar Mar 07 '19 02:03 xiaoaq

Exceptions will also be thrown after running for a period of time.

image

image

I'm not sure what caused it..

xiaoaq avatar Mar 07 '19 04:03 xiaoaq

Thank you for sharing these errors, can you share me callstacks? so I can look into it. Have you added more than 200ish items in a grid?

locus84 avatar Mar 07 '19 05:03 locus84

You have to list up all networked actors in Replication Info Settings. At least it's root AActor class.

locus84 avatar Mar 07 '19 05:03 locus84

Sure! This is the callstacks for question which exception at GetChecked . image

xiaoaq avatar Mar 07 '19 09:03 xiaoaq

Is there a limit on the number of items per gird? This is the level I tested, and there will be AI generated after Playing. image


BTW,I'm sorry If I don't understand your means very well. In fact, I'm not good at English. Plz forgive me. ^ ^

xiaoaq avatar Mar 07 '19 09:03 xiaoaq

You have to list up all networked actors in Replication Info Settings. At least it's root AActor class.


I didn't adjust the plugin setting. I used the default settings. Is that the problem?

xiaoaq avatar Mar 07 '19 09:03 xiaoaq

You have to add your gun BP to the setting list Only pawn is listed in default settings

locus84 avatar Mar 07 '19 09:03 locus84

Well, I seem to understand. Take the gun for example, I should add the gun to Replication Policy Settings and set it to NotRouted; then when Character picks up the gun, I add the gun to Character through the AddDependent Actor, and synchronize with Character. As for Character, I need to set not only Policy, but also ReplicationInfo. Is that so?

xiaoaq avatar Mar 07 '19 10:03 xiaoaq

Exactly, because there's already a setting for Pawn which is parent class of Character. You don't have to. Likewise, if there's a parent class that represent all of you item classes(let's say Gun is child class of Item), you can add it into Info settings, leads all of child class(Gun, for example) will follow that that setting.

locus84 avatar Mar 07 '19 13:03 locus84

Got it! So if I don't check 'Include Child Class', even if a class inherits it, the child class won't follow its settings, right? Hypothesis,Gun is a child-class of Character and bullet is a child-class of gun(via bullet AddDependentActor to gun?). Will bullets be follow Character's settings?

I also have a question: Pawn set RepInfo but not set RepPolicy at the same time? So what knows what kind of policy it is?

xiaoaq avatar Mar 08 '19 03:03 xiaoaq

Default RepPolicy for all networked actors is 'Spatialized Dynamic'. If you want 'Always relevant' or 'Spatialized static' or 'Not routed'(like your Gun), you need add your own policy for that class. You can use LocusRepGraph.PrintRouting console command to check actors' policy.

locus84 avatar Mar 08 '19 04:03 locus84

Thank you very much for your patient and detailed answer! I basically understand this part. ————————————————————————————————————————

image About the params of RepGraph & RepClassInfo, I know that adjustments need to be made according to actual projects, but is there have a basic rule can follow ?

In my test scene, this error is always reported, and I tried to adjust some parameters. I reduced the cell size, increased the number of buckets, but no use also? Am I putting too many items in a small range?

image image

xiaoaq avatar Mar 08 '19 09:03 xiaoaq

And, what 's the role of Buckets?

xiaoaq avatar Mar 08 '19 09:03 xiaoaq

Exactly, you're putting too many Items in small range. That error is came from pure ReplicationGraph plugin, not from mine. How's put your non-player actor to Spatialized static policy?

If you're doing some kind of stress test, you better scatter your objects into larger area. And reduce cull distance squard(to reduce view range).

locus84 avatar Mar 08 '19 09:03 locus84

Bucket is kind of a list which holds actors that should be relevant to an actor in corresponding grid. The error means that requested bucket size is too large to allocate.

locus84 avatar Mar 08 '19 09:03 locus84

Yes, that's the problem. How should I setting the rep-policy for the actor spawn in the playing? If static existence is known after spawn, set it Spatialize_Static; but if the actor can be destroyed, can it be set to Spatialize_Dormancy? If it's dormancy policy, do I need to manage the actor's dormancy attribute after setting it up?

xiaoaq avatar Mar 09 '19 07:03 xiaoaq