BlueprintPseudocode guide

Blueprint pseudocode in P4 Code Review

Set up P4 Code Review (Swarm) so a changed .uasset in a review shows as pseudocode: side by side or in-line, with comments on its lines, like any text file. You set it up once, on the Swarm server.

What you need

This was set up and checked on one combination. Anything else is untried.

Checked on

  • P4 Code Review 2026.4, build 3138518, in its Docker image
  • Helix Core server 2023.1 (case-insensitive)
  • Unreal Engine 5.8 content

On the Swarm host

  • Swarm running on x86-64 Linux with glibc 2.31 or later (not Alpine)
  • Nothing else: no p4 command line, cron or flock, and no Perforce workspace. The module reads your project from Perforce itself, as Swarm's admin user
  • Optional: a folder for the project's generated data, to keep it on the host instead of in Perforce
  • Optional: about 7 GB for a copy of the engine's content

On a Windows machine

  • Your project's editor, to write the project's generated data: its metadata table and an archive of a few MB (4 MB for UE 5.8 with its default plugins) of the engine files the plugin reads. No engine install is needed on the Swarm host
  • Optional: the engine install, to copy the engine's content

Install

1. Copy the tools

Copy the plugin's Tools folder (see where the plugin is) to the Swarm host as /opt/bp-tools, and make BlueprintReaderLinux and Swarm/ConvertBlueprint.sh executable. Run as Swarm's web server user, /opt/bp-tools/BlueprintReaderLinux prints its usage and exits with an error.

The plugin ships the reader's source. To build BlueprintReaderLinux yourself, run sh Tools/BlueprintReader/BuildLinux.sh in a copy of the whole plugin folder on a Linux machine with g++, then copy its Tools folder.

2. Add the module to Swarm

In Swarm's folder (/opt/perforce/swarm in its packages and its Docker image), place /opt/bp-tools/Swarm/BinaryTextDiff as module/BinaryTextDiff, and /opt/bp-tools/Swarm/CustomModules.php as config/custom.modules.config.php; a copy or a link. If Swarm already has that file, add 'BinaryTextDiff' to its list instead. Swarm's own files are not changed.

Docker example: in Swarm's Docker image, the converter runs inside the container, so mount /opt/bp-tools too, read-only, for example in a compose override, then recreate the container:

services:
  swarm:
    volumes:
      - /opt/bp-tools:/opt/bp-tools:ro
      - /opt/bp-tools/Swarm/BinaryTextDiff:/opt/perforce/swarm/module/BinaryTextDiff:ro
      - /opt/bp-tools/Swarm/CustomModules.php:/opt/perforce/swarm/config/custom.modules.config.php:ro

Configure

1. Swarm's config

Merge the binary_text_diff block of Swarm/SwarmConfigExample.php into Swarm's data/config.php. It names the converter, sets a 50 MB limit (a bigger file shows a stub instead) and holds a context block: with it, the module reads your project's config, generated data and referenced assets from Perforce, at the revision of the review. Leave 'engine' => null: the project's engine archive then stands in for the engine (below).

2. Reload the configuration

Swarm caches its configuration: reload it, with Reload Configuration on Swarm's System Information page. Do the same after every later change to the config. In Docker, recreating the container also reloads it.

The project's generated data

The module finds a Blueprint's project as the nearest folder above it in the depot that holds a .uproject. The project's editor writes two files to Saved/BlueprintPseudocode/GeneratedData each time it starts. Metadata-Project.tsv is what lets the text name your C++ classes, calls and values. EngineContext.tar holds the engine files the plugin reads, so the Swarm host needs no engine: the engine's version and config, and its enums, structs and macro libraries, such as ForEachLoop's. The editor writes the archive once it has scanned your assets, a little after it starts. Keep both in the depot, or on the host and name them with -Metadata.

In the depot

Submit the two files as <Project>/Build/BlueprintPseudocode/Metadata-Project.tsv and <Project>/Build/BlueprintPseudocode/EngineContext.tar, with <Project> the folder that holds the .uproject. The module reads both at each revision of a review and places them under Saved for the reader. Submit them again after C++ changes and after an engine update. Installing the module is then the only step on the Swarm host: no engine copy and no 'engine' setting.

A revision from before their first submit reads without them, so a Blueprint's first review after it also shows the lines they change, such as the note that the engine was not found.

On a build machine, Tools/BlueprintReader.py -GenerateMetadata writes both files without opening the editor window, once your C++ is built (see notes at the top). A build step can run it and submit the files that changed.

Without the table, calls and values of your C++ read incomplete, and each class, function, enum or struct the table would hold is noted at the top of the text. If the depot also holds your project's Binaries/Win64/*.modules, every text in the project also opens with the note that the project has no metadata. Without the archive, and with no engine named, every text opens with // The engine was not found.

On the host, with -Metadata

For a pipeline that keeps the files out of the depot, copy the whole GeneratedData folder to the Swarm host, for example as /srv/bp-context/GeneratedData, and name it in the converter's command in Swarm's config, after '{file}':

'command' => ['/opt/bp-tools/Swarm/ConvertBlueprint.sh', '{file}',
              '-Metadata=/srv/bp-context/GeneratedData'],

