In this post I’ll try to explain in detail what our file builder is, why you need it, and how to build a patch for your updater.

The builder is a program that prepares files so the updater can work with them. Preparation happens in a few main stages:

  1. Reading information about files and folders.
  2. Syncing with a previously created patch.
  3. Building the file map for the updater.
  4. Removing files from the patch that aren’t part of it.
  5. Packing every file individually.
Patch Builder main window — the patch-building tool for an updater's launcher
patch builder

Gathering Information

To guarantee that files are correctly downloaded during an update, the builder collects information about each file, including its name, size and, most importantly, its hash sum.

A hash sum is a unique identifier for a file, calculated using a mathematical algorithm based on the data it contains. Right now we use the CRC32 algorithm, for speed and efficiency when collecting information. Any change to a file will change its hash sum, even if the size stays the same.

Example of a line with file information, where 4144 is the size in bytes and dbc44dcf is the hash sum: L2.ini 4144 dbc44dcf

Synchronization

If you’ve already created a patch for your client, don’t rush to delete it. Our builder has a synchronization system that compares the previous patch against the new files. The magic happens after comparing the new patch’s virtual file tree against the previously created patch’s file map (UpdateInfo.xml). The sync result is shown on the virtual file tree using color indicators:

virtual file tree with sync color indicators in Patch Builder
color indicators: green new, blue modified, black untouched, red deleted
  • Green — new file.
  • Blue — modified file.
  • Black — untouched file.
  • Red — deleted file.

Building

The build starts by turning the virtual file tree into a flat test file in xml format — let’s call it the update’s file map. This file contains all the information the updater will need for a successful update. More on that in the post about the Updater.

example UpdateInfo.xml file map — output of a Patch Builder build

After that, files that are no longer part of the new patch get deleted first. Finally, each file is packed into an archive using the Zip algorithm with the best compression setting.

So How Do You Use It?

Launch UpdateBuilder.exe. On the left side, select or drag in the folder with the new patch. Once selected, it’ll start loading file information. Detailed info on what’s happening is written to the logging window.

UpdateBuilder.exe — selecting the source folder for building a patch

After the virtual file map is built, it’s time to pick the folder to save the patch result to. If you’ve already built a patch before, pick the same folder to sync the files. If this is your first patch, pick an empty folder.

selecting the output folder for the patch result in Patch Builder

Once syncing is done, we have full information about the files — what’s next? Now we can move on to configuring the file update parameters. Our system has two types of parameters:

  1. Whether the file participates in the quick (critical) check.
  2. Whether the file needs to be checked for size and hash sum during an update.

Each of these parameters has its own toggle per file. The same toggles on folders change all their dependent items.

file parameter toggles: quick check and CRC32 hash check

More on Quick and Critical Updates

When packing a single patch, you can specify which files, out of all of them, need to be updated during a quick check in the updater. And here we give you full flexibility — you can build a simple patch with just the system folder added to the quick check, or build the whole game client and mark the patch’s files for a quick update. That way you can distribute and update the entire game for your users. On the updater side, you can build this into different quick-update and full-update buttons, as well as running a quick update automatically on updater startup.

quick and full critical update settings in Patch Builder

More on Size and Hash Checks

All settings are enabled by default.

Once everything’s synced and configured, all that’s left is to click “Start Packing” and run the build. All the info shows up in the log too, and the results folder opens automatically.

Start Packing button — running the patch build for a launcher in Patch Builder

All that’s left is to copy the files to the host and send me the link.

Wrapping Up

Just a reminder that the builder’s source code is publicly available on GitHub — I’d be glad to see any activity there.

That’s all for now, thanks for reading! Now you know a bit about how to build an L2 updater and how our Lineage 2 (and other) patch file builder works. Hope that answers your questions, but if not — welcome to reach out via the contact form.