Many unanchored parts in a large map

I have a SavePlace 4K by 4K map (a Rust-type game) where players may drop their items (parts), and there have been now hundreds of the parts scattered in the map. The parts are Anchored false and CanCollide true. They are just lying there most of the time, but when a player comes by I need them physics-simulated.
My concern is the performance.
The default NetworkOwnership did not work well, when there were many items around a player or when more players moved near. So I set the parts’ NetworkOwnership to server, hoping to take the burden of the client. Is that a good way for many Anchored-false parts in a large map? Will it take a toll on the network replication?
Would greatly appreciate any better ideas.

This is the game…

I would say first you should be considering cleaning up the mass of parts after a certain amount of time at least.

But if not, why not anchor the parts after they’re dropped, then when a user touches one, a script kicks off, un-anchoring it setting network ownership to the player, and then adding some velocity to it to help kick the physics into action.

You could do this with the client handling the touch event, which when touched, sends a signal to the server via RemoteEvent with the ID/Name of the part touched, which will make the part interactable.

That’s probably your best bet.

1 Like

If you don’t have a Debris timer for the parts that are dropped, the server can handle massive lag.
You might want to add a simple script to get rid of hundreds of parts.
It should look like this:

local part = script.Parent
local timer = 60
game:GetService("Debris"):AddItem(part,timer) --How long you want it to be.

Thanks, cleaning up or a decay system makes sense, but I want the players to keep the items.

I made a script that welds a dropped part as long as it is not moving. Just wondering if having such a script run in every dropped item is more efficient than having them physic-simulated.

The solution many games (not Roblox games, games in general) use is to have physics sleep.
Idle objects just lying around have their physics turned off until something stimulates them.

Roblox has no user-accessible equivalent to this, so you’ll have to make your own system.
The closest you can get to a part with slept physics is to anchor it and turn off collisions, and wait until the part is touched.
The flaw with this is that there will be a ping-based delay between player interaction with a slept part and the part waking up, and a one-frame delay between a moving part touching a slept part and the slept part responding. The reasion collisions are turned off is so that this one-frame delay doesn’t allow the anchored slept part to halt a large moving object.

1 Like

Is it so that having the item welded to an anchored part or to the terrain has the same effect as anchoring the item, ie. physics off? Then I can wake up the item when part.ChildRemoved(“ManualWeld”).

Yes, but I don’t know why you’d do that.

As complexo said, there is no reason to do that if the part you want to weld the object to is permanently static. You’ll just needlessly create an Instance.

Thanks guys. I just need the items to activate not on player’s touch, but when a building is removed from underneath (to fall down). That’s why I am welding the items to whatever is below them, until the weld is removed, and it seems to work fine as far as the performance goes.