14.11.12

Packages in UDK

It was quite confusing for me to figure out how package system works in UDK. All the information available online is either scattered or slightly unclear. So I decided to put together a quick guide.
Simply put, when assets are imported into or created within UDK, they are all being compressed together as a package file. This allows for easier loading of groups of assets used in the scene. Instead of loading many files, user only has to load one or two. And all the source files could be deleted without affecting any of the imported things.
Files can be imported into UDK either by dragging and dropping them into the content browser, or by clicking "Import" button. When doing so, you'll be asked to input the name and grouping of the package you want to put the assets in. Common ways to group assets is to categorize them into meshes, materials or textures, or, if the level is large enough, by the name of the area they are used in.
Keep in mind that empty packages simply do not exist. If a new package is created (by pressing "New" in the content browser), the dialogue window will ask for "Factory", which is a type of content that will be stored in it. For example, if "Materials" factory was chosen, then the newly created package will contain an empty material without any name or texture references.
Imported assets can be put into the scene by simply dragging and dropping them. Another way is to select an object in the content browser, then right-click somewhere in the level, and placing it as a specific actor, such as static or dynamic mesh. Pretty straightforward.
There are two types of packages - .upk (just assets) and .udk (level). They can be internal - that is located within [%UDK Location%\UDK\UDK-%version%\UDKGame\Content], or external, meaning they are saved somewhere else. Internal packages are found by UDK on startup, so there is pretty much no problem with loading of the level. External ones, on the other hand, require to be loaded manually before the loading of the level itself.
This makes perfect sense if you take in account what UDK was initially made for - a creation of a single project that could be shared between several PCs. Not many small university assignments. So this system is slightly troublesome for people like us.
Packages are very location-dependent. That is, if a level references assets from a .upk, and you change the location of this package, all the reference links will be broken. This means that if you try to upload your assignment on a network drive, it will result in breaking all the links and thus having an empty level.
There is a workaround though. Level packages (.udk) can store assets just as easy as the common ones. All you need to do is to create a package with exactly the same name as the level you are working on, and instead of saving it by right clicking on the new package and choosing "Save", it is sufficient to just save the level. UDK will save the assets of the new package in the same .udk file as the level itself. Now the level only references assets within itself, and thus is not tied to a specific location of external packages. It can be moved to different machines pretty easily.
An example of a level package.
A downside of this approach is, of course, the size and loading time of the file. All the imported assets have to be stored somewhere. This is not very important though, in my opinion. Another problem is that it will only save the assets that are being used in the scene. So if, for example, a mesh and a couple of textures are imported, but they are not being used in the scene, they are going to be lost when the level is saved. Again - level packages will not save the assets that are not being referenced in the level itself.
Also, a minor inconvenience of level packages is that for whatever reason (a bug, maybe?) dragging and dropping assets from the content browser onto the level no longer works. It is still possible to place whatever is needed using the right-click menu, though.
So, this is pretty much it. Please, let me know if I am mistaken or unclear somewhere, I'll try to fix it.

No comments:

Post a Comment