NS2 automated build
If you aren’t a programmer this post might be pretty dry. You’ve been warned…onward!
In our continuing quest to streamline development and allow our tiny team to work as efficiently as possible, we tackled another problem that dogged us a bit during NS1 development – builds. Building the game so you can release it to a group of playtesters, or so you can release it publicly requires quite a few steps:
1. Get the latest source code from your repository (Subversion in our case)
2. Clean and rebuild everything. MSVC sometimes gets confused and builds wacky binaries, so cleaning first will make sure to avoid wasting time on a temporary "bug".
3. Perform some basic "smoke" testing to make sure all the load, make sure no values snuck into your .cfg files (my config was shipped a few times to our playtesters, resulting in a server full of "Flayras" and mass confusion).
4. Create the dedicated server .zip and the client installer. We also create patches, which are the difference between the last version and the current version, so players and server operators don’t need to download the whole thing.
5. Upload both to our site and send out e-mail to mirrors (if a public build) so they can have the files mirrored the minute we release.
For NS1, we did all this manually. Harry "puzl" Walsh and I got pretty good at this, though it ended up taking a good portion of a day. It is stressful because if there are any bugs or problems that appear at any point along the way, you have to fix the bug or include the file and start over at step 1. We always talked about automating this process in some way, but we never found the time.
For NS2, we’re making this as painless as possible. We’re shipping on Steam so that takes care steps 4 and 5. On the flip-side, builds take a lot longer. NS1 only took about 15 minutes to build from scratch and a complete rebuild of NS2 takes over an hour. So this time we wrote a script that’s accessible by web-browser to do steps 1 and 2 on our server. Here’s what it looks like:
I can kick off the build by clicking a link and then it e-mails me when the build is done. Some notes on the script implementation if you want to do this yourself:
- I used MagicISO to install MSVC on our server. You can make disc images, upload them, then mount them so it looks like a CD. This is needed if you rent a server that you don’t have physical access to.
- You could use cron (or PyCron) and rsync to build your own system that will allow your playtesters to only need to download diffs.
- We save all the output of the builds to build logs so if there are any compilation or system errors they visible. We queue the process via the browser, which is then built by a PyCron job so the browser doesn’t "hang".
I hope this gives you some ideas on how to look at your own build process and streamline it. Now the final part is reducing work on step #3 (automated testing), which I’m taking a look at now.