Perforce: Workspace and project folder - newbie question

Sorry if my question sound a bit stupid :smiley: but I don’t understand a very basic thing about the concept of Perforce.
Have just installed Perforce on two PCs at home.

Background:
My machine is running Perforce server, client and UE4, the second one only Perforce client and UE4.
Have tried to install Perforce on our OpenSuse Leap but that didn’t work and I didn’t want to lose more time.

I already have a project which I want to share with my girlfriend working on the second machine.
We want to work with level streamed sub levels to be able to see the other’s work within each of our editors.

**My questions are: **I don’t know how to treat the Workspaces thing within Perforce in connection with UE4’s project folder/s

  1. Should I create ONE Workspace per UE4 project?
  2. How should I treat existing projects? Create a Workspace and place/point it in the appropriate project folder or create a seperate folder in a different location and copy the UE4 files there? Wouldn’t the last be a bit strange doubling the hard disk space necessary?
  3. Basically: Should a Workspace and a project be different folders? (It’s clear to me that the server is completely seperated)

I have the follwing structure:

  • E:\Users\My Profile\My Documents\My Unreal Projects{multiple projects here}
  • E:\z_Perforce\Server{depots etc}
  • E:\z_Perforce\Workspaces\

I used to work with Git in web projects. Is the terminology a bit like this?:

  1. Single UE4 Project folder = single project within my dev-Folder
  2. Workspace = local project repository
  3. Server = remote origin shared git repository

Thank you and hope you could understand what I mean :smiley:

Cheers, Tom

Hey Tom,

Never fear, these are questions all of us asked when beginning with Perforce.

I’m no guru, but I think I can point you in the right direction (but if those of you out there who are more experienced with Perforce can see something wrong with what I say please feel free to point it out).

First up, a workspace is not a second special copy of your project on your hard drive, it’s just a “mapping” in perforce that says which files on your hard drive you want to version control and where they’re backed up to in the depot in your perforce server.

Second thing to know about workspaces is that they are machine specific. I have a bit of an odd setup where my projects live on an external hard drive so that I can work on them on my laptop at home and my work computer at work. When I use Perforce in this context, I have to have one workspace defined in the installation of Perforce on my laptop, and another defined in the installation of Perforce on my work machine. Even though they’re pointing to the same files on my hard drive and the same location in the depot, I still have to have a seperate one for each machine.

That means when I open my project up on a different computer from last time I opened it, the first thing I do is rebuild the solution files (right click on the solution file for this) so that VS has the right paths to my UE4 installation on that machine, then open the project in UE4 and go straight to the perforce settings and change the workspace to the one for this machine.

Another important thing to know about is NOT backing up your entire UE4 project. When you do create your workspace you DO select the projects root folder, but that doesn’t mean you have to add ALL of it’s folders and files to the repository.

After creating the workspace I add the following folders and files by selecting them in the file list in P4V and marking them for add:

folders:

  • Config
  • Content
  • Source

Files:

  • Eden.png
  • Eden.uproject

Other assorted gotchas:

  • Had to select main for stream in workspace creation otherwise couldn’t submit to helix.perforce.com (don’t know about local servers but)
  • Couldn’t connect to project in depot from UE4 (at helix.perforce.com) had to use P4V for the first time to get a “trust connection dialog”
  • If your project is using plugins, you don’t have to mark for add the whole plugins folder, go into it and just add the source folders (i.e. not the binaries)
  • P4VS (perforce addon for VS) is generally good but it’s default settings make VS hang every couple of minutes. Fix below:
  1. From P4V, go to Edit → Preferences → Server Data and change Check server for updates every from 5 to 1440 minutes (i.e., 24 hours). that’s the largest value P4V will accept.
  2. From Visual Studio, go to Tools → Options → Tools Source Control → Perforce - Data retrieval, change Check server for updates every from 5 to 1440 minutes.
1 Like

Thank you for your detailed reply!
I will check this out within the next days :slight_smile:

1 Like

I can tell you what I did in order to set it up. If you want UE4 to automatically connect to your SC you want your project inside your workspace, otherwise you have to retype your login and manually reconnect. Don’t know if that is fixed yet, and is not a big deal, but if you want UE4 to list the workspace in the dropdown menu, the project has to be inside the workspace folder.

Also, go here: Using Perforce as Source Control for Unreal Engine | Unreal Engine 5.1 Documentation and copy the P4 Typemap and P4 Ignore. Set them up and then you’re golden.