Skip to content

Instantly share code, notes, and snippets.

@jase-perf
Last active May 11, 2025 21:33
Show Gist options
  • Save jase-perf/3f6328fb66427802090f458775e481df to your computer and use it in GitHub Desktop.
Save jase-perf/3f6328fb66427802090f458775e481df to your computer and use it in GitHub Desktop.
Game Engine Typemap (WIP) Engine-agnostic typemap that will work with UE, Unity, Godot, etc.
# 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 files that are usually already compressed. Store in full.
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
# Common binary formats to lock
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
# These build files could be set to S2, to store fewer revisions
binary+w //....app
binary+w //....dll
binary+w //....dylib
binary+w //....exe
binary+w //....ipa
binary+w //....lib
binary+w //....pdb
binary+w //....stub
# Test files automatically updated by UE and other programs
text+w //....config
text+w //....DotSettings
text+w //....ini
text+w //....log
text+w //....modules
text+w //....pdm
text+w //....target
text+w //....uatbuildrecord
text+w //....version
# Unreal Specific binaries
binary+l //....uasset
binary+l //....ubulk
binary+l //....udk
binary+l //....umap
binary+l //....upk
# BuildData files are large and can be regenerated, so lets store just two past versions
binary+wS2 //..._BuildData.uasset
# Project files are text-based. +w avoids problems when changing editor version
# but can lead users forgetting to submit. Could remove the +w part.
text+w //....uproject
#Unity Specific
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
#Godot Specific
binary+l //....res
binary+l //....tres
#Adobe Files
binary+l //....ae
binary+l //....psd
binary+l //....psb
binary+l //....ai
@rosenand
Copy link

rosenand commented Jan 18, 2025

.uproject should be text or text+w, I believe?

text+w //....uproject

Also, in the UE quick start guide in official docs, there's a useful entry for BuildData, if one wants to save up space (personally I would set it to S2, I think):

binary+wS //..._BuildData.uasset

