Part Pooling Version: Stable
(This topic was separated from the suggestion of a Community Sage)
I am releasing two modules that are mostly complete and generally only for more advanced scripters. (The other modules are on the bottom of this post)
Part Pooling
The first, more complete module is called Part Pooling. This is a technique used more commonly in quantity-intensive games, such as bullet hells, example:
Games that use pooling can use many objects because they do not suffer from performance loss created from instancing or destroying. Part Pooling works the same by creating a bunch of parts built from a ‘template’ part and putting them in ReplicatedStorage (or a location of your choosing) until you need them.
Pooling Usage Example Code
local Pooling = require(PoolingSystem)
---Let's create a template part so the pooling script can duplicate it
local TemplatePart = Instance.new("Part")
---We tell the pooling script to create 50 copies of the template part
local Objects = Pooling:Create(50, TemplatePart)
---Get the part from our pooling list
local Part = Pooling:GetObject(Objects)
Part.CFrame = CFrame.new(0, 5, 0)
Part.Parent = workspace
wait(5)
---"Destroy" means putting back the part into our pooling list.
Pooling:Destroy(Objects, Part)
wait(5)
---This will actually destroy all of our pooled objects. Only use if you don't need it anymore.
Pooling:Clear(Objects)
Parts aren’t actually removed in a pooling system, they are put back in the “queue” until the next time they need to be used. This ensures that performance will not suffer since we are reusing the parts.
https://gfycat.com/NearDistortedFinch
You can get the Pooling System here. Alternatively, you can download the place file here containing both my pooling system and IK w/ creature. Scripts are in workspace.
PoolingAndIK.rbxl (27.5 KB)
My other modules:
Raycast Hitbox Module
Inverse Kinematics and Procedural Animations