Giter VIP home page Giter VIP logo

locusreplicationgraph's Introduction

Hashem Game Dev Edit of Locus Replication Graph

This fork adds support for 4.26-5.0 which are the latest versions of Unreal engine , Star and share with others.

This is an extension of ReplicationGraph plugin introduced in UE 4.20. It contains a few blueprint library functions that controls replication graph.

As Epic provides a good example of ReplicationGraph in ShooterGame project, most of concepts are came from there.

What it does

Basic functionality that ReplicationGraph provies +
It expose basic control of ReplicationGraph to Blueprints.
It supports actors that only relevant to owner connection.
It supports actors that only relevant to team connections.
It provides api that add/remove dependent actors(c++/blueprint).

How to install

  1. Download or clone this repo.

  2. Create "Plugins" folder in root folder of your project.

  3. UnZip/Paste downloaded files into Plugins/LocusReplicationGraph.

  4. Open project, under Edit/Plugins window, enable LocusReplicationGraphPlugin in Project/Networking. This step requires restart/compile. enableplugin

  5. Now, create your blueprint class and inherit from LocusReplicationGraph. Do required settings there. createblueprint

  6. Open up Config/DefaultEngine.ini then add

[/Script/OnlineSubsystemUtils.IpNetDriver] 
ReplicationDriverClassName="[Your custom blueprint created in step 5]"

*this usually looks like this

ReplicationDriverClassName="/Game/Blueprints/Online/CustomReplicationGraph.CustomReplicationGraph_C"

defaultengine

  1. Play game in network mode and type console command blow to ensure it works
LocusRepGraph.PrintRouting

How to use it.

After installation, open up created blueprint class. In Class default details, there are some settings that you may customize to fit your own game.
classdefaults
Each of these values have simple description you can check when you hover your mouse.

During play, you can access ReplicationGraph's functionality with given library functions.
blueprintfunctionlist

  1. Add/Remove Dependent Actor.
  • Add/Remove Dependent actor to Replicator's dependent actor list. Whenever Replicator actor replicates, DependentActor will replicate either.
  • Dependent Actor should not routed to any nodes(but bReplicated=true), as well as Replicator actor should be currently networked.
  1. Set Team for Player Controller.
  • Set Team name for a APlayerController. Name_None does not have team(default)
  • Routed Policy Relevant Team Connection will show your owned Actors to teammates
  1. Change Owner and Refresh Replication.
  • As we don't collect all replicated actor's owner during playtime, you have to tell exactly which actor want to change it's owner.
  • Actor will be out of ReplicationRgaph, and back to it after changing owner(inside function)

Limitations

It has same limitations that original replication graph has. For performance reasons, only initial setup is exposed to blueprints. Exceptions are setting team, owner, dependent actor.

This plugin does not support complex owner chain. It only look for it's NetOwner at spawn time. If you want to change owner after spawn, use provided function.
If A owns B, and B owns C. changing owner should be from bottom to top. C->B->A.
This is for performance reason. I don't want to find and look up all possible actors per a frame.

What the hell is ReplicationGraph

In Unreal Engine Networking, Listen/Dedicated Server replicates networked actors to connections. To reduce network bandwidth and performance, those actors expected to have relevancy to that connection. In default implementation, only actors which have less distance (from ViewPosition) than NetCullDistance value will be replicated. Of course, some classes such as APlayerController do have their own replication rules.

Let's say we have 10 replicated(networked) actors, to know it's relevancy to a connection, we have to calculate distance 10 times per connection. Looks straightforward and simple. But what if we need more and more replicated actors and player connections? Let's say we're making a PUBG like game that has 1000+ replicated actors and 100+ connections. In that case, we have to run 1000*100 calculations to get actor relevancies, and that is huge.

But most of MMO server implementation, there usually is a system AKA Interest Management. Which divides entire world to small divisions and populate relevancy only in interested divisions. It is very common optimization in MMOGs. Back to UnrealEngine, Epic also introduced this kind of relevancy optimization in ReplicationGraph which is provided by Engine Plugin(Take a look at UReplicationGraphNode_GridSpatialization2D class).

A ReplicationGraph is collection of ReplicationGraphNodes. A ReplicationGraphNode is a main building block that calculates actor relevancy for a connection. There are many kind of ReplicationGraphNode that completes ReplicationGraph functionality. AlwaysRelevant Node(AGameState), GridSpatialization2D Node(Actors culled by NetCullDistance), AlwaysRelevantForConnection Node(APlayerController, APlayerState) are one of these.

References

https://docs.unrealengine.com/en-us/Engine/Networking/ReplicationGraph
https://www.youtube.com/watch?v=CDnNAAzgltw

Thank you!

locusreplicationgraph's People

Contributors

hashemshepard avatar locus84 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.