<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>devmag.org.za</title>
	<atom:link href="http://devmag.org.za/feed/" rel="self" type="application/rss+xml" />
	<link>http://devmag.org.za</link>
	<description>A game development magazine</description>
	<lastBuildDate>Wed, 16 May 2012 08:59:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Loopholes in Game Design</title>
		<link>http://devmag.org.za/2012/05/07/loopholes-in-game-design/</link>
		<comments>http://devmag.org.za/2012/05/07/loopholes-in-game-design/#comments</comments>
		<pubDate>Mon, 07 May 2012 16:00:20 +0000</pubDate>
		<dc:creator>Julian Pritchard</dc:creator>
				<category><![CDATA[Game Design]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[exploits]]></category>
		<category><![CDATA[game design]]></category>
		<category><![CDATA[loopholes]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4531</guid>
		<description><![CDATA[<br/>I had just finished working on my latest card game; I was rather chuffed with it: the rules were elegant and nuanced: there was a wealth of strategies you could use in the game. I explained the rules to two friends, and they began to play. I was expecting them to be amazed with the <a href='http://devmag.org.za/2012/05/07/loopholes-in-game-design/' class='excerpt-more'>[...]</a><h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2009/08/31/minimised-game-design-for-indies/' rel='bookmark' title='Minimised game design for indies'>Minimised game design for indies</a> <small>When you sit down to write a book, one of...</small></li>
<li><a href='http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/' rel='bookmark' title='Video game user interface design: Diegesis theory'>Video game user interface design: Diegesis theory</a> <small>In this article, the Dave Russell introduces the basic concepts...</small></li>
<li><a href='http://devmag.org.za/2011/02/16/board-silly-tabletop-game-design/' rel='bookmark' title='Board Silly (Tabletop Game Design)'>Board Silly (Tabletop Game Design)</a> <small>Two Dev.Mag writers share their board game design experiences: conception,...</small></li>
<li><a href='http://devmag.org.za/2011/03/03/desktop-dungeons-design-analysis-part-1/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 1)'>Desktop Dungeons: Design Analysis (Part 1)</a> <small>This is the first part of an in-depth look at...</small></li>
<li><a href='http://devmag.org.za/2012/02/13/game-design-on-ideas/' rel='bookmark' title='Game Design: On Ideas'>Game Design: On Ideas</a> <small>In this article, Julian Pritchard gives us his take on...</small></li>
<li><a href='http://devmag.org.za/2011/03/23/desktop-dungeons-design-analysis-part-2/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 2)'>Desktop Dungeons: Design Analysis (Part 2)</a> <small>In this second part of analyzing Desktop Dungeons, we look...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/03/loopholes.png" alt="platfrom_banner" width="680" height="341" border="0" /><br />
I had just finished working on my latest card game; I was rather chuffed with it: the rules were elegant and nuanced: there was a wealth of strategies you could use in the game. I explained the rules to two friends, and they began to play. I was expecting them to be amazed with the game.</p>
<p>Instead, <em>I</em> was amazed with how one had managed to find a neat little trick to <em>— </em>unexpectedly <em>— </em>win the game: a loophole!</p>
<p>After the discovery, the game was never the same. I eventually decided to change the card game into a board game so that the game could keep my original idea, but without the loophole.</p>
<p>After the change in my game, I became obsessed with loopholes in games. I began to research them and find how they could affect games. In this article, I summarize my research. This article covers what loopholes are, and why they are bad, with a big list of generic types of loopholes that can be found in games. The article also gives some advice on how to find and correct these nasty little game breakers.<br />
<span id="more-4531"></span></p>
<h2><a name="h.6okvlirwdmw2"></a>What a loophole is</h2>
<p style="text-align: right;"><em>If something can be abused, it will be.</em></p>
<p style="text-align: right;"><em></em><em>— </em>Hyrop’s Law of Loopholes</p>
<blockquote><p>A loophole can be defined as a flaw in the system that users can exploit to gain an unfair or unintended advantage.</p></blockquote>
<p>[Fullerton, <a href="http://www.amazon.com/Game-Design-Workshop-Second-Edition/dp/0240809742/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1336031450&amp;sr=1-1">Game Design Workshop</a>]</p>
<p>Loopholes are often the result of <a href="http://en.wikipedia.org/wiki/Emergent_gameplay">emergence</a>; two or more rules acting together to make something possible that was not thought possible. Loopholes arise when the game rules don’t completely limit or enforce the legal behaviour.</p>
<p>Players find loopholes when they know the rules very well, or by accident. However they find it, the result is always the same: they will use the loophole, regardless of whether it makes the game more fun. A pointed example of players grinding away instead of having fun is with <a href="http://www.gamasutra.com/blogs/GregMcClanahan/20091202/3709/Achievement_Design_101.php">achievement</a> farming.</p>
<p>When given a task, players will find the optimal solutions, even if it ruins their fun. Finding optimal solutions is part of playing the game — it is the designer’s responsibility to create the necessary challenges for an interesting solution; this burden is never the player’s.</p>
<p>Loopholes lead to unwanted player behaviour; the named loopholes discussed below are all words for things the player can do, but the designer does not (usually) want.</p>
<h2><a name="h.4huziveiaomj"></a>Related Concepts</h2>
<p>Loopholes are degenerate strategies to play the game. Among all available strategies, a <strong>dominant strategy</strong> has the best chance of leading to success. A <strong>degenerate strategy </strong>is a dominant strategy that <em>always </em>leads to success. (Not all dominant strategies are degenerate: the <a href="http://en.wikipedia.org/wiki/Prisoners_dilemma">prisoner’s dilemma</a> is a classical example.)</p>
<p>Loopholes are often bugs, but only bugs that can be exploited by the player are loopholes.</p>
<p>Many loopholes are <a href="http://en.wikipedia.org/wiki/Sequence_breaking">sequence breakers</a> (that is, they allow the player to experience events in a different order than was intended), but only sequence breaks that benefit the player are loopholes.</p>
<p>Many loopholes are exploits — ways to play the game that goes against the spirit of the game. But not all exploits are loopholes. For example, some exploits require special tools for hacking the game. These are generally considered cheating.</p>
<h2><a name="h.acbdqwh0nzbq"></a>Examples of loopholes</h2>
<p>In <a href="http://supergiantgames.com/?page_id=242"><em>Bastion</em></a>, players can deliberately fall off a barge, forcing the game to respawn them in a non-combative state on a moving barge. In this way, players can traverse part of the level without having to engage in combat. A secondary effect of this loophole is that the narrator does not realise what’s happening; he happily talks about combat as if it is still happening.</p>
<p>In an earlier version of <em><a href="http://www.desktopdungeons.net/">Desktop Dungeons</a></em>, there was three altars in each dungeon. Each of these altars randomly selected one god from a possible nine <a href="http://www.qcfdesign.com/wiki/DesktopDungeons/index.php?title=Full:Gods">gods</a>. These gods were unlocked one-by-one through quests. Players realised that if they have only unlocked three gods, they could know which three gods would spawn with certainty. Thus, the randomness of gods was removed. The developers have since fixed this loophole by making only one altar available in a dungeon until the player has unlocked four gods.</p>
<p>In <em><a href="http://en.wikipedia.org/wiki/Rock_of_Ages_(video_game)">Rock of Ages</a></em> it is <a href="http://www.youtube.com/watch?v=gvM-pM4RVTk">possible</a> for a rock to hit the door, and then bounce off the pathway. The game then places the rock back on the pathway, allowing the player to hit the door twice with only running the course once. This is a detrimental loophole because the game requires the player to traverse a course before they can hit the door.</p>
<p>In <em>Magic The Gathering </em>the <em>Chaos Orb</em> card removes any card it landed on from play. Some players would tear it up and sprinkle it on their opponents cards to remove multiple cards from play. When a player tried this the first time, the <a href="http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtgcom/askwizards/1202">judges ruled it legal</a>, since there was no rule against tearing the card up.</p>
<p><em>Fallout 3</em> has a loophole where the player may skip a large portion of the game by <a href="http://www.youtube.com/watch?v=8RiwiAlAQNI&amp;feature=watch_response">going straight to one city (<em>The Citadel</em>), and then using any item to jump</a> into the city, instead of completing the quests to get inside.<em></em></p>
<p>In <em>The Elder Scrolls V: Skyrim</em> a player can place a <a href="http://www.gamebandits.com/news/the-elder-scrolls-5-skyrim-howard-likes-the-bucket-exploit-25542/">bucket on NPC’s</a> head and rob him blind without the NPC realising it.</p>
<p>In <em>Deus Ex</em> players could uses <a href="http://deusex.wikia.com/wiki/LAM">LAMs</a>, a grenade which could be placed as a proximity mine, as a ladder. This allowed players into areas in ways that were not intended.</p>
<p>A ten year old hacker exposed the following generic loophole at <a href="http://www.gev.com/2011/08/ten-year-old-hacker-finds-loopholes-in-mobile-games/">DefCon</a>: in social games that run on mobile devices, you can set the time forward and receive reward without having to wait for it.</p>
<p>More examples:</p>
<ul>
<li><a href="http://www.gamefaqs.com/pc/564621-sid-meiers-civilization/faqs/1847">Loopholes in Sid Meyer’s Civilisation IV</a></li>
<li><a href="http://elder-scrolls.alteredgamer.com/tes-5-skyrim/126742-gaming-the-system-how-to-level-up/">Loopholes in Skyrim (levelling up)</a></li>
<li><a href="http://epicodes.com/games/how-to-get-ahead-in-the-sims-3/">Loopholes in The Sims 3 </a></li>
<li><a href="http://www.8bitrocket.com/2012/03/16/going-into-space-mode-playing-with-video-games-in-ways-that-were-not-originally-intended-to-be-played/">Playing games in different ways</a></li>
</ul>
<div style="text-align: center;"><img class="alignnone" src="http://imgs.xkcd.com/comics/meerkat.jpg" alt="" width="400" height="334" /></div>
<p style="text-align: center;" dir="ltr"><a href="http://www.xkcd.com/115">Image from xkcd.com/115</a></p>
<p>&nbsp;</p>
<h2><a name="h.l2vkqfkfwzra"></a>Why loopholes are bad</h2>
<p>According to <a href="http://books.google.co.za/books?id=-BCrex2U1XMC&amp;lpg=PP1&amp;dq=adams%20fundamentals%2C%20challenge&amp;pg=PA11#v=onepage&amp;q&amp;f=false">Adams</a>, gameplay is</p>
<ul>
<li> The challenges a player must face to arrive at the object of the game.</li>
<li> The actions the player is permitted to take to address those challenges.</li>
</ul>
<p>Loopholes interfere with both these aspects of gameplay.</p>
<p><strong>They remove the challenge of the game.</strong> As mentioned earlier, players will take the easiest path towards their goal. A loophole introduces a new, easier path, effectively removing the path of challenge the designer intended. Without challenge, the gameplay is ruined.<strong></strong></p>
<p><strong>They remove <strong id="internal-source-marker_0.06049521756358445"><a href="http://thegameprodigy.com/to-be-or-not-to-be-ingredients-for-meaningful-choice-in-games/">meaningful choice</a></strong></strong><strong>. </strong>Loopholes mess with the balance of the game, and an unbalanced choice is almost always a no-brainer. The existence of a loophole limits the range of interesting actions the player can take..<strong></strong></p>
<p>There are two additional reasons why loopholes are bad.</p>
<p><strong>They remove fairness </strong>in multiplayer games. A game that is not fair is not fun, because all players would have to use the loophole to stay competitive. Designers should always strive to <a href="http://www.sirlin.net/articles/balancing-multiplayer-games-part-3-fairness.html">make games fair</a>.<strong></strong></p>
<p><strong>They can break the fourth wall.</strong> When a player uses a loophole, the game reacts in a way that exposes its limitations and underlying machinery. This can remove the sense of atmosphere and story from the game, because things no longer make sense without looking outside the magic circle. The narrator glitch in Bastion mentioned above is the perfect example.</p>
<h2><a name="h.mlisc8arm8ot"></a>General types of loophole</h2>
<p>The following behaviours can occur in any type of game. Many games rely on these behaviours for their gameplay, but when they were not the behaviours intended by the game designer, they show a loophole.</p>
<p><strong>Memorizing </strong>is when the game or game AI follows patterns that players can memorize.<strong></strong></p>
<p><em>Pac-Man </em>is famous for this — instead of responding to enemy behaviour, the best players memorize sequences of moves they have to make to complete a level.<em></em></p>
<p>The easiest way to avoid players from memorizing game events is to introduce a random element in the game, either in AI behaviour, or item and AI placement, or even just in the timing of the AI.</p>
<p><strong>Predicting</strong> is when the player can learn the logic of the AI, and easily defeat it by predicting its next action.</p>
<p>Prediction can be avoided by introducing random elements as explained above, or making AI more nuanced (essentially, making it depend on more input variables).</p>
<p><strong>Brute forcing</strong> (also called <a href="http://www.whatgamesare.com/permutation-play.html">permutation play</a>) is a way of solving certain kinds of puzzles, usually where the player must figure out the correct combination of moves, digits, levers, buttons, or something similar (there are many of these kinds of puzzles in <em>Machinarium</em>, for example). <strong></strong></p>
<p>In some cases, brute force is the intended method of solution. But when the designer intends the player to use logic and clues provided to solve the puzzle, solving it by brute force is a loophole.</p>
<p>There are two ways to fix this:</p>
<ul>
<li> Add more combinations (for example, adding a lever to a puzzle doubles the number of possible solutions), so that brute force techniques become infeasible.</li>
<li> Make the logic or clues more transparent.</li>
</ul>
<p><strong>Pixel hunting</strong> is a special form of brute forcing that is common in point-and-click adventure games. Pixel hunting is where the player mouses over (or clicks, depending on the controls) the entire screen until a indicator pops up to show that they had found an interactive point. <strong></strong></p>
<p>Pixel hunting can occur in any game that highlights interactive points only when the mouse hovers over them or they are clicked, such as a FPS reticle turning red when passing over a hidden enemy.</p>
<p>In some cases making the player hunt for pixels is intentional, such as <a href="http://www.youtube.com/watch?v=cpB2RkrelQE">resource scanning in Mass Effect 2</a>.</p>
<p><strong>Hustling </strong>is when a player exploits the dynamic difficulty adjustment of a game by player lower than her potential. This makes the game easier, and eventually allows the player an easy victory. This is similar to <a href="http://en.wikipedia.org/wiki/Hustling">pool hustling</a> in the “real world”.<strong></strong></p>
<p>Hustling is most common in the single-player mode of racing games. Racing games use dynamic difficulty adjustment, called <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/RubberBandAI">rubber band AI</a>, which adjusts the AI vehicles’ performance to match the player’s: the faster the player, the faster the AI.<em> </em>A player hustles by keeping in second place until the last lap (even if she <em>can </em>pass the first vehicle). With the player in second place, the game will not increase the difficulty; it thinks that the player is being challenged.</p>
<p>To fix rubberband exploits can be difficult. The racing game <em>Pure</em> uses a sophisticated <a href="http://www.gamasutra.com/view/feature/132313/the_pure_advantage_advanced_.php?page=1">alternative to the rubber band method</a>. The system dynamically sets the AI some distance ahead of the player from the start. This means that the player is continually playing catch-up throughout the race until the end, where she can narrowly beat the AI. Like with rubber band AI, the player is generally capable of victory, but she can’t hustle.</p>
<p><strong>Fortune hunting</strong> occurs in games with random level generation. The player briefly glances around the level to decide if they feel the level is easy enough for them to complete; if not, they simply restart the level in the hope of a more favourable one. Like the hustler, the fortune hunter is playing the game at a difficulty lower than the one that designer intended.<strong></strong></p>
<p>The designer can prevent fortune hunting in several ways:</p>
<ul>
<li> By normalizing level difficulty so that each randomly generated level is about the same level of difficulty (this can be hard, and requires a good understanding of statistics and the game mechanics).</li>
<li> By not allowing a new level to be generated until the previous one has been played.This requires that you can guarantee that all your levels are fair. Otherwise, a level may be generated that frustrates the player to the point of quitting the game permanently.</li>
<li> To make it more difficult to judge the level difficulty until the player has invested enough time not to want to quit the level.</li>
</ul>
<h2><a name="h.fsf0uts6bhh0"></a>Loopholes in FPSes</h2>
<p><strong>Edging</strong> is where the player stands around a corner and shoots a part of the enemy while the enemy can’t see the player. This loophole can be countered by having the enemy AI seek out the source of the damage.<strong></strong></p>
<p><strong>Picking</strong> is the same as edging, except that the player hops out from the corner, shoots, and returns to hiding. As with edging, this loophole can be corrected by making the AI move towards the players to attack.</p>
<p><strong>Wedging</strong> can be used on enemies with a short attack range: the player lodges an enemy in a place where it cannot attack her from. This allows the player to pick off this enemy with ease.</p>
<p>Ways to counter this loophole are to give the enemy a long range attack, to allow it a means to reach the player by fixing the level design or improve the AI, or to create entities which force the player towards it (using a rope, for example).</p>
<p><strong>Kiting </strong>is when the player can move faster or shoot further than the AI. This allows the player to move backwards and attack the AI while not receiving damage.<strong></strong></p>
<p><strong>Camping</strong> is when a player stations herself where enemies can’t see her, and attacks enemies from such a place. Camping is normally done from a distance and with a sniper weapon.</p>
<p>Simply making enemies return fire may cause the player to feel cheated. A proper solution is to make the enemies move towards the player. Another strategy (especially useful in multiplayer games) is to carefully design levels without any good camping spots, and give enough feedback so that players can learn the positions of campers, for example, the Heartbeat Sensors, Unmanned Arial Vehicles (UAVs), and KillCam in <em>Modern Warfare 2</em>.</p>
<p><strong>Splashing</strong> is similar to camping. The player positions herself far away from the enemy and shoots an object that does splash damage, such as a grenade, at the enemy. <strong></strong></p>
<p>The are two solutions to this problem: first, the AI can be made to avoid splash damage of oncoming missiles with a bit of physics math; second, the AI can be made to seek out the player who launched the attack.</p>
<p><strong>Serializing </strong>is when a player kills an entire group of enemies by picking them off one-by-one. This is typically happens in narrow spaces, or if the AI causes enemies to separate from the group. This is a loophole if the intention was to make it more difficult to take out groups, and give the player an opportunity to choose which enemies to take out first. <strong></strong></p>
<p>The simplest fix is for the enemy to trigger an alert state in the nearby enemies which allow them to move off in a group towards the player. The combat space also needs to be designed carefully to prevent serialisation.</p>
<h2><a name="h.p1p6esktufjy"></a>Loopholes in multiplayer games</h2>
<p><strong>Turtling </strong>happens in games with resources — typically strategy games — and there are more than two players. When two players engage in combat, both will consume resources. This puts the combatants at a disadvantage since they both lost resources in the engagement. In the meantime, the turtle is better off than both, since she did not need to spend any resources, giving her an advantage in the next combat against either player. <strong></strong></p>
<p>This effect can lead everyone in the game to play turtle, which of course prevents the game from moving forward. The solution is to encourage aggressive play by awarding the winner of each battle with enough resources to offset the losses suffered in that battle.</p>
<p><strong>Killing the leader</strong> occurs in games where a scoreboard is available during play. Players attack the leader, since she is the person most likely to win, often forming coalitions to achieve this goal.<strong></strong></p>
<p>With the multitude of players attacking the leader, it is likely that they may suffer damages to a point where they can’t recover from them, and they no longer have any chance at victory.</p>
<p>A simple solution is to remove scoreboards from the game. A more complex solutions is to prevent players from cooperating with one and other.</p>
<p><strong>Sandbagging</strong> is is a form of hustling caused by the killing-the-leader effect. Good players are aware that others are likely to attack them if they are seen to be doing well. To prevent this, they deliberately underperform until they can act to their full potential and win the game. Note that the killing the leader effect serves as built-in dynamic difficulty adjustment.<strong></strong></p>
<p>The solution to this is the same as that for killing the leader: remove the leaderboard. If players don’t know who the leader is, there is no reason to play sub-optimally.</p>
<p><strong>Kingmaking</strong> is when the player lower down in the scores is not able to win, but by her actions she can decide whom among the leaders does win. These actions can be in the form of sending resources to another player, or combining the armies in a coalition. This introduces an element of diplomacy into the game, where a player can win based on relationships and not skill. (As always, it is just a loophole if this is unintentional).<strong></strong></p>
<p>The solution to this is the same as the one for sandbagging and killing the leader: remove scorebords.</p>
<p><strong>Experience leeching</strong> takes a variety of forms, but the general formula is the same. A player gains benefit of participation without putting in the required effort involved to achieve the outcome.<strong></strong></p>
<p>In games where experience is awarded to the player who lands the killing blow, leechers are passive in combat until the last moment, when they jump in and kill the enemy to get the experience, at little risk of dying.</p>
<p>In games where experience is awarded to all players in range of the kill, leechers can stay passive all the time; as long as they trail behind, they can get experience without having to take any risks.</p>
<p><strong>Power leveling</strong> is a special kind of leeching. A player groups with a high level player who also kills enemies of a high level. Because of the level difference, the low level player will gain a wealth of experience causing them to level fast.<strong></strong></p>
<p>Simple solutions are to assign experience to the player who does the most damage, or to assign experience in proportion to the damage dealt.</p>
<p><strong>AFK loopholes</strong> are a special form of experience leeching: instead of putting <em>minimal </em>effort, though, the player doesn’t put in <em>any </em>effort (they are, in fact, away from keyboard). The player hides in a place where other players will not notice that they are AFK, or even employs some form of bot.<strong></strong></p>
<p><strong>Boosting </strong>or <strong>alt farming </strong>or <strong>alternate-account farming</strong> is a method where a player uses an alternate account to enhance the gains of her primary account. This is widespread in <a href="http://en.wikipedia.org/wiki/MUD">MUDs</a>, where the players have a resource that they can attack repeatedly without fear of retribution. Boosting is also common in fighting games, where a player will “fight” against the character of her second account to boost her stats or position in the leaderboards.<strong></strong></p>
<p>A simple solution is to check the IP usage and discipline the user for abusing the game. The problem with this scheme is that the developer may punish a player unfairly, for example, if a player beats her brother at a game that they play together.</p>
<p>A more elegant solution is to implement a system of diminishing returns, where the continued killing of a single entity gives less gains for the attacker until it no longer to make sense to attack. This can further be improved by also making higher level players receive less benefits from attacking lower level players.</p>
<p><strong>Twinking</strong> is the opposite of alt farming. It is when a player creates a low-level character and gives it the benefits that are intended for a high level character. The twink is kept at a low-level so that it may defeat opponents of similar level with great ease. <strong></strong></p>
<p><strong>Smurfing</strong> is hustling by using a new account and pretending to be an inexperienced player to lure in and kill players that are actually inexperienced easily. This is common in games where there is matchmaking based on metrics tracking player capabilities. Examples include the recent <em>Call of Duty</em> games, the leagues in <em>StarCraft II</em>, and <em>League of Legends</em>.<strong></strong></p>
<p>Matchmaking systems are self-correcting: metrics will move the smurfer to matches with equally skilled players after a few games, so she can only use this technique a few times before having to create another new account. And with pay-to-play games, the smurfer is required to <em>buy</em> the game each time she wants to create a smurf account. In a free-to-play game it is up to the community and dev team to find a solution using social norms and policy (discussed more in a section below).</p>
<p><strong>Ghosting</strong> is when a non-playing observer in a multiplayer game communicates to one player, or team, the actions of their opponent.<strong></strong></p>
<p>A sub form of ghosting is called <strong>stream sniping</strong> this is when highly skilled player broadcast their games live on a streaming service. Their opponents may then watch the stream and counter their opponents actions as they are watching them.</p>
<p><strong>Account Sharing</strong> is when multiple people use the same account to achieve a goal that would need a large time commitment by a single player. With account sharing, such a goal can be reached with only a modest time commitment by each player.<strong></strong></p>
<p><strong>Farming</strong> is when players focus on a goal that is not the main goal of the game. This can be something such as increasing their stats, or gaining achievements. Each of which would normally prefix farming when in action.<strong></strong></p>
<p>Achievement farming, in a multiplayer games, is when players of opposing teams cooperate with one and other so that players can easily gain achievements that would normally require skill and investment in the game.</p>
<h2><a name="h.pz7ify9qlnaq"></a>Loopholes in racing games</h2>
<p><strong>Short circuiting </strong>is when the player finds a faster route to complete the race than the intended one. This can be as simple as <a href="http://kotaku.com/379260/watch-mario-kart-wii-ghost-glitch-cheat">driving the course backwards</a>, but normally requires the player to find an error in the level design.<strong></strong></p>
<p><strong>Spawn jumping </strong>occurs when the player respawns and has gained time. This normally involves the player dying in such a place that it is possible for them to spawn ahead, or dying in such a way that would dramatically increase her speed. An example of this is the rainbow bridge in <em>Mario Kart</em>, where a player could skip half the race by spawn jumping.<strong></strong></p>
<p><strong>Perma boosting</strong> is when the player is able to continually use a speed boost that is only supposed to be used seldomly, or in a limited amount. An example of such an exploit is <a href="http://www.metro.co.uk/tech/games/883669-mario-kart-7-expert-discovers-snaking-exploit"><strong>snaking</strong></a> in the <em>Mario Kart </em>games, where players use power slides to always have a boost on the vehicle. Another example is in <a href="http://en.wikipedia.org/wiki/F-Zero_X"><em>F</em></a><a href="http://en.wikipedia.org/wiki/F-Zero_X"><em>-</em></a><a href="http://en.wikipedia.org/wiki/F-Zero_X"><em>Zero</em></a><a href="http://en.wikipedia.org/wiki/F-Zero_X"><em>X</em></a>, where separate scoreboards are used for players who perma boost and those who don’t.</p>
<h2><a name="h.6pyqhkg98ota"></a>Loopholes in game physics</h2>
<p><strong>Wall jumping </strong>is when the player is able to climb up a wall by jumping against it, usually because of inaccurate physics or small glitches in the world geometry.<strong></strong></p>
<p>In <em>World of Warcraft,</em> before the introduction of flying mounts, it was possible to use this loophole to reach places in the game that the player shouldn’t have been able to.</p>
<p><strong>Bootstrapping </strong>is when the player jumps onto an object that she ‘holds’. She just moves up and also brings the object up with her. This allows the player to jump up or fly as if she had a jetpack. The <em>Fallout 3</em> loophole mentioned earlier relies on bootstrapping for the player to get access to the Citadel.<strong></strong></p>
<p><strong>Bunny hopping </strong>is when the player uses a series of secondary movements to increase the movement speed. These movements typically involve jumping or crouching. Bunny hopping techniques vary from engine to engine.<strong></strong></p>
<h2><a name="h.f9kcgqkndilq"></a>Loopholes in saving systems</h2>
<p><strong>Duping </strong>is when there is a resource that persists through saves — generally a currency the player <a>gains </a>through an in-app purchase. The player gathers the resource; loads and gathers it again, while they are in turn getting richer for not doing any work.<strong></strong></p>
<p><strong>Cloning</strong> is similar to twinking, but instead of creating a new account the player copies a saved game into a dummy account, sells the resources of the saved game for currency, and sends the currency back to the original account via a form of social integration where friends can ‘gift’ things to one and other.<strong></strong></p>
<p>The solution is to track the validity of player saves, or to check where the ‘gifts’ are coming from to be sure that they are from a legitimate user.</p>
<p><strong>Save scumming</strong> is when a player makes multiple saves so that they can play a ‘perfect’ game. The player creates a number of saves and simply reloads one until they get the result they want.</p>
<p>A solution is to remove, or disable, a save that is frequently used without the correct condition for the load to happen — player death is typical. This, unfortunately, removes the player’s ability to reload when death is certain even before it occurred. An alternative is to make the games use save points instead of free saves.</p>
<p>Save scumming is similar to fortune hunting — the difference is that a player can progress with save scumming, while a player that merely fortune hunts has to restart the game (or level).</p>
<p>Some games make statistics manipulation a valid game mechanic, for example, in <a href="http://tvtropes.org/pmwiki/pmwiki.php/VideoGame/CastleOfTheWinds">Castle Of The Winds</a> levels are randomly generated on player entering, and players can choose to re-enter the level. This is a kind of fall-back-fix for otherwise broken mechanics (more precisely, broken procedural generation).</p>
<p><strong>Save jumping</strong> is when the player uses the game auto-save system to their advantage. The player can do things such as teleporting to a different game point, or run to an autosave point while fighting to load the save and remove the enemies.<strong></strong></p>
<h2><a name="h.6po58ccpnx9t"></a>How to find game design loopholes</h2>
<p>As a designer, finding loopholes is a challenge: you are trying to break the very rules you crafted so carefully to govern the game world. In non-computer games this may be easier because the rules are stated explicitly. In video games, the rules are implicit, and requires a player to learn the rules, mostly, through trial-and-error. Because of the complexity of some games, a loophole may be completely overlooked simply because the “proper way of playing” is ingrained in the designer’s head.</p>
<p>There are four ways to find loopholes in your design.</p>
<h4><a name="h.rrjw7rmnavkh"></a>1. Use your own knowledge, experience and instincts</h4>
<p><strong>Look for loophole patterns. </strong>With experience, you will start to recognize the patterns that can lead to loopholes, and remove them from the design early. All the FPS loopholes discussed above arises from the interaction between the level design and AI. <strong></strong></p>
<p>Drawing from a large knowledge-base of loopholes in other games in your genre can be very helpful, and it’s a good idea to build such a base for yourself.</p>
<p><strong>Understand player motives. </strong>Even in simple games, the possibilities for loopholes are endless. Focus your attention where it matters. Consider what players want to do, and pay attention to the various systems that allows or limits these goals:</p>
<ul>
<li>Players want to win.</li>
<li>Players want more resources.</li>
<li>Players want to get to every spot in the game.</li>
<li>Players want to be the first, the fastest, the strongest,the richest, the prettiest, the coolest.</li>
<li>Players want achievements.</li>
</ul>
<p>This will not necessarily be the systems with the most loopholes, but it will be systems that players will pay most attention to, and loopholes in these systems are most likely to have important effects (on gameplay, player satisfaction, and even your bottom line).</p>
<p><strong>Don’t Kill Emergence. </strong>Trying to predict player behaviour can be tricky, and there is always the risk that your loophole corrections unnecessarily limits the game, and removes the possibilities of positive emergence.</p>
<h4><a name="h.qkk6pgvaypr4"></a>2. Ask fellow game designers to check your design</h4>
<p>Fellow designers can be great at finding loopholes. Designers have a good way of looking at a system and its rules and finding where to break them, and they typically have a vast knowledge of various loopholes in other games.</p>
<p>Of course, this method is not perfect:</p>
<ul>
<li> different designers may not agree on what are the loopholes of the game; and</li>
<li> even a hundred game designers may still overlook some loopholes.</li>
</ul>
<h4><a name="h.q7uj49jbmo9k"></a>3. Test</h4>
<p>Testing overcomes some of these problems: gamers don’t have designer’s bias, and you can generally find more game players than game designers willing to comment on your game.</p>
<p>Gamers know their game worlds have rules, and that they can break these rules to their advantage. Tournament level players are often used as <a href="http://www.igda.org/sites/default/files/IGDA_CreditsSnapshot_Apr06.pdf">balance testers</a> and have been extremely important in the making of games such as <em>Starcraft 2 </em>and <a href="http://www.rockpapershotgun.com/2011/08/15/counter-strike-go/">Counter Strike: Global Offensive</a>.</p>
<p>Metrics are a powerful tool for finding loopholes, especially if you have a large test group. A simple statistic such as number of players that choose a certain character may point to a balance issue: if a disproportionate number of players choose a certain character or combination, you know there is a problem. The course blog <em>Game Balance Concepts</em> gives an extensive overview of the use of <a href="http://gamebalanceconcepts.wordpress.com/2010/08/25/level-8-metrics-and-statistics/">metrics in game design</a>.</p>
<p>The <em>Desktop Dungeons</em> team was able to pick up the loophole with the gods by looking at the metrics of their players. A number of players were creating alternative characters on the same account where they unlocked only three gods. This puzzled the developers, until they realised the advantage of only unlocking three gods.</p>
<p>Metrics are also useful to pick up more general exploits: metrics exposed a <a href="http://wikibin.org/articles/overrated.html">highly skilled guild</a> of <em>WoW</em> players that used a client side tool to delete a wall during a raid and skip to the last boss, making game events happen out of the planned order.</p>
<p>A heatmap — a visual depiction of a metric on the game map — is another useful tool in finding loopholes. A heat map can show things such as player deaths, shots fired, enemy cover and player exploration. Heatmaps make it visually apparent where there are topographical problems with the map. See for example how this technique was applied in <a href="http://www.wired.com/gaming/virtualworlds/magazine/15-09/ff_halo?currentPage=all"><em>Halo</em></a><a href="http://www.wired.com/gaming/virtualworlds/magazine/15-09/ff_halo?currentPage=all"><em> 3</em></a>, <em><a href="http://www.fastcompany.com/1756538/infographic-of-the-day-using-113m-player-deaths-to-map-a-videogames-world">Just Cause 2</a></em>, <em><a href="http://www.gamasutra.com/view/feature/134526/hot_failure_tuning_gameplay_with_.php">Replica Island</a></em>, <em><a href="http://blog.counter-strike.net/science/maps.html">Counter Strike: Global Offensive</a></em>, by <a href="http://www.forcejunkies.com/2011/11/12/the-magic-behind-the-metrics/">BioWare</a>, and even in <a href="http://www.untoldentertainment.com/blog/2012/02/16/5-graphic-adventure-game-goofs-and-how-to-fix-them/">point-and-click adventure games</a>.</p>
<p style="text-align: center;"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/05/clip_image005.jpg"><img class="aligncenter size-full wp-image-4529" title="clip_image005.jpg" src="http://devmag.org.za/blog/wp-content/uploads/2012/05/clip_image005.jpg" alt="" width="614" height="351" /></a></p>
<p style="text-align: center;"> <span style="text-align: center;">Player deaths in </span><em style="text-align: center;">Just Cause 2</em><span style="text-align: center;">.</span></p>
<h4><a name="h.erpvfzwvh9vx"></a>4. Use feedback from players in the field</h4>
<p>Once a game has shipped, and your game is played by a large number of players, even more loopholes will be exposed. Adding metrics to your games can be very helpful to expose loopholes in these circumstances (players may not want to report loopholes as eagerly as testers). Unfortunately, you will only be able to fix with a patch or update.</p>
<h2><a name="h.f8qwyyurz0h9"></a>How to fix loopholes</h2>
<p><strong>Change one of the components. </strong>Since loopholes arise from the unintended interaction of game elements (rules or systems), a loophole can generally be fixed by making a change to just one of these systems. For example, all the FPS loopholes discussed can be fixed by either changing the level design, or by changing the AI.<strong></strong></p>
<p><strong>Change the interaction. </strong>Loopholes can also be fixed at the points where systems that cause them interact. Taking the FPS examples, the AI can be adjusted to take the level design into account, so that alternate behaviours are used based on the topology of the surroundings.</p>
<p><strong>Beware: general versus specific solutions.</strong> Some loopholes can be fixed by introducing very specific rules or exceptions. For example, in an FPS game, AI can be developed for specific zones: “if I am close to position (123, 456), I need to move away from the crates”. Alternatively, problems can be fixed with general rules; in an FPS, for example, the AI may be adjusted “if I am between two crates, move away”. <strong></strong></p>
<p>General rules are more elegant and easier to manage. But adding general rules to fix loopholes may introduce new loopholes. Specific rules don’t impact on the overall game, but many may be needed, leading to debugging nightmare. “Why is this AI moving away from crates when he is near the big boss?”</p>
<p><strong>Rely on social norms. </strong>In multiplayer games, social norms can make up for broken rules. This is especially useful when a loophole would be too expensive to fix, or a solution is not clear. <a href="http://www.gamasutra.com/view/feature/131849/online_justice_systems.php">Online justice systems</a> are an essential part of MMO social systems. Such social norms can be provided by behavioural guidelines — such as the <em>World of Warcraft</em> <a href="http://us.battle.net/support/en/article/harassment-policy">harassment policy</a> — or rewarding players who positively contribute to the community, such is the <a href="http://www.gamasutra.com/view/feature/134839/the_valve_way_gabe_newell_and_.php?page=1">plan</a> for <em>Dota 2.</em><strong></strong></p>
<h2><a name="h.djbe8zgg7apc"></a>It’s not a bug, it’s a feature</h2>
<p>A loophole can destroy a game, but not always.</p>
<p><strong>Some loopholes require considerable skill in themselves</strong>, and thus they don’t break the game. In the developer commentary for <em>Portal</em>. The developers said they left trick methods of completing the puzzles in because they required more skill than completing the puzzle normally would.<strong></strong></p>
<p><strong>Some loopholes become new mechanics. </strong>If they are rich enough, it can still be a good game, even if it is not the one the designer intended. In Quake 3 players could use a combination of directional jumping and turning to increase her speed. This technique, called <a href="http://en.wikipedia.org/wiki/Strafe-jumping">strafe jumping</a>, was never planned for, but it soon became an essential part of the game, and the developers decided to leave it in. <strong></strong></p>
<p>The loopholes in a game can even become the <em>main </em>mechanics of the sequel. In <em>Starsiege: Tribes</em> the <a href="http://en.wikipedia.org/wiki/Starsiege:_Tribes#Movement">movement</a> system allowed players to attain very high speeds by using their jetpack to go down a hill. This is referred to as skiing, and is one of the core feature of every tribes game.</p>
<p><strong>Some loopholes have little effect in the greater scheme. </strong>They may make one small part of the game easier, but overall don’t change the difficulty. In this case, they may become a source of amusement, such as the bucket-on-the-head Skyrim loophole mentioned earlier.<strong></strong></p>
<p><strong>Some loopholes “fix” broken design.</strong> Yes, if you take out the ability to bruteforce puzzles in certain games, they may be totally unsolvable. <strong></strong></p>
<p><strong>Finding loopholes is a sport.</strong> The meta game of <a href="http://en.wikipedia.org/wiki/Speedrun">speed runs</a> use sequence breaking loopholes so that the player can complete a given game or level thereof in the least amount of game time possible.<strong></strong></p>
<h2><a name="h.kmtnl6ilcb2"></a>Conclusion</h2>
<p>Loopholes pop up from time to time. Experience and knowledge of loopholes in other games will help you avoid them, and proper testing to find and remove them when they do slip through.</p>
<p>Give us some of the loopholes found in your games in the comments!</p>
<h2><a name="h.w751l44yjzt"></a>References</h2>
<p>Many of the terms used in the FPS section and some in the general loopholes section come from John LeFlohic’ article <a href="http://www-cs-students.stanford.edu/~jl/Essays/enemies.html">Computer-Game Enemy Design</a>.</p>
<p>Some terms in <em>Loopholes in multiplayer games </em>were taken from Ian Schreiber’s course blog <a href="http://gamebalanceconcepts.wordpress.com/2010/09/08/level-10-final-boss/">Game Balance Concepts</a>.</p>
<p>Many of the multiplayer game loopholes come from Wikipedia: <a href="http://en.wikipedia.org/wiki/Exploit_(online_gaming)">Exploit (Online Gaming)</a>, <a href="http://en.wikipedia.org/wiki/Cheating_in_online_games">Cheating in online games</a>, <a href="http://en.wikipedia.org/wiki/Bunny_hopping">Bunny hopping</a>, <a href="http://www.google.com/url?q=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDuping&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNF4xcXka2f9LBxJxBbysaJu_oUQFQ">Duping</a>, <a href="http://en.wikipedia.org/wiki/Camping_(video_gaming)">Camping</a>,</p>
<p>Many of the terms and examples come from TV Tropes under various entries: <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/LoopholeAbuse">loophole abuses</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/SequenceBreaking">sequence breaking</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/GameplayDerailment">gameplay derailment</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/NotTheIntendedUse">not the intended use</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/EasyLevelTrick">easy level trick</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/RubberBandAI">rubber band AI</a>.</p>
<h2><a name="h.c30lwu1xkadd"></a>Thanks</h2>
<p>My thanks to Jonathan Hau-Yoon for completely breaking my card game. And Herman Tulleken, my editor, who put a great deal of effort into polishing this article.</p>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2009/08/31/minimised-game-design-for-indies/' rel='bookmark' title='Minimised game design for indies'>Minimised game design for indies</a> <small>When you sit down to write a book, one of...</small></li>
<li><a href='http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/' rel='bookmark' title='Video game user interface design: Diegesis theory'>Video game user interface design: Diegesis theory</a> <small>In this article, the Dave Russell introduces the basic concepts...</small></li>
<li><a href='http://devmag.org.za/2011/02/16/board-silly-tabletop-game-design/' rel='bookmark' title='Board Silly (Tabletop Game Design)'>Board Silly (Tabletop Game Design)</a> <small>Two Dev.Mag writers share their board game design experiences: conception,...</small></li>
<li><a href='http://devmag.org.za/2011/03/03/desktop-dungeons-design-analysis-part-1/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 1)'>Desktop Dungeons: Design Analysis (Part 1)</a> <small>This is the first part of an in-depth look at...</small></li>
<li><a href='http://devmag.org.za/2012/02/13/game-design-on-ideas/' rel='bookmark' title='Game Design: On Ideas'>Game Design: On Ideas</a> <small>In this article, Julian Pritchard gives us his take on...</small></li>
<li><a href='http://devmag.org.za/2011/03/23/desktop-dungeons-design-analysis-part-2/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 2)'>Desktop Dungeons: Design Analysis (Part 2)</a> <small>In this second part of analyzing Desktop Dungeons, we look...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/05/07/loopholes-in-game-design/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Video Game Audio: Diegesis Theory</title>
		<link>http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/</link>
		<comments>http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 14:00:35 +0000</pubDate>
		<dc:creator>Dave Russell</dc:creator>
				<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Sound]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[diegesis]]></category>
		<category><![CDATA[fourth wall]]></category>
		<category><![CDATA[game design]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4482</guid>
		<description><![CDATA[<br/>In a previous article, we looked at the diegesis theory of interface design. The theory can also be applied to audio design. This is a look into the design of audio for games, and how diegesis theory can help us structure our thoughts.<h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/' rel='bookmark' title='Video game user interface design: Diegesis theory'>Video game user interface design: Diegesis theory</a> <small>In this article, the Dave Russell introduces the basic concepts...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/04/diegetic-audio.png" alt="platfrom_banner" width="680" height="341" border="0" /><br />
In a previous article, we looked at the <a href="http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/">diegesis theory of interface design</a>. The theory can also be applied to audio design. This is a look into the design of audio for games, and how diegesis theory can help us structure our thoughts.<br />
<span id="more-4482"></span><br />
So where do we start? Let’s start with an experiment.</p>
<ol>
<li>Turn computer on mute, start-up favourite game and play a bit of it.</li>
<li>Now do exactly the same thing, but this time with the audio.</li>
</ol>
<p>You would have most likely found the game easier, and more enjoyable to play. So what are the functions of audio in games? Sound serve four main functions in a game:</p>
<ul>
<li>Sound gives <strong>feedback</strong> to the player, often in addition to visual feedback. This is most obvious in the interface, where buttons make noises. In the game itself, audio feedback helps the player feel his actions have an effect, an example is the sound played when a gun is reloaded.</li>
<li>Sound gives the player <strong>information</strong> about the game and its world itself, for example, the sound of approaching enemies warns to player to get ready. It also helps draw the attention to important game events.</li>
<li>Sound forms part of the <strong>award system</strong> of games. The sounds and flashes that go with completing a row in <em>Tetris</em> make the act much more pleasurable. It is a short-term award that supports the long-term award of not dying and beating a high-score.</li>
<li>Sounds help create <strong>realism</strong>. They help to immerse the player deeper into the game world and encourages the suspension of disbelief. It helps put the player in the scene, making her part of the action. Explosions without audio are neither believable, nor very dramatic.</li>
<li>Sound creates <strong>mood and pace</strong>, most often as background music. The cinematic soundtracks used in strategy games have nothing to do with realism or feedback or information. Instead, glorifies the setting, it makes the events feel epic, and so enhances the player’s feeling that he is doing something important. Similarly, the action-packed feeling of an arcade game is as much a result of the blingy music as it is of the actual gameplay.</li>
</ul>
<p>This article is going to look at how we can use the concepts of diegesis or narration to help us design audio for a game. We will look at various different games to understand how this approach will help us.<br />
As with the diegesis theory of interface design, we are concerned with two main concepts: narrative and the fourth wall. I repeat the explanations of these two concepts from the interface article:</p>
<h2 dir="ltr">Narrative</h2>
<p><a href="http://devmag.org.za/category/development/narrative/">Narrative</a> is a message that conveys the particulars of an act or occurrence or course of events. In simple terms, it is the story the designer wishes to convey; be it the story of blocks falling from the sky which need to land in the right place (<em><a href="http://en.wikipedia.org/wiki/Tetris">Tetris</a></em>), or a journey through a strange land (<em><a href="http://machinarium.net/demo/">Machinarium</a></em>).</p>
<p>Not all elements of a game are part of the narration. For example, the game menus and the HUD, because the game’s characters are not aware of these elements. This does not mean these components do not support the narrative. For example, a futuristic game typically has GUI elements that also appear futuristic.</p>
<h2 dir="ltr">The fourth wall</h2>
<p>The fourth wall is the imaginary divide between the player and the world of the game. In order for the player to immerse themselves in the game world, he needs to move through the fourth wall. The ease with which the player moves between the real world and the game world depends on the way the interface designer delivers information to the player.</p>
<p>Posting your latest game accomplishments on Facebook is an example of how a game extends beyond the fourth wall. To further delve into this concept, one should read Steven Conway’s interesting discussion of the fourth wall in games: <a href="http://www.gamasutra.com/view/feature/4086/a_circular_wall_reformulating_the_.php">A Circular Wall? Reformulating the Fourth Wall for Video Games</a>.</p>
<h2 dir="ltr">Sounds in games</h2>
<p>We can now ask ourselves two questions about any sound:</p>
<ul>
<li>Is the sound of the game story? (Is it part of the narrative?)</li>
<li>Is the sound of the game space? (Is it behind the fourth wall?)</li>
</ul>
<p>Depending on the answers, we can classify the sound into one of four classes: diegetic; non-diegetic; spatial; or meta.</p>
<p>The diagram below summarises the four possible combinations.<img class="aligncenter" src="http://devmag.org.za/blog/wp-content/uploads/2011/02/diegesis_theory.png" alt="" width="600px;" height="415px;" /><br />
In talking about audio, meta and spatial representations are often clumped together with non-diegetic and diegetic sounds; we won’t cover go into detail into meta and spatial representations here (they are not very common), but it is still useful to keep the distinction.</p>
<h2 dir="ltr">Diegetic sound</h2>
<p>For diegetic sound, we answer our two questions as follows:</p>
<ul>
<li>Is the sound in the game story? <strong>YES</strong></li>
<li>Is the sound in the game space? <strong>YES</strong></li>
</ul>
<p>When we talk about diegetic sound, we are talking about sound that is part of the world that the player is in, any audio produced in your game world. This is includes sound-effects, ambient environmental sound, and game character dialog.</p>
<p>In this trailer of <em>Call of Duty: Black Ops</em>, all the sound is diegetic. The absence of music helps build tension, and helps the player focus on the events as they unfold.<br />
<span style="text-align:center; display: block;"><a href="http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/"><img src="http://img.youtube.com/vi/h_fsM6LBi54/2.jpg" alt="" /></a></span></p>
<p>Although diegetic sound is used most often to increase immersion and realism (bigger guns make bigger noise), it can also support gameplay. In <em>Dead Space</em>, the audio (an alien “screaming” from behind) is used to draw the player’s attention to the wave of enemies that is behind him.<br />
<span style="text-align:center; display: block;"><a href="http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/"><img src="http://img.youtube.com/vi/4DmsDICPnjg/2.jpg" alt="" /></a></span></p>
<h2 dir="ltr">Non-diegetic sound</h2>
<p>For non-diegetic sound, we answer our two questions as follows:</p>
<ul>
<li>Is the sound in the game story? <strong>NO</strong></li>
<li>Is the sound in the game space? <strong>NO</strong></li>
</ul>
<p>Non-diegetic sounds are audio cues provided from outside the world that the player is in. This includes background music (where is this magical omnipresent band playing in the world?) and interface sounds.<br />
Music is incredibly useful to create atmosphere and manipulate the player’s emotions. (Changing the music is the single most effective tool used for genre bender spoofs, such as the recut trailers for <em><a href="http://www.youtube.com/watch?v=2T5_0AGdFic&amp;feature=player_embedded#!">Mary Poppins</a></em> or <em><a href="http://www.youtube.com/watch?v=KmkVWuP_sO0&amp;list=PL55525E6A147A240A&amp;index=2&amp;feature=plpp_video">The Shining</a></em>).</p>
<p><em>Robot Unicorn Attack</em> the crazy backing track supplied by Erasure, together with the chirpy graphics, emphasises the ironically chosen title of the game.<br />
<span style="text-align:center; display: block;"><a href="http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/"><img src="http://img.youtube.com/vi/i1QUX6--waA/2.jpg" alt="" /></a></span></p>
<p>In games that use <a href="http://www.gamasutra.com/view/feature/1567/defining_adaptive_music.php">adaptive music</a>, the player’s emotions can be controlled even more tightly. How much more dramatic is a battle when the brass enters as it starts?</p>
<p>Interface sounds give the player feedback on his or her actions. They are vital to show that the interface is responding, and to draw the player’s attention to important events or information.</p>
<p>In <em>Borderlands</em>, the music effectively becomes part of the interface, changing based on your life level, presence of enemies, and their difficulty.</p>
<h2 dir="ltr">Meta representations</h2>
<p>For meta sound, we answer our two questions as follows:</p>
<ul>
<li>Is the sound in the game story? <strong>YES</strong></li>
<li>Is the sound in the game space? <strong>NO</strong></li>
</ul>
<p>Meta audio is audio which sits between the world of the protagonist and the player. The most obvious example is a game narrator, which is not part of the game world, but definitely adds to the story. In <em>Bastion</em> this is taken to the limit, where a running commentary is given on the player’s every move.</p>
<h2 dir="ltr">Spatial representations</h2>
<p>For spatial sound, we answer our two questions as follows:</p>
<ul>
<li>Is the sound in the game story? <strong>NO</strong></li>
<li>Is the sound in the game space? <strong>YES</strong></li>
</ul>
<p>Spatial audio representations are sounds set in the game space, but is not part of that world. It is not very common in games, mostly because we cannot easily map the source of a sound with a location in the game.</p>
<p>One example is in <em>Anno 1404</em>, where the music changes depending on the location the player is viewing: the music gets an Arabic flavour when the player views locations in the “Orient”; this, together with the visual differences, helps to sets the east part from the west in the game. Another example is the audio-navigation system used in <em><a href="http://thepath-game.com/">The Path</a></em>.</p>
<h2 dir="ltr">Links</h2>
<ul>
<li>The <a href="http://www.gamasutra.com/view/feature/3509/ieza_a_framework_for_game_audio.php?print=1">IEZA framework</a> is another very useful theory of game sound. It also makes use of the diegetic axis.</li>
<li>Game Sound provides a whole bunch of links to publications on <a href="http://www.gamessound.com/research.htm">game audio</a>.</li>
<li>Sander Huibert’s thesis <a href="http://download.captivatingsound.com/Sander_Huiberts_CaptivatingSound.pdf">Capitivating Sound</a> [14.6 MB, PDF] provides a wealth of useful information on how game sound contributes to immersion.</li>
</ul>
<h2 dir="ltr">Thanks</h2>
<p>Thank you <a href="https://plus.google.com/u/0/111401724839459268077">Zachary Reese</a> and <a href="https://plus.google.com/u/0/100592160437913066141">Devin Moore</a> for giving some of the examples.</p>
<p>Header image from <a href="http://www.flickr.com/photos/frostnova/606822557/sizes/z/in/photostream/">http://www.flickr.com/photos/frostnova/606822557/sizes/z/in/photostream/</a>.</p>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/' rel='bookmark' title='Video game user interface design: Diegesis theory'>Video game user interface design: Diegesis theory</a> <small>In this article, the Dave Russell introduces the basic concepts...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Student&#8217;s Perspective on Education: DigiPen</title>
		<link>http://devmag.org.za/2012/04/17/a-stundents-perspective-on-education-digipen/</link>
		<comments>http://devmag.org.za/2012/04/17/a-stundents-perspective-on-education-digipen/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 15:19:02 +0000</pubDate>
		<dc:creator>Julian Pritchard</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Interviews]]></category>
		<category><![CDATA[digipen]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[tertiary education]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4459</guid>
		<description><![CDATA[<br/>Julian Pritchard talks to DigiPen student Alicia Yeargin about her degree, her experience as a student, and her thoughts on games and game design.
No related posts.]]></description>
			<content:encoded><![CDATA[<br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/04/education-interview.png" alt="platfrom_banner" width="680" height="341" border="0" /></p>
<p><strong>Hi, thanks for doing this Dev.Mag interview. For the record, please state your name, what you do, and your favourite pastry.</strong></p>
<p>Alicia: Heya, my name is Alicia Yeargin. I’m currently a student at DigiPen Institute of Technology in Redmond, Washington, and about to complete my Bachelor of Science in Game Design. My favorite pastry is, without a doubt, the maple donut.</p>
<p><span id="more-4459"></span></p>
<p><strong>Your degree is a tech degree. Did it include non-technical topics?</strong></p>
<p>Alicia: Yes, my degree had one introductory psychology class, and I took a number of different art classes. There were two sketching / traditional art classes, one 3D art class, an architecture class, an art appreciation class, a film class, and a Photoshop class.</p>
<p><strong>Cool! I like that amount of art in a &#8216;tech&#8217; degree.</strong></p>
<p><strong>Do you think, as a game designer, that you should have a good grasp, or at least an understanding, of tech, art, and music?</strong></p>
<p>Alicia: Absolutely. Even though I don&#8217;t take any more art classes, I continue to use 3D Studio Max and sketch in notebooks. Naturally, all the things I make are crap, but just doing it helps me understand the art process; I think that&#8217;s incredibly important.</p>
<p>Music is something that&#8217;s always been beyond me, though. It&#8217;s not very big at DigiPen right now. (The rumor is that we&#8217;re getting an audio degree of some kind.)</p>
<p><strong>I&#8217;m happy to hear that. The reason I was asking about music is that when I look at games like Bastion, Amnesia, and even Deus Ex: Human Revolution, I see that music forms an extremely important part of the atmosphere. So it should be something that a designer should have in their arsenal.</strong></p>
<p>Alicia: I agree.</p>
<p><strong>So do you feel you would do anything to expand your knowledge of music?</strong></p>
<p>Alicia: At this point, I&#8217;m not sure. It&#8217;s unlikely. I&#8217;ve just personally never been musically inclined. I have a good ear for things; just not the mind or anything to create it.</p>
<p><strong>What do you feel the relationship between coding and design is like?</strong></p>
<p>Alicia: It should be together, definitely. I can&#8217;t imagine even calling myself a designer without knowing how to code. It&#8217;s super huge for understanding the tech behind games and how the software actually works.</p>
<p><strong>So what kind of background in coding would you feel someone approaching design from and art side would need?</strong></p>
<p>Alicia: At DigiPen even our artists learn some code -even the BFAs (<em>Ed. note: the BFA referred to is the DigiPen <a href="https://www.digipen.edu/academics/degree-programs/digital-art-and-animation/">Bachelor of Fine Arts in Digital Art and Animation</a></em>)  who may never touch a game in their lives do some code-, mostly ActionScript. Even if you&#8217;re an artist, I think you should have some ActionScript or something like that in your belt. Technology&#8217;s so huge these days; it&#8217;s kinda crazy to not.</p>
<p><strong>Did you learn anything about the production side of things?</strong></p>
<p>Alicia: In terms of being a producer and team management?</p>
<p><strong>Yes.</strong></p>
<p>Alicia: That&#8217;s kind of an interesting thing here. Every year, we work on a team project, and on every team someone has to be a producer; it&#8217;s just a requirement of the class. So, someone will be learning a bit about scheduling. We do have, I think, one or two management-type classes, but it&#8217;s not super huge. I personally haven&#8217;t taken any of those, and I was a producer on my first-year game team.</p>
<p><strong>Making video games is an applied field. How often did you make projects and such things?</strong></p>
<p>Alicia: First year, we made an individual semester project with the engine provided by the school. (It&#8217;s something like GameMaker.) The second half of first year, we worked on a team on an ASCII game.  Second year was a two-semester (one year) long 2D game. Third year was another year-long 3D game. Fourth year has more leeway. It can be 3D or 2D, and we also can do solo projects in order to pursue something more specifically related to our desired fields. For designers, there are also the design courses where you make prototypes of games and other projects as well.</p>
<p><strong>Are those design courses similar to Global Game Jam style of making games?</strong></p>
<p>Alicia: Oh. Hmm, I don&#8217;t know enough to make a direct comparison, but I can say it does vary between each class. One class, we had a prototype due every two weeks. One week an RPG, another an FPS, and so on. In my analog class right now, we&#8217;re just doing two projects. First half of the semester was a tabletop RPG, and the second is a tabletop simulation game.</p>
<p><strong>Would you have like to do more prototypes or less?</strong></p>
<p>Alicia: Hmm, probably less. I would have preferred to spend more time on projects to get further polish on them.</p>
<p><strong>Do you believe polish is an important aspect of every game?</strong></p>
<p>Alicia: Yes, I think polish matters. That may just be more of a personal thing. I&#8217;m kind of a perfectionist. I always notice the little things.</p>
<p><strong>Well, there is a point where you have to let things go, otherwise you end up with Duke Nukem Forever.</strong></p>
<p>Alicia: Definitely.</p>
<p><strong>Do you think there is a difference between a story and a narrative?</strong></p>
<p>Alicia: Yes. I believe pretty much every game ever has a narrative, but I think story requires a little bit more. (I&#8217;ve yet to do enough personal research and study to fully define where the &#8220;line&#8221; of story/not-story is, if it exists.)</p>
<p><strong>Did you try and make games before you started your studies?</strong></p>
<p>Alicia: I actually didn&#8217;t really. I went to the ProjectFUN summer program that DigiPen hosts, and I made a game there. Other than that, I really hadn&#8217;t even thought much about making games. I&#8217;d always just been a writer, but I knew I didn&#8217;t want to write novels.</p>
<p><strong>What sort of writing courses did you study? Or have you just always been a natural writer?</strong></p>
<p>Alicia: Writing has always been huge for me, even before I ever started playing games. DigiPen has a decent amount of English classes, though not very many writing classes. I think having actual writing classes is something the school needs.</p>
<p><strong>With your background in writing, what position would you like to end up with in the game industry?</strong></p>
<p>Alicia: At the moment, I&#8217;m just digging around to see if I can find any level-design jobs. If not that then playtesting. Ideally, in five to ten years, I&#8217;d like to work my way up to a position as a full-time writer for games. Maybe something like a Mass Effect or a Skyrim.</p>
<p><strong>Do you think that Mass Effect and The Elder Scrolls games are good in terms of their story?</strong></p>
<p>Alicia: I think Mass Effect&#8217;s story and dialog are both incredible. The Elder Scrolls series is amazing for its lore and depth and uniqueness of universe. (I started with The Elder Scrolls III: Morrowind, so that&#8217;s why I say that.) The actual game stories in the Elder Scrolls games are, admittedly, a bit flat, but I&#8217;ve always enjoyed the writing in the quests.</p>
<p><strong>Mass Effect, and The Elder Scrolls games are massive, but do you think you could make a complete game by yourself?</strong></p>
<p>Alicia: It&#8217;s possible. I&#8217;ve technically almost done that with my senior project. However, it&#8217;s not easy, and it&#8217;s not practical for a professional game. Although, it does give you a REALLY good appreciation for every part of a game team.</p>
<p><strong>Minecraft did start out as a one man project. Do you think it will be more common for game to grow with their community as minecraft did?</strong></p>
<p>Alicia: Yeah, I can definitely see more things popping up like that, especially with the way things seem to be growing for Internet-based products like that.</p>
<p><strong>With regards to your student projects how do the IP-rights for those work?</strong></p>
<p>Alicia: DigiPen owns everything. No question about it. Even access to installers for games, those have to be distributed through DigiPen&#8217;s website (unless super special permission is given).</p>
<p><strong>Yeah, I remember downloading The Fourth Wall from the website. Has any full scale game ever emerged out of digipen, or do they end up like Narbacular Drop and Portal?</strong></p>
<p>Alicia: No commercial full scale games can emerge from DigiPen; that&#8217;s just the way things are. If the students want to take their ideas and go big, they have to go the way of Portal pretty much.</p>
<p><strong>Now that you have basically completed your degree, are there anything you wish you could have learned, learned more of, learned less of, or even not learned at all?</strong></p>
<p>Alicia: I wish there were classes dedicated to learning specific tools or something, like a class on Unreal, as a design course elective or something. I think that would have been very helpful. Unreal experience is something a lot of companies look for, and I&#8217;m one of the few graduating designers who actually has it.</p>
<p>Also, a class in mobile game design might have been great. Not sure how that would have been done, but that&#8217;s such a huge thing now; I feel like it would have been nice to get more experience with that.</p>
<p><strong>That is a rather strange concept to me. In South Africa just about everyone makes mobile games, and perhaps even more people make their games with Unity.</strong></p>
<p>Alicia: Yeah, Unity is just now getting into our design courses as a serious thing. I&#8217;ve had some prior experience with it, but I&#8217;ve talked to very few dev&#8217;s who use it (so far). I like it though.</p>
<p><strong>What kind of text books were you given for game design?</strong></p>
<p>Alicia: Not a lot really. The only book that was consistently a recommended/required bit of text between classes was Schell&#8217;s The Art of Game Design. We do a lot of learning by doing here.</p>
<p><strong>Thanks for the interview. Anything else you want to say?</strong></p>
<p>Alicia: DigiPen’s done a great job kicking my butt every day until making me into a solid game designer, and it’s been tough&#8211;but a really good experience. Looking forward to graduating and finally getting into the industry!</p>
<p>Thanks for the interview!</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/04/17/a-stundents-perspective-on-education-digipen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crunch Time</title>
		<link>http://devmag.org.za/2012/02/27/crunch-time/</link>
		<comments>http://devmag.org.za/2012/02/27/crunch-time/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 14:00:45 +0000</pubDate>
		<dc:creator>Julian Pritchard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Production]]></category>
		<category><![CDATA[Crunch]]></category>
		<category><![CDATA[Finance]]></category>
		<category><![CDATA[Satire]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4423</guid>
		<description><![CDATA[<img src="http://devmag.org.za/blog/wp-content/uploads/2010/12/devmag_orange.png" width="29" height="29" alt="" title="Development" /><br/>This article looks at crunch time, its effects on the development process and the developers themselves, how to avoid it, and how to deal with it if it does come.
No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://devmag.org.za/blog/wp-content/uploads/2010/12/devmag_orange.png" width="29" height="29" alt="" title="Development" /><br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/02/crunch.png" alt="platfrom_banner" width="680" height="341" border="0" /><br />
Looking into the development cycle for video games we look at one of the worst, and almost unavoidable occurrences. Crunch. For a common definition of crunch, or in full crunch time, <a href="http://en.wiktionary.org/wiki/crunch_time">Wikipedia</a> give us A critical period of time during which it is necessary to work hard and fast . Indeed when we are crunch, for anything, we work as hard and as fast as we can.</p>
<p>But unfortunately crunch has a series of negative effect. In a brief summation of Evan Robinson’s article <a href="http://www.igda.org/why-crunch-modes-doesnt-work-six-lessons">Why Crunch Modes Don’t Work: Six Lessons</a>. Crunch leads to a short-term productivity boost due to the extended hours the people work. But in a long-term scenario crunch leads to a loss in productivity as the there is a natural peak amount of hours that a person can work and be effective at that work. As such it leads to poor work rushed out to meet deadlines. This happens with video games, writing, and many other things.</p>
<p><span id="more-4423"></span>Given the apparent nature that a long-term crunch is a bad thing why does it occur? In larger development this occurs due to publishers only giving so much money to the studio to complete certain goals. This leads to the management pushing harder on the staff to be more productive without giving them overtime. Which in often enough they do not have the money for, as it was said above they crunch to meet a deadline so they can get money.</p>
<p>With small-medium sized studios, it comes down to budget. The investors a lot a certain budget to a project. And if they can’t make that deadline they have to let staff go or close. So they crunch to make deadlines to survive. Often if the project is not complete a skeleton staff remains to finish the project to something ship-able &#8211; or it is handed over to a third-party developer who get paid once the game is released.</p>
<p>With, unfunded, indie studios it is simple. Since you have no one signing a pay check you need to finish the game so you can eat. If it came down to crunching or starving I am sure most people would be crunching.</p>
<h2 dir="ltr">It’s not always about the money</h2>
<p>Unfortunately the financial losses of crunching are not always the greatest worry, you won’t find many developers who make games purely for the money. One of the most famous cases of the effect of crunch was written almost a decade prior to this article. It was a <a href="http://ea-spouse.livejournal.com/274.html">LiveJournal entry</a> by Erin Hoffman, who used the pseudonym ea_spouse. She highlight the emotional, mental, and physical strain that her family took due to the extended period of crunching in game development.</p>
<p>It is easy to understand how when working over double the number of hours a week that most other people to, and only to be told that you won’t receive over-time, days off, or any compensation for that matter would have a terrible effect. On a person’s mental and emotional state. And given the long hours one can easily see that it would put strain on both a person’s body, and their relationships.</p>
<p>Another infamous, but more recent, case of game development crunch was the developers of L.A. Noire, Team Bondi. <a href="http://www.gamesindustry.biz/articles/2011-06-28-igda-to-investigate-team-bondi-allegations">Reports</a> of 12 hour 7 day a week work weeks being the normal conditions. This was also expanded upon by the fact that developers who refused to comply with these abhorrent conditions were refused a title in the credits.</p>
<h2 dir="ltr">What is special about games?</h2>
<p>Given the above, people who don’t work in the game development industry may wonder why on earth we go through this.</p>
<p>Well, many don’t. The average time developers stay in the industry is 5 years, and taking that further; according to the <a href="http://www.igda.org/sites/default/files/IGDA_QualityOfLife_WhitePaper.pdf">IGDA quality of life white paper</a> only 3.4% of people working in the industry have beyond 10 years experience.</p>
<p>And those that put up with this?</p>
<p>Game development is of course not unique in this regard; many other industries also deal with the same problem, software development is infamous for projects going overtime and over-budget. As is always the case, those who do it believe the benefits outstrip the negatives. They do it because it is part of the price to pay. If you want to become a doctor, you have to study for many years, and depending on your country, work for the government for a few years after that. If you want to be a game developer, the chances are that you will have to crunch it is a part of the industry unfortunately, and even more unfortunate is how often it is necessary.</p>
<h2 dir="ltr">So what are the benefits of being a game developer?</h2>
<p>The people who work in video games have a passion and love for games. The best parable is: “If you win the lottery you are happy for a year, but if you love the work you do; you are happy for life.” For those who find the right place in the industry I do not believe that they would do not believe that they would do anything else.</p>
<p>But unfortunately many companies propagate the mentality of: “This is game development be grateful you have your job here, and get used to crunching.”</p>
<p>That is a very unfortunate reality, and one that is not true. Work is like life there are periods when things are good, and there are periods where you have to get things moving and give it all you have. The thing that is being opposed is a system of continual overtime without compensation.</p>
<p>But there are places, like <a href="http://www.develop-online.net/features/1184/The-Valve-manifesto">Valve</a>, which emphasise an open-work environment, and collaborative work mentality. Perhaps this is an ideal for game development? On the other hand Extra Credits did a piece on <a href="http://www.penny-arcade.com/patv/episode/an-open-letter-to-ea-marketing">EA marketing</a>* in which they covered an old advertisement, which I found transcribed <a href="http://johanistan.wordpress.com/2011/03/16/the-electronic-arts-manifesto-can-computer-make-you-cry/">here</a>. I cannot do it justice by paraphrasing, but I will say it talks about issues which I believe are at the heart of video games but are so often forgotten.</p>
<h2 dir="ltr">What to do about crunch</h2>
<p>As a developer there are some things you can do to avoid crunch. The first is understand the ethic of the studio that you work at. If it seems wrong how it works speak to your lead and producer. Producers are in charge of scheduling so if there is a reason for crunching they are definitely the ones to speak to. Some times you with your fellow workers can open negotiations so that you receive the appropriate benefits for the crunch, or have a reduction in the amount of time spent crunching, but keep the reasons for why studios crunch in mind when you do this.</p>
<p>In the end if it seems like the studio is abusive towards its employees then that is not a good place to be at. I would suggest finding somewhere else to work. Since if you believe that game development is the job for your then there is most likely a studio that is the right place for you.</p>
<p>Or you can write an article about crunch which abuses the English language so hard that grammar nazis cry in an attempt to give people an example of why crunch does not work.</p>
<p><em>*If you want to just watch the segment of video related start at 5:15.</em></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/02/27/crunch-time/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>So You Want to Crowd-Source Your Funding?</title>
		<link>http://devmag.org.za/2012/02/20/so-you-want-to-crowd-source-your-funding/</link>
		<comments>http://devmag.org.za/2012/02/20/so-you-want-to-crowd-source-your-funding/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 15:17:56 +0000</pubDate>
		<dc:creator>Julian Pritchard</dc:creator>
				<category><![CDATA[Funding]]></category>
		<category><![CDATA[business]]></category>
		<category><![CDATA[funding]]></category>
		<category><![CDATA[marketing]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4391</guid>
		<description><![CDATA[<br/>This article looks at Kickstarter, and to use it to raise funding for game development as an alternative to the traditional publishing model.
No related posts.]]></description>
			<content:encoded><![CDATA[<br/><div>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/02/crowdfunding.png" alt="platfrom_banner" width="680" height="341" border="0" /></p>
<p>With Double Fine adventures just hitting the $2,000,000 when I started writing this article; I seem to notice that the Internet, or at least the parts I pay attention to, is abuzz with ‘Kickstarter fever.’ Now I am extremely happy about this since: I love Double Fine, don’t like publishers, and feel this can be the start of something great.</p>
<p><span id="more-4391"></span>But, I must caution people against thinking that they can crowd source millions of dollars. The reason I say this is because <a href="http://en.wikipedia.org/wiki/Double_Fine_Productions">Double Fine</a> has something unique. They have been around for 12 years, created one of the most celebrated cult hits, are making a game for a genre that is almost forgotten, and have two of the most famous people of that genre working on the game. Now that is a tall order to top!</p>
<h2 dir="ltr">What do you need to crowd-source a million dollars?</h2>
<p>This is a question I don’t have an exact answer to, nor does anyone I would imagine. But we can take a good look at the man who has done it. <a href="http://en.wikipedia.org/wiki/Tim_Schafer">Tim Schafer</a> has worked on adventure games since 1990 where he was a co-writer on <em>The Secret of Monkey Island</em>. Since then he has been the lead of <em>Full Throttle</em>, and <em>Grim Fandango</em>. And these days he is the founder/owner of Double Fine. In terms of social media he has: 5,400 likes on <a href="http://www.facebook.com/TimOfLegend">Facebook</a>, has been circled 6,392 on <a href="https://plus.google.com/117564870844254304139/posts">Google+</a>, and finally 68,218 followers on <a href="http://twitter.com/TimOfLegend">Twitter</a>. So if video games have celebrities I’m sure Tim is one of them.</p>
<p>The next is Double Fine; I have already stated the company&#8217;s record. But they have one person I haven’t talked about yet. <a href="http://en.wikipedia.org/wiki/Ron_Gilbert">Ron Gilbert</a> is the creator of the point-and-click adventure game. Which is the genre of game that DF are crowd-sourcing the funds for. So think about this: they have two of the most celebrated developers of the genre, talk to the community with the same sincerity as an indie developer, did not ask, or expect a million dollars in funding, but now they have two.</p>
<h2 dir="ltr">The Kickstarter Fever</h2>
<p>The current developer that I am paying attention to with regards to crowd sourcing is <a href="http://en.wikipedia.org/wiki/Brian_Fargo">Brian Fargo</a>. Who by the <a href="http://www.rockpapershotgun.com/2012/02/16/brian-fargo-turning-to-kickstarter-for-wasteland-2">news</a> wants to make a sequel to <em><a href="http://en.wikipedia.org/wiki/Wasteland_(video_game)">Wasteland</a></em>. <em>Wasteland</em> came out in 1988 and may be viewed as the progenitor of the <em>Fallout</em> series. The reason why I am paying attention to Fargo is that he is say he needs exactly a million dollars; he also is somewhat of a prolific developer.</p>
<p>So why the attention to Fargo? That is simple; with all the Kickstarter fever in the air we need some judge of the make or break conditions it take to make a game using crowd funding. Fargo, I believe, is at the right point to see what those conditions are.</p>
<p>Since he is working on an old franchise with fans, which is one of those things that the fans would like to see again. So when it comes to reaching the million dollar mark I believe that this will be the test.</p>
<h2 dir="ltr">Learn from the indies</h2>
<p>Indie developers make some of the most awesome games, and on some of the tightest budgets. For example <em>World of Goo</em> was made on a budget of just <a href="http://venturebeat.com/2009/01/02/the-world-of-goo-became-one-of-the-indie-hits-of-2008/">$10,000</a>, and it was a phenomenal game. On the other hand Braid cost <a href="http://kotaku.com/5037392/jonathan-blow-says-he-spent-180000-on-braid">$180,000</a>. Clearly, indies have a diverse range of costs.</p>
<p>Recently I have seen almost unknown indies turn to Kickstarter for funding. Then there are indie developers asking just as little as a <a href="http://indiegames.com/2012/02/kinect_and_ipad_kickstarter_do.htm">$1,500</a> to get there game out. I will however point out that such Kickstarters are, mostly, funded by indie developers.</p>
<p>The moral behind the indies is that you need to have a small game that you can make, and that you don’t need a massive budget to do it. Well this may sound like advice in the opposite direction of this article, it is in fact at the core of this article. Since developers want to make awesome games, and fans want to play them.</p>
<h2 dir="ltr">It’s a trap!</h2>
<p>The video game industry goes through ‘fads’. I clearly remember when everything was a: FPS, MMO, Social game, make for mobile devices. Now there might be the fad of we made a game using Kickstarter. While it was stated earlier that there was a hope that this could be a practical future. There is still the question of whether this is the correct choice for developers to follow.</p>
<p><a href="http://devmag.org.za/blog/wp-content/uploads/2012/02/DFbudget.png"><img class="aligncenter size-full wp-image-4394" title="DFbudget" src="http://devmag.org.za/blog/wp-content/uploads/2012/02/DFbudget.png" alt="" width="518" height="395" /></a><br />
The reason I bring thing up is that Double Fine’s XBLA type games were each made using about $2,000,000 and they had received traditional publishing on those. And they have been great success. Taking <a href="http://www.gamasutra.com/view/news/39712/InDepth_Xbox_Live_Arcade_sales_analysis_December_2011.php?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+GamasutraNews+%28Gamasutra+News%29">some statistic</a> <em>Iron Brigade</em> (nee <em>Trenched</em> in the stats) sold 120,126 units. Which at about $15, variance given to the MSpoint costs, the game so far made $1,800,000.</p>
<p>So you don’t always have to go with crowd-funding. But publishers are publishers. And they don’t like taking big risks. So seek funding in the right way sometimes that might be a publisher</p>
<p>Developers as with almost every choice they make need to be careful not to fall into a trap. Whether that is using a publisher, crowd-funding, or using your savings. So if you decide that a crowd-funded project is the way to go. Be aware of the terms of the platform, and what <a href="http://www.gamasutra.com/view/news/40291/Equitybased_crowdfunding_platform_Gambitious_launching_next_month.php">new</a> ones there are.</p>
<h2 dir="ltr">Make a Game</h2>
<p>As a developer and designer I would advocate a model similar to what Double Fine has done. Say the least you need to get the project done; then apply a modular design of expansion. So say your core is a: “City management game” which you think will cost $100,000. Call it $150,000 on your initial funding to be safe. But you want it to have cities in the same world that can trade and so on. That feature requires you to have raised $300,000.</p>
<p>The reason I say this is that when people fund a game in this way they know it might not get done. But you really want to get it done, and they really want to play it. Look at Minecraft how it has grown with its community and how integral that community has been to the development of the game.</p>
<p>So if you only get enough funding to make the first part of the game. Make that first part! Get people playing it tell them if more people buy it then you can continue development and you will implement that feature that they really want.</p>
<p>A Kickstarter is a great way to get a start, and then a closed beta for people who paid, and will pay, is a great way to make a game. Just remember to never close the doors for people who want to pay and be a part of your game!</p>
</div>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/02/20/so-you-want-to-crowd-source-your-funding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A guide for prospective game programmers</title>
		<link>http://devmag.org.za/2012/02/16/a-guide-for-prospective-game-programmers-bobby-anguelov/</link>
		<comments>http://devmag.org.za/2012/02/16/a-guide-for-prospective-game-programmers-bobby-anguelov/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 14:00:27 +0000</pubDate>
		<dc:creator>Bobby Anguelov</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[skills]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4359</guid>
		<description><![CDATA[<br/>In this article, game developer Bobby Anguelov gives advice on getting a good education for a career as a game programmer.<h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2009/08/12/latest-game-career-guide-challenge-results/' rel='bookmark' title='Latest Game Career Guide challenge results'>Latest Game Career Guide challenge results</a> <small>I&#8217;m going to assume you know about Game Career Guide...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/02/header.png" alt="platfrom_banner" width="680" height="341" border="0" /></p>
<div>
<p>While I was still deciding on a topic for this article, huge discussions (read arguments) started popping up in various game dev communities I followed, all based around the same theme: education<span id="more-4359"></span></p>
<ul>
<li><a href="http://altdevblogaday.com/2011/07/14/an-ai-curriculum/">http://altdevblogaday.com/2011/07/14/an-ai-curriculum/</a></li>
<li><a href="http://altdevblogaday.com/2011/07/04/the-importance-of-a-balanced-gamedev-curriculum/">http://altdevblogaday.com/2011/07/04/the-importance-of-a-balanced-gamedev-curriculum/</a></li>
<li><a href="http://altdevblogaday.com/2011/05/09/thoughts-on-university-education/">http://altdevblogaday.com/2011/05/09/thoughts-on-university-education/</a></li>
</ul>
<div>There seems to be quite a lot of debate on what prospective game programmers should study as well as what current curricula should include. The most common questions still being asked by prospective game programmers are: “What do I need to study to become a game programmer?” and “What do I need to do to help me land a game industry job as a programmer?” It is these questions that I wish to address in this article.</div>
<div>I’m lucky enough to have been exposed to the enterprise software industry, the game industry as well as academia. Which I think gives me a broad perspective on what is required of potential game programmers as well as programmers in general. I do need to stress that this is just my own personal opinion and that this topic is quite a hotly debated one.</p>
<h2 dir="ltr">Game Programming is Hard!</h2>
<p>The first thing that I need to say is about game programming is that it is hard! It is by far one of the most challenging software development fields. As such, game programmers, and game developers in general, are a separate breed.</p>
<p>Game programmers are not in the industry for the money; game programmer salaries are usually quite a bit lower than those found in the enterprise space.</p>
<p>Nor do people become game programmers for the comfortable work environments; crunch time is an unfortunate fact of life in the game industry. During periods of crunch you are expected to work 60 to 80 hours a week for several weeks at a time.</p>
<p>Furthermore, the game industry can be rather unstable, layoffs and project cancellations are common as are employee burnouts. At GDC 2011, I was told the average lifetime of a game programmer in the industry is around 7 years. I don’t know how true that is, but it’s something that I can believe.</p>
<p>In addition to all this, the game industry is also notoriously difficult to get into, especially for fresh graduates.</p>
<p>Now I’m not trying to scare anyone away, but this is the truth of the industry. So why the hell would any sane person want to work as a game programmer? Well, the first and most important reason is simply passion.</p>
<p>Game programmers love what they do and would not want to do anything else. So far I’ve only mentioned the negatives of the industry, but game development is one of the most exciting, innovative, and personally rewarding industries in the software development field. Unlike the majority of enterprise development which is repetitive and mundane; there are always new challenges with each new project. Game programmers are by their nature problem solvers and thrive on the constant challenges that they are presented with. Personally, I cannot see myself ever working in enterprise software again.</p>
<p>From a technical perspective, game programming is extremely challenging. Game programmers are often tasked with the impossible; creating a high fidelity 3D virtual world with sounds and eveything else in 33 milliseconds or less. As such, game programming, particularly in the AAA space, tends to be extremely low level work. It requires that programmers be comfortable with concepts such as advanced mathematics, data structures, memory management, optimization techniques and a basic understanding of hardware and operating system architectures.</p>
<p>Programming isn’t something that can really be taught. Just like everything else in the world, programming requires a fair amount of natural talent and a brain that works well with concepts like math and logic. If you struggle with math, that’s probably a good sign that programming is probably not a good career choice for you. If that’s the case then don’t despair; there are numerous other non-programming positions in the game industry like game design, art, or production that may be more suited for your talents.</p>
<p>Now before I carry on with study options, let’s briefly discuss the various positions available within the game programming field. While generalist programming positions do exist, they are few and far between. The large majority of game programming positions are specialized within a single area of expertise such as: graphics, physics, AI, sound, tools, networking, etc.</p>
<p>So how are you, with no experience in any of these fields, supposed to choose one and specialize in it? How do you know that you will enjoy it or that you will be good at it? Well, I feel that you really shouldn’t make that choice without actually trying each of these sub-fields first.</p>
<h2 dir="ltr">What should I Study?</h2>
<p>The central point of this article is the “What should I study?” question.</p>
<p>Simply put, the answer is computer science. As with any other programming field, game programmers are expected to have completed at least a bachelor’s degree in computer science. Luckily computer science (CS) is a rather standard course which most universities will offer a degree in.</p>
<p>So why a CS degree? Because it will give you a great foundation in mathematics, programming and computer systems. As with any tertiary degree program; CS degrees will vary across universities and in most cases offer some degree of flexibility with regards to subject choices or specializations. At the very least a good computer science degree should cover the following fundamental subjects:</p>
<ul>
<li>Calculus</li>
<li>Linear Algebra</li>
<li>Discrete Mathematics</li>
<li>A C/C++ programming course</li>
<li>Data Structures</li>
<li>Design Patterns</li>
<li>Operating Systems</li>
<li>Software Engineering</li>
<li>Concurrency / Parallel Programming</li>
</ul>
<p>In addition to these fundamentals you will usually have a choice between specialization electives such as the following:</p>
<ul>
<li>Computer Graphics</li>
<li>Artificial Intelligence</li>
<li>Compiler Construction</li>
<li>Network Programming</li>
<li>Databases</li>
<li>Computer Security</li>
<li>Microprocessors</li>
</ul>
<p>In some cases, as in the US colleges, students will be presented with a single course called something along the lines of Computer Science 1, or Fundamentals of Computer Science, etc. These kinds of courses are usually a single semester or a year course that will act as an umbrella for several of the above courses. For example, the University of Cape Town (UCT) has such courses e.g. <a href="http://www.cs.uct.ac.za/teaching/undergraduate-courses">CSC1015</a> (Problem solving and algorithm development; object orientated program design using Java; number systems) whereas the University of Pretoria (TUKS) has separate modules for each topic (<a href="http://www.cs.up.ac.za/courses/list">http://www.cs.up.ac.za/courses/list</a>).</p>
<p>With so many options and varying degree programs; how should you choose what program to take? Well, my first piece of advice is to choose the computer science degree program which allows you to take the most math modules. This is good metric of the quality of the degree program. CS degrees that are light on math are usually of a low quality. So to reiterate, try to take as many math electives as you can, as they will be essential later on, especially for game programming.</p>
<p>Game programming is pretty much one large math problem. For example: computer graphics is heavily reliant on a good understanding of calculus and linear algebra; Artificial intelligence (AI) concepts are based on the first order logic covered in discrete math courses; other key computer science concepts like data structures, graph theory, combinatorics and sets are also covered in discrete math courses. Other math subjects like numerical methods, mathematical modeling and statistic will also be useful in your future career as a game programmer. If you have the choice and think you may be interested in physics programming; take a physics module or two as well. In addition to the standard course load, most colleges will let you take additional non degree subjects as well and you are also able to simply attend the lectures for other subjects without actually enrolling in them.</p>
<p>Now what about electives? Well, I’d advise taking all the C++ modules available and the compiler construction module. Furthermore choose a degree program which offers courses in computer graphics, AI, and networks. This may prove a bit tricky since, for example, computer graphics courses are not taught in a lot of computer science degrees in South Africa. Try to take electives that have similar fields in the game industry. They don’t have to be identical just similar enough. For example, network programming might not focus on creating game server but you will definitely learn about client/server architecture and much, much more. Past that, it’s your own choice to take what subjects seem interesting to you.</p>
<p>You need to think of college as an opportunity to be exposed to and experience as many different sub-fields as possible. Don’t think of college as place to specialize; especially not in an undergraduate degree. Think of that degree as an opportunity to learn more about yourself, your talents and your potential interests. Especially ones that you never knew you had! The only way to find out if you will enjoy something or have a knack for it is to try it so be smart and make full use of the opportunity college provides you.</p>
<p>In South Africa (and as far as I know the UK, Australia and Canada), we have a postgraduate honors degree, which is similar to a US master’s degree, in that it consists of multiple specialization modules (graphics, AI, etc.) as well as a mini-thesis. It is only a one year degree unlike the US masters which is two year but content wise, the degrees are quite similar. It is advisable that you do your honors as well if it is an option, once more giving you an opportunity to explore various fields.</p>
<p>Having a master’s degree or higher is not essential for the game industry, in fact I don’t think it really matters. I’m sure it helps but there are way more important things which I will discuss later on. Personally, I completed my master’s degree because it allowed me to spend two or more years researching a game oriented topic while also leaving me a lot of free time in which I could improve my skills, and do research on various other game programming topics I was interested in (animation, engine architectures, AI,) and most importantly learn more about the industry. This is a personal choice, and as I mentioned not really essential.</p>
<p>Once you’ve graduated with a CS degree and have hopefully had exposure to most of the various sub-fields present in the industry. You should also know more about your personal skill-set as well as which of those sub-fields you really enjoy working in. For example, early on in my degree I found out that I really hated things like networking and computer security but I really enjoyed AI and graphics. Conversely a friend of mine went in with a game dev, in his case graphics,  interest; did the security module and got hooked. He now works for one of the leading computer security firms in the world. That for me is the greatest selling point of doing a general computer science degree. The fact that in exploring various fields it might spark a passion for something that you never knew you had. Furthermore, a CS degree will quickly show you whether you are cut out to be a programmer or not.</p>
<h2 dir="ltr">Beware of the easy method</h2>
<p>Sometimes people say: “So yeah, computer science…  But wait, I just saw that ‘University XYZ’ is offering a course in ‘uber game programming’, wouldn’t that be a better option since it like says game programming and stuff?”<br />
In general, I’m skeptical of specialized degree programs, but they aren’t all bad. You just have to be careful and do your research before enrolling in such programs. Compare these programs with a standard computer science degree. If you notice a large discrepancy between the two programs (especially when it comes to math or C++ modules), be wary of those specialized degrees.</p>
<p>Recently, a local university, the University of the Witwatersrand (WITS), announced that they will be starting a <a href="http://www.wits.ac.za/academic/humanities/wsoa/digitalart/8828/undergraduate_courses.html">degree program in game design</a> (they state they have a game design and a game programming degree as well). This is in addition to another local university, the University of Cape Town (UCT), already having a <a href="http://www.cs.uct.ac.za/about-us/gamesFlyer%20-%202010.pdf">game programming /design degree program</a> as well. In the US there has been an explosion of colleges that are now offering specialized game development oriented programs, most notably: <a href="https://www.digipen.edu/">The Digipen Institute of Technology</a>, <a href="http://www.fullsail.edu/">Full Sail University</a> and <a href="http://www.scad.edu/">Savannah College of Art and Design</a>. It is important to note, that all of the above options are accredited universities and you will graduate with a bachelor’s degree.</p>
<p>On the other hand, there are also numerous “fly-by-night” online courses/college on game development available, such as <a href="http://www.gameversity.com/">viCampus</a>, <a href="http://www.gameinstitute.com/">GameInstitute</a> and <a href="http://www.train2game.com/">Train2Game</a>. There are some local options as well:  <a href="http://www.adcourses.co.za/">AD Courses</a>. My advice with this whole group of “colleges” and I use this word loosely, is to avoid them like the plague. You will often walk out of these “colleges”, after wasting a ton of money and time, with a diploma that isn’t worth the paper it’s printed on.</p>
<p>If you are serious about studying a specialized game development course, do so at an accredited university.</p>
<p>If you are still unsure about your choice, try to get hold of a game developer either via twitter or email and see if they are willing to give you some advice. In my experience, game devs are quite a friendly bunch and are more than willing to answer a few questions.</p>
</div>
<h2 dir="ltr">Portfolios and Side Projects</h2>
<p>Now to blow your mind! At the end of the day, what you studied is pretty irrelevant when it comes to getting a job in the game industry. Having a Ph.D. in ‘UBERGameProgamming’ is not going to make you a better candidate than some other guy with a high-school diploma that wrote a real-time ray tracer in his garage. The game industry is all about skills and being able to demonstrate those skills.</p>
<p>A degree is a great way to filter applicants but it is your portfolio that will get you an interview. If you have an outstanding academic record and nothing to show at the end of your studies apart from a degree, don’t expect a call back. Being a programmer; means it’s a lot harder to create an impressive portfolio than let’s say if you were an artist. So try to play around with things that interested you in your college class at home. If something in class caught your attention, go home and try it. First, it’s a great way to build up a portfolio of demos. Second, it’s the best way to actually understand a technique. I started a tiny tech blog to just keep track of all the things I’ve been mucking around with in my spare time and you know what, that tech blog has actually become my portfolio.</p>
<p>Remember that there are hundreds of other guys just like you that are applying for the same job, some of which probably have more impressive academic records than you or went to better schools than you. On paper these candidates look better so you need to make yourself stand out from the crowd and say: “screw my resume! This is who I am as an engineer!” Do something weird or unusual; show the company that you can think out of the box.  Don’t just fire up UDK and slap together another shooter mod and send that in.</p>
<p>It’s also not a good idea to hand in group projects or class assignments as portfolio pieces. Companies want to see what you can do and they want to see stuff that’s slightly more advanced than something that was made so that entire class was expected to be able to complete. College assignments are usually set so that the weaker students can still complete them to some degree and therefore make very bad benchmarks of your individual skills. Group assignments also allow you to claim greater credit than is actually due to you and so are usually disregarded.</p>
<p>Another problem, at least for me, was that I hadn’t specialized when I was looking for a job. I was doing my masters in AI yet I was teaching graphics. My blog is more graphics oriented than game AI and yet I was applying for AI positions. This was a point of confusion for most of the callbacks I got, and I got asked numerous times which field I preferred and why. If you know what you want to do, focus on that and tailor your portfolio with that in mind. So obviously, don’t do send in a ray tracer project for a networking position.</p>
<p>In the game industry, so far my experience is that talent is king. There are lots of amazingly talented game programmers that are self-taught and don’t have any college education (for various reasons). They didn’t get their jobs because of their education rather despite it. They got their jobs because of their skills, but I think if you asked them, the consensus would be that getting a college education is a good idea.</p>
<p>So now, taking all this into account, why did I spend such a long time discussing education if it’s not that relevant? Well, as I said your education won’t train you but what it will give you is a set of tools which you can then use to learn and improve.</p>
<p>The worst thing for me was seeing programmers spend a day trying to solve what is essentially an already solved problem. These programmers are so proud of their solution and are oblivious to the fact they’ve simply re-invented the wheel (usually their reinvented wheel is kind of squarish) and have wasted a massive amount of time doing so because they had gaps in their fundamental education and didn’t know a solution existed.</p>
<p>I often identify areas in my own background that are rather “swiss-cheesy” and so I try to fill them whenever I get a chance. For example, I never took a compiler construction course during my degree (I took microprocessors instead) and now that’s starting to bug me, so my next step is going to be reading up on compiler construction.</p>
<p>As a programmer your education will never end, there will always be things that you may not know and have yet to learn, new technologies to master and so on but it is essential that you know the fundamentals. Just like building a house, you need to ensure that the foundations are strong before you start building upon them. Just like a bad foundation will make a bad house, bad fundamentals will make a bad programmer.</p>
<p><em><br />
</em></p>
</div>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2009/08/12/latest-game-career-guide-challenge-results/' rel='bookmark' title='Latest Game Career Guide challenge results'>Latest Game Career Guide challenge results</a> <small>I&#8217;m going to assume you know about Game Career Guide...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/02/16/a-guide-for-prospective-game-programmers-bobby-anguelov/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Game Design: On Ideas</title>
		<link>http://devmag.org.za/2012/02/13/game-design-on-ideas/</link>
		<comments>http://devmag.org.za/2012/02/13/game-design-on-ideas/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 14:38:35 +0000</pubDate>
		<dc:creator>Julian Pritchard</dc:creator>
				<category><![CDATA[Opinion and Analysis]]></category>
		<category><![CDATA[game design]]></category>
		<category><![CDATA[ideas]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4336</guid>
		<description><![CDATA[<br/>In this article, Julian Pritchard gives us his take on game ideas: what is necessary to support a good idea, and how to develop the skills to bring ideas to fruition.<h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2009/08/20/your-ideas-dont-matter-much/' rel='bookmark' title='Your ideas don&#8217;t matter &#8230; much'>Your ideas don&#8217;t matter &#8230; much</a> <small>...</small></li>
<li><a href='http://devmag.org.za/2009/08/31/minimised-game-design-for-indies/' rel='bookmark' title='Minimised game design for indies'>Minimised game design for indies</a> <small>When you sit down to write a book, one of...</small></li>
<li><a href='http://devmag.org.za/2012/05/07/loopholes-in-game-design/' rel='bookmark' title='Loopholes in Game Design'>Loopholes in Game Design</a> <small>I had just finished working on my latest card game;...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2012/02/ideas.png" alt="platfrom_banner" width="680" height="341" border="0" /></p>
<div>Often enough I have talked to people wanting to start making video games. And often enough they talk about making the next big game. I have to admire their enthusiasm, as it reminds me of a much younger me. But most often they say one thing which I can’t forgive.“I have this great idea.”</p>
<p>The number of times anyone in the industry has heard that must be innumerable. And I can understand why. There is vision and drive to make something awesome. The belief that this idea can be the next half-diablo-doom-craft. And wanting to be at the front of seeing that idea come to life is admirable.</p>
<p>Unfortunately, when you just start trying to make video games, that great idea is worthless. Not necessarily because it is a bad idea, but because you lack the experience to take that idea from the vision in your head, to the reality that the fanboys drool over. This is because a great game comes down to how the ideas are executed in the game.</p>
</div>
<div>
<p><span id="more-4336"></span></p>
<div>
<p>To illustrate the difference between idea and execution: Take your favourite FPS, and the one that you hate. Play them. All FPSes have a similar base. A weapon to shoot with, movement, and enemies to shoot at. They have a whole bunch of ideas in common. What separates the two games you picked? Many things: the studio, publisher, budget, platform, and even era. They may some ideas that they share, but what separates them is how they were made.To push the idea point: Every person working on those games most likely had hundreds of ideas. People who play video games have ideas. After all isn’t that where you started? Wanting to work in video games after you played wonderful games and had your own ideas. Even the people who play only FIFA and Pro Evolution Soccer have ideas. Ideas are cheap.</p>
<p>But making something with ideas is not cheap. A game designer could make a great game and never have an original idea to add. This is because the best resource a game designer has is the passionate team they work with. The artists have an understanding of visual aesthetics that you do not. The programmers have an understanding of the computing limitations, and the feasibility to implement features that you do not. People who make games, play games. They also have ideas, and very often good ones, so as a designer it’s your job to listen to them and create the best game you can with the budget you have.</p>
<p>If you are just getting into game development (especially if you enter as a designer), then I doubt your first stop is making some big game. So start small. Take your idea. Examine it; dissect it and see what it is about at its core. I find the best way to do this is to describe your game in a single sentence.</p>
<p>As an exercise, let’s say you want to make a game about a unicorn that jumps on clouds of dreams, and it can shoot rainbows from its hooves to run faster, and shoot lightning from its horn to kill enemies for extra score. In a single sentence that would be “An action platformer”. You can elaborate and say “An action platformer with a unicorn as the main character”. In this case, the unicorn is a defining aspect of the game; it makes it different from Mario.</p>
<p>What does all this mean?</p>
<p>If you want to make games, start now, and start small. Focus on small manageable pieces that you can make. Make the platformer, then add the speed boost, then the attack. Build the game up in stages.</p>
<p>Keep your expectations realistic. Statistically games don’t make it big—failure is common. So if your game doesn’t make you the next <a href="http://en.wikipedia.org/wiki/Gabe_Newell">Gabe Newell</a>, don’t worry—even some of the greatest game studios release flops. You have just started on a road of learning how to make games.</p>
<p>In fact, I would recommend that you don’t release your first games for money, since you want as much  feedback to learn from. And the best way to do that is to make your game free, post it on forums and see what people think. Look chances are it wont be the best thing ever. It will have a mixture of good points and bad points. You should learn from those.</p>
<p>When starting out, your aim should be to make great stuff. But you should realise that you have to learn how to make the great stuff. So make games and see what happens. Some might be great, and some might be flops. In the end you learn from both, and often enough you can learn more from what went wrong than from what went right.</p>
</div>
</div>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2009/08/20/your-ideas-dont-matter-much/' rel='bookmark' title='Your ideas don&#8217;t matter &#8230; much'>Your ideas don&#8217;t matter &#8230; much</a> <small>...</small></li>
<li><a href='http://devmag.org.za/2009/08/31/minimised-game-design-for-indies/' rel='bookmark' title='Minimised game design for indies'>Minimised game design for indies</a> <small>When you sit down to write a book, one of...</small></li>
<li><a href='http://devmag.org.za/2012/05/07/loopholes-in-game-design/' rel='bookmark' title='Loopholes in Game Design'>Loopholes in Game Design</a> <small>I had just finished working on my latest card game;...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2012/02/13/game-design-on-ideas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to design levels for a platformer</title>
		<link>http://devmag.org.za/2011/07/04/how-to-design-levels-for-a-platformer/</link>
		<comments>http://devmag.org.za/2011/07/04/how-to-design-levels-for-a-platformer/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 21:16:41 +0000</pubDate>
		<dc:creator>Diorgo Jonkers</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Platform Game Design]]></category>
		<category><![CDATA[deisgm process]]></category>
		<category><![CDATA[level game design]]></category>
		<category><![CDATA[platform game design]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4310</guid>
		<description><![CDATA[<img src="http://devmag.org.za/blog/wp-content/uploads/2010/12/devmag_orange.png" width="29" height="29" alt="" title="Development" /><br/>This article looks at the process of designing levels for a platformer: from the initial idea to the final playable level.<h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2011/01/18/11-tips-for-making-a-fun-platformer/' rel='bookmark' title='11 Tips for making a fun platformer'>11 Tips for making a fun platformer</a> <small>This article gives handy tips for designing and building a...</small></li>
<li><a href='http://devmag.org.za/2011/03/03/desktop-dungeons-design-analysis-part-1/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 1)'>Desktop Dungeons: Design Analysis (Part 1)</a> <small>This is the first part of an in-depth look at...</small></li>
<li><a href='http://devmag.org.za/2011/03/23/desktop-dungeons-design-analysis-part-2/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 2)'>Desktop Dungeons: Design Analysis (Part 2)</a> <small>In this second part of analyzing Desktop Dungeons, we look...</small></li>
<li><a href='http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/' rel='bookmark' title='Video game user interface design: Diegesis theory'>Video game user interface design: Diegesis theory</a> <small>In this article, the Dave Russell introduces the basic concepts...</small></li>
<li><a href='http://devmag.org.za/2011/02/16/board-silly-tabletop-game-design/' rel='bookmark' title='Board Silly (Tabletop Game Design)'>Board Silly (Tabletop Game Design)</a> <small>Two Dev.Mag writers share their board game design experiences: conception,...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://devmag.org.za/blog/wp-content/uploads/2010/12/devmag_orange.png" width="29" height="29" alt="" title="Development" /><br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="platfrom_banner" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/platfrom_banner.png" border="0" alt="platfrom_banner" width="680" height="341" /></p>
<p>In a previous article, I gave you <em><a href="http://devmag.org.za/2011/01/18/11-tips-for-making-a-fun-platformer/">11 Tips for making a fun platformer</a></em>. That article had general tips that covered a wide range of game design tasks. This article looks specifically at the process of designing levels for a platformer. The process is a guideline and covers the steps from the initial idea to the final playable level.</p>
<p><span id="more-4310"></span>The article does not focus on scheduling. However, you do need to keep scheduling in mind when designing levels. The size of a level and the amount of resources it contains depend on the number of people working on it, and the time available to complete it.</p>
<h2>1. Choose a visual theme</h2>
<p>Choose a visual theme for the level. You can go with a predetermined, game-wide theme, such as ‘Forest’, ‘Ice’, ‘Lava’, or ‘Castle’. Or go for something more creative, such as ‘Steampunk Cloning Facility’, ‘Psychologist&#8217;s Nightmare’, or ‘Cupid&#8217;s Ice cream Parlour’. Ask everyone in the team for theme ideas.</p>
<h2>2. Make a list</h2>
<p>Make a list of everything you want the player to experience in the level. This includes what the player does, sees, learns, hears, and encounters. The list should include <em>specific items</em> and <em>general items</em>.</p>
<ul>
<li><strong>Specific items</strong> usually occur once in a level.</li>
<li><strong>General items</strong> occur more than once in a level.</li>
</ul>
<p>Throughout the article the term ‘item’ is used to refer to the items of a list. These items not only include game items (power-ups, keys, and doors), but also events (finding the first locked door), enemies, and game mechanics (double-jumping).</p>
<p>Write down how many times each general item occurs (for example, there could be 50 coins to collect in the level, or the player might need to defeat 10 swordsmen). These numbers are estimates, and they help you to determine the level&#8217;s difficulty. For example, there could be two Tough Trolls in level 1, but four Tough Trolls in level 2. Let everyone in the team contribute to the list.</p>
<p>The following examples are also used in the images later in this article:</p>
<p>Specific items:</p>
<ol>
<li>Meet first enemy.</li>
<li>Find first power-up.</li>
<li>Learn about double-jumping.</li>
<li>Learn about destructible environments.</li>
<li>Find first locked door.</li>
<li>Find first key to open the locked door.</li>
<li>Pull lever to activate the moving platform.</li>
</ol>
<p>General items:</p>
<ol>
<li>Foot soldier enemies (x30)</li>
<li>Gun turret enemies (x10)</li>
<li>Power-ups (x30)</li>
<li>Moving platforms (x3)</li>
<li>Locked doors (x2)</li>
<li>Keys (x2)</li>
</ol>
<h2>3. Make a rough layout</h2>
<p>Draw a very rough layout of the entire level. This layout should show the path that the player will take through the level. Think of it as designing the street layout of a city, but ignoring the buildings.</p>
<p>You may end up doing several layouts before you have one that you’re happy with. Usually, the reason for changing the layout is one or more of these:</p>
<ul>
<li>Some areas are too big or small.</li>
<li>Some lines are too straight and too long (i.e. boring).</li>
<li>The overall layout is too simple or too complex.</li>
<li>The overall layout looks uninteresting.</li>
</ul>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="3_rough_layout" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/3_rough_layout.png" border="0" alt="3_rough_layout" width="372" height="270" /></p>
<p style="text-align: center;"><em>An example of the rough layout of an entire level.</em></p>
<h2>4. Make rough sketches for the specific items</h2>
<p>Players will need to find each item in the list that you created in step 2 somewhere in the level. They might also find some items in the same area. Make rough sketches of each area in which the player will find the <strong>specific items</strong> in the list.</p>
<p>Use symbols to identify the various objects in the level, for example, <em>E</em> for ‘Enemy’, <em>P</em> for `Power-up’, and <em>K</em> for ‘Key’. Also make notes on the sketches.</p>
<p>Distinguish clearly between negative and positive space when you do the sketches. The negative spaces (white in the sketches) are the areas where the player can move, and the positive spaces (diagonal lines in the sketches) are things like floors, walls and platforms where the player cannot move.</p>
<p>These sketches help you focus on the layout of each small area, without having to worry about where they fit in the overall layout of the level. Think of it as focusing on designing a building and ignoring its location in the city.</p>
<p>You may make sketches for some or all of the general items, but it is not necessary. The general items are usually moved around when you design the detailed layout or play test the level, so they may end up in completely different areas than you originally planned.</p>
<p><strong>Examples of rough sketches</strong></p>
<table border="0" cellspacing="0" width="680">
<tbody>
<tr>
<td width="340" valign="top"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item1" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item1.png" border="0" alt="4_item1" width="340" height="194" /></td>
<td width="340" valign="top"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item2" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item2.png" border="0" alt="4_item2" width="328" height="234" /></td>
</tr>
<tr>
<td style="text-align: center;" width="340" valign="top"><em>Specific item 1: Meet first enemy.</em></td>
<td style="text-align: center;" width="340" valign="top"><em>Specific item 2: Find first power-up.</em></td>
</tr>
<tr>
<td width="340" valign="top"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item3" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item3.png" border="0" alt="4_item3" width="340" height="264" /></td>
<td width="340" valign="top"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item4" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item4.png" border="0" alt="4_item4" width="340" height="226" /></td>
</tr>
<tr>
<td style="text-align: center;" width="340" valign="top"><em>Specific item 3: Learn about double-jumping.</em></td>
<td style="text-align: center;" width="340" valign="top"><em>Specific item 4: Learn about destructible environments.</em></td>
</tr>
<tr>
<td width="340" valign="top"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item5" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item5.png" border="0" alt="4_item5" width="337" height="229" /></td>
<td width="340" valign="top"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item6" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item6.png" border="0" alt="4_item6" width="357" height="243" /></td>
</tr>
<tr>
<td style="text-align: center;" width="340" valign="top"><em>Specific item 5: Find first locked door.</em></td>
<td style="text-align: center;" width="340" valign="top"><em>Specific item 6: Find first key to open the locked door.</em></td>
</tr>
</tbody>
</table>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border: 0px;" title="4_item7" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/4_item7.png" border="0" alt="4_item7" width="265" height="260" /></p>
<p style="text-align: center;"><em>Specific item 7: Pull lever to activate the moving platform.</em></p>
<h2>5. Make a detailed layout</h2>
<p>Draw a detailed layout of the level. The detailed layout uses the rough layout (from step 3) as a guideline. It includes all the specific items (copying the rough sketches from the previous step) and the general items. When you copy the rough sketches of the specific items, you may need to change them slightly (for example, change the size, flip it horizontally).</p>
<p>Place as many of the general items in the detailed layout as you can. You can add the remaining general items when you build the level using a level editor.</p>
<p>When you place the items, keep in mind the path that the player will take through the level. Certain items may need to be placed in a specific order, such as a weapon being placed somewhere before the player encounters the first enemy.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="5_layout_big" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/5_layout_big.png" border="0" alt="5_layout_big" width="600" height="484" /></p>
<p style="text-align: center;"><em>An example of a detailed layout.</em></p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="5_layout_items_big" src="http://devmag.org.za/blog/wp-content/uploads/2011/07/5_layout_items_big.png" border="0" alt="5_layout_items_big" width="600" height="484" /></p>
<p style="text-align: center;"><em>The locations of the specific items on the detailed layout. </em></p>
<h2>6. Build the initial layout</h2>
<p>Use a level editor to build the level&#8217;s initial layout, using the detailed layout (from the previous step) as a blueprint. You may need to change the sizes of some areas when you build the level. This happens because the layout sketch is usually not drawn exactly to scale. Also use the editor to add all the outstanding general items to the level. For example, your list might contain 20 enemies, but the detailed layout has only 15 enemies. Add the remaining 5 at this stage.</p>
<p>First build the initial layout before you add the visual details. In other words, use limited graphics for the initial layout, to make it easy to change things if you need to. For example, if you have five grass images, use only one for the initial layout. You can add the other four in step 8 when you decorate the level.</p>
<p>At this point the final graphics for the level may be incomplete, in which case you can use placeholder graphics. It is a good idea if the placeholder graphics have similar colours to those of the final graphics, because the colours affect the feel of the level.</p>
<h2>7. Play the level</h2>
<p>The initial layout is for playing the level, so that you can determine if it is fun and how long it will take to play through the level. Play the level and change the layout until is it fun and balanced. Let other people play it as well.</p>
<p>Changing the layout may include the following:</p>
<ol>
<li>Move, add. or delete platforms to make jumps easier or more challenging.</li>
<li>Move, add, or delete power-ups to balance the amount available.</li>
<li>Move, add, or delete enemies to make the level easier or more challenging.</li>
</ol>
<p><strong>Important note:</strong> By the time you design and build your first level, you should already have prototyped and finalized the gameplay mechanics using temporary test levels. If your gameplay has not been finalised by this time, then you risk having to change your levels when the gameplay changes. For example, if you decide to make the player jump higher, then you will have to move many platforms to accommodate the new jump height. Changing fundamental gameplay usually has a ripple effect.</p>
<h2>8. Decorate the level</h2>
<p>Once you’re happy with the level&#8217;s layout and once it’s fun to play, then add the details. This includes adding all the final graphics and audio. Play the level again to make sure that it still feels the same – or better – after all the graphics have been added. There’s a good chance that the level will feel different. It should feel better with the final graphics, but sometimes it may feel worse. For example, the placeholder background might have been a single colour, but the final background might be a detailed image that makes it difficult to see the enemies, in which case you will have to tone down the background or change the enemies, whichever will be quicker.</p>
<h2>Further Reading</h2>
<p><em>Super Mario Brothers 3 &#8211; Level Design Lessons</em> (Radek Koncewicz)</p>
<ul>
<li><a href="http://www.significant-bits.com/super-mario-bros-3-level-design-lessons" target="_blank">http://www.significant-bits.com/super-mario-bros-3-level-design-lessons</a></li>
<li><a href="http://www.significant-bits.com/super-mario-bros-3-level-design-lessons-part-2" target="_blank">http://www.significant-bits.com/super-mario-bros-3-level-design-lessons-part-2</a></li>
</ul>
<p><em>Level Design Lessons</em> (Anna Anthropy)</p>
<ul>
<li><a href="http://www.auntiepixelante.com/?p=1022" target="_blank">Low Overhead</a></li>
<li><a href="http://www.auntiepixelante.com/?p=465" target="_blank">To the Right, Hold on Tight</a></li>
<li><a href="http://www.auntiepixelante.com/?p=459" target="_blank">In the Pyramid</a></li>
</ul>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2011/01/18/11-tips-for-making-a-fun-platformer/' rel='bookmark' title='11 Tips for making a fun platformer'>11 Tips for making a fun platformer</a> <small>This article gives handy tips for designing and building a...</small></li>
<li><a href='http://devmag.org.za/2011/03/03/desktop-dungeons-design-analysis-part-1/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 1)'>Desktop Dungeons: Design Analysis (Part 1)</a> <small>This is the first part of an in-depth look at...</small></li>
<li><a href='http://devmag.org.za/2011/03/23/desktop-dungeons-design-analysis-part-2/' rel='bookmark' title='Desktop Dungeons: Design Analysis (Part 2)'>Desktop Dungeons: Design Analysis (Part 2)</a> <small>In this second part of analyzing Desktop Dungeons, we look...</small></li>
<li><a href='http://devmag.org.za/2011/02/02/video-game-user-interface-design-diegesis-theory/' rel='bookmark' title='Video game user interface design: Diegesis theory'>Video game user interface design: Diegesis theory</a> <small>In this article, the Dave Russell introduces the basic concepts...</small></li>
<li><a href='http://devmag.org.za/2011/02/16/board-silly-tabletop-game-design/' rel='bookmark' title='Board Silly (Tabletop Game Design)'>Board Silly (Tabletop Game Design)</a> <small>Two Dev.Mag writers share their board game design experiences: conception,...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2011/07/04/how-to-design-levels-for-a-platformer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Implementing and Debugging the Perlin Noise Algorithm</title>
		<link>http://devmag.org.za/2011/06/25/implementing-and-debugging-the-perlin-noise-algorithm/</link>
		<comments>http://devmag.org.za/2011/06/25/implementing-and-debugging-the-perlin-noise-algorithm/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 21:00:32 +0000</pubDate>
		<dc:creator>Herman Tulleken</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[implementation]]></category>
		<category><![CDATA[perlin noise]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4239</guid>
		<description><![CDATA[<br/>This article looks at common errors that can be made when implementing Perlin noise, and give systematic tests to verify for the various steps in the algorithm.<h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2009/04/25/perlin-noise/' rel='bookmark' title='How to Use Perlin Noise in Your Games'>How to Use Perlin Noise in Your Games</a> <small>(Originally appeared in Dev.Mag Issue 20, released in February 2008.)...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<br/><p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_header2" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_header2.png" alt="perlin_header2" width="680" height="340" border="0" /> One of the most visited articles on our site – <em><a href="http://devmag.org.za/2009/04/25/perlin-noise/">How to Use Perlin Noise in Your Games</a></em> – also caused the most problems. The pseudo-code contained an alarming number of bugs (one of the nastier ones is depicted above), which made it difficult to implement. Readers pointed out these in the comments, and so helped to make the pseudo-code progressively more correct. But even so, some operations remained unclear, so that I finally decided to replace the pseudo-code with real and tested code. I really hope that all bugs have now been squashed!</p>
<p>In the spirit of this extermination effort, this article gives some pointers to get a version of the algorithm up and running as quickly as possible. It is an extension of the original Perlin noise article, and refers to the code now presented there.</p>
<p><span id="more-4239"></span><span style="font-size: 20px; font-weight: bold;">Common Errors</span></p>
<p>Some mistakes that are easy to make:</p>
<ul>
<li>Swapping rows and columns, and widths and heights.</li>
<li>Confusing floating point values (in the range 0 to 1) with byte values (in the range 0 to 255). One symptom of this is black images.</li>
<li>An error in the interpolation.</li>
<li>Sampling the wrong points.</li>
<li>Inverting octaves (highest for lowest, and so on).</li>
</ul>
<p>The following tips will help you avoid these errors, and help track them down faster when they occur.</p>
<h2>Implementation Tips</h2>
<h3>1. Use a non-square image to test</h3>
<p>One of the easiest mistakes to make is to swap around widths and heights, or x and y coordinates. Using non-square images will help you detect these errors faster.</p>
<h3>2. Implement linear interpolation first</h3>
<p>Only once you have this working, you can try other interpolation schemes (such as cosine interpolation). This way there is less risk that the interpolation algorithm is wrong and throws you off the track.</p>
<h3>3. Save interim images to file</h3>
<p>The smooth noise images are a valuable aid in finding bugs. If they don’t look the way they are supposed to, you know something is wrong. (Below I give some typical examples).</p>
<h2>When Things Go Wrong</h2>
<p>If you get different results from what you expect, here are some things you can try to help you find the error faster:</p>
<h3>1. Check your smooth noise images</h3>
<p>Here is how they are supposed to look for different octaves and <strong>linear interpolation</strong>:</p>
<table width="680" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise0" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise0.png" alt="smoothNoise0" width="256" height="128" border="0" /><em>Octave 0</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise1" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise1.png" alt="smoothNoise1" width="256" height="128" border="0" /><em>Octave 1</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise2" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise2.png" alt="smoothNoise2" width="256" height="128" border="0" /><em>Octave 2</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise3" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise3.png" alt="smoothNoise3" width="256" height="128" border="0" /><em>Octave 3</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise4" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise4.png" alt="smoothNoise4" width="256" height="128" border="0" /><em>Octave 4</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise5" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise5.png" alt="smoothNoise5" width="256" height="128" border="0" /> <em>Octave 5</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise6" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise6.png" alt="smoothNoise6" width="256" height="128" border="0" /> <em>Octave 6</em></td>
<td valign="top" width="340"></td>
</tr>
</tbody>
</table>
<p>Here is how they are supposed to look for different octaves and <strong>cosine interpolation</strong>:</p>
<table width="680" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise0" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise01.png" alt="smoothNoise0" width="256" height="128" border="0" /> <em>Octave 0</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise1" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise11.png" alt="smoothNoise1" width="256" height="128" border="0" /> <em>Octave 1</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise2" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise21.png" alt="smoothNoise2" width="256" height="128" border="0" /> <em>Octave 2</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise3" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise31.png" alt="smoothNoise3" width="256" height="128" border="0" /> <em>Octave 3</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise4" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise41.png" alt="smoothNoise4" width="256" height="128" border="0" /> <em>Octave 4</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise5" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise51.png" alt="smoothNoise5" width="256" height="128" border="0" /> <em>Octave 5</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="smoothNoise6" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/smoothNoise61.png" alt="smoothNoise6" width="256" height="128" border="0" /><em>Octave 6</em></td>
<td valign="top" width="340"></td>
</tr>
</tbody>
</table>
<h3>2. Check other variables of the smooth noise function by writing them into images</h3>
<h4>a. Check the blend factors</h4>
<p>Modify the smooth noise algorithm to save the vertical and horizontal blend factors to an image, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">float</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> GenerateSmoothNoise<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">float</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> baseNoise, <span style="color: #6666cc; font-weight: bold;">int</span> octave<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
   <span style="color: #008000;">...</span>
&nbsp;
   <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> width<span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
   <span style="color: #008000;">&#123;</span>
      <span style="color: #008000;">...</span>
&nbsp;
      <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> j <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> j <span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;</span> height<span style="color: #008000;">;</span> j<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
         <span style="color: #008000;">...</span>
&nbsp;
         <span style="color: #008080; font-style: italic;">////////////////////  Changed for debugging</span>
         <span style="color: #008080; font-style: italic;">//smoothNoise[i][j] = Interpolate(top, bottom, vertical_blend);</span>
         smoothNoise<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> horizontal_blend<span style="color: #008000;">;</span>
      <span style="color: #008000;">&#125;</span>
   <span style="color: #008000;">&#125;</span>
&nbsp;
   <span style="color: #008080; font-style: italic;">////////////////////  Added for debugging</span>
   SaveImage<span style="color: #008000;">&#40;</span>smoothNoise, <span style="color: #666666;">&quot;horizontal_blend&quot;</span> <span style="color: #008000;">+</span> octave <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.png&quot;</span><span style="color: #008000;">&#41;</span>
&nbsp;
   <span style="color: #0600FF; font-weight: bold;">return</span> smoothNoise<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>For different octaves, you should get a series of ramps from black to white.</p>
<p>For vertical_blend:</p>
<table width="677" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="356"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend0" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend0.png" alt="vertical_blend0" width="256" height="128" border="0" /> <em>Octave 0</em></td>
<td style="text-align: center;" valign="top" width="346"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend2" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend2.png" alt="vertical_blend2" width="256" height="128" border="0" /> <em>Octave 1</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="356"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend2" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend21.png" alt="vertical_blend2" width="256" height="128" border="0" /> <em>Octave 2</em></td>
<td style="text-align: center;" valign="top" width="346"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend3" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend3.png" alt="vertical_blend3" width="256" height="128" border="0" /> <em>Octave 3</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="356"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend4" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend4.png" alt="vertical_blend4" width="256" height="128" border="0" /> <em>Octave 4</em></td>
<td style="text-align: center;" valign="top" width="346"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend5" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend5.png" alt="vertical_blend5" width="256" height="128" border="0" /> <em>Octave 5</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="356"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="vertical_blend6" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/vertical_blend6.png" alt="vertical_blend6" width="256" height="128" border="0" /> <em>Octave 6</em></td>
<td valign="top" width="346"></td>
</tr>
</tbody>
</table>
<p>For horizontal_blend:</p>
<table width="680" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend0" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend0.png" alt="horizontal_blend0" width="256" height="128" border="0" /> <em>Octave 0</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend1" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend1.png" alt="horizontal_blend1" width="256" height="128" border="0" /> <em>Octave 1</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend2" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend2.png" alt="horizontal_blend2" width="256" height="128" border="0" /> <em>Octave 2</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend3" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend3.png" alt="horizontal_blend3" width="256" height="128" border="0" /> <em>Octave 3</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend4" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend4.png" alt="horizontal_blend4" width="256" height="128" border="0" /> <em>Octave 4</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend5" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend5.png" alt="horizontal_blend5" width="256" height="128" border="0" /> <em>Octave 5</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="horizontal_blend6" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/horizontal_blend6.png" alt="horizontal_blend6" width="256" height="128" border="0" /> <em>Octave 6</em></td>
<td valign="top" width="340"></td>
</tr>
</tbody>
</table>
<h4><span style="font-weight: bold;">b. Check your sample points</span></h4>
<p>Save sample points in an image, by modifying the same line as above to this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">////////////////////  Changed for debugging</span>
<span style="color: #008080; font-style: italic;">//smoothNoise[i][j] = Interpolate(top, bottom, vertical_blend);</span>
smoothNoise<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> baseNoise<span style="color: #008000;">&#91;</span>sample_i0<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>sample_j0<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Do the same for <code>baseNoise[sample_i1][sample_j0]</code> and <code>baseNoise[sample_i0][sample_j1]</code>, then compare them (it is only necessary to compare one octave – choose one that is easy to see). They should all be the same, except that they are translated by the sample period, as shown below:</p>
<table width="680" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="samplei0j05" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/samplei0j05.png" alt="samplei0j05" width="256" height="128" border="0" /> <em>i0 j0</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="samplei1j05" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/samplei1j05.png" alt="samplei1j05" width="256" height="128" border="0" /> <em>i1 j0 (The same as i0 j0, but translated to the left)</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="samplei0j15" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/samplei0j15.png" alt="samplei0j15" width="256" height="128" border="0" /> <em>i0 j1 (The same as i0 j0, but translated to the top)</em></td>
<td valign="top" width="340"></td>
</tr>
</tbody>
</table>
<h3>3. Check that your smooth noise is blended correctly</h3>
<ul>
<li>Change your base noise to pure white. The resulting image should also be pure white.</li>
<li>Change your base noise to pure black. The resulting image should also be pure black.</li>
<li>Check your resulting Perlin noise for different persistence values.</li>
</ul>
<p>Here is how the images look for different persistent values and <strong>linear interpolation</strong>.</p>
<table width="680" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.1</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise1.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.3</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise2.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.5</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise3.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.7</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise4.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.9</em></td>
<td valign="top" width="340"></td>
</tr>
</tbody>
</table>
<p>Here is how the images look for different persistent values and <strong>cosine interpolation</strong>.</p>
<table width="680" border="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise5.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.1</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise6.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.3</em></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise7.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.5</em></td>
<td style="text-align: center;" valign="top" width="340"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise8.png" alt="perlin_noise" width="256" height="128" border="0" /> <em>Persistence = 0.7</em></td>
</tr>
<tr>
<td valign="top" width="340">
<p style="text-align: center;"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="perlin_noise" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/perlin_noise9.png" alt="perlin_noise" width="256" height="128" border="0" /><em>Persistence = 0.9</em></p>
</td>
<td valign="top" width="340">&nbsp;</td>
</tr>
</tbody>
</table>
<h2><span style="font-size: 13px; font-weight: normal;">If you have any more implementation or debugging tips to share, please let us know in the comments!</span></h2>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2009/04/25/perlin-noise/' rel='bookmark' title='How to Use Perlin Noise in Your Games'>How to Use Perlin Noise in Your Games</a> <small>(Originally appeared in Dev.Mag Issue 20, released in February 2008.)...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2011/06/25/implementing-and-debugging-the-perlin-noise-algorithm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>B&#233;zier Path Algorithms</title>
		<link>http://devmag.org.za/2011/06/23/bzier-path-algorithms/</link>
		<comments>http://devmag.org.za/2011/06/23/bzier-path-algorithms/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 19:56:41 +0000</pubDate>
		<dc:creator>Herman Tulleken</dc:creator>
				<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[bezier curve]]></category>
		<category><![CDATA[bezier path]]></category>
		<category><![CDATA[curve length]]></category>
		<category><![CDATA[interpolation]]></category>
		<category><![CDATA[sampling]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4247</guid>
		<description><![CDATA[<br/>This tutorial provides some algorithms useful for working with Bézier curves: determining the length of a piece of curve; interpolating a set of points with a Bézier path; and reducing a large point set to a smooth Bézier curve.<h2>Related posts:</h2>
<ol>
<li><a href='http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/' rel='bookmark' title='B&eacute;zier Curves for your Games: A Tutorial'>B&eacute;zier Curves for your Games: A Tutorial</a> <small>A Bézier curve is a type of curve that is...</small></li>
<li><a href='http://devmag.org.za/2009/06/07/the-path-demo-is-out/' rel='bookmark' title='The Path demo is out!'>The Path demo is out!</a> <small>The Path is one of those videogames that just keeps...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<br/><p><img class="aligncenter size-full wp-image-4248" title="bezier" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/bezier.png" alt="" width="680" height="340" /></p>
<p>In the article <em><a href="http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/">Bézier Curves for your Games: A Tutorial</a>,</em> I introduced Bézier curves and Bézier paths. In this tutorial I provide some algorithms useful for working with Bézier curves: determining the length of a piece of curve; interpolating a set of points with a Bézier path; and reducing a large point set to a smooth Bézier curve. (Image by <a href="http://www.flickr.com/photos/snuffythebear/">snuffyTHEbear</a>).</p>
<h2><span id="more-4247"></span>Calculating curve length</h2>
<p>Assuming that the line segments we use for drawing are a reasonable representation of our curve, we can estimate the curve length by summing the lengths of the segments. These can be added together to get the length of a Bézier path.</p>
<p>A more complicated strategy is necessary when we need the length of only a part of the curve, and not the complete curve.</p>
<p>First, we must cache the <em>accumulative</em> length of segments when we update the drawing points. For example, if the lengths of the first three segments of a curve are 2, 3 and 1, the accumulative lengths are 2, 5, and 6.</p>
<p>Then, we can use a simple subtraction to find the length of the piece of the curve (assuming, for a moment, that we need it only between points that coincide with the drawing points). For example, to find the length of curve between drawing points 5 and 8, we do the following calculation:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">accumulativeLength<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">8</span><span style="color: #008000;">&#93;</span> – accumulativeLength<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">5</span> – <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008080; font-style: italic;">//wrong</span></pre></div></div>

<p>Note that we subtract 1 from the smaller index. To prevent us from having to handle a special case, we can start the accumulative lengths with 0. The accumulativeLengths array is then one larger than the drawingPoints array. With this scheme, we calculate the length between drawing points 5 and 8 as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">accumulativeLength<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">8</span> <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> – accumulativeLength<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#93;</span> <span style="color: #008080; font-style: italic;">//correct</span></pre></div></div>

<p>If we need to calculate the length between arbitrary points (not just drawing points), then we need a slightly more complicated scheme, as in the following function:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">//Calculates the length of curve between two points on the curve</span>
CalculateLenth<span style="color: #008000;">&#40;</span>segmentIndex0, t0, segmentIndex1, t1<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">//assert(segmentIndex0 &lt;= segmentIndex1)</span>
    <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>segmentIndex0 <span style="color: #008000;">==</span> segmentIndex1<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        assert<span style="color: #008000;">&#40;</span>t1 <span style="color: #008000;">&gt;=</span> t0<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    p0 <span style="color: #008000;">=</span> getPoint<span style="color: #008000;">&#40;</span>curveIndex0, t0<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    beginningLength <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>drawingPoints<span style="color: #008000;">&#91;</span>segmentIndex0 <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> – p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span><span style="color: #008000;">;</span>
    p1 <span style="color: #008000;">=</span> getPoint<span style="color: #008000;">&#40;</span>curveIndex1, t1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    endLength <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>drawingPoints<span style="color: #008000;">&#91;</span>segmentIndex1<span style="color: #008000;">&#93;</span> – p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span><span style="color: #008000;">;</span>
    length <span style="color: #008000;">=</span> beginningLength <span style="color: #008000;">+</span> endLength<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>segmentIndex0 <span style="color: #008000;">!=</span> segmentIndex1<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        midLength <span style="color: #008000;">=</span> accumulativeLength<span style="color: #008000;">&#91;</span>segmentIndex0 <span style="color: #008000;">+</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span> –
          accumulativeLength<span style="color: #008000;">&#91;</span>segmentIndex1<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
        length <span style="color: #008000;">+=</span> midLength<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">return</span> length<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The code in red above samples the curve directly to calculate the two points. However, this will give results inconsistent with our approximation using line segments of the midLength. It is often not a problem, since the difference might be small. If it <em>is</em> a problem, you can use points on the line segments instead of points on the curve to calculate the approximation.</p>
<p>This technique is consistent with the approximation of the interior segment, and is somewhat faster. All you have to do is use the following method to calculate p0 and p1, instead of using the getPoint method as above.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">GetPointOnSegment<span style="color: #008000;">&#40;</span>curveIndex, t<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span>t – <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">*</span> points<span style="color: #008000;">&#91;</span>curveIndex<span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> t <span style="color: #008000;">*</span>  points<span style="color: #008000;">&#91;</span>curveIndex <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h2>Constructing a smooth Bézier path from a set of points</h2>
<p>Two related problems arise frequently when working with paths. Both problems require us to find an aesthetic, smooth curve for a set of points.</p>
<p>The first problem occurs when only a few points of the curve are given, and we have to find a smooth curve that passes through all the points. One example of this is the paths given to AI agents. A walking character looks very funny when abruptly turning to follow the path laid out by the AI designer or algorithm. Using a bit of smoothing greatly enhances the believability of the character’s movements. This is <strong>interpolation</strong>.</p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="interpolation" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/interpolation.png" border="0" alt="interpolation" width="681" height="145" /></p>
<p><em>An example of Bézier interpolation.</em></p>
<p>The second problem occurs when a vast number of points are given, and we need to simplify the curve without distorting the overall shape. This, for example, is useful to make a curve in a line drawing game more pleasing to the eye, and easier for the AI to follow. This is <strong>simplification</strong>.</p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="reduction" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/reduction.png" border="0" alt="reduction" width="681" height="190" /></p>
<p><em>An example of Bézier simplification.</em></p>
<h3>Bézier interpolation</h3>
<p>The challenge is to find a nice, smooth curve passing through all the points given in order. We can think of this as smoothing a curve made out of line segments. A Bézier path is smooth if each endpoint and its two surrounding control points lie in a straight line. In other words, the two tangents at each Bézier endpoint are parallel.</p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="tangents" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/tangents.png" border="0" alt="tangents" width="679" height="185" /></p>
<p><em>These figures show two Bézier paths, each made out of two Bézier curves. The yellow line segments are tangents to the left and right of the orange Bézier endpoint. When the tangents are parallel, as on the left, the connection between the two Bézier curves is smooth. If they are not parallel, as on the right, there is a cusp where the curves connect.</em></p>
<p>For now, let us assume the segments are roughly of the same length.</p>
<p>The basic idea is to calculate control points around each endpoint so that they lie in a straight line with the endpoint. We make this line parallel to the line formed with the neighbouring Bézier endpoints, and we make the control points the same distance from the endpoint that they surround (for now). We use a scaling parameter to control curvature of the curve at the Bézier endpoint. Curves for different scale values are shown below.</p>
<p><em><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="g5680" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/g5680.png" border="0" alt="g5680" width="207" height="323" /> </em></p>
<p><em>We are given the orange points. The algorithm calculates the yellow points, which in this case are the control points around the Bézier endpoint in the middle. We do it so that the yellow points that surround a Bézier endpoint lie in a straight line. We can tweak the distance of the control points from this Bézier endpoint with a parameter. The larger this parameter, the smaller the curvature at that Bézier endpoint. In these images, each of the three Bézier paths has two Bézier curves.</em></p>
<p>The basic steps to calculate the two control points around a point p1, are the following, where p0 and p2 are the endpoints around p1:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">tangent <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p2 – p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">normalized</span><span style="color: #008000;">;</span>
q0 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">-</span> scale <span style="color: #008000;">*</span> tangent<span style="color: #008000;">;</span>
q1 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">+</span> scale <span style="color: #008000;">*</span> tangent<span style="color: #008000;">;</span></pre></div></div>

<p>The tricky bit is handling the first and last control points of the path. These are calculated as before, except that we use the two first or two last endpoints to do the tangent calculation.</p>
<p>We can now iterate through all the segment points, and calculate control points depending on the correct case.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">List<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span> Interpolate<span style="color: #008000;">&#40;</span>List<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span> segmentPoints, <span style="color: #6666cc; font-weight: bold;">float</span> scale<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    controlPoints <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>segmentPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> segmentPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>i <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">// is first</span>
        <span style="color: #008000;">&#123;</span>
            Vector3 p1 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            Vector3 p2 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>                
&nbsp;
            Vector3 tangent <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p2 <span style="color: #008000;">-</span> p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Vector3 q1 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">+</span> scale <span style="color: #008000;">*</span> tangent<span style="color: #008000;">;</span>
&nbsp;
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>q1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>i <span style="color: #008000;">==</span> segmentPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008080; font-style: italic;">//last</span>
        <span style="color: #008000;">&#123;</span>
            Vector3 p0 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            Vector3 p1 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            Vector3 tangent <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p1 <span style="color: #008000;">-</span> p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Vector3 q0 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">-</span> scale <span style="color: #008000;">*</span> tangent<span style="color: #008000;">;</span>
&nbsp;
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>q0<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">else</span>
        <span style="color: #008000;">&#123;</span>
            Vector3 p0 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i <span style="color: #008000;">-</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            Vector3 p1 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            Vector3 p2 <span style="color: #008000;">=</span> segmentPoints<span style="color: #008000;">&#91;</span>i <span style="color: #008000;">+</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            Vector3 tangent <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p2 <span style="color: #008000;">-</span> p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">normalized</span><span style="color: #008000;">;</span>
            Vector3 q0 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">-</span> scale <span style="color: #008000;">*</span> tangent <span style="color: #008000;">*</span> <span style="color: #008000;">&#40;</span>p1 <span style="color: #008000;">-</span> p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">magnitude</span><span style="color: #008000;">;</span>
            Vector3 q1 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">+</span> scale <span style="color: #008000;">*</span> tangent <span style="color: #008000;">*</span> <span style="color: #008000;">&#40;</span>p2 <span style="color: #008000;">-</span> p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">magnitude</span><span style="color: #008000;">;</span>
&nbsp;
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>q0<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            controlPoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>q1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">return</span> controlPoints<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h3>Bézier simplification (Quick and Dirty Method)</h3>
<p>If we would also like to reduce the number of points in our curve, it is much harder to construct a suitable Bézier curve, especially if we want the best possible fit given constraints on the number of control points and degree of the curve. There is a quick and dirty method that works well in many cases. Here is the broad outline:</p>
<ol>
<li>Add points to a list so that successive points are as far apart as possible, within a specified minimum.</li>
<li>Use Bézier interpolation discussed above.</li>
</ol>
<p>The algorithm to perform step 1 works as follows:</p>
<ol>
<li>We add the first point from our list of source points to the list sample points.</li>
<li>We set the next potential sample point as the second point in the list of source points.</li>
<li>We then iterate through the remaining source points (starting at the third point). For each point, we check whether the last sample point added is outside a minimum square distance of that point. If it is, we add the potential sample point to the list of sample points. The current point becomes the new potential sample point (regardless of whether the last test failed).</li>
</ol>
<p>Here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>sourcePoints<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
Vector3 potentialSamplePoint <span style="color: #008000;">=</span> sourcePoints<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> sourcePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span> <span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>potentialSamplePoint <span style="color: #008000;">-</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">sqrMagnitude</span> <span style="color: #008000;">&gt;</span> minSqrDistance<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span>
       <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Peek</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">-</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">sqrMagnitude</span> <span style="color: #008000;">&gt;</span> maxSqrDistance<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>potentialSamplePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    potentialSamplePoint <span style="color: #008000;">=</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The last bit of the curve is a bit messy to handle. We can either throw the last point away, and lose a small piece of the curve; or add the last point as a control point, and keep the full curve.</p>
<p>If we decide to add the last point, the last two points in samplePoints may lie very close to each other. If this is the case, you might either discard the <em>second</em> last point, or move it a bit further from the last point, closer to the third last point. The exact best new location for this point is a bit tricky to calculate. The following is an approximation scheme:</p>
<p>Let p0, p1 be the last two sample points, and p2 be the last potentialSamplePoint (which is also the last point from samplePoints). We want to calculate a new position for p1.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">tangent <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p0 – p2<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">normalized</span><span style="color: #008000;">;</span>
d2 <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p2 – p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">magnitude</span><span style="color: #008000;">;</span>
d1 <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p1 – p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">magnitude</span><span style="color: #008000;">;</span>
p1 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">+</span> tangent <span style="color: #008000;">*</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>d1 <span style="color: #008000;">-</span> d2<span style="color: #008000;">&#41;</span><span style="color: #008000;">/</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>I based the approximation above on the following reasoning:</p>
<p><img style="display: inline; margin: 5px 10px 0px 0px; border-width: 0px;" title="last_point" src="http://devmag.org.za/blog/wp-content/uploads/2011/06/last_point.png" border="0" alt="last_point" width="340" height="180" align="left" /> The vector t is an approximate tangent vector for the curve at p1. This is the same tangent as would be calculated by our smoothing algorithm. We then want to move p1 so that it lies on this tangent, (passing through the original p1), and lies roughly the same distance from p0 and p1. Instead of calculating exact intersections, we approximate the desired distance as half the sum of the original distances, that is, the new distance from p1 to p0 (and p2) is given by (d1 + d2) / 2. Now p1 is already d2 from p2, so we subtract that from (d1 + d2) / 2 to obtain (d1 &#8211; d2) / 2. This is exact only when all three points lie in a straight line, but it is close enough in other cases.</p>
<p>The final algorithm is this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> List<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span> SamplePoints<span style="color: #008000;">&#40;</span>List<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span> sourcePoints,
        <span style="color: #6666cc; font-weight: bold;">float</span> minSqrDistance, <span style="color: #6666cc; font-weight: bold;">float</span> maxSqrDistance, <span style="color: #6666cc; font-weight: bold;">float</span> scale<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>sourcePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    Stack<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span> samplePoints <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Stack<span style="color: #008000;">&lt;</span>Vector3<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>sourcePoints<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    Vector3 potentialSamplePoint <span style="color: #008000;">=</span> sourcePoints<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #008000;">=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> sourcePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>potentialSamplePoint <span style="color: #008000;">-</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">sqrMagnitude</span> <span style="color: #008000;">&gt;</span> minSqrDistance<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span>
           <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Peek</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">-</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">sqrMagnitude</span> <span style="color: #008000;">&gt;</span> maxSqrDistance<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>potentialSamplePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        potentialSamplePoint <span style="color: #008000;">=</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//now handle last bit of curve</span>
    Vector3 p1 <span style="color: #008000;">=</span> samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Pop</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//last sample point</span>
    Vector3 p0 <span style="color: #008000;">=</span> samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Peek</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//second last sample point</span>
    Vector3 tangent <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p0 <span style="color: #008000;">-</span> potentialSamplePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">normalized</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">float</span> d2 <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>potentialSamplePoint <span style="color: #008000;">-</span> p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">magnitude</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">float</span> d1 <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>p1 <span style="color: #008000;">-</span> p0<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">magnitude</span><span style="color: #008000;">;</span>
    p1 <span style="color: #008000;">=</span> p1 <span style="color: #008000;">+</span> tangent <span style="color: #008000;">*</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>d1 <span style="color: #008000;">-</span> d2<span style="color: #008000;">&#41;</span><span style="color: #008000;">/</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>p1<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>potentialSamplePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">return</span> Interpolate<span style="color: #008000;">&#40;</span>samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">ToArray</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>, scale<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Once we have reduced the points, the final step is to make the curve smooth, by using Bézier interpolation. We simply pass the list returned by SamplePoints to the Interpolate function.</p>
<p>The algorithm is easily converted to an online algorithm. If the curve is drawn while the sampling is being done, the potential point should be included for drawing to make the curve building smooth. If it is not, the curve end will jump as the curve is extended. The end of the curve will also adjust itself as the curve is extended; unfortunately, there is not much that can be done about this.</p>
<p>If the last samples being too close present a problem, we can perform the end-of-curve calculations where the curve is drawn. We also need to do the calculations once the last sourcePoint has been given.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">void</span> SamplePointsOnline<span style="color: #008000;">&#40;</span>Vector3 newSourcePoint, <span style="color: #6666cc; font-weight: bold;">float</span> minSqrDistance<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">//samplePoints and potentialSamplePoint are now fields</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>newSourcePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        potentialSamplePoint <span style="color: #008000;">=</span> newSourcePoint<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">else</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>samplePoints<span style="color: #008000;">.</span><span style="color: #0000FF;">Back</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> – newSourcePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">sqrMagnitude</span> <span style="color: #008000;">&gt;=</span> minSqrDistance<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            segmentPoint<span style="color: #008000;">.</span><span style="color: #0000FF;">Push</span><span style="color: #008000;">&#40;</span>potentialSamplePoint<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        potentialSamplePoint <span style="color: #008000;">=</span> sourcePoints<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">;;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h2>Downloads</h2>
<p>(WARNING: The code fairy stole all the comments in these files!)</p>
<ul>
<li><a href="http://www.devmag.org.za/downloads/bezier_curves/Curve.zip">Bezier Curves</a> (64 KB, Unity 3D Project, zipped)</li>
<li><a href="http://www.devmag.org.za/downloads/bezier_curves/BezierPath.cs">BezierPath.cs</a> (C# source code file)</li>
</ul>
<h2>Related posts:</h2><p><ol>
<li><a href='http://devmag.org.za/2011/04/05/bzier-curves-a-tutorial/' rel='bookmark' title='B&eacute;zier Curves for your Games: A Tutorial'>B&eacute;zier Curves for your Games: A Tutorial</a> <small>A Bézier curve is a type of curve that is...</small></li>
<li><a href='http://devmag.org.za/2009/06/07/the-path-demo-is-out/' rel='bookmark' title='The Path demo is out!'>The Path demo is out!</a> <small>The Path is one of those videogames that just keeps...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devmag.org.za/2011/06/23/bzier-path-algorithms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