Reload the configuration as in Configure. The shipped engine tables still load. Each time your pipeline replaces the folder's files, delete the .txt files in data/cache/binarytextdiff: a converted text is cached by the command, not by the folder's content.

Docker example: mount /srv/bp-context into the container too, read-only, next to the others in Install: - /srv/bp-context:/srv/bp-context:ro.

Every revision, an old or a shelved one too, then reads the host's copy, and the files in the depot are not used.

Check

Shelve a change to a Blueprint with #review in its description, then open the review.

  • The file shows a text diff of pseudocode, side by side or in-line (Alt+L)
  • Clicking a line opens the comment box, and the comment stays on that line
  • The arrows above and below a hunk show more pseudocode, not blank lines

If the file still shows as binary, the module is off: check that Swarm sees the module (Install), the binary_text_diff block, and that the configuration was reloaded.

A stub that says the file could not be converted is not cached: fix the cause and reload. Its detail is in data/log, as BinaryTextDiff: conversion failed. Every other text, a could not read stub included, stays cached; to see a fix, delete the .txt files in data/cache/binarytextdiff.

Update

Copy the new plugin's Tools folder over /opt/bp-tools, and over the module if you copied it into Swarm. Make its programs executable again and reload the configuration. A release with a new text format, the number in each text's first line, converts each file again on its next view, so comments on open reviews can move (below). A release with the same format converts nothing again.

Engine content (optional)

The project's engine archive already covers the engine's enums, structs and macro libraries, and its renamed functions. What it lacks is the engine's Blueprints: one your Blueprint uses as a parent, an interface or a function library reads as if its file were missing, so that part prints as the file holds it, with no note in the text, and a warning in Swarm's log that appears only at log.priority 4 or higher. To read them, copy the engine's content to the host, or name a depot folder that holds it. The archive is then not used.

1. Export it on Windows

powershell -ExecutionPolicy Bypass -File "<plugin folder>\Tools\Swarm\ExportEngineContext.ps1" -Engine "C:\Program Files\Epic Games\UE_5.8" -Out D:\engine-context

It copies the engine's version file, config, content and plugin descriptors under -Out: for 5.8, about 17,000 files and 7 GB.

2. Copy it to the host

Copy the folder to the Swarm host, for example as /srv/bp-context/engine, so that Engine sits directly under it. Copy it again after an engine update.

3. Name it

In the context block of the config, set 'engine' => '/srv/bp-context/engine', and reload the configuration as in Configure. Whenever you replace the copy, delete the .txt files in data/cache/binarytextdiff: a converted text is cached by the folder's path, not its content.

Docker example: mount /srv/bp-context into the container, read-only, as for the generated data.

If your depot holds the engine, skip steps 1 and 2: set 'engine' to the depot folder that holds Engine/, for example '//depot/UE5/', and reload the configuration. The module reads the engine's files from Perforce, as it reads your project's. A revision from before the engine's first submit reads as if no engine were named.

What a review shows

Every .uasset shows text. When it is not the text of a Blueprint, string table or StateTree, it is a stub that says why, with the file's size and a hash, so two different files never look the same.

The file isThe text is
A Blueprint, string table or StateTreeThe pseudocode; all of it added or deleted when the file is
Another asset (a texture, a sound, a data asset)// Unsupported type: not a Blueprint, string table or StateTree, then its size and SHA-1
Over the size limit// Unsupported: <n> bytes, over the converter's limit, then the server's digest of the file
Not readable, or in no project (no .uproject in a folder above it)// BlueprintPseudocode could not read this file: and the reason, such as no project: no .uproject in a folder above '<folder>/', then its size and SHA-1
Not converted: the converter could not start, timed out, failed or printed nothing// BlueprintPseudocode could not convert this file: and the reason, then its size and SHA-1

Limits

References are read at each revision

A Blueprint's config, metadata table, engine archive and referenced assets come from Perforce as they were at the revision shown, so each side of a diff reads its own. For a shelved file, the shelf's own files are read from the shelf and every other file as submitted at the shelf's change number, not as its author has them. A table and archive named with -Metadata are the host's, the same for every revision.

The engine archive is as old as its last submit

The archive holds the engine as it was when the editor last wrote it. After an engine update, or a change to your engine plugins, submit it again; revisions from before keep the archive they had. Engine Blueprints are not in it (above).

The first view is slower

A revision's first view fetches its files from Perforce and runs the reader again for each batch of references it finds, within the converter's timeout. Later views come from the cache.

Read as Swarm's admin user

A review can show pseudocode built from files its reviewers cannot open themselves, and a converted text is shared by everyone who views it. On a case-sensitive server, which is untried, an asset whose reference spells its path in another case than the depot is not read.

Notes on both sides

Each revision is converted alone, so a note at the top of the text, such as a missing table, appears on both sides and diffs to nothing.

Comments follow line numbers

A comment is tied to a line of the converted text. When a plugin update changes how a Blueprint reads, comments on open reviews can move.

Swarm upgrades

The module replaces parts of Swarm's file handling. After a Swarm upgrade, check a Blueprint review as above. Swarm's old (non-React) diff page and its ?lines= and annotate views do not show pseudocode.

The caches grow

Converted texts in data/cache/binarytextdiff, and the files fetched from Perforce in its files folder, are never removed. Delete them to reclaim the space; they are made again on the next view.