Hello, ive been working on a tycoon game, and im currently handling all dropper drop physics on the server. The system works fine, but I’ve noticed that my game’s ping averages around 200ms regardless of how many players are in the server.
When I check the Physics KB/s in the developer console, it’s around 150, which seems really high for a tycoon game. The only physics-heavy elements in my game are the dropper drops, which fall and move through the tycoon system. Here is a screenshot of the server stats in an active server with a few players:
I currently have these functions in the main tycoon handler script that clones these drops, which in my case are “seeds”, every 5 seconds on the server:
local function spawnDrop(dropper, player)
if not player and player ~= ownerValue then return end
local dropModel = seedFolder:FindFirstChild("Seed1")
if not dropModel then return end
dropModel = dropModel:Clone()
local drop = dropModel:FindFirstChild("Seed")
local dropMain = dropModel:FindFirstChild("Main")
if not drop or not dropMain then return end
drop.Color = dropper:FindFirstChild("DropColour")
drop.Material = dropper:FindFirstChild("DropMaterial")
dropModel:SetPrimaryPartCFrame(dropper.Drop.CFrame * CFrame.new(0, -1, 0))
dropModel.Name = dropper:FindFirstChild("DropType")
dropModel.Parent = dropsFolder
for _, part in ipairs(dropModel:GetChildren()) do
if part:IsA("BasePart") then
part.CollisionGroup = dropCollisionGroupName
end
end
local cash = Instance.new("IntValue")
cash.Name = "Cash"
local cashValue = dropper:FindFirstChild("CashValue")
cash.Value = cashValue and cashValue.Value * cashMultiplier or 1
cash.Parent = dropModel
local billboardGui = dropMain:FindFirstChild("BillboardGui")
if billboardGui then
local valueText = billboardGui:FindFirstChild("ValueText")
if valueText then
valueText.Text = "$" .. cash.Value
cash.Changed:Connect(function()
valueText.Text = "$" .. cash.Value
end)
end
end
debris:AddItem(dropModel, 10)
dropMain:SetNetworkOwner(player)
end
local function startDropperLoop(dropper, player)
local running = true
local function dropLoop()
while running and ownerValue.Value == player do
task.wait(5)
spawnDrop(dropper, player)
end
end
end
I’m wondering if there’s a more efficient way to handle the dropper physics to reduce the network strain and improve performance. Should I consider moving some of the physics calculations to the client, or is there a better approach?
Any advice would be greatly appreciated. Thanks.