Question about build optimizations - Part sizes

I would like to know from a render performance optimization expert here if the size of a basic cube part affects the amount of data required to replicate/load into the workspace/client (Streaming enabled purposes)

For example, would a basic size (2,2,2) standard plastic material part be worth the same amount of memory as a, say, 10,10 ,200 plastic material part ? I assumed yes as I believe triangles/faces are the cause of a higher memory cost?

My only guess is that if it would be worth more data, it’d have to be material-related? (Roblox’s material mapping having to tile more as the part grows in size?)

Side note-
I am currently creating a “Cell” system for my game (remote Building interiors physically located far from the main map) , and have noticed that while building, I noticed that some ambient lighting passes through the corners of the room’s edges, so I want to know if it would be efficient to use thicker parts to completely block the lighting without wasting more memory than I should.

EDIT: Here are some examples of the “leaky lighting” to clear things out:

The answer is actually very complicated, because there are a lot of optimizations to cut down on memory. There might be more, but here are two examples that I know of (but cannot confirm)

  1. Default properties are not stored. So if you insert a part and do not change its color, the color property will not take up any memory.
  2. Objects with similar properties are stored together in memory. So let’s say you have a house made out of many parts that share the same material, color, shape, elasticity, friction and so on. Instead of storing the data for all these parts separately, it is ‘grouped’ together in memory to take up less space. Grouping is possible because many properties are shared, so you only have to store the differences.

Again, I am not 100% sure about the accuracy of all of this. And in reality, you don’t really have to know it either because these kind of optimizations aren’t needed in 99.9% of the cases.

Also, the more complex the shape of an object/mesh, the more memory has to be stored for the mesh. However, the scale of the mesh does not matter at all. If you scale up a mesh it will not take up any extra memory because the number of triangles stays the same. The shape is not changed. The mesh has just become bigger.

Textures are stored only once in memory. Five objects with the same texture won’t take up more ‘texture memory’ than two objects with the same texture, because they reference the same memory space. What does matter though is the complexity of the texture. The higher the resolution, the more memory it takes up. However, what you see often is tileable textures, which can be copied and pasted next to each other to look like one big texture, while it’s just small patches of the same texture. This tiling means small objects and large objects can have the same detail without requiring any extra memory.

Using the info from above, it’s safe to say that making your part thicker isn’t going to waste any extra memory. And if anything, one part is dirt cheap anyway. There are Roblox builds and games with up to a hundred thousand BasePart objects nowadays that still run totally fine. Don’t worry about it.

tl;dr Don’t worry about memory. Just make sure you’re not making shapes that are super complex and you’ll be fine.

4 Likes

Thank you very much for clarifying! :slight_smile: I can now return to building safely. :smiley:

From what you told me, I think I’ll go ahead and change all of my radius detection parts’ (That use a .touched event) color to default and pretty much every part I have in workspace meant to serve as a CFrame reference for spawning, Camera angles, etc. :slight_smile:

Thanks again! :smiley:

So to find a way to see if this theory is true (With the part’s memory use) you could try to convert a bunch of parts into meshes (I’d suggest using spheres to speed up the results.) Let’s say you have about 50 spheres you’d like to convert into a mesh. On one side, all of those spheres’ size are 1,1,1, on the other, 10,10,10. Try converting both of them one at a time to see if they have any differences, thus, this theory can easily be tested as Roblox Studio will reveal the amount of triangles your mesh contains if it exceeds the 10k tris limit.

1 Like

I actually tried experimenting with your method with grouping the spheres although I did so using UnionOperations.

I came up with a statement from the Union experimenting - Base parts seem to have 16 triangles by default and Cylinders have 92 when unioned alone.

I do want to try with meshes, however. Do you think it’s better to test memory usage via meshes or unions?

Meshes are the best option. If your mesh exceeds 10k tris then Roblox Studio will indicate how many tris your mesh has.

1 Like