YouTube2Text

How to optimize performance on Roblox — Transcript

by Roblox Creators · 1,964 words · 303 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Hey everyone, it's Andrew from Roblox.
  2. 0:02This video looks at common performance
  3. 0:04problems in Roblox experiences and
  4. 0:06strategies you can use to mitigate them.
  5. 0:08Before we dive in though, two quick
  6. 0:10disclaimers. One, I am not an
  7. 0:12environmental artist. At several points
  8. 0:14in this video, I'll ask you to use your
  9. 0:15imagination because I don't have the
  10. 0:17time or the skill to build the things
  11. 0:18I'm talking about. Two, I'm not
  12. 0:21advocating for compromising on your
  13. 0:23artistic vision. Build the experience
  14. 0:25you want to build. But along the way,
  15. 0:26you might consider how these strategies
  16. 0:28can make your experience more performant
  17. 0:30and help it reach a broader audience.
  18. 0:32With that out of the way, let's start
  19. 0:33with rocks. That's right, rocks. Lots of
  20. 0:37rocks. We're using rocks to demonstrate
  21. 0:39a fundamental concept of computer
  22. 0:41graphics. Draw calls. Draw calls are
  23. 0:43commands from the CPU to the GPU to
  24. 0:45render something on screen. If you have
  25. 0:47lots of unique meshes, the Roblox engine
  26. 0:49has to make draw calls for each mesh. On
  27. 0:52mobile, you can quickly get into a
  28. 0:53situation where your device is
  29. 0:54struggling to keep up. If you were to
  30. 0:56look closely at the beautiful stone
  31. 0:58walls of Ireland, you'd of course see
  32. 1:00lots and lots of unique rocks. But what
  33. 1:03if you constructed a wall by duplicating
  34. 1:04four or five rocks over and over and
  35. 1:06then artfully arranging, coloring,
  36. 1:08resizing, and rotating them? Unless
  37. 1:10somebody really scrutinized that wall,
  38. 1:12would they even notice?
  39. 1:15A technique known as batching lets your
  40. 1:17CPU make a single draw call for tons of
  41. 1:19objects as long as they share the same
  42. 1:21mesh. So you can import a small handful
  43. 1:23of particularly excellent rocks and use
  44. 1:25them to build all sorts of things.
  45. 1:26Walls, landscapes, cliffs, rivereds,
  46. 1:29whatever. Here I've imported the same
  47. 1:30rock many, many times so that each one
  48. 1:32gets its own mesh ID. Don't do this. I
  49. 1:36only did it to illustrate the point.
  50. 1:38Look at all those draw calls. If I
  51. 1:40delete all of those duplicate imports
  52. 1:41and just copy the same rock over and
  53. 1:43over, draw calls don't increase at all
  54. 1:44because I'm reusing the same mesh. The
  55. 1:47goal here isn't to keep your draw calls
  56. 1:49needlessly low and build bland
  57. 1:50environments. Instead, this sort of
  58. 1:52optimization gives you the headroom to
  59. 1:54use your draw calls on the things that
  60. 1:55really matter. On a low-end mobile
  61. 1:57device like this one, it can be the
  62. 1:58difference between a game that looks
  63. 1:59like this, running pretty darn well, or
  64. 2:02a base plate with some rocks struggling
  65. 2:04to stay above 30 FPS. But you don't have
  66. 2:06to take my word for it because I've
  67. 2:07recruited the one and only Mr. Chicken
  68. 2:09Rocket for a quick discussion of draw
  69. 2:11calls and relative device performance.
  70. 2:13Take it away, Peter. Hey, thanks Andrew.
  71. 2:15When I create a game, I usually start
  72. 2:17with a basic budget. Something like half
  73. 2:19a million triangles and 500 draw calls
  74. 2:21in the scene for any given view. And
  75. 2:23then I stick to that budget as I build.
  76. 2:24It's the best way I know of to avoid
  77. 2:26having to go back and redo work because
  78. 2:28things aren't running at 60 frames per
  79. 2:29second anymore. And I hate redoing work.
  80. 2:32Staying under budget while I'm working
  81. 2:33in studio means I can be fairly sure
  82. 2:35that it'll run great on a wide range of
  83. 2:37devices, but every now and then I'll
  84. 2:39still break out an old iPhone and go
  85. 2:41check. When I am testing on device, what
  86. 2:43I'm usually looking for is making sure
  87. 2:44that it's still running at 60 frames a
  88. 2:46second. And sometimes I'll check the
  89. 2:48micro profile to see what's going on
  90. 2:50with CPU usage, too. Next, let's talk
  91. 2:53streaming. Streaming is enormously
  92. 2:55complex under the hood, but it's easy to
  93. 2:57enable and offers huge performance
  94. 2:58benefits. In essence, streaming creates
  95. 3:01an invisible cube around each character.
  96. 3:03As characters move around, parts stream
  97. 3:05in and out based on whether they're
  98. 3:07inside or outside of the cube. Streaming
  99. 3:09improves frame rate and join times.
  100. 3:11Maybe most importantly, it reduces
  101. 3:13memory usage on the client, which can
  102. 3:15help you build more expansive worlds,
  103. 3:17minimize crashes on low-end devices, and
  104. 3:19let more people play your game. The
  105. 3:21default values are good options for a
  106. 3:23wide variety of experiences, but
  107. 3:24streaming has a bunch of properties you
  108. 3:26can tune. Check the documentation for
  109. 3:27full descriptions of these properties.
  110. 3:29The key ones for today are streaming
  111. 3:31target radius and streaming min radius.
  112. 3:33Streaming target radius defines the
  113. 3:35outer bounds of the cube, the maximum
  114. 3:37distance at which players see the full
  115. 3:38detail of your experience. If your
  116. 3:40experience relies on longer viewing
  117. 3:42distances for visual impact, consider
  118. 3:44bumping this up a bit as you tweak the
  119. 3:46value. Test your experience and note the
  120. 3:48impact on memory usage and frame rate.
  121. 3:50There's almost always a sweet spot that
  122. 3:52offers tangible performance gains
  123. 3:53without diminishing visuals. Streaming
  124. 3:56min radius defines a second smaller cube
  125. 3:58inside the larger one. Parts inside of
  126. 4:00it have the highest priority when it
  127. 4:02comes to streaming. Because the engine
  128. 4:04is already trying to stream in content
  129. 4:05at the streaming target radius, this
  130. 4:07second cube is more of a fallback for
  131. 4:09situations in which the engine is
  132. 4:10struggling to keep up and has to
  133. 4:12prioritize parts closer to the
  134. 4:14character. As such, be sure to keep this
  135. 4:16value smaller than streaming target
  136. 4:17radius. If the two values are the same,
  137. 4:19what you've done is make everything a
  138. 4:21priority. And when everything's a
  139. 4:22priority, nothing's a priority. Yet
  140. 4:25again, you don't have to take my word
  141. 4:26for it because I've recruited
  142. 4:27Wellblander from our engine team to say
  143. 4:29more. Hey, thanks. As mentioned, I'm
  144. 4:31Well, Blander, a PM on the streaming
  145. 4:32team here at Roblox, and I want to
  146. 4:34quickly talk about how streaming can
  147. 4:36help with humanoids in your games. In
  148. 4:39short, humanoids can really stress your
  149. 4:41players devices, especially those
  150. 4:43lower-end phones and tablets some might
  151. 4:44be using. Humanoids are animation and
  152. 4:47physics heavy, causing high CPU usage
  153. 4:50while also using lots of memory and
  154. 4:52network bandwidth. And in really large
  155. 4:54worlds with lots of players and/or NPCs,
  156. 4:57your players devices, no matter their
  157. 4:59strength, will really struggle to keep
  158. 5:01up with all your game's characters. Hey,
  159. 5:04well, streaming can help here, too. If
  160. 5:06those humanoids are in the distance and
  161. 5:08they aren't impacting gameplay, then
  162. 5:11chances are, well, they're not needed.
  163. 5:13With streaming on, the Roblox engine
  164. 5:15will automatically stream these distant
  165. 5:18characters out, saving your players
  166. 5:20device resources, resulting in smoother
  167. 5:23gameplay and fewer
  168. 5:25crashes. But well, what if there's a
  169. 5:27particular humanoid that is crucial to
  170. 5:29your gameplay? I don't know. Um, take
  171. 5:32for example some opponent player
  172. 5:34carrying a captured flag or something,
  173. 5:36but they're really far away. Well, then
  174. 5:39you can use StreamY's persistence option
  175. 5:41to ensure that flag carrying character
  176. 5:44is always streamed in. Pretty cool. But
  177. 5:47beware, if you overuse persistence,
  178. 5:49you'll find yourself right back dealing
  179. 5:51with the problems that streaming was
  180. 5:53meant to solve in the first place. So,
  181. 5:55use this option sparingly. Last, I want
  182. 5:58to say that sometimes even streaming
  183. 6:00isn't enough and instead you might need
  184. 6:02to design your places and gameplay to
  185. 6:05space players out or reduce the maximum
  186. 6:07numbers of players per server. If you
  187. 6:09think your experience might have issues
  188. 6:11here, keep an eye on the update
  189. 6:13invalidated fast clusters tag and the
  190. 6:16micro profiler. Thanks so much, Wland
  191. 6:18Blander. Finally, let's talk central
  192. 6:20processing units, CPUs. If you owned any
  193. 6:23of the original smartphones, you might
  194. 6:24have fond memories of how revolutionary
  195. 6:26they felt. But you also might remember
  196. 6:28that they were so slow. Smartphones have
  197. 6:30made extraordinary strides over the past
  198. 6:3215 years. But due to thermal
  199. 6:34constraints, their CPUs are still only
  200. 6:36about one quarter the speed of powerful
  201. 6:38desktops in longunning intensive
  202. 6:40workloads like, you know, games. All of
  203. 6:42this is to say that it's easy to create
  204. 6:44experiences that run fine on your
  205. 6:46development machine and completely tank
  206. 6:48CPU performance on a smartphone. There
  207. 6:50are three main culprits here. Scripts,
  208. 6:52physics, and lighting. Let's start with
  209. 6:55scripts. Placing code into run
  210. 6:57service.preder or its deprecated
  211. 6:59counterpart render step causes it to
  212. 7:01execute before each and every frame.
  213. 7:03With a budget of only 16.67 milliseconds
  214. 7:05per frame in a 60fps experience, even
  215. 7:08seemingly minor additions to pre-render
  216. 7:10can have an enormous impact on
  217. 7:12performance. See here how I was able to
  218. 7:14bring this experience to a crawl with
  219. 7:16just a few lines of code by searching
  220. 7:17the scene every frame and doing a bit of
  221. 7:19ray casting. This isn't to say that you
  222. 7:21should never add code to run service.p
  223. 7:22pre-render. Sometimes it's the best
  224. 7:24solution, but you should keep it to the
  225. 7:26bare minimum, such as custom camera
  226. 7:27updates or other elements that require
  227. 7:29precise visual synchronization. Whenever
  228. 7:32possible, write code that runs in
  229. 7:34response to specific events rather than
  230. 7:36before every frame. If you want a call
  231. 7:38back to run on a loop, consider whether
  232. 7:40it really has to happen every frame or
  233. 7:42whether it can happen more infrequently.
  234. 7:44Next, physics. If you see the physics
  235. 7:46stepped tag in the microprofiler
  236. 7:48becoming a limiting factor to your frame
  237. 7:50rate, check which parts in the scene
  238. 7:52really need to be unanchored. The sheer
  239. 7:54number of simulated parts is the most
  240. 7:56common cause of poor physics
  241. 7:57performance. You should also consider
  242. 7:59enabling adaptive physics stepping in
  243. 8:01the workspace, which lets Roblox run
  244. 8:03certain physics calculations less often.
  245. 8:06Finally, lighting. Lighting and shadows
  246. 8:08are critical to the atmosphere of an
  247. 8:09experience. The client eventually falls
  248. 8:11back on simplified voxil technology. As
  249. 8:14graphics quality level decreases, so
  250. 8:16keeping lighting performance high means
  251. 8:17that more players get to see the scene
  252. 8:19as you designed it. Consider setting
  253. 8:21cast shadow to false on small parts
  254. 8:23where the shadow would barely be visible
  255. 8:25anyway. Also, watch out for movement. If
  256. 8:27you have a large light that's always in
  257. 8:29motion, the engine has to continuously
  258. 8:31calculate the effect of that light on
  259. 8:32its surroundings. See here how CPU
  260. 8:34performance dips as the lights approach
  261. 8:37and then improves as they depart. I know
  262. 8:39what you're thinking, Andrew, no. You
  263. 8:41didn't find a third performance expert
  264. 8:42wandering the halls of Roblox, did you?
  265. 8:44Well, I did. Go for it, Owen. Hi all.
  266. 8:47One thing Andrew didn't mention is you
  267. 8:49can actually create your own tags when
  268. 8:50profiling your experience. Using the
  269. 8:52debug.profile begin and debug.profile
  270. 8:55end methods, you can tag a section in
  271. 8:56your code with an arbitrary string. Then
  272. 8:58when you pull up the microprofiler, you
  273. 8:59can look for these tags to reason about
  274. 9:01the impact of a specific game system.
  275. 9:03Please remember though, code is supposed
  276. 9:04to take time to execute. If you're
  277. 9:06encountering frame rate hitches or your
  278. 9:08players are complaining about these
  279. 9:09issues, perhaps low heartbeat, you
  280. 9:11should definitely dive in and diagnose.
  281. 9:12But early on in development, you really
  282. 9:14don't want to spend too long obsessing
  283. 9:15with how many milliseconds each function
  284. 9:17in your code takes to run. All that time
  285. 9:19you'll spend micro optimizing is time
  286. 9:21you're not spending making your game
  287. 9:22more fun. And over time, all these micro
  288. 9:24optimizations you add to your code will
  289. 9:26add up. You have to stay focused on the
  290. 9:27big picture. Performance optimization is
  291. 9:30an all-encompassing, extraordinarily
  292. 9:32challenging topic, so there's no way we
  293. 9:33could cover every possible facet in a
  294. 9:35video. I want to extend a huge thank you
  295. 9:37to our three experts for joining me
  296. 9:39today and shedding some additional light
  297. 9:40on the subject. If you want to dive
  298. 9:42deeper into performance, including way,
  299. 9:44way more information on tools, memory
  300. 9:46usage, streaming, humanoids, rendering,
  301. 9:47and everything else from this video,
  302. 9:49check out the documentation at
  303. 9:52create.roll.com. Thanks for watching.

About this transcript

This page contains the full transcript of How to optimize performance on Roblox by Roblox Creators, generated from the public captions YouTube serves with the video. The transcript has 1,964 words across 303 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.