As a developer, there is nothing worse than losing all your hard work because of a power failure or a hardware issue or some other catastrophic event. Your source code is your most valuable asset in any project, it should be treated with such respect. Source control will save the day and it isn’t as hard as it first may seem.
Even if your just a part-time IF author, source control can be your friend. You don’t want to lose all your hard work that comes out of your creative mind.
What is source control?
If you already know, skip to the next section. I’ll be brief here anyways. A source control system is essentially a repository for your source code. Why do we want that? Here’s a few reasons:
- Protect from hardware / software failures. If you keep a copy of your source code in a separate folder on your computer, that is a form of source control. At a minimum this can be valuable if you can do nothing else. A source control system can add so much more as we’ll see.
- Keep a history of code edits. If you use a system instead of just making copies of your code, all good systems now will keep a history of all changes made. Why is this important? It gives you a view back in time so that if you decided to go back to a previous version or if you decide you wish you wouldn’t have moved a bit of code, you can easily go back to prior version.
- Allow for easier collaboration. A source control system where the repository is in the cloud or on a shared server, allows for multiple developers to work on the same system at the same time. In the easiest case, each developer may be working on different sections (files) at the same time so when you “check-in” to the repository there is no conflicts between the two developers. Other times, you can be working on different “branches” of the same code, meaning that the developers will have to merge their code changes together. Most of the time this is easier than it sounds and is handled somewhat automatically by the system you’re using.
What systems are out there?
There are quite a few systems available, but I’ll just talk about a few that I use most often, GitHub and BitBucket. These both are fairly popular and work very similarly (in fact I believe BitBucket is actually based on the GitHub code base). The both work with the popular Git source control system and BitBucket supports the Mercurial system.
Both have free options that work perfectly for independent developers. While GitHub is more widely known and used, BitBucket offers some nice features that make it appealing as an alternative. For example, BitBucket offers free private repositories where GitHub only offers public ones for free. If you are working on a new game that you plan to release in a comp and want to keep secret, BitBucket allows you to create a free private repository that isn’t visible in any searches.
Another benefit to both systems are their inclusion of issue tracking system. This allows you, testers or general public (if allowed) to enter in issues, feature requests, bugs, … that you can track and determine if you want to include the changes in your game.
Collaboration becomes easier with a system. Other developers that have access to your code repository can create their own branch of your code, make changes and fixes, and push them back where you as the main developer will be able to evaluate and if you approve of them, you can pull those changes into your main code branch. All this is optional of course, but does make for some nice collaboration opportunities.
So what tools do you need to work with these systems? Well other than signing up for a free account with whichever service you use (I actually use both), the only real tool that I recommend is TortoiseGit. This tool simply integrates easily with your windows shell and allows you to work with your chosen service.
There are plenty of tutorials out there on installing TortoiseGit and connecting with Github or Bitbucket, that I won’t bother repeating those here. But if you run into trouble hooking these up, there is plenty of help available.
Note: I’m a windows guy, so for the Mac or Linux users out there I know there are tools, but have no recommendations. If you have something to recommend, please feel free to comment.
Don’t risk your source code and all your hard work. I know that writing IF is like any other programming task, it’s a labor of love that combines creativity and technical skills and what comes out is something unique and enjoyable. Keep that safe.
Another fun thing to use these services for….do searches on Inform 7 and you’ll find not only other games that you can peruse the code for and learn, but utilities and source for some interesting projects that you may not have otherwise known about.