Real world building and scripting optimization for Roblox

What did you use to work on collectible physics? I’m guessing it’s either just using roblox’s default physics or you got some kind of other magic up your sleeves?

3 Likes

…guy, why so much to read over that one comment…

2 Likes

Which? The comment about me having 0 proof or data about streaming not being good? Fair enough but ultimately to show him said data it may create a giant text of wall and images in the process. Sorry about that!

3 Likes

Awesome article but out of curiosity why aren’t you using the task library for yielding I took a look and saw you use the old wait()?

1 Like

Haha oh no >_<’

Smartypants Answer: old wait() will automatically throttle in high CPU situations, which is useful if you’re using a coroutine to balance load.

Real answer: I forgot

6 Likes

Thank you so much for this article! I found all the tips really helpful for me as a developer trying to optimize my games.

I noticed that this script doesn’t do what the quote says it does, it only removes a small detail object if the character’s HumanoidRootPart is 300 studs away from it, which doesn’t really account for a camera being zoomed in and out so I rewrote it to do that. Here’s the beginning of the heartbeat function, I just redefined the pos variable to be the CurrentCamera in the workspace. It works for me now whenever I zoom in and out. I’m not sure if this was intended but this is just a heads up that you should edit the game (or the quote) to be more accurate.

RunService.Heartbeat:Connect(function(dt)
	
	local pos = workspace.CurrentCamera.CFrame.Position

6 Likes

What about having them both connected together?

Just like the camera position and HumanoidRoot

Yeah the text doesn’t quite match the code there.
Imho it’s a tiny bit nicer to have distance culling tied to the player rather than the camera if only because the camera is orbital, and if you spin it around you could cause a lot of updates.

2 Likes

That makes sense. Thank you for clarifying!

Thank you for this very detailed post! This is a great overview of several ways to optimize a Roblox game!

This is an excellent way to summarize which is the limiting factor. Thanks!

I have a question - how did you create the budget for how many triangles, drawcalls, CPU usage, etc. in Chapter 1? I’m curious as to what went into the numbers. :slight_smile:

3 Likes

It’s just an approximation I came up with by adding stuff to a test place until it wasn’t running at 60 anymore. Divided and conquered.

2 Likes

Awesome resource, I found the building & models chapter especially useful.
I think there’s a better alternative to the suggested coin system though.
Instead of creating a serial number for each coin, we could store the max possible amount of coins to pick up on the server, and then only check if this amount wasn’t exceeded.

2 Likes