Perforce Integration in the Creation Kit

Post » Sun May 18, 2014 8:23 am

Hi there, I'm a project lead over at Beyond Skyrim: Cyrodiil. We have been working with version control, but a bug recently came up that led us to believe that there were issues in our merges related to Perforce integration not being functional. That didn't end up being the cause but it led me to research Perforce integration and how it might function if working. Long story short, I figured out how to get it set up and wanted to share the steps with you all.

When set up properly, Perforce works hand-in-hand with the Version Control system to keep backups of previous iterations of scripts, and allow for each individual working on a project to pull the latest versions of all project scripts from the Perforce server. The full functionality of it has not yet been outlined and tested, but with this tutorial, I hope that the community will be able to fully document its features and processes.

With Perforce integration now unlocked, this also opens the path to networked teams working off of a master server using just the Creation Kit and Perforce for version control. With the recent release of Perforce/Git integration, it is possible that we might see a complete change in the way large groups collaborate. We now have access to the complete set of tools that Bethesda did when developing Skyrim and its DLC.

First, set up Version Control per Maefaeger's tutorial.

Download the p4com.dll from this page and add it to your Skyrim folder.

http://public.perforce.com/guest/robert_cowham/perforce/API/p4com/main/

In SkyrimEditor.ini in your Skyrim folder, make sure that, under the [Papyrus] Settings, you have the following set as it is below:

sScriptSourceFolder = "Data\Scripts\Source"

sScriptCompiledFolder = "Data\Scripts\"

sCompilerFolder = "Papyrus Compiler\"

bPerforceEnabled = 1

Perforce Setup

http://gameindustry.about.com/b/2012/07/29/version-control-management-and-games.htm

I worked off of this tutorial by Warren Schultz, with a few changes that are necessary for the Creation Kit to properly read your script backup workspace. I also ignored some of the instructions more geared towards setting up Perforce on a server that would host multiple users. If you are aiming to collaborate over a network, you may want to heed them.

I will outline the steps roughly for now, but for step by step instructions please refer to that tutorial.

From http://www.perforce.com/downloads

Install Perforce Server using the suggested default settings. Make your username the same as your Windows username. You must have administrator permissions.

Set up your Perforce Depot to have the name TESVData. This is important, the depot name and subfolders that we will eventually set up in our workspace are paths that are hardcoded into the Creation Kit.

Next, go back to the Perforce site and install the Perforce Visual Client, also using default settings. You can uncheck the Plug-in for Windows Explorer.

Open up your Perforce Server, ensure it is set up per the tutorial, then open P4V (the visual client). You will need to create a new workspace named Papyrus (not sure if this is hardcoded but it seems like it may be. Feel free to test other workspace names).

The workspace root should be in a new folder anywhere on your computer. I have mine in the folder above my Skyrim directory, since that is where the Source folder needed for LOD generation is kept. Don't add files yet if prompted.

In Windows Explorer, open up the new directory you created and add the following folders:

\current\Source\scripts

Copy all of the contents of your Skyrim/Data/Scripts folder into the Scripts subfolder. This should be thousands of .psc files and the subfolders for each DLC. If you are using a custom prefix for your project, you will need to set it in your Creation Kit preferences as. Do not rename script fragments manually, even through the Creation Kit.

Refresh your Perforce Client and you should see the new subfolders and files. Right click on the scripts folder and click add. It should put your files into a changelist. Then, right click again and click submit to commit those changes to the depot. You will need to add a comment, it can be anything.

Now, the fun part. You should now be able to load up the Creation Kit and go to your preferences. At the very end is a tab for Perforce integration, where you can select your new workspace. Select it and hit apply. You shouldn't get any error messages but if you do one of the steps earlier went wrong.

Properly using Perforce integration is a tutorial of its own, but I haven't had enough experience using the system to write it. I do have a few notes of what I've been able to see below:

Any Creation Kit generated script fragments in the proper format should automatically be loaded by the Creation Kit and have their formids reassigned on merge. Do not alter script fragment names at all if you plan on using Version Control.

For other scripts, you can add them to Perforce by right clicking them in the Papyrus manager. This allows you to check out the scripts from the version control window, alter them, then submit the altered script to your Perforce workspace. If there is a newer version of the script on the Perforce server, you will be prompted to download it.

User avatar
Sylvia Luciani
 
Posts: 3380
Joined: Sun Feb 11, 2007 2:31 am

Post » Sun May 18, 2014 5:20 am

Okay, I had a big bug and figured out why. You need to copy your full scripts/source folder into the Scripts folder in your workspace. The workspace should always contain .psc files and it needs all of the ones that come with the Creation Kit to work (compile/spit out files with the new formids).

User avatar
Cccurly
 
Posts: 3381
Joined: Mon Apr 09, 2007 8:18 pm

Post » Sun May 18, 2014 4:22 am

Fantastic, our team will benefit greatly from this. I actually spent a day getting this working last month, but never got around to actually figuring out the last few steps. Thanks! :)

User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Sun May 18, 2014 4:04 am

Apologies if I'm missing the obvious, it's been a long day at work...

