High Priority – Game Art

Perforce for Artists

1. What is Perforce

Perforce is a version control software. Similar to Subversion (SVN) or GIT. In general, these tools work by having a server where files or projects are stored. Clients, like an artist, connect to this server to download and work on the files. Once the files the artist worked on are adjusted and ready. The artist sends them back to the server. The server checks if they are valid and if there are no conflicts, for example if someone else worked on the files in the meantime. And the server stores a history of every version of every file that has been sent to the server. Which functions as a backup system so you can always go back “in time” to previous states.

In the case of Perforce, this happens on a per file basis. For GIT this happens on a per project basis. And I believe Subversion (SVN) also works on a per file basis.

Perforce has an additional benefit that it checks who is working on what file. The chance that two people work on the same file, and so creating a conflict, is therefore limited. This however brings a cost with what is called a “checkout”. Every file in the Perforce system is in a “read-only” state. Meaning you cannot edit it. You MUST first select the file and declare it “checked out”. Everyone on the Perforce server can then see you are working on the file. The file becomes “writable” and it remains in your domain until you release it. As long as you have the file “checked out” no one else can work on it. It is therefore of importance that you always release all files once you are done working on them. We don’t want an instance where you go home and people cannot work because you have claimed files.

2. Perforce client (P4V) installation

1: Download and install the Perforce Visual client, called P4V.

During installation when asked for the server address. See step 2.

2: Open P4V, and connect to the server.
It will show you a Connection window. Enter the server address, your user name and either create a new workspace (See step 3 below) or use a previous one.

3: Creating a new workspace.

– A workspace is the location on your computer where you work on files that are managed by the Perforce server. If you have multiple computers, you would have a workspace per computer.
– For the Workspace name. Add your full name and your device name, eg; YourName-ComputerName. Everyone can see all workspaces. So make it easy for others to see which workspace belongs to who.
– Find a location on your computer where you want to store all Perforce projects. I have chosen my second drive, and then made a Perforce folder. D:/Perforce/.. All Perforce projects will then be inside that folder. So don’t name this folder to a specific project.

3. Downloading Projects/Depots

Step 1: Add a new depot to your workspace.

1: Go to Connection, Edit current workspace, and include the new Depot to your workspace by “include tree”. Then hit accept.

2: Go to the Wordspace view in the P4V client. Select top most root folder and “Get Latest”. It should download the entire depot to your computer. If not, Go to the Depot view and try it there.

Step 2: Add the ignore files << Important!

Not all files should be pushed to the server. Like temporary files that are specific to your computer. We do this by giving Perforce an ignore file. That, once applied, will automatically ignore folders and files. You only have to set this once for all projects. Assuming the ignore file has the same name.

In the perforce visual client (P4V), you should find a perforce ignore file (.p4ignore) in the root of (every) Unity or Unreal project. Right click on it and select “Open Command Window here”:

p4 set P4IGNORE=.p4ignore

You will not get any message of success (yes, it’s a bad design by Perforce). You can close the command window after you enter the command.

!!!  Restart the perforce client (and Unity/Unreal) and do a refresh in the perforce client.

To test that the ignore file works. Try to “add” a file that is ignored.
For unity, that would be a file within the Library folder.

For Unreal, that would be a file within the Intermediate or Saved folder.

4. Perforce Setup in Unity/Unreal projects

4.1. Perforce in Unity

1: Go to Edit > Project Settings > Editor > Versions Control.

2: Set the Mode to “Perforce” and enter the server IP, your username, workspace and Password.

3: Click on Connect to see if it can connect to the server.

!!!  Be aware that Meta files are very important and need to be managed in Perforce just like other assets.

4.2. Perforce in Unreal

1: Click on the “Source Control” button at the top of the Unreal interface.
2: Set the Provider to “Perforce” and enter the server IP, your username, workspace and Password.
3: Click on “accept Settings” to see if it can connect to the server.

5. Tips & Tricks

5.1. Change maximum number of files displayed per changelist

  1. In P4V, go to Edit > Preferences
  2. Go to Server Data and change maximum number of files displayed per changelist

Note: High numbers is a slower experience

5.2.Video series showing how to use Perforce

Youtube – Working with Perforce