Featured image of post How to Perforce

How to Perforce

The Unreal Way.

Difficulty | Easy ⚖️

In this guide we will be going over the rough setup for a perforce server. The setup in this guide allows for setting up Unreal Game Sync, however i’m not going to be covering this, because perforce themselves already have an excellent guide on how to set this up. There are much better and much more complex ways to set this up, but we are going to just go with the very basics, and it assumes you’re using Unreal Engine 5.5 and that you don’t have licensee access. Only requirements are a linux host machine.

I highly recommend studying the following doc by epic as it is very important when it comes to deciding how you should deal with various types in the typemap.

Installing Perforce

A word of warning before we start. There is 2 very crucial settings here that you must setup properly, you will find out the hard way later on if you don’t set these properly. The two settings in question are unicode mode and case sensitivity mode which once are set cannot be changed.

I can recommend to install Ubuntu Server unless you really know what you’re doing or actually have a good reason not to, generally it will provide a very stable distribution and easy maintenance from Linux side, and this guide assumes you use Ubuntu.

First, install helix p4d

sudo wget -qO - https://package.perforce.com/perforce.pubkey | gpg --dearmor | sudo tee /usr/share/keyrings/perforce.gpg
sudo touch /etc/apt/sources.list.d/perforce.list
sudo echo "deb [signed-by=/usr/share/keyrings/perforce.gpg] https://package.perforce.com/apt/ubuntu noble release" | sudo tee -a /etc/apt/sources.list.d/perforce.list > /dev/null
sudo apt update
sudo apt install helix-p4d

Run the helix p4d installer:

sudo /opt/perforce/sbin/configure-helix-p4d.sh

Use the following settings if unsure:

  • Perforce Service name: master
  • Perforce Server root: /opt/perforce/servers/master
  • Create directory: y
  • Perforce Server unicode-mode: n
  • Perforce Server case-sensitive: n
  • Perforce Server address (P4PORT): ssl:1666
  • Perforce super-user login: super

Configure Perforce

Most of these settings are stolen directly from this talk anything else was probably stolen from here, thanks to David Radobenko.

These settings must be configured on the server so login using the following command before you set them

p4 login
p4 configure set net.autotune=0
p4 configure set net.parallel.max=8
p4 configure set filesys.bufsize=2097152
p4 configure set lbr.bufsize=2097152
p4 configure set net.tcpsize=2097152
p4 configure set net.bufsize=2097152
p4 configure set net.parallel.max=40
p4 configure set net.parallel.min=9
p4 configure set net.parallel.threads=6
p4 configure set net.parallel.batch=8
p4 configure set net.parallel.submit.threads=8
p4 configure set net.parallel.submit.batch=8
p4 configure set net.parallel.submit.min=9
p4 configure set dm.stream.components=1
p4 configure set security=3
p4 configure set dm.user.setinitialpasswd=0
p4 configure set dm.user.resetpassword=1
p4 configure set dm.user.noautocreate=2
p4 configure set dm.info.hide=1
p4 configure set run.users.authorize=1
p4 configure set dm.keys.hide=2
p4 configure set defaultChangeType=restricted
p4 configure set dm.password.minlength=16

Typemap Setup

Epic has their own recommended typemap setup, however I don’t actually recommend using it because frankly, it’s missing quite a lot of required things or QoL, it will work but you are likely going to have troubles with shoving the engine into a depot with it.

I recommend studying carefully your needs and which files you expect to put into perforce - eg are you going to be uploading source assets like mp4, wav, pngs, psds? If so you should be adding these in your typemap before you even add these file types to your workspace.

Here is a very broad typemap to get you started. I would consider also comparing it to the Epic provided typemap and some others on the web, eg the one from Xist.

To setup your typemap you login as the super user and run the typemap command on the server.

p4 login
p4 typemap

Then you can paste in the following file contents, it’s likely the editor that will be opened is vim, so when you’re done you type :wq to save and exit.

# Perforce File Type Mapping Specifications.
#
#  TypeMap:     a list of filetype mappings; one per line.
#               Each line has two elements:
#
#               Filetype: The filetype to use on 'p4 add'.
#
#               Path:     File pattern which will use this filetype.
#
# See 'p4 help typemap' for more information.

