if its the same won’t the CPU Be Same And I Would Have The Same Lag?
No, try running a loop 1 million times and do smth that’s resource intensive, then do it and add a loop each 100 iterations, u will notice the difference.
seems to be same for me man idk. but ye i still need help
What catrom model are you using, i wanna check its performance
You might check out this response I made to a similar post. TD game entity system, help on optimization - #28 by CompilerError
With the optimizations I mentioned in the post I was able to handle up to 18k entities at 60FPS. I didn’t mention in the post, but when I was testing I was able to control those 18k entities while also knowing which ones were within tower range in real time, in my tests I had 79 towers.
If the entities did not have character models then I was able to run about 150,000 while maintaining 60 FPS.
In my example, my units are clumped together, which actually makes the tower problem notably more performance heavy than if they were spread out.
Minus the tower implementation, all of the other optimization tricks I used were noted in my two posts on that topic.
wait are you the owner of vault td game which has an optimized entity system?
Nah sorry, I am not. His methods are interesting and good but not the best.
Also, the catrom module movement system might backfire, Since you do not know where the enemies are/which node they are. These can affect towers with the ‘First’ and ‘Last’ targeting. If you think you can calculate the distance of each node, well consider a waypoint X the enemy is going to. But waypoint Y is more near.
then what do i use i want smooth curves
Splines are just a set of straight lines, the “curvedness” of which is based on how high the resolution of the spline is. Use whatever spline gives you the best looking result, treat each point on the spline as a waypoint and interpolate the position of the entity between them. Given a waypoint index and a time at which the entity reached the previous waypoint and a time to the next waypoint you can determine an alpha value for a lerp
and smoothly move along the “curve”.
Why not listen to this guy? He has maybe the best systems
wdym i have already read his post or reply.
soo you are saying when i want to make a turn i should use spline and when i don’t want a curve i will use lerp?
That would take too much performance
No, I’m saying at runtime, or when you make your tracks in studio, use a spline curve with a high definition (lots of waypoints) and move between those instead of moving using the spline math. It will look nearly identical if you have a high resolution on your spline curve and you’ll have much more control over it, not to mention that a interpolation calculation is far less computationally expensive than calculating the position of an entity along a curve.
Also why not use bulkmoveto as its good for performance i think
For example, see this path?
This is a series of spline curves, and if you understand how spline curve math works then you’ll know that you provide it with a time t
and it gives a point along the curve. I’m simply saying, sample your spline curve at runtime or when you build your maps, store these yellow points, and move in a straight line between each of the yellow points.
I recommend using Bones to offset your entities rather than moving a part. Bones don’t update physics information and are far faster to move. I did some testing around this as well:
Bones always took 0.002ms, CFrame was roughly 0.023-0.03ms and BulkMoveTo was around 0.012-0.16ms
In general, bones are about 7.5x faster to move than BulkMoveTo.
Here’s the logic I used to test this:
local Cube = workspace.Cube.Bone
local Cube2 = workspace.Cube2
local Cube3 = workspace.Cube3
local bulk = {Cube3}
game:GetService('RunService').Heartbeat:Connect(function()
local cframe = CFrame.new(math.random(-100, 100), 0, math.random(-100, 100))
Cube.Transform = cframe
Cube2.CFrame = cframe
workspace:BulkMoveTo(bulk, {cframe}, Enum.BulkMoveMode.FireCFrameChanged)
end)
I kinda feel like I’m being ignored though, so I’m just gonna let you guys hash this one out. Enjoy!