When you say this will allow teams to work together on one project using Version Control combined with Perforce, what exactly do we need to use to do the actual "network" bit over the internet? Dropbox or something?

This sounds like a huge breakthrough for team projects. We'll literally be able to have multi-national teams working together as if they are all in one studio. Congrats for working this out and thanks for sharing :)

- Hypno
User avatar
Russell Davies
 
Posts: 3429
Joined: Wed Nov 07, 2007 5:01 am

Post » Sat May 17, 2014 10:31 pm

You need a perforce server that can be accessed by all team members.
There are several options:
- You can host it yourself, if you have a good connection and a machine running 24/7.
- If you're willing to pay, assembla.com has offers for hosting P4 repositories.
- Alternatively, pay for a server (Amazon EC2 maybe?) and install P4 there.

But for scripts, I think just using external source control like Git is a viable alternative? At least for us that worked well so far, though our scripts usually don't require much integration with game objects, so that might be why.
User avatar
Danger Mouse
 
Posts: 3393
Joined: Sat Oct 07, 2006 9:55 am

Post » Sun May 18, 2014 10:45 am

My team uses Dropbox for VC, and like you said, it's as if we're all working in the same room. Our team is spread across the US and Norway, and Dropbox + Version Control really helps bring us together. :smile:

User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Sat May 17, 2014 11:22 pm

We actually currently use Git and Dropbox so we probably won't adopt Perforce any time soon, but I hope this will be valuable to other teams in the future. I haven't fully documented how to use it yet, but the fact that Skyrim's Version Control ties into it so completely seems like it would make it a more appealing option to teams looking at a method of version control in the future.

I'll be sure to pop in to answer any questions, my instructions might be missing a step or two and I'm still exploring the features the same as the rest of you.

User avatar
Breanna Van Dijk
 
Posts: 3384
Joined: Mon Mar 12, 2007 2:18 pm

Post » Sat May 17, 2014 9:51 pm

Hmmm. Definitely something to keep in mind. Lack of Perforce in the usual version control usage is probably why it doesn't always come out smoothly in the end.

As far as server space, Linode.com is a good place to pick up a solid, cheap VPS with plenty of room for a project like this.

User avatar
Charles Weber
 
Posts: 3447
Joined: Wed Aug 08, 2007 5:14 pm

Post » Sun May 18, 2014 8:16 am

I've done a bit more testing with the .psc scripts in the Perforce workspace where they belong and, once set up correctly, it makes merging mods with scripts fairly straightforward and bug-free. If it detects that a script you have on your Perforce depot is not present locally, it will even copy it over for you.

User avatar
kiss my weasel
 
Posts: 3221
Joined: Tue Feb 20, 2007 9:08 am

Post » Sun May 18, 2014 12:20 am

Yeah, based off my experience so far, having Perforce active seems to run scripts through the same validation process that it does for other record types. It checks that fragments are in the correct format and that all references to other scripts make sense. It seems like Version Control does do this to some degree normally, though.

User avatar
Saul C
 
Posts: 3405
Joined: Wed Oct 17, 2007 12:41 pm

Post » Sun May 18, 2014 12:26 am

Punk has now managed to do a merge that keeps all of my scripts intact. I'm glad something good came out of this debacle.

User avatar
Nathan Hunter
 
Posts: 3464
Joined: Sun Apr 29, 2007 9:58 am

Post » Sun May 18, 2014 8:27 am

Debacle is such a harsh word, but it just goes to show how fragile the Creation Kit and the Skyrim engine can be. One setting or one filename outside its expected norm and everything goes boom. I think we're making some big strides at figuring out the inner workings of it. As I've been saying a bit too often lately, it's trial and error. And error. And error.

And we're back to why version control is so important. :D

Edit: Another note for the eventual tutorial. If you have more than one Perforce workspace active on your computer, the Creation Kit seems to select the first one it sees. I can't tell if it's alphabetical or if it checks your Perforce Client to see what is first on its list. Or maybe it checks the depot? Not sure on that yet.

User avatar
Charlotte Buckley
 
Posts: 3532
Joined: Fri Oct 27, 2006 11:29 am

Post » Sun May 18, 2014 8:33 am

Thanks for the tutorial! :)

We managed to get perforce up and running with the CK, but when we try to open a script in the papyrus manager, the CK seems to be looking for the scripts in the wrong path: D:\Program Files\SteamApps\common\Skyrim\depotFile \\TESVData\current\source\Scripts\_00E_A1_StOilImpactScript.psc"

Do you have any idea what this might be related to?

Thanks,

Nicolas

User avatar
Emerald Dreams
 
Posts: 3376
Joined: Sun Jan 07, 2007 2:52 pm

Post » Sun May 18, 2014 6:54 am

Hmm, sorry I missed this post, I haven't logged into gamesas in a while. Do you have your depot inside of your Skyrim folder? That will likely cause a big issue, I originally tried putting it there and couldn't get anything running. Also, the depot name does appear to need to be TESVData; as far as I can tell Bethesda hardcoded it.

User avatar
kristy dunn
 
Posts: 3410
Joined: Thu Mar 01, 2007 2:08 am


Return to V - Skyrim