multiplayer-sync
Installation
SKILL.md
Multiplayer Synchronization in Decentraland
Authoring split
syncEntity() adds a NetworkEntity component at runtime — and NetworkEntity is not in main-entities.ts's supported component list. The pattern is:
- Predefined synced entities (a door, a switch, a scoreboard — known at author time): declare them in
main-entities.tswith their visual components. Look them up insrc/index.tsand callsyncEntity(entity, [...componentIds], SyncIds.NAME)there. - Dynamically-spawned synced entities (projectiles, drops, runtime-created game objects): create with
engine.addEntity()insrc/index.tsandsyncEntityimmediately.
// main-entities.ts
door: {
components: {
Transform: { position: { x: 8, y: 1, z: 8 } },
MeshRenderer: { mesh: { $case: 'box', box: { uvs: [] } } }
}
}