Tips & Tricks: Performance Optimization in UDK
The Unreal Development Kit is a wonderful editor for building both games and levels, but sometimes, things don’t always work as anticipated. I’ve heard numerous complaints of people who claim UDK is a terrible editor simply because it was running slow, but don’t forget that there are ways to fix this problem, so don’t just give up on the editor, especially if it could be caused by something you did! If UDK is running impossibly slow, check out these tips for optimizing the editor’s performance.
One of the biggest causes for slow performance is due to your computer’s specs. The Unreal Development Kit is a very powerful program, and it uses up a lot of memory when running, so before you even download it, check out the official site and make sure your computer has the proper specs to actually run it. You can find a list of PC Specs on the right side of the UDK Download page, so compare these to your own. If you can’t meet the minimum requirements, then I’d recommend finding another editor to use, or upgrading your computer, if you can. Furthermore, if you are running the 64-bit version, you might try switching to the 32-bit version of the editor, especially if your computer only meets the minimum specs.
Other Programs Running
Another common problem comes from running other problems at the same time as UDK. Sometimes, we might be working in multiple programs at the same time, but this can cause UDK, as well as your whole computer, to run at a sluggish pace since so much memory is being used. If you’re working in UDK, be sure to close all other programs, including your browser. No matter which browser you use, it still uses up memory while running, especially if you have multiple tabs open. I’ve also found that having other powerful programs, such as Photoshop, open with UDK will cause UDK to crash completely, which can mean losing unsaved work if you’re not careful. If you need to look something up online or work in another program, be sure to save your work in UDK and close it out to avoid lag.
Too Many Meshes
If you’re like me and like to really polish your levels up, which means having a lot of static meshes, you’re likely to come across a lag problem in your level. Using a variety of different meshes in your level might make it look better, but it could cause problems, especially if you’re creating a larger level. If you notice UDK is lagging, you might need to replace some of the different meshes with ones you use more frequently in the level. For example, let’s say I’m building an apartment complex and I have three different couch models in the level. If I’m experiencing problems with lag, I might want to swap out the least used couch model with one of the other ones that is used more. It might not look as nice, but you can always swap out textures to make it look different. Doing this will keep the editor from having to load a whole new model, since it can just use one that it’s already loaded in.
There is another problem that is mostly seen in outdoor levels, when you have too many trees in one level. I just experienced this issue for the first time while creating my swamp level, when it got to the point that I could barely do anything in the level. The most obvious solution would be to remove the majority of the trees, but if you’re making a forest or similar type level, that just isn’t going to work. If you’re using several different tree meshes, you can try replacing some of them to the mesh that is used most often, which might solve your problem. However, this probably isn’t going to work either, because the problem lies with the transparencies used for the tree meshes. If you look at the actual 3D model for one of the tree meshes (no textures/materials applied), you should see something like this image:
The area of the tree where the leaves go is kind of just a mess. But when you apply the materials to the tree, it looks more like an actual tree, like the following image:
UDK is using a bunch of transparencies where the leaves are, to make them look more like leaves and not clumps of a leaf texture. Including a ton of trees in your level makes for a ton of transparencies, which cause problems during rendering, since you’re going to have transparencies on top of transparencies. The editor has a hard time trying to render all of these transparencies, which leads to an extremely slow UDK and horribly long lighting builds, even with lightmass turned off. To correct this problem, you need to simplify your meshes, which will lower your memory footprint at the expense of lowering the mesh’s quality. There is an option in UDK to simplify a mesh, and you can read more about it on the UDN’s Mesh Simplification Tool page.
I’ve put together a before and after from my own level to show the comparison. If you turn on the shader complexity toggle in the perspective viewport (it’s on the bar with the options for brush wireframe, unlit, lit, etc.), you can get a good idea of areas that are causing rendering problems. The brighter the green, the better the editor will render it; anything that is red is a problem area that should be dealt with.
Here’s the before image, with lots of red and a fairly dark green:
And here’s the after image, with less red and brighter greens:
For the above images, I used the mesh simplification tool on the two tree meshes I used here, setting the quality of each to 50 and rebuilding the normals. As you can see, there’s still quite a bit of red, especially on that tree on the left, and the editor is still running a little slow, so I can actually go back and lower the quality even more if I want to. Just remember that when you use this tool, you are making the static mesh not look as good, so keep this in mind if you’re working with a really bright level, since you can always use darker lighting to hide lower quality.
Save Often and Exit
If you’re having lag issues, you should probably be saving your work even more than usual, since UDK could crash at any time. I also recommend saving multiple versions of your level, so that if something messes up, you can always reopen a previous version. It might seem trivial, but sometimes you just need to exit out of UDK. My computer isn’t the greatest, so I find that if my level is running slow, it helps to close UDK and give it a break.
I hope these tips helped, and let me know if you have any questions or suggestions!