Reduct | Manual Replication

Reduct

GitHub
currently can’t get on the Creator Marketplace for whatever reason >:(

Reduct is a lightweight module designed to manage manual client–server replication. By giving developers explicit control over what data is synchronized and when, it avoids the overhead of Roblox’s automatic instance replication significantly reducing unnecessary updates and server traffic.

This documentation covers how to use Reduct, along with practical use cases and implementation examples.

Thanks to AlexanderLindholt for creating the Signal+ module, which is used heavily throughout this module.


Objects


Status

Properties

Status: "pending" | "dead" | "complete";
StatusID: string;
TrackedObject: Instance;
Owner: Player;
Changed: Signal;

The Status object represents the lifecycle of a replicated object.
If its state changes from "pending" and the status is not stored, it will fall out of scope.

Changed fires when:

  • A player leaves before confirming replication ("dead")
  • Replication completes successfully ("complete")

Tracker

Properties

ListenTo: (self: Tracker, Topic: string) -> Signal;
Listen: (self: Tracker) -> Signal;

This is a client-only object used when an object is loaded on the client. It allows you to attach handlers to the update stream.

  • Listen is wildcard-based and listens to all topics, passing the topic as the first argument.
  • ListenTo listens to a single topic only.

When an object is unreplicated or destroyed, the tracker will fall out of scope unless it is explicitly stored.


Functions


Reduct.ReplicateTo | SERVER ONLY

Replicates an object to one or more clients.

Example

Reduct.ReplicateTo(ObjectToReplicate, Players:GetPlayers())

Returns: { Status }


Reduct.UnReplicate | SERVER ONLY

Tells clients to unreplicate an object.
If the object is not currently replicated on the client, this function will simply return.

Example

Reduct.UnReplicate(ObjectToReplicate, Players:GetPlayers())

Reduct.ReplicateChanges | SERVER ONLY

Sends updates for a given topic to the client.
This is where the Tracker object comes into play.

Example

Reduct.ReplicateChanges(ObjectToReplicate, Players:GetPlayers(), "test", ...)

Reduct.Track | CLIENT ONLY

Returns a Tracker that receives updates for an object replicated using Reduct.ReplicateChanges.

Example

Reduct.Track(Target)

Returns: Tracker


Reduct.IsReplicated | SERVER ONLY

Returns a dictionary of player : boolean the bool will be true if replicated.

Example

Reduct.IsReplicated(Instance,  Players:GetPlayers())

Returns: { [player] : boolean }


Properties

  • Replicated
    A folder where all replicated instances are placed on the client.

  • OnReplication
    A client-only event that fires whenever an object is replicated to the client.


Extra Info

  • If a replicated object is destroyed on the server, clients will be instructed to deconstruct the object on their end.
  • Configuration options are included. Currently, there is one config that warns if an object being replicated is not a descendant of ServerStorage.

Collaborators

Kobayashi - A good friend of mine who helped work on this module.

11 Likes

Working on a new update to expand features of this module, feel free to suggest stuff!

V1.0.1

  • added new function IsReplicated

Reduct.IsReplicated | SERVER ONLY

Returns a dictionary of player : boolean the bool will be true if replicated.

Example

Reduct.IsReplicated(Instance,  Players:GetPlayers())

Returns: { [player] : boolean }

does this also nullify roblox’s native interpolation with moving?

If you’re referring to the server automatically informing the client about positional changes, then yes. This framework is designed for lightweight replication. However, you can use the tracking system to send data from the server to the client. So if you mean stuff like current move vector you could send it on topic “adjust move” but if you mean send position you can easily do what I did here.

if you mean for tweening you can probably just send the current target and cancel the current tween.

Server

local model:Model = nil::any
local Player:Player = nil::any

model:GetPropertyChangedSignal("WorldPivot"):Connect(function()
    Reduct.ReplicateChanges(model, Players:GetPlayers(), "pos_mov", model:GetPivot())
end)

Reduct.ReplicateTo(model, {Player})

Client

Reduct.OnReplication:Connect(function(Target:Model)
    local Tracker = Reduct.Track(Target) -- could be done better I just did it this
-- way to showcase how it would work
    Tracker:ListenTo("pos_mov"):Connect(function(Position:CFrame)
        Target:PivotTo(Position)
    end)
end)

and do not worry about a player recieving changes for a object they do not have, the client will not handle the packet if they do not have a variant of the instance on client.

I see, I’m asking because i have a asymmetrical game in the works, the issue being faced is we are trying to replicate dead by daylights style of “spinning” which is just the act of abusing the cameras rotation speed along side the way the animations are made (offset forward) to essentially spin VERY fast, the code works however because of how roblox handles the built in interpolation on players the effect does not work, making it smooth nulls the effect given from dead by daylight, you know?

I don’t mean to sound rude, but I fail to see how this relates to this project.

Should be just changing the camera style, to scriptable and rotating around a player. No replication is involved in this unless I am missing something.

1 Like

I added a new async version to isreplicated, the standard version just checks the server if it’s replicated this version physically asks the client if they have it

the way it owrks is weird, i understand where you’re coming from so no pressure if you still don’t get it </3 a sort of vulnerability is present in dead by daylight because the players run have them offset FORWARD, obviously that wouldn’t cause any problems by it’s self however if you turn very fast, if you mix that with this offset you essentially turn in a much larger radius making it hard for the enemy to get a hit off of you. this is something worth replication in my game, however it isn’t possible due to roblox interpolating the players for smoothness, my question was if this has that interpolation, assuming it has it added on because this is manual replication which from there could be easily removed.

This litterally has nothing to do with this post at all. that is entirely up to your code. This is a module to manually load assets from server to clients in a controlled manor.