4/3/2024 0 Comments Lag switch roblox downloadIf h.Name = "bullet" or h.Name = "serverbullet" thenĮlseif h.CanCollide = false or h.Name = "HumanoidRootPart" or h.Transparency = 1 thenįigure 4 - Another function similar to this exists in the code, and both are called per frame. Local h, p, n = workspace:FindPartOnRayWithIgnoreList(ray, i2, false, true) When a bullet is fired, this is called every single Heartbeat frame If index = "dampen" or index = "d" thenĮlseif index = "target" or index = "t" thenįigure 3 - This is a raycast module. If index = "position" or index = "p" thenĮlseif index = "velocity" or index = "v" thenĮlseif index = "dampen" or index = "d" thenĮlseif index = "speed" or index = "s" thenįunction meta._newindex(table, index, value) Local p, v = getposvel(s, d, p0, c1, c2, t0) Local function getposvel(s, d, p0, c1, c2, t0) Local floor,ceil,clamp = math.floor,math.ceil,math.clampįigure 2 - This is a springing module, with springs being calculated a couple times every frame. Local pi,tpi,hpi = math.pi,math.pi*2,math.pi/2 Local asin,acos,atan = math.asin,math.acos,math.atan Local modules = wfc(RepStore,"GunModules") Local Context = game:GetService("ContextActionService") Local RepStore = game:GetService("ReplicatedStorage") Local Tween = game:GetService("TweenService") Local TextService = game:GetService("TextService") Local RunService = game:GetService("RunService") Local UserInput = game:GetService("UserInputService") Those are things I could think of, but if there are common mistakes that cause things to not be garbage collected I would love to hear. Puttings things like entire maps on client, vs on server.Using Instance.new(_,parent) rather than Instance.new(_).Parent.Embedding tables instead of using a variable (see Figure 5).Using LocalTransparencyModifier vs Transparency. Using SetPrimaryPartCFrame vs using PrimaryPart.CFrame.Using Tween:Create():Play() instead of pre-creating tweens.Usage of constraints on client vs on server.Constant calling of bobbing calculation (see Figure 4).Usage of a custom raycast function (see Figure 3).Constant springing calculation (see Figure 2).Usage of JSON encoded strings rather than tables.Instance connections such as Died, Changed, and Heartbeat.Large scripts (800-2000 average-sized lines of code).Storing Roblox metamethods, functions, and instances as variables in the script (see Figure 1).Weak tables (for internal modules and other data).Or should I use wrap instead of resume(create)?) Which of these cause lag? Which of these should I worry most about? It seems that some of my games, especially the ones with my weapon system, has a TON of issues keeping that 60 FPS in the stats. Be weary that some information may be outdated!Įven after being on Roblox for a decade now, I struggle with fighting performance problems with poor memory management chewing away at framerate and internet response time. Hey folks! Looks like you stumbled across an old post of mine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |