Sinister Soups Serving Musings On Game Development and Play


Source Control For The Hobbyist Developer

I've been working on an XNA game project with some friends in my free time, and as any professional developer knows, it's much more difficult to coordinate changes to a programming project without some sort of source control solution. While we did without in the beginning, it came to be too much of a hassle, and last night I finally set up source control repository for us. I was thinking that it might be helpful to others, and to myself for future reference, to outline the solution I ended up using, and how I set it up.

Firstly, what is source control? Source control is a way to let multiple people edit the same resources, whether that's documents or source code, without their edits stomping on each other. While there are different ways to accomplish this, the method my friends and I are used to involves checking out files from a central repository, editing them independently, and then checking them back into the repository. If multiple people check out the same file, then the first to check changes in can do so freely, while everyone who checks in after that needs to first correct any conflicts their checkins might have with that first person's changes.

Ultimately, for our home work, we wanted a system with a decent GUI, that was simple to use, and worked more or less how we were used to. Since there are a lot of sites out there that will host repositories using the Subversion (or SVN) source control system, and there is a popular shell integration application called TortoiseSVN which allows you to work with SVN without using the command line, this was the system we ended up going with.

The first thing you need to decide if you want to use TortoiseSVN is whether you want to have a local repository on your computer, which you can use to track your own changes to a project you are working on, but which you can't easily give other people access to, or if you want to have the repository stored on a server so that team members on multiple computers can all access and edit it easily.

In our case, the latter was the only logical choice, a local repository only makes sense if you are the only one working on a project, so we looked for a service site that would let us host a repository easily. We ended up going with XP-Dev, a service we chose because it allows free hosting of up to two SVN repositories with 200 MBs of space available, and also gives you a lot of rather nice tools as part of your account to make project management easier, tools like forums, a wiki, a blog, and bug and task tracking.

There are very many different hosting sites like this, however, so you may be able to find one that gives you even more space for free, if you need it, and they all offer subscription options as well that give you more space and unlock more powerful features.

Once you have an account set up, you will be able to create a repository for your project, and you should get a URL that you can use to access your repository. On XP-Dev, the repository URL looks something like this:

At this point, you are ready to install TortoiseSVN; you can get the installer at their download page. While it is installing, consider where you want your project to reside on your computer, you will need a directory that you designate as the root of your repository, so that Tortoise can download a copy of the repository there for you to edit and then check back into the repository on the server. In my case, I wanted to make sure the repository was obvious and easy to find, so I created a directory called D:\SVN\Projectname.

Once you have your directory ready, and Tortoise successfully installed (you will need to restart Windows for the shell integration to work correctly), you can then start setting up your repository. Assuming your repository on the server is empty at this point, move whatever folders you are going to be managing to your SVN\Projectname folder, right-click on the SVN\Projectname folder and select the TortoiseSVN --> Import option.

Import option, with equally relevant SVN Checkout option above it...

You will be prompted for the URL of the repository, which you should have gotten from your hosting service, and when you click OK, for your credentials to access that repository. Assuming there are no hiccups with your credentials, it should then upload the contents of your SVN\Projectname folder to the repository on the server, and the first revision of your project will be up and running!

While this put the files you want into your repository, it doesn't actually register that this directory is a local copy of the repository, and so you won't be able to use Tortoise to check in file and folder changes yet. To do this, you must now right-click on the SVN\Projectname folder, and select the SVN Checkout option, which will download the files back from the repository, and mark them as local copies that you can edit, and later commit to merge them back into the repository.

Once you have done this, you should see the folders in the SVN\Projectname folder with little green check-mark icons on top of them, indicating that they are fully up to date. If you edit any of these files or folders, the icon will change to a red stop sign, and when clicking on any file or folder in the repository directory structure, you will be able to use the SVN Update command to sync up to the newest version of the repository, and the SVN Commit command to check in any changes you have made.

SVN Update and SVN Commit commands available once you have checked out the repository.

A few other useful tips for working with Tortoise and SVN in general:

  • Since Tortoise is a shell extension, all of its functionality can be accessed through the right-click menu in Explorer. There are many nice options here to help you manage your files and your repository.
  • When you go to commit your changes, you will be given a list of files that will be added with your check in, as well as any modified files. You can double-click on any of the files in this list to see the difference between them and make any changes.
  • If the list of files that will be added on a commit includes files built as part of the project, binaries or obj files you don't actually want cluttering up your repository, you can simply right-click these files in the list and choose to ignore entire directories or specific file extensions. Those files and folders will not be uploaded to the repository, and will not show up in subsequent commits.
  • TortoiseSVN has a very nice manual available in the docs section of their website. The manual not only covers Tortoise itself, but also has some good info about SVN and best practices for setting up your repositories and how to use it on a daily basis.

Hopefully, this has been helpful to anyone out there looking for a quick and easy explanation of how to set up source control for a personal project. It seems to be working out pretty nicely for our team, and I wish you good luck in your own endeavors!

Comments (2) Trackbacks (0)
  1. I’m using Subversion and TortoiseSVN both at work and at home. I’ve heard good things about SmartSVN as a client, as it fixes some deficiencies that exist in Tortoise, at the expense of costing actual money.

    As for servers, while many online services make SVN servers available as part of a package, I’m using VisualSVN Server for Windows at home, which is also free (the company charges for their VisualStudio Client PlugIn), and can be managed locally with a super-easy GUI interface.

    Alongside this, I’ve installed Subversion Notify For Windows, which is a server-sde check-in email solution that is super-slick. It allows for complete control over recipients by path, and the check-in emails that it sends are glorious HTML formatted messages that display the files changed, check-in comments, and a full diff right in the email.

    If you’re running any kind of “always on” server at home (like WHS), and you have a persistant Internet connection and a router that allows port-forwarding, you can run VisualSVN locally and use Dynamic DNS to provide a URL for your teammates. Then you’re not limited by service provider storage or bandwidth limits, and the configuration is completely in your control.

  2. Thanks for the tips, Furio! I’ll try to check out some of that stuff, specifically the Notify For Windows.

    As far as setting up your own server goes, I specifically wanted to find the solution that would require the least manual configuration of servers and such. I have set up my own web server under Linux before, and it wasn’t terrible or anything, but I really don’t want to have to deal with any of the details these days, I’d rather focus on the development I find interesting.

    With that in mind, I found the sites offering SVN hosting to be a fine choice, especially since I doubt we’ll need more than 200 MB, and if we did, a year-long subscription with a bigger limit is still cheaper than a single new video game.

Leave a comment

You must be logged in to post a comment.

No trackbacks yet.