Jecs replication

Just trying to make my own replication system. Is there a better approach?
function blah(world: World): void {
Players.PlayerAdded.Connect((player: Player) => {
const playerEntity = world.entity();
world.set(playerEntity, Components.Player, player);
world.set(playerEntity, pair(Name, Components.Networked, "Player"));
});
}
function blah(world: World): void {
Players.PlayerAdded.Connect((player: Player) => {
const playerEntity = world.entity();
world.set(playerEntity, Components.Player, player);
world.set(playerEntity, pair(Name, Components.Networked, "Player"));
});
}
I want to be able to add the networked tag to an entity so that the entire entity is replicated, etc. I also want to replicate certain components of an entity, not just the component as a whole. Is there a better approach to doing this?
1 Reply
duck
duck2mo ago
https://gist.github.com/NormalDuck/63a53bc6e9af7de6c8b52a5e0df75327 check out my gist for component based replication, all unit tests pass!
Gist
Roblox-TS Jecs component based replication
Roblox-TS Jecs component based replication. GitHub Gist: instantly share code, notes, and snippets.

Did you find this page helpful?