Tuesday, May 7, 2013

Perforce

As I stated in my last post I am currently starting to work on a 3d game with the Unreal Development Kit. Obviously when working with such a system version control is a must. They recommend to use perforce, which I thought was a pain to setup, so I thought I'd write down how I did it in case others need some help.

First of all, the reason why they suggest to use perforce instead of svn, git, etc is because UDK files are binary. That means there is no such thing as merging, rebasing, branching, etc. With perforce, when you check out a file, you lock it. This means no one else can work on it while you have it checked out which obviously prevents any possibility of having to merge, which in the case of a binary file doesn't exist.

For my repository, I found assembla which offers free, private perforce repositories. This was perfect for me so I created one according to the directions and it was up in a matter of minutes.

Then, I installed both the perforce command line and visual clients from the perforce clients page. You only really need the command line client but I'm a visual person so I prefer to use the visual client when I check-out and check-in my files.

Once you have the command line client installed, you need to make a config file. The instructions on this page were adequate enough to get me going. This config files makes perforce recognize what files you would like to be candidates for version control. Though, where you put the p4config.txt and your workspace names are very important and that's what was messing me up. For example, my install of UDK is C:\UDK\UDK-2013-02\... What this means is that if I want all of UDK to be available to perforce, I needed to put my p4config.txt in C:\ and my workspace name is UDK. It then put two and two together to say, aha, you want to be able to use files from C:\UDK for perforce huh? Gotcha.

Once that was finally setup correctly, the next few things I did were trivial. I had my simple level that I wanted to added so I navigated to it on my Workspace tab in p4v. Then right-click, Mark For Add. Then when I wanted to put it online, in the Files tab I right-click, Submit with my commit message.

Now that this file is in perforce, before you start to edit it you need to check it out. So again I found the file, right-click, Checkout. Do my edits, and then re-submit it.

Again, this actually isn't too bad it's just the fact of where to put the p4config.txt file and the name of the workspace you input are very sensitive.

I hope this helps anyone else that has troubles setting up perforce.

No comments:

Post a Comment