CDRP's Part Optimization Guide

A guide on quelling part lag.

This guide assumes the reader understands all the fundamental basics of and can easily navigate the UI of Roblox Studio.

This guide was made primarily for Checho's Deltarune Roleplay (CDRP) and CDRP builders, and thus this guide is geared towards pixel-y builds and pixel art.


Contents


Overview

Part optimization is a big part of game development. However, many Roblox developers unfortunately gloss over part count, triangle count, and part properties. This short guide was created with the intention to help builders looking to optimize their part-filled creations.


Reducing Part Count

The most basic form of part optimization is removing redundant parts. It is easy to gloss over these redundant parts when building in Studio. But first off, what are "redundant parts"? Redundant parts are parts that exist when a smaller number of parts can be used instead while achieving the same look. Here are a few examples:

Let's start off with this rug.
img
It has five parts. Four parts are the light blue edges ("outer"), and the fifth part is the dark blue center piece ("center")
img
This build is not optimized, as there are three unnecessary parts. However, we can easily fix this while keeping the appearance of the rug unchanged. See the table below.

The What Visual
Remove all but one of the "outer" parts. gif
Resize the fourth "outer" part (henceforth called "outline part") until it takes up the bounds of the other three previously deleted "outer" parts. Or, worded differently: until it forms a complete outline around the "center" part. This should result in two colors flashing back and forth (Called Z-Fighting). gif
By utilizing Roblox's Properties tab, resize the outline part to ±0.01 on whichever axis the Z-Fighting is occurring. Repeat this until the Z-Fighting stops. In this example, the Z-Fighting was occurring on the Y-Axis, and I changed the outline part's Y size from 0.2 to 0.19 gif
Note: There is a plugin that makes the last bit a whole lot easier.

This may not seem like a huge improvement, as only three parts got removed. However, every part has to have a hitbox rendered and shadows calculated. Now imagine that on a massive scale, say, 10k parts. Those three removed parts suddenly sound a lot more impactful. Here's another example.

The What Visual
Between the protruding wall, pieces of molding climb up either side of it to the ceiling. The molding consists of two separate parts (The wall is semi-transparent for ease of viewing). img
By deleting one side and resizing it to fit where the previously deleted part was, we can reduce the number of parts in this build while keeping its appearance unchanged to players. img

Think about going back through your old builds and removing redundant parts from all of them. That's a lot of performance you will be saving. Now, we can still do more to optimize even further. Let's talk about Part Properties.


Part Properties

Part Properties are, as the name implies, a set of attributes that every part has, most enabled by default. These can be accessed in the Properties tab. Some of these are rather damaging to performance, especially if every part in-game has them enabled.
img

Below is a list of the most performance-harming properties you should consider disabling in decorative builds or builds the player does not interact with. Some of these are more performant harming than others, notably CanCollide and CastShadow.

Name Feature
CanCollide Determines if the selected part physically interacts with other parts.
CanTouch Required for touch events. (Only used in scripting.)
CanQuery Required for spatial query operations. (only available if CanCollide is disabled.) (Only used in scripting.)
CastShadow If enabled, the selected part will cast a shadow.
Transparency Set to 0 by default. Semi-transparent parts (0.2 through 0.9) are harder to render.
RenderFidelity Union/MeshPart exclusive. Set to "Automatic" or "Performance".
CollisionFidelity Union/MeshPart exclusive. Set to "Hull" or "Box".

Decals & Textures

Decals and textures are great substitutes for parts. They can bring substantial detail to builds at a fraction of a cost parts would. You may ask: "What's the difference between a decal and texture?" A texture is a pattern that repeats that repeats both horizontally and vertically of a part's surface. A decal is an image that stretches to fit the part it is on. Textures are better suited for repeating patterns, while decals are better for single images (such as graffiti on a wall).
img
In this example, the floor is a single part with a texture on it. This allows me to have a great-looking pixel art floor without having to have ten parts per tile, and with 95 tiles in this image, that would be would be an additional 950 parts!!).

Decals and textures are not without problems. Roblox automatically sizes every image to 1024x1024, which can lead to stretched and blurry images. If you are having problems with or would like more information regarding decals, I recommend reading TheFoundWatcher's Pixel Art Resizing Guide.

Alternatively, there is also ImageLabels combined with SurfaceGuis. It is a somewhat hack-y method to get crystal-clear pixel art. However, that is a topic for a different page.


What About Unions?

Right off the bat, I want to state that unions are absolutely not an acceptable alternative to parts or meshes. When union geometry is calculated, it tends to produce the most gruesome topology. I also wish to dispel a common myth: unioning many parts together does not decrease lag. It may decrease the part count but often inflates the triangle count.

If you are using unions, I recommend cleaning up the topology in Blender or any other 3D modelling software after creating your desired shape.

img
img

Edit
Pub: 25 May 2023 01:03 UTC
Edit: 26 May 2023 23:48 UTC
Views: 197