Well, for the past few months I’ve been using git and github to develop my choicescript games, and wow, does it help A LOT, and in more ways than one. However, in the beginning, I almost gave up because of the learning curve. Frankly, I was a little scared of it. Would I lose data? What if I messed things up? But I survived and now just love it.
For a long time, I wanted to tell this forum about this tool, but I wondered if it was too hard to learn. After all, it’s a tool for programmers that intimidates even programmers themselves, so it might be far too daunting for choicescript writers without a high degree of technical background.
But then today I saw a thread about people using vim to write choicescript, which I also thought would be too hard for most writers. If people are using vim, maybe some will like git too, so here goes.
First, why use git (and github)? Well, many reasons. First, the main reason I went through the trouble of learning it was for the version control. I’ve lost what I’ve written a few times, which sucks royally. Also, some more complex games of mine have become a big mess with many different versions and a confusing web of back up copies that I don’t know what they are anymore.
Git provides version control on your own local computer, and then, if you upload (or “push”, as it’s called) to github.com, it’s stored in the cloud too. This makes it a kind of backup. (But of course you should be doing other forms of backup in addition. I use both Dropbox and an external drive. I used to also use Box AND a thumbdrive in addition to these two for a total of four, cuz online sites and hard drives can both go down. It’s good to be safe.)
Github can also be used for collaboration if, say, you want to work on a game with a group of people, but this is probably rare for choicescript authors. However, if you do, wow, it would be fantastic. Imagine: kinda like wikipedia, anyone can change anything, but it’s all saved as “commits” which the owner can choose to incorporate or not. You could have different versions, spin-offs, communicate via “issues”, assign jobs for people to do, have your own wiki for the story, etc.
On the flipside, if you pay the $7 monthly fee, you can make your “repos”, as they’re called, private. Or use bitbucket, but github has some advantages which I’ll get into below.
Okay, so after a version-controlled backup, what is the next great benefit? Hmm… well, I’d say it’s that github gives you a free website. Here’s mine: https://flurrywinde.github.io/choicescript/ (You actually get one per project, plus a user one. The user one, you could probably use for something totally unrelated if you wanted.)
So what I did was “fork” (another git term) dfabulich’s choicescript project, meaning copy it to my own project. (Which means I can modify it using version control. More on that later.) In terms of the free website, what I did was make a submodule for each of my games and put them in the “web” folder (just like the example game, mygame).
Now, when I update (or “push” as it’s called in git) my stories, the website is automatically updated too. Before, I used to have to manually upload my games via FTP, and it got to be a pain. Even with dashingdon’s great site, you still have to manually upload your changes each time, so you might not keep your games there as up-to-date as you might like. Git makes it so easy to update your website it’s not even funny.
Next, say you want to modify choicescript, like, say, add CJW’s save system, change the colors, etc. I did this, and after awhile, all my mods were making it really confusing. I had a ton of different versions of choicescript with different games stored in different ones.
Well, with git you can have different “branches” for each feature, so one branch could be the save system branch, etc. Then you can pick and choose what feature to add. And of course all this is version controlled too. If you want to go back to stock choicescript, just do it, all in just one copy of the code, since that code contains all the branches and versions, just only shows one at a time. (I haven’t actually done much of this yet. I plan to study up and learn how.)
And, of course, programmers can collaborate and work on each others’ code without stepping on each others’ toes. I’ve noticed there are quite a few forks of choicescript on github, so I wonder how many cool new features are out there just waiting to be merged in?
Well, I guess that’s about it. I’m just a noob myself, but if anyone tries to implement this and runs into trouble, I’ll do what I can to help. I put a how-to on github: https://github.com/Flurrywinde/choicescript . (You have to scroll down.)