Jump to content
  • 0

Help me plz. now im vibecoding now Issue: with Network Sync for Scaled Parent Entity


Question

Posted (edited)

Hello developers, I am working on a plugin to spawn a "Giant Drone" boss.

My Approach: To increase the size of the drone, I spawned a SphereEntity, set its scale to 25.0, and then parented a Drone entity to it.image.png.251ab7f5bbc8e67a10e8ea1a56f94c3d.png

The Problem:

Sync Issue: Players who are near the spawn point see the giant drone correctly. However, players who come from far away (entering the network group later) see the drone at its default scale (1.0x) instead of 25.0x.

Failed Attempt (Important): I tried to force a sync by calling SendNetworkUpdateImmediate() on both the parent (Sphere) and the child (Drone) when a player enters the zone. However, this never worked. The client still renders the drone at the default scale (1x) even after receiving the update packet.

Performance Issue: I also tried calling SendNetworkUpdateImmediate() in a loop (e.g., every 0.1s), but it only caused severe server lag/freezing and still did not fix the visual sync issue for new players.

My Question: It seems SendNetworkUpdateImmediate() does not properly force the client to update the inherited Scale from a parent entity.

Is there a known workaround to force the client to re-sync the hierarchy/scale correctly when a player enters the network range?

Any advice would be appreciated. Thanks!

 

The Code Snippet

```

// 1. Create Carrier (Sphere)
string spherePrefab = "assets/prefabs/visualization/sphere.prefab";
SphereEntity sphere = GameManager.server.CreateEntity(spherePrefab, startPos, spawnRot) as SphereEntity;

float scale = 25.0f;
sphere.currentRadius = scale;
sphere.lerpRadius = scale;
sphere.transform.localScale = new Vector3(scale, scale, scale);

sphere.EnableSaving(false);
sphere.EnableGlobalBroadcast(true); // Tried this, but didn't help much
sphere.Spawn();
sphere.SendNetworkUpdateImmediate();

// 2. Create Drone and Parent
string dronePrefab = "assets/prefabs/deployable/drone/drone.deployed.prefab";
BaseEntity drone = GameManager.server.CreateEntity(dronePrefab, Vector3.zero, Quaternion.identity);

// Parent to the scaled sphere to resize the drone
drone.SetParent(sphere);
drone.transform.localPosition = Vector3.zero;
drone.transform.localScale = Vector3.one;

drone.Spawn();

```

 

Edited by MooDDang

2 answers to this question

Recommended Posts

  • 0
Posted

Suggestion. I would decompile the assemblies for the game and oxide/carbon and see how it works. You don't need spheres for scaling as FP implemented native scaling for the client recently.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2.1m

Downloads

Total number of downloads.

9.9k

Customers

Total customers served.

143.7k

Files Sold

Total number of files sold.

3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.