TypeMap:
        binary+Fl //....avi
        binary+Fl //....bz2
        binary+Fl //....gif
        binary+Fl //....gz
        binary+Fl //....jar
        binary+Fl //....jpeg
        binary+Fl //....jpg
        binary+Fl //....mov
        binary+Fl //....mpg
        binary+Fl //....rar
        binary+Fl //....tif
        binary+Fl //....zip
        binary+l //....aac
        binary+l //....bin
        binary+l //....blend
        binary+l //....bmp
        binary+l //....btr
        binary+l //....cfm
        binary+l //....class
        binary+l //....doc
        binary+l //....docx
        binary+l //....dot
        binary+l //....ear
        binary+l //....exp
        binary+l //....fbx
        binary+l //....ico
        binary+l //....m4a
        binary+l //....ma
        binary+l //....mb
        binary+l //....mp4
        binary+l //....odg
        binary+l //....odp
        binary+l //....ods
        binary+l //....odt
        binary+l //....otg
        binary+l //....ots
        binary+l //....ott
        binary+l //....pac
        binary+l //....pdf
        binary+l //....png
        binary+l //....ppt
        binary+l //....pptx
        binary+l //....psd
        binary+l //....raw
        binary+l //....rpt
        binary+l //....so
        binary+l //....sxw
        binary+l //....tar
        binary+l //....war
        binary+l //....wma
        binary+l //....wmv
        binary+l //....xls
        binary+l //....xlsx
        binary+w //....app
        binary+w //....dll
        binary+w //....dylib
        binary+w //....exe
        binary+w //....ipa
        binary+w //....lib
        binary+w //....pdb
        binary+w //....stub
        text+w //....DotSettings
        text+w //....log
        text+w //....modules
        text+w //....pdm
        text+w //....target
        text+w //....uatbuildrecord
        text+w //....version
        binary+l //....uasset
        binary+l //....ubulk
        binary+l //....udk
        binary+l //....umap
        binary+l //....upk
        binary+wS2 //..._BuildData.uasset
        text+w //....uproject
        text+l //....cm
        text+l //....proc
        binary+l //....prefab
        binary+l //....mat
        binary+l //....unity
        binary+l //....asset
        binary+l //....dds
        binary+l //....bnk
        binary+l //....light
        binary+l //....shadow
        binary+l //....ibl
        binary+l //....bik
        binary+l //....upk
        binary+l //....res
        binary+l //....tres
        binary+l //....ae
        binary+l //....psd
        binary+l //....psb
        binary+l //....ai
        binary+l //....rc
        text //....ini
        text //....config
        text //....cpp
        text //....hpp
        text //....h
        text //....c
        text //....cs
        text //....m
        text //....mm

Native Build P4Ignore (Combined Engine + Project)

For Native Builds my recommended ignore file looks like the following, make sure you replace “ProjectName” on the file path of the ignores at the bottom!

#########################################################################################################
# Daft Software P4IGNORE
# Ignore for Native Builds 5.5 (Engine + Project)
#########################################################################################################

#########################################################################################################
# Root or Filetype Ignores
#########################################################################################################

# Ignore project files in the root
/*.sln
/*.xcodeproj
/*.xcworkspace
/*.code-workspace
/*.clangd
/*.clang-format
/*.p4config
/*.p4sync.txt
/*/*.sln
/*/*.xcodeproj
/*/*.xcworkspace
/*/*.clangd
/*/*.clang-format

# Ignore local user files in any folder
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
*.vsconfig
*.user
.vs
.vscode
.ignore
.idea
.gradle
.tgitconfig

# Standard binary files
*.slo
*.lo
*.o
*.obj
*.gch
*.pch
*.so
*.so.*
*.dylib
*.dll
*.lai
*.la
*.a
*.lib
*.exe
*.out
*.app
*.ipa
*.idb
*.bz2
*.zip
*.gz
*.jar
*.pak
*.bmp
*.pdb
*.pyc
*.sym
*.debug
*.link

# Unreal Build Output
*.modules
*.csproj.props
*.csprojAssemblyReference.cache
*.uatbuildrecord
*.tmp

#########################################################################################################
# Tool Ignores
#########################################################################################################

/Tools/SteamPipe/content/*
!/Tools/SteamPipe/content/placecontenthere.txt
/Tools/SteamPipe/builder/*
/Tools/SteamPipe/builder_linux/*
/Tools/SteamPipe/builder_osx/*
!/Tools/SteamPipe/builder/steamcmd.exe
/Tools/SteamPipe/output/*
/Tools/SteamPipe/userdata/*
/Tools/p4-fast-reconcile/target/*
!/Tools/p4-fast-reconcile/target/debug/p4-fast-reconcile.exe
!/Tools/p4-fast-reconcile/target/release/p4-fast-reconcile.exe

#########################################################################################################
# Engine Level Ignores
#########################################################################################################

/Engine/DerivedDataCache/*

# Ignore NET binaries
/Engine/Binaries/ThirdParty/DotNet/
/Engine/Binaries/DotNET/UnrealBuildTool/
/Engine/Binaries/DotNET/UnrealBuildTool.Tests/
/Engine/Binaries/DotNET/AutomationTool/
/Engine/Binaries/DotNET/AutomationTool.Tests/
/Engine/Source/Programs/DotNETCommon/BuildUtilities/bin/
/Engine/Source/Programs/Shared/*/bin/
/Engine/Source/Programs/UnrealBuildTool.Tests/
/Engine/Source/Programs/AutomationTool.Tests/