Lastly, also in the docs, there's a neat example for preserving original timestamps of third party binaries. It's not necessary, but the modifier is also explained in the usage notes, with some justification. This is my version, at least it should work for the DLSS plugin in UE (the syntax may be a bit off, I'm not sure about the slashes and wildcards):

binary+lm //...Plugins/...Binaries/ThirdParty/....dll

@jase-perf
Copy link
Author

Thanks @rosenand !

.uproject should be text or text+w, I believe?

Great suggestion. I will add that change.

Also, in the UE quick start guide in official docs, there's a useful entry for BuildData

I'm actually the one who wrote that typemap for the docs, so I definitely should have included it! lol

binary+lm //...Plugins/...Binaries/ThirdParty/....dll

Adding ... recursive wildcards within paths in typemaps, stream specs, and protections can lead to slowing down the server as they add up, so I tend to avoid those on anything that runs server-side like this.
That said, I actually prefer to set all my workspaces to have the modtime settings so ALL files are treated this way. It speeds up reconcile offline work and (at least to my brain) makes more sense so I can have a sense of when things were actually edited, not just when I lasted synced them.

@rosenand
Copy link

Haha!

Yeah, modtime also made sense to me, so yesterday I took the risk and enabled it globally for my workspace, while I was setting up p4d for my personal project. Glad to hear I'm on the right track!

And good to know about recursive wildcards, I'll take this into account.

Thanks so much for the typemap, I've been using Perforce for years, but this is my first time as a p4d admin (even if just for myself), and with slight modifications it's been a great base for my setup! I tried linking it here yesterday, as people in the comments seem to be asking about the typemap config (which was only shown briefly in the video), but for some reason my comments disappear right after publication (both as replies, and as a standalone comment). Hope people find their way here.

@Skylarzz
Copy link

The best typemap template, well commented and constantly updated, thank you for sharing!

@loisivanaj
Copy link

Thank you very much for this Jase!

@CitizenZultron
Copy link

CitizenZultron commented Apr 15, 2025

Since information is limited, I am sharing my typemap with a more specific focus on Unity Engine that could complement this list:

#----------------------------
# TEXT FILES (Mergeable)
#----------------------------
text //....cs
text //....js
text //....shader
text //....cginc
text //....hlsl
text //....compute
text //....uss
text //....txt
text //....json
text //....xml
text //....csv
text //....md
text //....gitignore
text //....editorconfig
text //....asmdef
text //....asmref
text //....rsp
text //....yaml
text //....package
text //....template
text //....ini
text //....cm
text //....proc
text //....md5mesh
text //....md5anim

#----------------------------
# META FILES (Text but lock)
#----------------------------
text+l      //....meta

#----------------------------
# UNITY ASSETS (Binary, Locked)
#----------------------------
binary+l    //....unity
binary+l    //....prefab
binary+l    //....prefab.unity
binary+l    //....asset
binary+l    //....mat
binary+l    //....renderTexture
binary+l    //....physicMaterial
binary+l    //....controller
binary+l    //....anim
binary+l    //....overrideController
binary+l    //....cubemap
binary+l    //....terrain
binary+l    //....navmesh
binary+l    //....mask
binary+l    //....lighting
binary+l    //....light
binary+l    //....shadow
binary+l    //....ibl
binary+l    //....aas
binary+l    //....response
binary+l    //....u
binary+l    //....ip
binary+l    //....demo
binary+l    //....roq

#----------------------------
# 3D MODELS
#----------------------------
binary+l    //....fbx
binary+l    //....obj
binary+l    //....blend
binary+l    //....dae
binary+l    //....ma
binary+l    //....mb
binary+l    //....lwo
binary+l    //....skp

#----------------------------
# TEXTURES & SPRITES
#----------------------------
binary+l    //....png
binary+l    //....jpg
binary+l    //....jpeg
binary+l    //....tga
binary+l    //....psd
binary+l    //....psb
binary+l    //....tif
binary+l    //....tiff
binary+l    //....bmp
binary+l    //....gif
binary+lS   //....dds

#----------------------------
# AUDIO
#----------------------------
binary+l    //....wav
binary+l    //....mp3
binary+l    //....ogg
binary+l    //....aiff
binary+l    //....flac
binary+l    //....aac
binary+l    //....m4a
binary+lS   //....bnk

#----------------------------
# VIDEO
#----------------------------
binary+l    //....mp4
binary+Fl   //....mov
binary+Fl   //....avi
binary+lS   //....bik
binary+l    //....webm
binary+Fl   //....mpg
binary+l    //....wmv
binary+l    //....wma

#----------------------------
# FONTS
#----------------------------
binary+l    //....ttf
binary+l    //....otf
binary+l    //....fnt

#----------------------------
# ADOBE
#----------------------------
binary+l    //....psd
binary+l    //....psb
binary+l    //....ae
binary+l    //....ai

#----------------------------
# PLUGINS / LIBS / BUILD
#----------------------------
binary+l    //....dll
binary+l    //....so
binary+l    //....lib
binary+l    //....a
binary+l    //....jar
binary+l    //....aar
binary+l    //....apk
binary+l    //....unitypackage
binary+w    //....app
binary+w    //....exe
binary+w    //....ipa
binary+w    //....pdb
binary+w    //....dylib
binary+w    //....stub

#----------------------------
# MISC BINARY
#----------------------------
binary+l    //....bin
binary+l    //....data
binary+l    //....class
binary+l    //....dot
binary+l    //....ear
binary+l    //....exp
binary+l    //....ico
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    //....ppt
binary+l    //....pptx
binary+l    //....doc
binary+l    //....docx
binary+l    //....rpt
binary+l    //....sxw
binary+l    //....raw
binary+l    //....celtx
binary+l    //....upk
binary+l    //....war

#----------------------------
# ALREADY COMPRESSED FILES (no delta storage)
#----------------------------
binary+Fl   //....bz2
binary+Fl   //....gz
binary+Fl   //....zip
binary+Fl   //....rar

@jase-perf
Copy link
Author

Thanks, @CitizenZultron ! I will look at incorporating this soon.
The P4 server will automatically detect if files are text or binary so I generally only use the typemap for files that I want to add special modifiers to, OR files that it incorrectly identifies (for example, a binary file with a long text-based header can sometimes incorrectly show up as text).
So unless you've found any of those text files to be interpreted incorrectly by the server, I'll probably leave those off.

The suggestion of adding .meta files as text+l makes sense! Definitely happy for the input on Unity files since I don't use Unity as often.

@michaelwbell
Copy link

Hello. This is a helpful typemap. I believe there's one error:
.exp files are set to be binary. I believe they need to be writeable in the workspace. At least in my case, trying to compile Unreal Engine 5.

I have a related question. Should the .exp and .lib files just be ignored in P4Ignore?

Cheers.

@jase-perf
Copy link
Author

@michaelwbell
I just checked my gist for p4ignore here https://gist.github.com/jase-perf/b15b57d72fa8095c732fdbc4ca948903
which is based on Epic's recommendations and there is this line:

**/Engine/Binaries/**/*.exp

So it does seem like at least those ones should be ignored. I wonder if all of them should, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment