Become a More Efficient Builder with These Studio Tricks
After mentioning the ability to select individual parts from a model in last week’s Feedback Loop, we were surprised to find how many of our builders were enthralled with, and grateful for, what we thought was a relatively minor suggestion. Alas, there are many small things you can learn that can make your building experience with Studio easier and faster. We decided to talk with Creative Director John Shedletsky and the Studio Team’s Tyler Berg to get some basic building advice. We’ll start with technical advice from John.
Is your ROBLOX level running slowly? ROBLOX Studio has tools to help you figure out why. Check out these three views in the “View” menu: “Script Performance”, “Task Scheduler” and “Diagnostics”. When your level is running (e.g., when you’re doing a Test > Solo visit), these panels are full of useful and telling stats about ROBLOX’s internal operations.
Script Performance View
This view shows all of the currently running scripts in your level. It shows the number of copies for each script, the total simulation time, and the execution frequency. In the jumbo sized screenshot below, you can see that I have one expensive script in my level: “DodgeGame”, which is using 11% of my CPU. ROBLOX executes all Lua scripts on a single core, so on my 8-core machine I’m actually using almost an entire CPU to run this one script. It’s executing 70 times per second, which is also interesting — typically this number should be much lower. This is a very chatty script that is doing a lot of Lua <-> C++ interop, which is very expensive. If I were looking to make this level less laggy, this is where I’d start. Then, I’d optimize my code until these numbers became more reasonable.
While running your ROBLOX game, the engine is actually performing a lot of different tasks: sending/recieving network packets, rendering the scene in 3D, simulating physics, executing Lua VM instructions, and doing Lua garbage collection. Many of these things actually happen concurrently and the task scheduler shows execution stats for each task. The most important number here is the “Activity”, which is the total amount of CPU load that the task is consuming. In the level pictured, I’m currently using 64% of my total CPU power simulating physics. That’s a fair amount. This view can help you diagnose certain problems that exist in your level. For example, if you’re creating and deleting a lot of objects in Lua, that bottleneck would show up here as the amount of time spent in garbage collection.
There’s a ton of information in this view about the underlying execution of your level. Render stats, physics stats, Lua stats, networking stats, sound stats, and more. I built a level where buses roll down a cliff while exploding (because why not?). Turns out doing this caused a lot of lag. One of the issues that surfaces in this view is that under Workspace > Contacts I can see that I have no fewer than 21,271 SteppingContacts. These are contacts between two parts that are currently being simulated — having over 21,000 simultaneously simulated contacts is a huge compute load. It suggests that if I want my level to run faster, I should reduce the number of collisions that are occurring. I solved this particular problem by making the buses less likely to shatter, which decreased the number of tiny pieces of debris without affecting core gameplay.
Thanks John. Now to share some basic Studio tricks and tips, Tyler Berg:
Camera: You can raise or lower your Camera Mouse Wheel speed, which will change the rate at which you zoom. Changing the Camera Shift Speed increases or decreases the speed at which you zoom using the shift key. Finally, the Camera Speed increases or decreases the speed at which the camera moves forward or backward. These settings can be very useful if you’re into precision building.
Auto-Save: This tab allows you to turn Auto-Save on or off, and also lets you choose how often Studio will auto-save. What’s more, you can choose the destination of each save.
Script Editor: Here’s a quick tip you may not have known: if you’ve got a script open and you’re editing it, hold Control (or Cmd on Mac) and scroll the mouse wheel to increase or decrease the size of the font. In the Script Editor, you are given full control of your scripts. You can change the fonts, colors, width of the tab, and enable or disable the Auto Indent.
Color-coding your scripts can really help keep you organized — code can be difficult to separate at times, especially after hours of staring at a script. Also, many programmers find it easier on the eyes to invert the color scheme, making the background black and the text white. All of this can be done in the Script Editor tab in Studio.
Bonus: How to change the color of your selection box
Here’s quick how-to on changing the color of your hover selection box (it’s blue/white by default). First, insert any object into a new place, and hover your mouse over the item. You’ll notice that a box appears, which transitions between the colors blue and white.
Go to Tools > Settings, then find the “Colors” tab. You will notice two squares, one blue, one white. To change the color, click one of the squares. This will generate an ellipses to the right. Click that, and a color palette will open, where you can set the color. Hit “OK” once you’ve got the color you want to use. Repeat these steps for the second box, only choose another color. Now, when you hover over an item, the selection box colors will alter between the two that you chose!
We want to continue to help builders create anything imaginable easily and efficiently. ROBLOX Studio is a massive application, so we’re curious to know: what would you like to learn more about next?