# Ignore documentation generated for C# tools
/Engine/Binaries/DotNET/UnrealBuildTool.xml
/Engine/Binaries/DotNET/AutomationScripts/BuildGraph.Automation.xml
/Engine/Binaries/DotNET/AutomationScripts/Newtonsoft.Json.xml
/Engine/Binaries/DotNet/Android/UnrealAndroidFileTool/*.xml
/Engine/Binaries/DotNet/**/*.deps.json
/Engine/Binaries/DotNet/**/*.runtimeconfig*.json
/Engine/Platforms/**/Binaries/DotNET/AutomationTool/AutomationScripts/**.xml
/Engine/Platforms/**/Binari
/Engine/Platforms/**/*.deps.json
/Engine/Source/Programs/AutomationTool/BuildGraph/BuildGraph.Automation.xml
/Engine/Source/Programs/**/*.deps.json
/Engine/Source/Programs/**/*.runtimeconfig*.json
/Engine/Source/Programs/**/Properties/launchSettings.json
/Engine/Source/Programs/UnrealBuildTool.Tests/bin/

# Add exceptions for GitDependencies
!/Engine/Binaries/DotNET/GitDependencies/
!/Engine/Binaries/DotNET/GitDependencies.exe
!/Engine/Binaries/DotNET/GitDependencies.dll
!/Engine/Binaries/DotNET/GitDependencies.runtimeconfig.json

# Ignore USD resources copied into Binaries directory at build time
/Engine/Binaries/ThirdParty/USD/**

# Ignore exp files in Engine directories as they aren't C/C++ source files
/Engine/Binaries/**/*.exp

# Ignore version files in the Engine/Binaries directory created by UBT
/Engine/Binaries/**/*.version

/Engine/Programs/MemoryProfiler2/*
/Engine/Programs/UnrealBuildTool/*

/Engine/Binaries/Linux/UnrealEditor
/Engine/Binaries/Linux/UnrealEditor-Cmd

/Engine/Extras/*/**
!/Engine/Extras/Maya_AnimationRiggingTools/**
/Engine/Extras/Maya_AnimationRiggingTools/**/*.pdf
/Engine/Extras/Maya_AnimationRiggingTools/**/*.pyd
/Engine/Extras/Maya_AnimationRiggingTools/MayaTools/General/ART/**
/Engine/Extras/Maya_AnimationRiggingTools/MayaTools/General/Icons/**
!/Engine/Extras/VisualStudioSnippets/**

/Templates/*
/FeaturePacks/*
/Samples/*

/Engine/Source/ThirdParty/ICU/icu4c-53_1/source/data/**
/Engine/Source/ThirdParty/ICU/icu4c-53_1/source/test/**

/.uedependencies

#########################################################################################################
# Project Level Ignores
#########################################################################################################

/ProjectName/ArchivedBuilds/*
/ProjectName/Releases/*
/ProjectName/Binaries/*

!/ProjectName/Binaries/DotNET/*
/ProjectName/Binaries/DotNET/AutomationTool/*
/ProjectName/Binaries/DotNET/UnrealBuildTool/*

/ProjectName/DerivedDataCache/*
/ProjectName/Saved/*

/ProjectName/Plugins/Developer/RiderLink*

#########################################################################################################
# Wildcard Directory Ignores
#########################################################################################################

*/Intermediate/*
*/Saved/*
**/Plugins/**/Binaries/*
*/obj/*
**/DerivedDataCache/Boot.ddc
**/DerivedDataCache/**/*.udd

Regular Project P4Ignore

If you don’t need Native builds either use the Epic provided ignore, or the one I usually use is below.

# Visual Studio user specific files
.vs/

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
*.ipa

# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb
*.vsconfig

# Archived Build
ArchivedBuilds/*

# Steam
Tools/SteamPipe/content/*
!Tools/SteamPipe/content/placecontenthere.txt
Tools/SteamPipe/builder/*
Tools/SteamPipe/builder_linux/*
Tools/SteamPipe/builder_osx/*
!Tools/SteamPipe/builder/steamcmd.exe
Tools/SteamPipe/output/*
Tools/SteamPipe/userdata/*

# Fast Reconcile
Tools/p4-fast-reconcile/target/*
!Tools/p4-fast-reconcile/target/debug/p4-fast-reconcile.exe
!Tools/p4-fast-reconcile/target/release/p4-fast-reconcile.exe

# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga

# Binary Files
Binaries/*

# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt

# Don't ignore icon files in Build
!Build/**/*.ico

# Built data for maps
*_BuiltData.uasset

# Configuration files generated by the Editor
Saved/*

# Compiled source files for the engine to use
Intermediate/*
Plugins/*/Intermediate/*

# Platforms like Hololens
Platforms/

# Cache files for the editor to use
DerivedDataCache/*

# Rider stuff
.idea/
*.user
Plugins/Developer/RiderLink*

On Your Own!

Now you have your perforce server up and running, you need your machines IP address, and then you can connect using ssl:mymachineip:1666 and the super user and pass. Good luck!

Built with Hugo
Theme Stack designed by Jimmy