Chunking Game Data into Parks

UE5 guide to making your projects output binaries clean and predictable

Mon, 31 Oct 2022

Quick introduction on what we are trying to achieve here. The default way Unreal Engine packages your games content is by throwing it into one .Pak file like this photo below

One Pak UE4

This guide will teach you how to structure you content like this

INSERT MEDIA

This isn’t a make it or break it feature to utilize. I mainly add this in for 3 reasons

  • When troubleshooting packaged builds, you can get more insight on missing/corrupt packaged content by labeling the chunk it will be put into
  • Content distributers such as Steam will look at the signature of all of the files you upload and only upload the files that are not already stored in Steam. If you only have one pak file, you will be uploading it every single time which can take a lot of time and bandwidth depending on your game size
  • Similar to above, Steam uses this same system for updating. We all experienced an app for a game that is a 300MB+ download each update because they are doing something like the one pak file method. If they were using pak chunks, that 300MB could be cut down to just the chunks that changed

The way we do this is be utilizing PrimaryAssetLabels. By default Unreal Engine gives you this asset type and assigns it to /Game and a default chunk value of 0. We are going to override this value by creating new PrimaryAssetLabels in all of the folders that we want to group up outside of the default chunk value of 0.

I document the chunk numbers. You don’t have to, I personally find it useful. I’ll walk you through step by step of how to do one and then after that I will show you how I did it with my game

  1. Go to Project Settings -> Packaging
  2. Make sure Use Pak Files and Generate Chunks are checked
  3. Navigate to a folder where you want to have added outside of the default chunk of 0. In my case I will be doing this with my config folder, /Game/EdgemaulLegends/Config for me. Create a new Data Asset, Misc -> Data Asset and the type is PrimaryAssetLabel. Name it whatever you like, the name is not important
  4. Priority to 0, Chunk ID to whatever you like the chunk to be named as. I set mine as 1000. Apply Recursively checked and finally click Label Assets in my Directory
  5. Build your game and you should have something like this in the output folder

One Pak example

Next step is to apply this to all of your folders. Here is a quick run down of how I’m currently doing mine and what the end result is. I start off with a 4 digit chunk since it gives me a lot of wiggle room. You can also go sequentially as well

1000 - Core gameplay blueprints such as the character bps, game mode and player controllers

2000 - Animations. I give each animation set its own chunk id for the main character

3000 - Character models. 3001 is my player character

4000 - Maps. Each map gets its own chunk id within this block

5000 - Functional testing components and its corresponding maps

6000 - widgets, icons and anything solely ui related

7000 - Marketplace content that did not fit into any of the above categories

0 - Any folder that you don’t have a label on will default to this chunk id

As my project advances and grows in size I might get more granular with my chunks. For example, my characters might be hefty in size, I might give the player character its own chunk as well as each type of enemy. It’s really fully customizable. The key think I would say to focus on is to make sure you most common edited files are in small chunks to keep update sizes small. A good example is your character bps. You wouldn’t want them in the same chunk as a 5gb character model

Last note, don’t make the mistake I did. Only add the asset labels to the folders that have content that will be packed into your game

Heres our result

final pak

The other thing I like is that you can tell where your games content is bulkiest. In my case, over 75% of my packaged game is inside of pak 4001 which is my level I use for testing combat

Buy Me A CoffeeDigitalOcean Referral Badge
Loading...
Edward Beazer

Edward Beazer - I just like to build shit. Sometimes I get stuck for hours, even days while trying to figure out how to solve an issue or implement a new feature. Hope my tips and tutorials can save you some time.