#Mining system

1 messages · Page 1 of 1 (latest)

median silo
#

Ive made a mining system using an instance part hitbox that relies on the physics of the game n other stuff

Is it a good system or will it be a lag bomb

hard willow
#

So like you use a part and .Touched or something?

Or are you talking about voxels

median silo
hard willow
hard willow
# quasi tundra It’s expensive

I'd love to see a benchmark between the different methods

I didn't think it'd be much considering this is probably a hit every few seconds or so and not a method in a loop

quasi tundra
hard willow
paper driftBOT
#

studio** You are now Level 10! **studio

hard willow
# quasi tundra lmk too

How do you implement a part hitbox with Touched? I don't normally do it that way

I tried doing 100,000 calls all at once with GetPartBoundsInBox, standing in the middle of a bunch of mesh parts
100,000 GetPartBoundsInBox calls took 8.29276960005518 seconds, detecting 21600216 parts or an average of 0.0000829276960005518 seconds & 216.00216 parts per call, or 0.4975661760033109% of a 1/60 frame - Server - test:16
This could be improved with OverlapParams

It's also possible I did this totally wrong lol

With this quick code

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(p: Player)
    p.CharacterAdded:Connect(function(c: Model)
        wait(10)

        local thr = coroutine.create(function()
            local t = os.clock()
            local parts = 0
            for i = 0, 100_000, 1 do
                parts += #workspace:GetPartBoundsInBox(c.PrimaryPart.CFrame, Vector3.one * 50)
            end
            local totalTime = os.clock() - t
            local timePerCall = totalTime / 100_000
            local secondsPerFrame = 1/60
            print(`100,000 GetPartBoundsInBox calls took {totalTime} seconds, detecting {parts} parts or an average of {timePerCall} seconds & {parts / 100_000} parts per call, or {(timePerCall / secondsPerFrame) * 100}% of a 1/60 frame`)
        end)

        coroutine.resume(thr)
    end)
end)

return {}
#

Hey @stone bridge, terribly sorry for the ping, but you're pretty experienced in this kind of thing, right?

I'm curious what's the best hitbox method in terms of performance?

quasi tundra
#

GetPartsInBound for this kind of hit would be better though

hard willow
hard willow
stone bridge
#

performance is the wrong question here most of the time

stone bridge
#

which method you'd use depends on the game

#

performance is irrelevant

obtuse jackal
#

At least for stationary objects