<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
	<title>Chemistry and Code</title>
	
	<link>http://www.rossbearman.co.uk</link>
	<description>One man's journey through stack traces and the scientific method.</description>
	<lastBuildDate>Fri, 20 Jan 2012 19:21:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/chemistryandcode" /><feedburner:info uri="chemistryandcode" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Introduction to Version Control with GitHub</title>
		<link>http://www.rossbearman.co.uk/introduction-to-version-control-with-github</link>
		<comments>http://www.rossbearman.co.uk/introduction-to-version-control-with-github#comments</comments>
		<pubDate>Fri, 11 Mar 2011 01:09:05 +0000</pubDate>
		<dc:creator>Ross Bearman</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[distributed version control]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[version control]]></category>
		<category><![CDATA[workflow]]></category>
		<guid isPermaLink="false">http://www.rossbearman.co.uk/?p=52</guid>
		<description><![CDATA[<p>Posted in <a href="http://www.rossbearman.co.uk/tumblog/articles">Articles</a></p>Why should I care? Version control (also known as revision or source control) is a procedure for managing changes to files over time; essentially, an intelligent backup system, designed specifically for the management of source code. Version control provides a tidier and vastly more robust solution to saving multiple copies of files as changes are [...]]]></description>
			<content:encoded><![CDATA[<p>Posted in <a href="http://www.rossbearman.co.uk/tumblog/articles">Articles</a></p><h2>Why should I care?</h2>
<p>Version control (also known as <a href="http://stackoverflow.com/questions/1056912/source-control-vs-revision-control/1056947#1056947">revision or source control</a>) is a procedure for managing changes to files over time; essentially, an intelligent backup system, designed specifically for the management of source code. Version control provides a tidier and vastly more robust solution to saving multiple copies of files as changes are made, e.g. &#8220;readme.txt&#8221;, &#8220;readme.txt.bak&#8221;, &#8220;readme.txt.bak2&#8243;. Generally each project will have its own repository, storing all the code and assets for that project. For every file in the repository there is a full list of changes over time. Version control systems (VCSs) provide tools for interacting with these listings, allowing the user to revert some code to an older version or work on an experimental feature in an isolated environment. A large number of version control systems exist; popular examples include <a href="http://bazaar.canonical.com/">Bazaar</a>, <a href="http://www.nongnu.org/cvs/">CVS</a>, <a href="http://mercurial.selenic.com/">Mercurial</a> and <a href="http://subversion.apache.org/">Subversion</a>. However, this article focuses on using Git, due to its widespread adoption and the popularity of GitHub.</p>
<p><span id="more-52"></span>A breakdown of the advantages of using version control on your projects:</p>
<ul>
<li>As each change to a file is stored,<strong> individual files and entire projects can be restored to any point</strong> in the history of the project.</li>
<li>Changes can be pushed to a remote repository, providing <strong>off-site backup</strong>.</li>
<li>An unlimited number of people can work on the same project, allowing for <strong>collaboration with any size of team</strong>.</li>
<li>Each change can be accompanied by a small explanation, allowing users to <strong>easily see what changes have been implemented</strong>.</li>
<li>Using branches it&#8217;s easy to <strong>work on larger experimental features in isolation</strong> and later <strong>merge the new code into the main branch</strong> painlessly.</li>
</ul>
<p>Even when working without any other collaborators, the vast majority of developers still use version control to allow them to easily revert changes and experiment in isolation from the main working source tree.</p>
<h2>Installation and Authentication</h2>
<p>Git clients are available for Linux, Windows and Mac OS X; comprehensive <a title="GitHub Git Installation" href="http://help.github.com/set-up-git-redirect">tutorials on installing Git</a> on each of these platforms are available from GitHub. GitHub primarily uses SSH for user authentication; as such, you’ll need to generate an SSH key and link it to your account in order to access repositories using Git. The installation tutorials detail how to go about generating and linking the keys on each of the platforms.</p>
<h2>Getting Started</h2>
<p>If you&#8217;re intending to work on an existing repository, you&#8217;ll need to perform a <em>clone</em> operation on it. This creates a local copy of the entire repository, including all the file history, allowing you to perform operations such as branching without having to connect to the remote repository. Git is one of several <em>distributed</em> version control systems, distinct from others in that each clone is created equal: at at a technical level there is no canonical or primary repository. In practice, one repository is often chosen as the canonical repository by the developers (when using GitHub, usually this is the GitHub repository, or &#8216;origin&#8217; as it is called), but this isn&#8217;t recognised on a technical level.</p>
<h3>Hardcore Forking Action</h3>
<div id="attachment_56" class="wp-caption alignright" style="width: 244px"><a href="http://www.rossbearman.co.uk/wp-content/uploads/2011/03/GitHub-Fork.png"><img class="size-full wp-image-56" title="GitHub Fork" src="http://www.rossbearman.co.uk/wp-content/uploads/2011/03/GitHub-Fork.png" alt="Fork a repository in GitHub" width="244" height="196" /></a><div class="wp-caption-text">Fork a repository in GitHub</div></div>
<p>Before we can <em>clone</em> a repository we need to have a repository to clone. <em> </em>For this tutorial I&#8217;ve created a tutorial <a href="https://github.com/rossbearman/git-tutorial">repository on GitHub,</a> which is going to allow me to demonstrate exactly how you&#8217;d go about contributing to any open source project on GitHub, and in the process teach you how to use Git for your own projects.</p>
<p>When you visit the repository linked above you should see the &#8216;Watch&#8217; and &#8216;Fork&#8217; buttons shown in the figure to the right. Forking a project creates an exact copy of it — with the full change history and branches — on your own GitHub account. Forking a project gives you a remote copy that you can edit and push changes too, either so you can contribute changes back into the project you forked from, or so you can use the project as a basis for your own (within the license terms for that particular project!)</p>
<p>Now, go ahead and <em>fork</em> <a href="https://github.com/rossbearman/git-tutorial">my project</a>.</p>
<h3>Cloning</h3>
<p>Once GitHub has finished forking the project, you&#8217;ll be presented with an almost identical screen to the one you were on previously, however you&#8217;ll notice rather than &#8216;rossbearman/git-tutorial&#8217;, the repository title reads &#8216;your-name/git-tutorial&#8217;. Congratulations! You&#8217;ve forked the repository successfully, now let&#8217;s clone it to your local computer and make some changes!</p>
<pre class="brush: bash; light: true; title: ; notranslate">
 git clone git@github.com:{USERNAME}/git-tutorial.git
</pre>
<p>This first command will create a new directory called git-tutorial and clone your fork into it. GitHub automatically adds a <em>remote </em>called &#8216;origin&#8217; that links to your fork of the repository; this is essentially an easy to remember name that points towards a remote repository. You&#8217;ll also want to manually add a <em>remote</em> to point to the repository you forked from, so you can pull any updates directly into your clone.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
cd git-tutorial
git remote add upstream git://github.com/rossbearman/git-tutorial.git
git fetch upstream
</pre>
<h2>Making our Changes</h2>
<h3>Branching</h3>
<p>Branches are an essential tool in any Git workflow. A branch is (yet another) copy of the full source tree; however the idea with a branch is to work on new features or changes, whilst keeping them isolated from the working code. In this manner you can easily keep your main branch (&#8216;master&#8217;) always compilable and continue to commit potentially broken changes to your new branch. You can have an unlimited number of branches on any project; for example you might have an &#8216;interface&#8217; branch for working on a new interface and a &#8216;validation&#8217; branch for working on some new validation code. Perhaps if you&#8217;re using an issue tracker you might create a new branch for fixing a specific bug, and use the ID of the bug in the branch name, i.e. &#8216;bug-2817&#8242;.</p>
<p>Vincent Driessen wrote an article proposing a <a href="http://nvie.com/posts/a-successful-git-branching-model/">complex but highly-scalable branching structure</a> for software projects. It&#8217;s worth reading once you&#8217;ve got to grips with the basics of Git usage.</p>
<p>Although our tutorial repository is a trivial example, and won&#8217;t really gain anything from the use of a branch, we&#8217;ll create one to demonstrate how to use them. Our branch will be named &#8216;development&#8217; and is created with the following line in the terminal:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git checkout -b development
</pre>
<p>The <em>checkout</em> command switches to a different branch, and the -b flag tells it to create the specified branch and then switch to it.</p>
<p>Finally we&#8217;ll just pull in any changes that have since been made to the &#8216;master&#8217; branch on the<em></em> original repository you forked from, using the remote we created in the last section. This ensures our new branch is up to date before we start making any modifications.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git pull upstream/master
</pre>
<h3>Editing</h3>
<p>Now that we have <em>forked, cloned </em>and <em>branched</em>, we can start editing. On a real project you might fix a bug, or implement a new feature, but for this tutorial we&#8217;ll just edit the README file and add a line of text to the end. It can be anything, your signature, a quote, or just some silly text.</p>
<p>After editing the file, run the <em>status</em> command and you should see that README is listed as having been modified.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git status
</pre>
<p>Another useful command for getting an overview of the changes is <em>diff</em>, this will show you a list of the changes to the files, and gives an insight into how the changes are stored by Git.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git diff
</pre>
<h2>Submitting our Changes</h2>
<p>Once you&#8217;re happy with your changes it&#8217;s time to <em>add</em> them to the staging area, <em>commit</em> them to your local repository, <em>push</em> them out to your remote repository and request a <em>pull</em> of your changes into the original repository.</p>
<h3>Staging</h3>
<p>The staging area is as it sounds, a temporary location (also known as the index) where you piece together all the elements for a single commit. To add changes to the staging area, use the <em>add</em> command. You can either specify the files individually, or use the . operator to add all files in the current location. To continue, run one of the following commands; on this small example they will both have the same result, adding yours changes to the README file to the staging area.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git add -A
</pre>
<pre class="brush: bash; light: true; title: ; notranslate">
git add README
</pre>
<p>When working with larger changes, potentially spanning multiple files, this staging system allows you to temporarily store your changes as you progress. You can then package all those changes into a single commit with a good description, resulting in a tidier, easier to manage history.</p>
<h3>Committing</h3>
<p>Let&#8217;s go ahead and commit the changes currently in our staging area, to our local repository. For this we use the <em>commit</em> command, optionally with the -m flag to provide a short commit message. If you don&#8217;t specify a commit message using the -m flag, your chosen text editor will open so you can enter a more detailed message.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git commit -m 'Added my signature to the tutorial README.'
</pre>
<h3>Merging</h3>
<p>Remember how we were making these changes in the development branch? Well now that we&#8217;ve finished what this branch was created to do, we can merge it back into the master branch and delete development. First we switch branch to the master.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git checkout master
</pre>
<p>Then we merge the changes from the development branch into our current branch.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git merge development
</pre>
<p>Finally we can delete the no longer needed development branch.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git branch -d development
</pre>
<h3>Pushing</h3>
<p>Now that our changes are merged into the master branch and stored in our local repository we can use the <em>push</em> command to send the commit to our forked repository on the GitHub servers.</p>
<pre class="brush: bash; light: true; title: ; notranslate">
git push origin master
</pre>
<p>If you now view your forked repository on GitHub you should see your commit message displayed at the top, and viewing the README file will reflect your changes.</p>
<h3>Request a Pull</h3>
<div id="attachment_61" class="wp-caption alignright" style="width: 292px"><a href="http://www.rossbearman.co.uk/wp-content/uploads/2011/03/GitHub-Pull-Request.png"><img class="size-full wp-image-61" title="GitHub Pull Request" src="http://www.rossbearman.co.uk/wp-content/uploads/2011/03/GitHub-Pull-Request.png" alt="GitHub Pull Request" width="292" height="191" /></a><div class="wp-caption-text">Send a pull request to the original repository</div></div>
<p>If you were working on your own repository, or building on top of a forked repository, this is where your interaction with Git would likely end. However if you&#8217;re contributing to another project, there&#8217;s one final step to get your changes merged into the original repository, the pull request.</p>
<p>A pull request simply notifies the repository maintainers that your fork of the repository has some changes they may want to merge into the official repository.</p>
<p>To make a pull request of your changes to the README file into the main git-tutorial repository, go to the page for your forked repository and click on &#8216;Pull Request&#8217;. The new page will allow you to write a message to accompany your request, once you&#8217;re done simply click &#8216;Send pull request&#8217; and you&#8217;re done.</p>
<p>I&#8217;ll endeavour to merge all pull requests into the original repository as soon as possible, so you can see the final results of your work.</p>
<h2>Future</h2>
<p>Now you&#8217;re equipped with a basic understanding of how to use Git and GitHub to contribute to open source projects, I urge you to go and do so! Even if it&#8217;s simply improving the documentation, GitHub makes it trivially easy to do.</p>
<h2>Further Reading</h2>
<p><a href="http://gitref.org/">Git Quick Reference</a></p>
<p><a href="http://progit.org/book/">Pro Git Online Book</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rossbearman.co.uk/introduction-to-version-control-with-github/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sculpting a World, Part One</title>
		<link>http://www.rossbearman.co.uk/sculpting-a-world-part-one</link>
		<comments>http://www.rossbearman.co.uk/sculpting-a-world-part-one#comments</comments>
		<pubDate>Mon, 27 Sep 2010 23:01:17 +0000</pubDate>
		<dc:creator>Ross Bearman</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Vertebrae]]></category>
		<category><![CDATA[continents]]></category>
		<category><![CDATA[generation]]></category>
		<category><![CDATA[island]]></category>
		<category><![CDATA[procedural]]></category>
		<category><![CDATA[procedural generation]]></category>
		<category><![CDATA[world]]></category>
		<category><![CDATA[world generation]]></category>
		<guid isPermaLink="false">http://www.rossbearman.co.uk/?p=9</guid>
		<description><![CDATA[<p>Posted in <a href="http://www.rossbearman.co.uk/tumblog/articles">Articles</a></p>Over the last three days I&#8217;ve been working on an early prototype of the procedural island generation system for the Vertebrae project. It&#8217;s currently still very much a work in progress and focuses more on the simple aspects of land mass generation, future versions will expand on this early work, incorporating a much larger element [...]]]></description>
			<content:encoded><![CDATA[<p>Posted in <a href="http://www.rossbearman.co.uk/tumblog/articles">Articles</a></p><p><a href="http://www.rossbearman.co.uk/wp-content/uploads/2010/12/continents.jpg"><img class="alignleft size-thumbnail wp-image-14" title="Vertebrae World Generator – Continents Preset" src="http://www.rossbearman.co.uk/wp-content/uploads/2010/12/continents-150x150.jpg" alt="Vertebrae World Generator – Continents Preset" width="150" height="150" /></a>Over the last three days I&#8217;ve been working on an early prototype of the procedural island generation system for the Vertebrae project. It&#8217;s currently still very much a work in progress and focuses more on the simple aspects of land mass generation, future versions will expand on this early work, incorporating a much larger element of actual simulation, such as erosion, rainfall, humidity and so forth. With all this data I should hopefully be able to more accurately model a living world, with well placed biomes, aiding the intelligent placement of fauna and flora within the world.</p>
<p><span id="more-9"></span></p>
<p><strong>Prototyping</strong></p>
<div id="attachment_12" class="wp-caption alignright" style="width: 150px"><a href="http://www.rossbearman.co.uk/wp-content/uploads/2010/12/broken2.jpg"><img class="size-thumbnail wp-image-12" title="Slightly Less Broken" src="http://www.rossbearman.co.uk/wp-content/uploads/2010/12/broken2-150x150.jpg" alt="Slightly Less Broken Continent Generator" width="150" height="150" /></a><div class="wp-caption-text">The first version that sort-of looked like landmasses.</div></div>
<p>The prototypes I produce for this project will generally start with little planning, beyond a rough idea of the intended final product, as a result the interface quickly evolves as time goes on, expanding to include features I need at the time, including features that won&#8217;t make it into the final product. Using this system of rapid prototyping to test out the various aspects of Vertebrae makes it very easy for me to test out ideas in a self-contained manner.</p>
<p>Several features, such as the ability to undo/redo generations were implemented purely because generating worlds is fun and I wanted to make it less frustrating to play with the generator. I initially added support for undo and redo after generating an analogue of North and South America, arranged correctly, and then accidentally generating a new world, overwriting it. Sigh.</p>
<p><strong>Thoughts on the Future</strong></p>
<div id="attachment_17" class="wp-caption alignright" style="width: 150px"><a href="http://www.rossbearman.co.uk/wp-content/uploads/2010/12/Working2.jpg"><img class="size-thumbnail wp-image-17" title="Second Working Generation" src="http://www.rossbearman.co.uk/wp-content/uploads/2010/12/Working2-150x150.jpg" alt="Second Working Continent Generation" width="150" height="150" /></a><div class="wp-caption-text">Landmasses starting to take shape.</div></div>
<p>Having implemented the generator using cellular automata, I still have three remaining algorithms to test out, based on midpoint displacement, Perlin noise and Voronoi diagrams, respectively. From what I&#8217;ve seen it is likely I&#8217;ll end up using a system based on Voronoi diagrams for my final world generator, this would seem to give me the most realistic looking terrain and the largest amount of data to work with (whereas midpoint displacements and cellular automata essentially leave me with a mass of pixels, the Voronoi diagrams gives me a large set of internal points that make good starting points for geographical and geological features.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rossbearman.co.uk/sculpting-a-world-part-one/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>And so it begins.</title>
		<link>http://www.rossbearman.co.uk/and-so-it-begins</link>
		<comments>http://www.rossbearman.co.uk/and-so-it-begins#comments</comments>
		<pubDate>Thu, 02 Sep 2010 19:49:08 +0000</pubDate>
		<dc:creator>Ross Bearman</dc:creator>
				<category><![CDATA[Vertebrae]]></category>
		<guid isPermaLink="false">http://www.rossbearman.co.uk/?p=5</guid>
		<description><![CDATA[<p>Posted in <a href="http://www.rossbearman.co.uk/tumblog/articles">Articles</a></p>With this diary I am intending to document the progress I make in developing Vertebrae, my final year project at the University of Plymouth. The project will deliver a game, it&#8217;s engine and a suite of tools for content editing. The gameplay will revolve around the advancement of a character in a fairly traditional RPG [...]]]></description>
			<content:encoded><![CDATA[<p>Posted in <a href="http://www.rossbearman.co.uk/tumblog/articles">Articles</a></p><p>With this diary I am intending to document the progress I make in developing Vertebrae, my final year project at the University of Plymouth. The project will deliver a game, it&#8217;s engine and a suite of tools for content editing. The gameplay will revolve around the advancement of a character in a fairly traditional RPG manner, combat, levelling, item management and questing. The engine will use procedural world generation to create an entirely unique tile based world on each play-through, though unlike many tile systems, the terrain will be contoured to a certain extent.</p>
<p><span id="more-5"></span></p>
<p>The editing suite allows content creators and authors to intersperse the generated world with set-piece content, such as pre-made locations, items, quests and non-player characters, supporting the creation of a deep storyline set in a world that is different for every player.</p>
<p>I will be utilising Microsoft&#8217;s XNA Framework 3.1 to produce the game and engine, and the .NET Framework for the content editing suite. The suite will be a set of tools to allow the creation of set-pieces, such as locations, quests and non-player characters that can be placed into the world intelligently by the procedural system.</p>
<p><strong>Procedurally Generated Content</strong></p>
<ul>
<li>Game world</li>
<li>Locations</li>
<li>Non-player characters</li>
<li>Side quests</li>
<li>Items</li>
</ul>
<p><strong>Fully Featured Editor Suite</strong></p>
<ul>
<li>Location designer</li>
<li>Ability designer</li>
<li>Character designer</li>
<li>Quest designer</li>
<li>Item designer</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rossbearman.co.uk/and-so-it-begins/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

