<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:georss="http://www.georss.org/georss" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>Dev.Mag</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>Tue, 16 Aug 2016 21:12:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.2.21</generator>
<site xmlns="com-wordpress:feed-additions:1">18198894</site>	<xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item>
		<title>5 Tips for developers to work more effectively with musicians</title>
		<link>http://devmag.org.za/2015/04/01/5-tips-for-developers-to-work-more-effectively-with-musicians/</link>
				<pubDate>Wed, 01 Apr 2015 18:07:58 +0000</pubDate>
		<dc:creator><![CDATA[Felipe Salinas]]></dc:creator>
				<category><![CDATA[Sound]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=5182</guid>
				<description><![CDATA[(This is an English transcription of the talk Como mejorar la música y el audio de tus videojuegos given at GameDev Santiago). As a musical producer, my first impression of the video game industry in Chile was that a lot of video game developers doesn’t know how to communicate with musicians, and that it leads [&#8230;]]]></description>
								<content:encoded><![CDATA[<p>(This is an English transcription of the talk <em>Como mejorar la música y el audio de tus videojuegos</em> given at <a href="http://www.meetup.com/Game-dev-Santiago/">GameDev Santiago</a>).</p>
<p>As a musical producer, my first impression of the video game industry in Chile was that a lot of video game developers doesn’t know how to communicate with musicians, and that it leads music that the developers did not want or need at all. These are a few tips that come from the audiovisual industry and I adapted them to video games I hope they’ll help you to get an excellent soundtrack!<span id="more-5182"></span></p>
<h1>1. Identify the Purpose of the music</h1>
<p>When it comes to music, there are a lot of developers who think “I have a game! I need music for this, let’s call a musician”. The issue is that when you have a game, you don’t necessary “need” music, there are a lot of indie titles out there that have almost nothing musical in the soundtrack (when I talk about soundtrack, I mean every sound that’s on the game, sound effects included). As vague as the first idea is, as vague that the result will be, so the first point of this post at all is for you to recognize what’s the purpose that you are going to assign to your songs and themes.</p>
<p>Here I will show you a list of musical purposes that are used in the  industry and the movie industry as well:</p>
<h2>To evoke emotion</h2>
<p>Is the musical representation of an emotion that is a part of the game, or a particular scene/stage. This is a very good example, the whole OST of this game works around the emotions of the story.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/cwDkutphzmU?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To identify character</h2>
<p>Is the musical representation of a character of the game, commonly the protagonist or antagonist. In this example we can listen how the composer managed to represent the origin of the character in the music.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/_cNdSyi0BxI?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To convey place</h2>
<p>This is the musical representation of a place and its characteristics. This is commonly used in RPG’s to represent cities, woods, deserts, etc. In the example, the music perfectly fits the place uniqueness (a tricky and mystic temple).</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/s1VYCy3HW00?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To convey time</h2>
<p>This is the musical representation of a time or age. Almost every game is placed in another timeline; it could be prehistoric, futuristic or medieval, for example. There’s a beautiful game that turned 20 years old a few days ago, and it features time travel, the example is the prehistoric music of the game, temporal identification at its best.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/WGWjp8Ew9p0?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To convey situation</h2>
<p>This represents a specific situation of the narrative development of your game. I hate to use so much RPG examples, but Uematsu is one of my favorite video game composers. In the example, the music represents the character and the situation simultaneously, when the player realizes that what just happened, the music comes immediately to support the situation</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/KQc7o2rm7po?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To give continuity</h2>
<p>Continuity is the music that connects two musical pieces that exist in the same stage, or the same scene. Transition is the music that connects a musical piece with another scene or stage. So, this is a movie/cinematic almost exclusive purpose, in this example there’s a lot of analysis to work with, but there are two things that are important to realize. In 0:38, the music volume goes down, so the dialogues could be the main audio of the mix, and in 1:08, the music became a continuity piece that connects with 1:32, when the new music begins.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/TLzhlsEFcVQ?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To give feedback</h2>
<p>When you need to represent an action. In the example, at 4:50, there’s a trigger for the music, the player gets 4 stars and new music appears.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/2ZERjqkLcSA?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To provide contrast</h2>
<p>This is an audiovisual tool that became popular with Quentin Tarantino movies; the music represents a contrast to what is happening in the scene. A movie example would be perfect, but I think this is a nice video game approach to the concept.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/3zpdyUGYRHo?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To represent mechanics</h2>
<p>This is a Video Game specific purpose and a really difficult one to compose, puzzle games music is the most representative but figure this example’s boss, you can’t kill him and you don’t know about it, so the music tries to represent that desperation.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/Ur0x1z7Zz7c?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h2>To anticipate events</h2>
<p>This is the representation of a future situation of the narrative development, terror movies use it to represent the feeling of “something is going to happen”. At 4:32, the music of the example works as a anticipation of the final boss, and prepares the player for what is to come.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/RR6u3e-LyOM?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<h1>2. Think of Instruments and Genre</h1>
<p>When you have the first step sort of defined, you’ll have to start thinking in a style and some instruments that will be the support for the music. It’s not necessary a huge level of detail in this point, in the indie videogame industry no musician will ask you to tell him to work in these terms: “Ok, I need 8 violins, 4 violas, 3 cellos, 2 double basses and a viola da gamba”, but it would be nice if you could tell him that you need “some strings”.</p>
<p>It’s the same thing with genre, it’s enough if you can tell the musician that you need “rock”, or “jazz”, but in the end, it comes for you to know some musical references that can help the musician to find where to start.</p>
<h1>3. Compile a List of Keywords</h1>
<p>This is a tip that works for almost every artist out there, from concept artist to sound designers. It’s always important to communicate the main concepts of the art that you’re requesting for your game, from emotions, adjectives or even situations, so when the artist makes any progress, they will look the keywords and figure out if they’re missing something important.</p>
<h1>4. Identify Sections</h1>
<p>For any developer, even experienced ones, it’s always good to remember to be organized with their work, and so it is for visual artists and musicians. A way to make the composers work a lot easier, is that you bring him a list of the “scenarios” from your game, everything that’s in your world, screens, menus, etc. And when you have this list, think in the tracks that you will need for every one of them. There’ll be a lot of situations when a musical piece will be in more than one scenario (the same music could be in the splash, the settings and the main menu, for example), and it’s really important for you and the musician to be aware of this.</p>
<h1>5. Find References</h1>
<p>As I said before, it is always up to you to communicate clearly with the composer, to let him know exactly what do you want and what do you need for your game. Audio references are an excellent way to do it.</p>
]]></content:encoded>
									<post-id xmlns="com-wordpress:feed-additions:1">5182</post-id>	</item>
		<item>
		<title>Match Game Mechanics: An exhaustive survey</title>
		<link>http://devmag.org.za/2015/03/03/match-game-mechanics-an-exhaustive-survey/</link>
				<comments>http://devmag.org.za/2015/03/03/match-game-mechanics-an-exhaustive-survey/#comments</comments>
				<pubDate>Tue, 03 Mar 2015 16:50:02 +0000</pubDate>
		<dc:creator><![CDATA[Jonathan Bailey]]></dc:creator>
				<category><![CDATA[Game Design]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=5144</guid>
				<description><![CDATA[(This article has also been published on Gamasutra. Check it out for insightful comments.) 1. Introduction At Gamelogic we are obsessed with game rules. Several weeks ago my colleague Herman Tulleken and I began building a match game tool. We played and analyzed many match games to deconstruct their mechanics. In this article we share our findings [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-5166" src="http://devmag.org.za/blog/wp-content/uploads/2015/03/Gamasutra-Header.jpg" alt="Gamasutra Header" width="646" height="323" srcset="http://devmag.org.za/blog/wp-content/uploads/2015/03/Gamasutra-Header.jpg 646w, http://devmag.org.za/blog/wp-content/uploads/2015/03/Gamasutra-Header-300x150.jpg 300w" sizes="(max-width: 646px) 100vw, 646px" /></p>
<p><em>(This article has also been published on <a href="http://gamasutra.com/blogs/JonathanBailey/20150227/237544/Match_Game_Mechanics.php">Gamasutra</a>. Check it out for insightful comments.)</em></p>
<h1>1. Introduction</h1>
<p>At <a href="http://www.gamelogic.co.za/" data-cke-saved-href="http://www.gamelogic.co.za/">Gamelogic</a> we are obsessed with game rules.</p>
<p>Several weeks ago my colleague Herman Tulleken and I began building a match game tool. We played and analyzed many match games to deconstruct their mechanics. In this article we share our findings as part of a larger research and development project, which will later include an article on match game implementation patterns.</p>
<p>During our research we found many games with similar features to match games. By changing how we define a match rule it is possible to include a wider variety of games for which our scheme can be applied. However, we decided against including match rules that are not intuitively associated with match games to keep our task manageable. How far our definitions can be stretched is something we want to explore in the future.<span id="more-5144"></span></p>
<p>For this document, we only include match games that are played on a grid, are 2D, and are on a single layer. Some 3D games (for instance <a href="https://en.wikipedia.org/wiki/Blockout" data-cke-saved-href="https://en.wikipedia.org/wiki/Blockout"><em>Blockout</em></a>) easily fall into our scheme if certain concepts are adapted for 3D.</p>
<p>In his paper <a href="http://www.jesperjuul.net/text/swapadjacent/" data-cke-saved-href="http://www.jesperjuul.net/text/swapadjacent/"><em>Swap Adjacent Gems to Make Sets of Three</em></a>, Jesper Juul defines matching tile games <em>as </em><em>“</em><em>video games where the object of the player is to manipulate tiles on a grid in order to create matches”</em> (We give a more precise definition below to suit our terminology and structure we use here.)</p>
<p>Juul says that one of the challenges that designers face is that casual gamers want to pick up and play these games immediately. There must be a level of familiarity without a steep learning curve. At the same time, games need to have enough uniqueness to stand out from the competition, and more importantly, enough to keep the player playing their game. Often these differences are subtle, such as <a href="https://en.wikipedia.org/wiki/Bejeweled" data-cke-saved-href="https://en.wikipedia.org/wiki/Bejeweled"><em>Bejeweled</em></a> introducing a timeless mode to its predecessors.</p>
<p>Because of this, the evolution of match games has occurred more incrementally than some other types of games, and it has resulted in many similar games (often labeled clones). More importantly for us, it makes match games easier to analyze than many other game genres.</p>
<p><strong>We also put the information in a graphical format. Click on <a href="http://www.gamelogic.co.za/images/MatchGamesInfographic.png">Match Game Mechanics Infographic</a> for the full-sized version.</strong></p>
<p><img class=" size-full wp-image-5178 aligncenter" src="http://devmag.org.za/blog/wp-content/uploads/2015/03/match_game_infographic_medium1.png" alt="match_game_infographic_medium" width="700" height="2816" /></p>
<h1>2. Definitions</h1>
<p><strong>Grid: </strong>A grid is a structured arrangement of <em>cells</em>. Games often use regular grids such as square grids and hexagonal grids.</p>
<p><strong>Cell: </strong>A cell is a container that can be empty or full.</p>
<p><strong>Tile: </strong>A tile is an object that can fill a cell. Cells cannot contain more than once tile. Except for during state transition animations, tiles are always inside exactly one cell, or completely outside the grid.</p>
<p><strong>Block: </strong>A connected group of tiles that is manipulated as a unit. In many games blocks have only one tile each.</p>
<p><em><strong>Matching tile game:</strong></em> a game where the object of the player is to manipulate blocks on a grid in order to create <em>matches</em> between tiles.</p>
<p><strong>Match:</strong> Is a group of tiles that satisfy the game’s matching rules. The most common match rule is three connected tiles with the same <em>color</em>. Matches can contain tiles from more than one block, and matches need not contain all the tiles of a block.</p>
<p><strong>Color:</strong> A property to distinguish tiles. This property is often an actual color, but can also be a shape, pattern or number. Not all tiles have a color in this sense.</p>
<p><strong>Gravity: </strong>A force that moves all tiles in a certain direction.</p>
<p><strong>Clear: </strong>A tile is cleared when it is removed from the game.</p>
<p><strong>Line: </strong>For square grids, a line is a row or column. For triangular and hexagonal grids, a line is similarly defined: a group of cells from end to end in a straight line.</p>
<p><strong>Combo</strong>: More than one simultaneous match. For example, if two tiles are swapped and this results in both tiles matching with other tiles (<em>Bejeweled</em>).</p>
<p><strong>Cascades:</strong> Consecutive matches. For example, a player’s input results in an auto match, and the new or existing tiles fall into empty cells in such a way that another auto match occurs (<a href="https://en.wikipedia.org/wiki/Bejeweled_Twist" data-cke-saved-href="https://en.wikipedia.org/wiki/Bejeweled_Twist"><em>Bejeweled</em> <em>Twist</em></a>).</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/o42WEhrJS-I?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p style="text-align: center;">(Bejeweled Twist)</p>
<h1>3. Game classification</h1>
<p>We classify all match games into three main categories. These main group capture the patterns in game loops and game goals, and affects the implementation of the rest of the game.</p>
<p><strong>Elimination game:</strong> Tiles are matched to clear (or partly clear) a grid that doesn’t refill as the player plays. The grid can begin full or partly full (<a href="https://en.wikipedia.org/wiki/SameGame" data-cke-saved-href="https://en.wikipedia.org/wiki/SameGame"><em>Chain Shot!</em></a>).</p>
<p><strong>Avoidance game:</strong> Tiles are matched to prevent a grid from becoming full or from tiles reaching an edge of the grid. The grid can begin empty or a partly full (<a href="https://en.wikipedia.org/wiki/Collapse!" data-cke-saved-href="https://en.wikipedia.org/wiki/Collapse!"><em>Collapse!</em></a><em>, </em><a href="https://en.wikipedia.org/wiki/Color_Lines" data-cke-saved-href="https://en.wikipedia.org/wiki/Color_Lines"><em>Lines</em></a>).</p>
<p><strong>Farming game:</strong> Tiles are matched on a grid that stays full. Every time a match is made and tiles are cleared, new tiles are added, and the goal is to maximize or reach a certain level of a metric (<em>Bejeweled</em>).</p>
<h1>4. Grid</h1>
<p>&nbsp;</p>
<h2>Grid topology</h2>
<p>A grid’s topology is how the cells are structured – which cells are connected. Commonly used grids include square (<em>Bejeweled</em>, <a href="http://www.bigfishgames.com/games/2327/around-the-world-in-80-days/" data-cke-saved-href="http://www.bigfishgames.com/games/2327/around-the-world-in-80-days/"><em>Around the World in 80 Days</em></a>), and hexagonal (<a href="https://en.wikipedia.org/wiki/Fractal_(video_game)" data-cke-saved-href="https://en.wikipedia.org/wiki/Fractal_(video_game)"><em>Fractal</em></a><em>, </em><a href="https://play.google.com/store/apps/details?id=cn.bluesky.samehexagon" class="broken_link" rel="nofollow"><em>Same Hexagon</em></a>) grids. A special case is 1D grids, which is a single line of cells, possibly curved (<a href="http://en.wikipedia.org/wiki/Zuma_%28video_game%29" data-cke-saved-href="http://en.wikipedia.org/wiki/Zuma_%28video_game%29"><em>Zuma</em></a>).</p>
<p><img src="http://www.gamasutra.com/db_area/images/blog/237544/Fractal646.png" alt="" width="646" height="363" data-cke-saved-src="http://www.gamasutra.com/db_area/images/blog/237544/Fractal646.png" /></p>
<p><em>(Fractal)</em></p>
<p><img src="http://www.gamasutra.com/db_area/images/blog/237544/Zuma646.jpg" alt="" width="646" height="363" data-cke-saved-src="http://www.gamasutra.com/db_area/images/blog/237544/Zuma646.jpg" /></p>
<p><em>(Zuma Deluxe)</em></p>
<h2>Grid shape and size</h2>
<p>A large variety of sizes and shapes are used, both symmetrical and unsymmetrical. A commonly used size and shape for a grid in a match game is an 8×8 rectangle (<em>Bejeweled 3, </em><a href="https://en.wikipedia.org/wiki/Puzzle_Quest:_Challenge_of_the_Warlords" data-cke-saved-href="https://en.wikipedia.org/wiki/Puzzle_Quest:_Challenge_of_the_Warlords"><em>Puzzle Quest: Challenge of the Warlords</em></a>).</p>
<p><img src="http://www.gamasutra.com/db_area/images/blog/237544/Bejeweled646.jpg" alt="" width="646" height="404" data-cke-saved-src="http://www.gamasutra.com/db_area/images/blog/237544/Bejeweled646.jpg" /></p>
<p><em>(Bejeweled 3)</em></p>
<h1>5. Block structure</h1>
<p>There are four different block structures. All but the first in this list are multi-tile blocks.</p>
<p><strong>Single-tile:</strong> Blocks with a single tile (<em>Bejeweled</em>)</p>
<p><strong>Monochromatic:</strong> Tiles of the same type in different shaped blocks (<a href="https://en.wikipedia.org/wiki/Tetris" data-cke-saved-href="https://en.wikipedia.org/wiki/Tetris"><em>Tetris</em></a>).</p>
<p><strong>Monomorphic:</strong> Same shaped blocks using tiles of different types (<a href="https://en.wikipedia.org/wiki/Columns_(video_game)" data-cke-saved-href="https://en.wikipedia.org/wiki/Columns_(video_game)"><em>Columns</em></a>).</p>
<p><strong>Mixed</strong>: Different shaped blocks using tiles of different types (<a href="https://en.wikipedia.org/wiki/Groovin%27_Blocks" data-cke-saved-href="https://en.wikipedia.org/wiki/Groovin%27_Blocks"><em>Groovin&#8217; Blocks</em></a>).</p>
<h1>6. Tile set structure</h1>
<h2>Tile set properties</h2>
<p>We classify tile properties into three categories:</p>
<p><strong>Clearing type:</strong> defines whether and how tiles are cleared.</p>
<p><strong>Gravity properties: </strong>properties that define whether and how tiles are affected by gravity.</p>
<p><strong>Game action:</strong> something that happens when the tile is cleared.</p>
<p>This classification may seem unintuitive from a design perspective, but it is useful for implementation.</p>
<h3>Clearing Type</h3>
<p>All tiles have a single clearing property. The chart below shows how the different clearing properties relate to each other.</p>
<p><img src="http://www.gamasutra.com/db_area/images/blog/237544/Tiles(2).png" alt="" width="589" height="267" data-cke-saved-src="http://www.gamasutra.com/db_area/images/blog/237544/Tiles(2).png" /></p>
<p><strong>Color tile:</strong> A tile that can be matched using matching rules that involve colors.</p>
<p><strong>Wildcard:</strong> A tile that can be matched using matching rules that involve colors, except it can substitute any color.</p>
<p><strong>Sinker:</strong> A tile that can be cleared by getting it to the bottom of the grid.</p>
<p><strong>Activator:</strong> A tile that can be cleared by clicking on it.</p>
<p><strong>Non-clearing tile:</strong> A tile that cannot be cleared.</p>
<h3>Gravity</h3>
<ul>
<li>Influence:
<ul>
<li><strong>Falling</strong><strong>:</strong> affected by gravity</li>
<li><strong>Floating:</strong> not affected by gravity</li>
</ul>
</li>
<li>Direction</li>
</ul>
<h3>Game action</h3>
<p>Clearing tiles can have any number of game actions that are performed when the tiles are cleared. These actions include:</p>
<ul>
<li>Generates a tile</li>
<li>Gives a reward (see Reward Types)</li>
<li>Ends the game</li>
</ul>
<h3>Examples</h3>
<ul>
<li>The colored matching tiles in <em>Bejeweled</em> are falling color tiles with no game actions.</li>
<li>The Icing (Meringues) blocker tile in <a href="https://en.wikipedia.org/wiki/Candy_Crush_Saga" data-cke-saved-href="https://en.wikipedia.org/wiki/Candy_Crush_Saga"><em>Candy Crush Saga</em></a> is a floating wildcard with no game actions.</li>
<li>The hypercube tile in <a href="https://en.wikipedia.org/wiki/Bejeweled_3" data-cke-saved-href="https://en.wikipedia.org/wiki/Bejeweled_3"><em>Bejeweled 3</em></a> is a falling wildcard that gives a reward when cleared.</li>
<li>The talisman tile in <a href="https://en.wikipedia.org/wiki/Azkend" data-cke-saved-href="https://en.wikipedia.org/wiki/Azkend"><em>Azkend</em></a> is a falling sinker that ends the game when cleared.</li>
<li>The chest tile in <a href="https://en.wikipedia.org/wiki/Triple_Town" data-cke-saved-href="https://en.wikipedia.org/wiki/Triple_Town"><em>Triple Town</em></a> is a floating activating tile that gives a reward when cleared.</li>
<li>The number tiles in <a href="https://en.wikipedia.org/wiki/Threes" data-cke-saved-href="https://en.wikipedia.org/wiki/Threes"><em>Threes</em></a> are floating colored tiles that generate new tiles when cleared.</li>
</ul>
<h2>Tile set additional structure</h2>
<p><strong>Sequence:</strong> Color tiles arranged in a sequence that is exploited for gameplay or scoring (<em>Triple Town, Threes, </em><a href="https://en.wikipedia.org/wiki/Gems_with_Friends" data-cke-saved-href="https://en.wikipedia.org/wiki/Gems_with_Friends"><em>Gems with Friends</em></a>).</p>
<p><strong>Multi-axis: </strong>There is more than one match property, for example color and pattern.  Matches can occur with tiles of the same color regardless of the pattern or matches can occur with tiles that have the same pattern regardless of the color (<a href="https://play.google.com/store/apps/details?id=de.netmin.Passage4XL&amp;hl=en" class="broken_link" rel="nofollow"><em>Passage 4 XL</em></a>).</p>
<h1>7. Block Spawning</h1>
<p>This section contains a few items marked with (*) for which we couldn’t find an example but for which we are sure one must exist. If you know of any examples, please share them in the comments.</p>
<h2>Spawning algorithms</h2>
<p>Tiles are selected</p>
<ul>
<li>randomly (<em>Tetris</em>)</li>
<li>in a predefined order (*)</li>
<li>so as to change the difficulty dynamically (<em>Candy Crush Saga</em>)</li>
<li>from recently cleared cells (*)</li>
<li>from a fixed batch with a random order (<em>Threes</em>)</li>
</ul>
<h2>Where blocks are spawned</h2>
<p>Blocks are spawned</p>
<ul>
<li>at the edge of the grid (<em>Bejeweled, Collapse!</em>)</li>
<li>in cells where blocks have been cleared (*)</li>
<li>in an empty cell (<em>Lines</em>)</li>
</ul>
<h2>Number of blocks spawned</h2>
<p>The number of cells to spawn can be</p>
<ul>
<li>a fixed number (<em>Lines</em>)</li>
<li>enough to fill all empty cells (<em>Bejeweled</em>)</li>
</ul>
<h2>When blocks are spawned</h2>
<p>Blocks are added</p>
<ul>
<li>after time (<em>Collapse</em><em>!, </em><a href="https://en.wikipedia.org/wiki/Tetris_Attack" data-cke-saved-href="https://en.wikipedia.org/wiki/Tetris_Attack"><em>Tetris Attack</em></a>)</li>
<li>when a match is made (<em>Bejeweled</em>)</li>
<li>when a match is not made (<em>Lines</em>)</li>
<li>after every turn (<a href="https://play.google.com/store/apps/details?id=com.FifthGame.colornumberpuzzle&amp;hl=en" class="broken_link" rel="nofollow"><em>Ultimate-4</em></a>)</li>
<li>after a number of turns (*)</li>
<li>when the player adds blocks (<a href="https://en.wikipedia.org/wiki/Stickets" data-cke-saved-href="https://en.wikipedia.org/wiki/Stickets"><em>Stickets</em></a>)</li>
</ul>
<h1>8. Player actions</h1>
<p>This is all the ways the player can change the game state.</p>
<p><img src="http://www.gamasutra.com/db_area/images/blog/237544/%5E61463521F5EDAE59ED7A42289E9527B95EB8D75E43FC25F63A%5Epimgpsh_fullsize_distr.jpg" alt="" width="616" height="527" data-cke-saved-src="http://www.gamasutra.com/db_area/images/blog/237544/%5E61463521F5EDAE59ED7A42289E9527B95EB8D75E43FC25F63A%5Epimgpsh_fullsize_distr.jpg" /></p>
<h2>Click Match</h2>
<p>The player clicks on any tile in a matching group of tiles to clear those tiles (<em>Collapse!, Same Hexagon</em>).</p>
<h2>Chain Match</h2>
<p>The player clicks on each tile or drags over each tile in a matching group of tiles to clear those tiles (<em>Azkend, </em><a href="https://en.wikipedia.org/wiki/Jelly_Splash" data-cke-saved-href="https://en.wikipedia.org/wiki/Jelly_Splash"><em>Jelly Splash</em></a><em>, </em><a href="https://play.google.com/store/apps/details?id=com.playrix.fel.inapp&amp;hl=en" class="broken_link" rel="nofollow"><em>4 Elements</em></a>).</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/m5qPU1uGQZY?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p style="text-align: center;"><em>(Jelly Splash)</em></p>
<h2>Place</h2>
<p>The player places a new block on the grid.</p>
<ul>
<li>There can either be no choice of which block to place next (<em>Columns</em>), or there can be a choice between a number of available blocks to place next (<em>Stickets</em>).</li>
<li>The block can be placed on either any empty group of cells with the same shape (<em>Lines, Stickets</em>), or on any of a restricted group of empty cells with the same shape (<a href="https://en.wikipedia.org/wiki/Might_%26_Magic:_Clash_of_Heroes" data-cke-saved-href="https://en.wikipedia.org/wiki/Might_%26_Magic:_Clash_of_Heroes"><em>Might &amp; Magic: Clash of Heroes</em></a><em>, Columns</em>).</li>
</ul>
<h2>Rotate</h2>
<p>The player rotates tiles of two or more cells, usually by clicking or dragging over the cells. The most common use of this action is <strong>swapping</strong> – rotating two cells (Bejeweled 3). Other examples include rotating the tiles in three cells (<a href="https://en.wikipedia.org/wiki/Hexic" data-cke-saved-href="https://en.wikipedia.org/wiki/Hexic">Hexic</a>) or four cells (Bejeweled Twist).</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/L1TiMKupcak?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p style="text-align: center;"><em>(Bejeweled 3)</em></p>
<h2>Line Swipe</h2>
<p>The player moves a whole line of tiles in the direction of the line. Lines are wrapped, so that tiles that go out the one end of the grid re-enters the grid on the opposite side (<a href="https://en.wikipedia.org/wiki/Chuzzle" data-cke-saved-href="https://en.wikipedia.org/wiki/Chuzzle"><em>Chuzzle</em></a><em>, </em><a href="http://apps.microsoft.com/windows/en-us/app/metronous/e9e386df-4706-4f50-8e7d-46e99e616647" data-cke-saved-href="http://apps.microsoft.com/windows/en-us/app/metronous/e9e386df-4706-4f50-8e7d-46e99e616647"><em>Metronous</em></a>).</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/4vZnNZ_G6Qk?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p style="text-align: center;"><em>(Chuzzle Deluxe)</em></p>
<h2>Grid Swipe</h2>
<p>The player swipes the whole grid, and all cells move as long as there is space available, or a match can be formed (<em>Threes</em>).</p>
<h2>Manipulate Block</h2>
<p>Block manipulation is defined by:</p>
<ul>
<li><strong>how the block is manipulated:</strong> for example rotating the block (<em>Tetris</em>) or changing the position of tiles within a block (<em>Columns</em>), and</li>
<li><strong>when the block is manipulated:</strong> before placement (<em>Tetris</em>) or after placement (<em>Chain Shot</em>).</li>
</ul>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/htcKIzCK_2c?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p><em>(Columns)</em></p>
<h2>Manipulate Gravity</h2>
<p>Changes in gravity include:</p>
<ul>
<li>The player turns it on or off (<a href="https://play.google.com/store/apps/details?id=org.massdeception.gravityswitch.free" class="broken_link" rel="nofollow"><em>Gravity Switch Puzzle Match</em></a>)</li>
<li>The player changes the direction of gravity relative to the grid, possibly by rotating the grid (<a href="https://en.wikipedia.org/wiki/Vizati" class="broken_link" rel="nofollow"><em>Vizati</em></a><em>, </em><a href="https://en.wikipedia.org/wiki/Spinzizzle" data-cke-saved-href="https://en.wikipedia.org/wiki/Spinzizzle"><em>Spinzizzle</em></a>).</li>
</ul>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/cFmmZZAjI7I?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<div></div>
<div><em>(Spinzizzle)</em></div>
<h2>Remove</h2>
<p>The player clicks on a tile to clear it.</p>
<h2>Shuffle</h2>
<p>The player moves some or all tiles into different randomly selected cells (<em>Candy Crush Saga</em>).</p>
<h1>9. Automatic Actions</h1>
<p>These are all the ways the game state changes automatically.</p>
<h2>Block spawning</h2>
<p>This automatic action adds new tiles to the game. We have already discussed various aspects of block spawning in a previous section.</p>
<h2>Auto-match</h2>
<p>In games where matching is not a player action, auto-match occurs as result of every player input. If the player input results in a group of matched tiles, auto-match will clear the tiles from the grid.</p>
<p>Auto-match can also occur without player input as a cascade.</p>
<h2>Gravity</h2>
<p>Gravity can influence generated blocks which enter the grid or cause tiles to move into empty cells created from clearing tiles (<em>Bejeweled</em>).</p>
<p>The direction of gravity can change during the game depending on how tiles are cleared (<em>Collapse!</em>).</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/YevK5QjO1xI?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p><em>(Super Collapse!)</em></p>
<h2>Repulsion</h2>
<p>Placing a block pushes all neighboring tiles away from it. The pushed tile create a chain whereby all tiles in that line move one cell away from its previous position (<em>Fractal</em>). Empty cells may or may not break this chain.</p>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/pCARWzzyaig?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p><em>(Fractal)</em></p>
<h2>Attraction</h2>
<p>Cleared tiles are replaced by tiles in neighboring cells (<a href="https://en.wikipedia.org/wiki/Lightning_Fighters" data-cke-saved-href="https://en.wikipedia.org/wiki/Lightning_Fighters"><em>Trigon</em></a>).</p>
<h1>10. Matching conditions</h1>
<h2>Number of tiles needed to make a match</h2>
<p>The most common number of tiles needed to make a match is 3 (Bejeweled); however, there are games that do not use three tiles as the minimum requirement for a match. Here are some examples:</p>
<ul>
<li>2 (<em>Threes</em>)</li>
<li>4 (<a href="https://en.wikipedia.org/wiki/Lumines" data-cke-saved-href="https://en.wikipedia.org/wiki/Lumines"><em>Lumines</em></a><em>, </em><a href="https://itunes.apple.com/us/app/gems-huntz-simple-funny-match/id358669082?mt=8" class="broken_link" rel="nofollow"><em>Gem Huntz</em></a>)</li>
<li>7 (<em>Fractal</em>)</li>
<li>10 (<em>Tetris</em>)</li>
</ul>
<h2>Orientation and shape of tiles needed to make a match</h2>
<p>Common shapes include:</p>
<ul>
<li>Horizontal or vertical lines</li>
<li>L-shape</li>
<li>T-shape</li>
<li>Cross</li>
<li>Square</li>
<li>Triangle</li>
<li>Hexagon</li>
</ul>
<h2>Special cases</h2>
<p>There are other less common rules for matching. Here are some examples:</p>
<ul>
<li>Matching tiles can be separated by empty cells but must be on the same axis and have no non-matching tiles in between them (<a href="https://play.google.com/store/apps/details?id=net.hexage.totemo.hd&amp;hl=en" class="broken_link" rel="nofollow"><em>Totemo</em></a><em>, </em><a href="http://en.gamesaien.com/game/color_tiles/" data-cke-saved-href="http://en.gamesaien.com/game/color_tiles/"><em>Color Tiles</em></a>).</li>
</ul>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/ho0obaaIR3k?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<p><em>(Totemo)</em></p>
<ul>
<li>Match tiles to create a closed shape, which clears those tiles and all of the tiles within the cells of that closed shape (<a href="https://en.wikipedia.org/wiki/Quarth" data-cke-saved-href="https://en.wikipedia.org/wiki/Quarth"><em>Quarth</em></a>).</li>
</ul>
<p><iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/9-xeRaHrV4o?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></p>
<div><img class="cke_iframe" title="IFrame" src="http://gamasutra.com/ckeditor/plugins/fakeobjects/images/spacer.gif?t=D6IE" alt="IFrame" align="" data-cke-realelement="%3Ciframe%20allowfullscreen%3D%22true%22%20allowscriptaccess%3D%22always%22%20frameborder%3D%220%22%20height%3D%22349%22%20scrolling%3D%22no%22%20src%3D%22%2F%2Fwww.youtube.com%2Fembed%2F9-xeRaHrV4o%3Fwmode%3Dtransparent%26amp%3Bjqoemcache%3DVik6O%22%20width%3D%22425%22%3E%3C%2Fiframe%3E" data-cke-real-node-type="1" data-cke-real-element-type="iframe" data-cke-resizable="true" /><em>(Quarth)</em></div>
<h1>11. Rewards</h1>
<h2>Reward types</h2>
<p>Examples of reward types include:</p>
<ul>
<li>Score</li>
<li>Special tiles</li>
<li>Special actions</li>
</ul>
<p>The outcome of a special tile or special action are interchangeable. Examples include</p>
<ul>
<li>Extra time</li>
<li>Time reset</li>
<li>Extra moves</li>
<li>Clear lines</li>
<li>Clear neighbors</li>
<li>Clear all tiles of a particular color</li>
</ul>
<h2>Reward conditions</h2>
<p>Rewards can occur due to a single condition or as a combination of conditions.</p>
<p><img src="http://www.gamasutra.com/db_area/images/blog/237544/RewardCondition(2).png" alt="" width="581" height="429" data-cke-saved-src="http://www.gamasutra.com/db_area/images/blog/237544/RewardCondition(2).png" /></p>
<h1>12. Game-end conditions</h1>
<p>Games have one or more conditions for ending the game. Below are typical ones.</p>
<h3>Win conditions</h3>
<p>The player wins the game when</p>
<ul>
<li>the grid is clear (<a href="https://en.wikipedia.org/wiki/Puzznic" data-cke-saved-href="https://en.wikipedia.org/wiki/Puzznic"><em>Puzznic</em></a>)</li>
<li>the player makes a specified number of matches or reaches a specified score (<em>Bejeweled</em>)</li>
<li>the player makes a specified set of matches (<a href="https://play.google.com/store/apps/details?id=com.sprakelsoftug.jewelfever&amp;hl=en" class="broken_link" rel="nofollow"><em>Jewel Fever</em>)</a></li>
<li>the player clears a specific tile (<em>Azkend</em>)</li>
</ul>
<h3>Lose conditions</h3>
<p>The player loses the game when</p>
<ul>
<li>the grid is full (<em>Stickets</em>)</li>
<li>a tile reaches an edge of the grid (<em>Tetris, Collapse!)</em></li>
<li>the player runs out of resources (<em>Fractal</em>)</li>
<li>the player has no more possible moves (<em>Threes</em>)</li>
</ul>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2015/03/03/match-game-mechanics-an-exhaustive-survey/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">5144</post-id>	</item>
		<item>
		<title>Rapid Game Prototyping: Tips for Programmers</title>
		<link>http://devmag.org.za/2014/01/08/rapid-game-prototyping-tips-for-programmers/</link>
				<comments>http://devmag.org.za/2014/01/08/rapid-game-prototyping-tips-for-programmers/#comments</comments>
				<pubDate>Wed, 08 Jan 2014 08:25:48 +0000</pubDate>
		<dc:creator><![CDATA[Herman Tulleken]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[rapid prototyping]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=5120</guid>
				<description><![CDATA[In November 2013, two colleagues* and I made 30 games. Although I have done some game prototyping before, working on so many games in such a short period gave me some insights I did not have before. As I said to a friend, it’s like watching a television series in a few days, instead of [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><img style="background-image: none; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; margin-right: auto; border-width: 0px;" title="proto2" src="http://devmag.org.za/blog/wp-content/uploads/2014/01/proto2.png" alt="proto2" width="625" height="340" border="0" /></p>
<p>In November 2013, two colleagues* and I made 30 games. Although I have done some game prototyping before, working on so many games in such a short period gave me some insights I did not have before. As I said to a friend, it’s like watching a television series in a few days, instead of watching each episode week by week – you just see different things.</p>
<p>In this article, I collect some of these observations in the form of a set of tips. I kind-of assume you are already familiar with the classical <a href="http://www.gamasutra.com/view/feature/2438/how_to_prototype_a_game_in_under_7_.php"><em>How to prototype a game in 7 days</em></a>, which describes prototyping from a more general point of view. In some ways, this is a programming-specific extension to the ideas presented there.<span id="more-5120"></span></p>
<p>(*Their names are Jonathan Bailey and Eduard Beukes. If you want to read more on our protoyping endeavour, see <a href="http://gamelogic.co.za/2013/12/06/how-we-made-30-games-in-30-days/"><em>How we made 30 games in 30 days</em></a>.)</p>
<h3>A. Rapid is a State of Mind</h3>
<p>Making something very quickly is a lot of fun. Day-to-day (“proper”) development can be slow progress, with the final products months (or years) away. Tinkering with an idea in your spare time gives you insight, but its outcome is vague.</p>
<p>Building a rapid-prototype gives you immediate satisfaction. It gives you focus; it allows you to channel energy, and gear up.</p>
<p>But you need to get out of development mode, and out of tinkering mode. You have to know you will throw work away, and waste some effort. You have to know that sometimes you don’t need the best decision – you just need to make it straight away. You have to let go of perfection and details.</p>
<p>You have to get to the core.</p>
<h4>Know and remember the goal</h4>
<p>The reasons for building a prototype are varied. Here are a few examples:</p>
<ul>
<li>To have a finished game at the end of a fixed time (such as in a jam).</li>
<li>To have the core of a game that is fun (such as in a pre-preproduction phase of a project).</li>
<li>To select the best idea from a set of alternatives.</li>
<li>To test the technical feasibility of an idea (where the <em>idea</em> can be anything from a full game to a graphics technique or AI algorithm).</li>
</ul>
<p>The best way to work and make decisions depends on this goal. Be clear about what the goal is, and remind yourself frequently.</p>
<p>If a task is not moving you closer to your goal, <strong>don’t do it</strong>.</p>
<h4>Find the essence of your idea, and schedule enough time for it</h4>
<p>An essence can be a mechanic, a style, a theme, a setting, an emotional experience. Find it, and, separate it from the supporting elements.</p>
<p>When you schedule, assign time accordingly. If your essence is a new mechanic, you want to have enough time to explore it; you don’t want to spend all your time building levels or coding atmospheric shaders.</p>
<h4>Take creative risks, but avoid technical risks</h4>
<p>If a game prototype fails, it should be because it’s boring, <em>not because of a technical problem</em>. (Except of course when the goal is technical prototyping). You want your prototypes to be finished, and allow you and your team to explore the essence, and pass this on to players.</p>
<ul>
<li>Avoid tricky, sophisticated data structures and algorithms.</li>
<li>Avoid sophisticated systems and architectures.</li>
<li>Avoid trying to make things too fast.</li>
<li>Avoid technical feats that do not improve gameplay.</li>
</ul>
<h4><img style="background-image: none; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; margin-right: auto; border-width: 0px;" title="proto4" src="http://devmag.org.za/blog/wp-content/uploads/2014/01/proto4.jpg" alt="proto4" width="625" height="340" border="0" /></h4>
<h3>B. Planning and Process</h3>
<h4>Think about content</h4>
<p>Ask yourself a few questions about the content your game will need to get a feel for its scope.</p>
<ul>
<li>How much do you need to build?</li>
<li>How will you inject variety?</li>
<li>At what stage during development should it go in?</li>
<li>What fallbacks can be used? If you run out of time, have a plan to get essential content in. Will it work to make the boss simply a pink version of the level-enemies? Could boxes work instead of characters?</li>
</ul>
<h4>Plan</h4>
<ul>
<li>Work out a rough plan, and put down some time estimates.</li>
<li>Check your plan against the goal, and remove things that do not take you closer to your goal.</li>
<li>Check your plan against the essence of your idea, and verify that you allocated enough time to explore the essence.</li>
<li>Identify the sections where your estimates are likely to be out. Keep fallbacks in mind; consider reducing their impact / role / complexity. Think of placeholder strategies (see below).</li>
</ul>
<h4>Follow an implementation strategy, but adapt it to follow the ebbs and flow of the creative process</h4>
<p>Here is the order I would suggest you follow. It puts the most important things first, keeping in mind (typical) dependencies.</p>
<ol>
<li>Get something on screen</li>
<li>Implement top level game</li>
<li>Get user controls in</li>
<li>Implement a minimalist level</li>
<li>Implement toy logic</li>
<li>Implement game goal</li>
<li>Implement AI</li>
<li>Implement feedback</li>
<li>Refine</li>
</ol>
<p>Prototyping is not coding a specification, though. Remember that there will be false starts, and that you will have to adapt. When necessary, change the plan and update the schedule.</p>
<h4>Know and avoid time drains</h4>
<p>Certain things just suck up a disproportionate amount of time. It’s useful to recognise these, and make sure you schedule enough time, have fallbacks, and keep it even simpler than you would other parts of the game. (Typical time drains depend of course on the type of game; the examples below are just to give you a sense of what I mean).</p>
<p><strong>Controls.</strong> In actions games, controls can take a long time to get playable (never mind to get <em>nice</em>).</p>
<p><strong>Balance.</strong> In simulation games, balancing takes a long time. Keep the number of systems low; keep the number of variables low. And leave enough time to balance them out.</p>
<p><strong>GUI.</strong> In information-heavy games, the GUI can suck up all your time. Finding audio can take a long time – don’t add it unless it’s essential, or you already know where the sounds you need are.</p>
<p><strong>Animation.</strong> Animation can slurp up a lot of time: consider using snap poses, or gliding when appropriate.</p>
<p><strong>Procedural content generation.</strong> Tweaking algorithms for content generation can be time consuming. Unlike other algorithms, the specifications for content generation algorithms are hard to make objective.</p>
<h4>Consider using serial development (programming pipelines)</h4>
<p>For teams with more than one programmer, it’s common to divide a project up in components, and dish each one out to a separate programmer, so that everyone works in parallel.</p>
<p>There is another method, and it is worth trying it out once or twice and see if it works for your team.</p>
<p>With this approach, most of the code passes through all the programmers, in a staggered fashion. The first programmer will implement the broad strokes of the project; the next one will start filling in details, and so on. Instead of owning a piece of the code, each programmer owns the entire project for a time slice (these slices may overlap somewhat, of course). It works especially well if you use a lot of placeholder code.</p>
<p>The nice thing about the approach is that it reduces discussions about interfaces. In your time slot, if you need an interface change, you make it. It won’t break other programmers’ code because you are the only programmer. (It still works with overlapping slices, but you need more care, and a plan.)</p>
<p>The down side is of course the design you end up with may be quite bad. It does not matter, though, because the design is not important. It seems a bit wasteful, since there are times where some programmers don’t program.</p>
<p>(Of course, this is meant to split off programming tasks; it would be a shame if you do this with other creative activities. In many prototyping projects programmers are also game designers; this does not apply when you have your design hats on!)</p>
<h4>Don’t get stuck</h4>
<p>Several things can make you feel stuck: bugs, tricky-to-implement code, unusable and fiddly controls, sheer amounts of content, level design.</p>
<p>When you are in the mud, <strong>get out of it</strong>, and move on. Here are a few things you could do when stuck:</p>
<ul>
<li>Ignore tricky bugs that do not ruin gameplay.</li>
<li>Cut culprit features; reduce content.</li>
<li>Use a simpler placeholder algorithm or approximation.</li>
<li>Use brute force with lookup – a handy technique to design correct, fast algorithms quickly at the expense of memory and some extra time spent outside the main loop (maybe even outside the game altogether).</li>
<li>Fake it. Monsters that respond to players look more intelligent than monsters that don’t, regardless of how intelligent they <em>actually</em> are.</li>
<li>Hard-code it. A long array of monster sequences is much easier to code than a sophisticated wave generation algorithm.</li>
<li>Hide it.</li>
</ul>
<p><img style="background-image: none; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; margin-right: auto; border-width: 0px;" title="proto3" src="http://devmag.org.za/blog/wp-content/uploads/2014/01/proto3.png" alt="proto3" width="625" height="340" border="0" /></p>
<h3>C. Code Design and Implementation</h3>
<h4>Use placeholder code</h4>
<p>Use placeholder code wherever you can so that you can move onto core gameplay earlier. Once you have that nailed, you can systematically replace placeholder code with code that does a better job. What is nice about this approach is that once you have all the systems in and working with your core gameplay, it is much easier to prioritize tasks according to their gameplay impact.</p>
<p>Here are some typical candidates for placeholder code.</p>
<p><strong>Controls</strong> In some games, controls are extremely important. But if second-rate controls won’t cripple the player’s experience, and it’s faster to implement, implement that first. For example, in many sliding puzzle games, the best controls allow you to use the mouse (or finger) to slide around objects. This can be a difficult scheme to implement. On the other hand, mouse selection with arrow keys or buttons can be quick to implement, allowing you to get onto other gameplay elements faster.</p>
<p><strong>Feedback</strong> Feedback is important, it provides information and improves the experience. But first do something simple: dialogs and messages, colour changes, flashes or beeps.</p>
<p><strong>AI </strong>AI is difficult: it’s hard to predict whether any given strategy will work. The following can be use for AI placeholders before you start implementing the final algorithm:</p>
<ul>
<li>Random AI.</li>
<li>AI using simple heuristics can stand in for look-ahead AI, or vice-vera, whatever is easier.</li>
<li>Greedy algorithms.</li>
<li>AI that cannot play all possible moves.</li>
</ul>
<p><strong>Procedural Content </strong>If your game relies on procedural content; you can use the following types of stand-ins:</p>
<ul>
<li>Fixed content.</li>
<li>Purely random content.</li>
</ul>
<p><strong>Approximation </strong>Crude approximations can often be very useful. Here are some examples:</p>
<ul>
<li>Using collision spheres instead of collision meshes.</li>
<li>Using linear approximations for curves.</li>
</ul>
<h4>Use design Shortcuts</h4>
<p>[<strong>USE WITH CARE</strong>] You should avoid god-like classes in production code, but in prototypes, they can save a large amount of time. Instead of having a monster and player that extends from actor, dump all the code in actor, and use the familiar switch-atrocity instead of polymorphism.</p>
<p>Mistrust any data structure that is more sophisticated than a dynamic list, especially if you need to implement it yourself. Focus on simple, safe, and easy to understand data structures and algorithms.</p>
<h4>Avoid false design shortcuts</h4>
<ul>
<li>Rules for naming and organisation in prototypes don’t change.</li>
<li>Unnecessary exposure of data (using public fields) can bite you even in the short span of a day or two. It’s simply not that easy to remember whether setting health to zero will kill a monster, or whether you also need to destroy it yourself.</li>
<li>States machines (or anything that keeps track of states) almost <em>always</em> need more states than you think. If you try to use a shortcut instead of an appropriate abstraction, there is a big chance that you will get entangled in a buggy if-else mess.</li>
</ul>
<h4>Manage your tweakables</h4>
<ul>
<li>Make the game easier to fine-tune by keeping tweakables in one place.</li>
<li>Not every value needs to be tweaked; don’t be afraid to make them constants. But put them in a central place. <strong>Do not</strong> use magic numbers.</li>
<li>Carefully name your tweakables.</li>
<li>When you design a tweakable system, make sure that the exposed variables have clear and linear effects. Subtle tweakables are best hidden away (or left until the end). It’s better to make a system that is clear to understand, but cannot be controlled completely.</li>
</ul>
<h4>Write readable code</h4>
<p>Throwaway code should not be engineered to the highest standards possible.</p>
<p>However, it still needs to serve the purpose of communicating your intention, especially if you work in a team. A muddle of code can waste a lot of time. The most useful things to do when writing code for rapid development:</p>
<ul>
<li>Name things properly.</li>
<li>Be organised.</li>
<li>Avoid deep hierarchies and complicated dependencies.</li>
<li>Keep methods <em>damn</em> short.</li>
<li>Limit the number of “smart” classes. A smart class is anything that handles game logic. In smaller, volatile projects, it’s better to centralise logic and reserve helper classes for presentation. It makes it easier to make drastic changes. As long as you keep methods <em>short</em>.</li>
</ul>
<h4>Use implementation patterns</h4>
<p>An implementation pattern is a standard way of doing things. As an example, here is the implementation pattern of a game’s main file:</p>
<pre>public void Start()
{
   Reset()
}

public void ResetGame()
{
   currentLevel = 0;
   ResetLevel();
}

public void ResetLevel()
{
   DestroyObjectsFromPreviousPlay()
   InitialiseVariables()
   BuildLevel()
   InitGameState()
}

public void Update()
{
   ProcessGameFlowInput(); //Reset or next level

   if(gameOver) return;

   ProcessGamplayInput(); //player controls
   UpdateContinuousGameState(); //movement, AI, etc.

   gameState = GetGameState();

   if(gameState == GameState.Win) WinGame();
   if(gameState == GameState.Loose) LooseGame();
}

private void NextLevel()
{
   currentLevel++;
   ResetLevel();
}

private WinGame()
{
   ShowMessage("You win");
   EndGame();
}

private LooseGame()
{
   ShowMessage("You loose");
   EndGame();
}

private EndGame()
{
   gameOver = true;
}</pre>
<p>By using standards, you will reduce the time you need to spend on thinking, and then quibbling over alternatives. Implementation patterns are useful for production code too, but prototyping patterns are different: they emphasise simplicity and clarity, rather than OOP re-use and efficiency.</p>
<p>You can often set up patterns as templates that you can use during prototyping. If you can, do it!</p>
<p>(You collect or design these standards between prototyping stints – see below).</p>
<p>As another example, here is an implementation pattern for changing a variable’s value smoothly over time.</p>
<pre>private IEnumerator ChangeSomething(, 
   , )
{
   float timePassed = 0;
   Set(thingToChange, originalState);
   bool finalStateReached = false;

   DoThingsAtStartOfChange();

   while(!finalStateReached)
   {
       timePassed += Time.deltaTime;

       if(timePassed &gt;= time)
       {
          timePassed = time;
          finalStateReached = true;
       }

       Set(thingToChange, Lerp(originalState, finalState, 
          timePassed / totalTime);

       yield return null;       
   }

   PlayArivalSound();

   DoThingsAtEndOfChange();
}</pre>
<h3>D. Before, After, In-between</h3>
<p>If you build prototypes regularly, you can put yourself at a great advantage by doing some stuff in-between prototyping stints.</p>
<h4>Reflect</h4>
<p>After you finish with a prototype, do a post mortem, and identify the good and the bad. Review your notes shortly before your next prototyping project.</p>
<h4>Build a library of code that enables rapid prototyping</h4>
<p>This is different from your library that’s shared between production projects. You can use techniques that are a bit slow, or make some platform assumptions, or uses other technology that you cannot normally use for production code.</p>
<p>As an example, we rendered the grid in many of our games by drawing on a texture pixel-by-pixel, instead of using sprites. This method is fine for prototyping, but too slow for the final product.</p>
<h4>Identify implementation patterns, bug patterns and time sinks</h4>
<p>After a few prototypes, you may begin to see some patterns emerge. Make a list, and use this to inform what to put in your library.</p>
<p>Can you codify implementation patterns as templates in your library? Could you design better data structures to avoid some bug pattern? Can you give yourself a head start on a time sink by adding to your library?</p>
<h3>Further Reading</h3>
<ul>
<li><a href="http://www.lostgarden.com/search/label/prototyping%20techniques">Common Game Prototyping Pitfalls</a></li>
<li><a href="http://www.gamasutra.com/view/feature/179501/rapid_prototyping_tips_for_.php">Rapid Prototyping: Tips for Running an Effective R&amp;D Process</a></li>
<li><a href="http://www.gamasutra.com/view/feature/132702/quick_and_dirty_prototyping_a_.php">Quick and Dirty Prototyping: A Success Story</a></li>
</ul>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2014/01/08/rapid-game-prototyping-tips-for-programmers/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">5120</post-id>	</item>
		<item>
		<title>Geometry with Hex Coordinates</title>
		<link>http://devmag.org.za/2013/08/31/geometry-with-hex-coordinates/</link>
				<comments>http://devmag.org.za/2013/08/31/geometry-with-hex-coordinates/#comments</comments>
				<pubDate>Sat, 31 Aug 2013 15:53:40 +0000</pubDate>
		<dc:creator><![CDATA[Herman Tulleken]]></dc:creator>
				<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[hex coordinate]]></category>
		<category><![CDATA[hex grid]]></category>
		<category><![CDATA[vector math]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=5054</guid>
				<description><![CDATA[There is surprising little information available on hex-coordinates, despite how many games use hex grids. In this article I will explain some of the math so that you can do basic geometry in a hex grid, and design more elegant algorithms for your hex-grid games. There are different coordinate systems for hexes of course. (For [&#8230;]]]></description>
								<content:encoded><![CDATA[<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_136" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_136.png" alt="screen_136" width="625" height="450" border="0" /></p>
\( \newcommand{\bv}[1]{{\bf #1}} \)
\( \newcommand{\bperp}{{\bf perp}} \)
\( \newcommand{\bproj}{{\bf proj}} \)
<p>There is surprising little information available on hex-coordinates, despite how many games use hex grids. In this article I will explain some of the math so that you can do basic geometry in a hex grid, and design more elegant algorithms for your hex-grid games.</p>
<p><span id="more-5054"></span>There are different coordinate systems for hexes of course. (For a very informative explanation, with many interactive examples, see Amit Patel&#8217;s wonderful guide <em><a href="http://www.redblobgames.com/grids/hexagons/">Hexagon Grids</a></em>.) We will work with an <strong>axial coordinate system</strong>, which is illustrated in the figure below.</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_122" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_122.png" alt="screen_122" width="625" height="450" border="0" /></p>
<p>From time to time we will use an extra coordinate. This coordinate can be calculated from the other two, like this:</p>
<p>$$z = -(x + y)$$</p>
<p>So in fact \(x + y + z = 0\). Any equation using the \(z\)-coordinate can be rewritten using \(x\) and \(y\)-coordinates alone. However, some equations are much cleaner (and the symmetry much more obvious) when we use the \(z\)-coordinate.</p>
<p>Here I will use both notations \([x, y, z]\) and \([x, y]\) to denote the same point. A point or vector will be displayed in bold, like this: \(v\), and integer and real values like this: \(k\).</p>
<ul>
<li>The \(x\)-axis is where \(y = 0\). It&#8217;s the horizontal orange axis in the figure.</li>
<li>The \(y\)-axis is where \(x = 0\). It&#8217;s the skew vertical orange axis in the figure.</li>
<li>The \(z\)-axis is where \(z = 0\). It&#8217;s the skew vertical yellow axis in the figure.</li>
</ul>
<h3>Coordinates work like (integer) vectors</h3>
<p>We can view each point as the offset from the origin and from there treat points as vectors. These vectors work just like point vectors in the Cartesian coordinate system. It is useful to name the unit vectors that align with the axes with the directions they represent:</p>
<ul>
<li>\(\bv {e} = [1, 0, -1] \)</li>
<li>\(\bv {ne} = [0, 1, -1] \)</li>
<li>\(\bv {nw} = [-1, 1, 0] \)</li>
<li>\(\bv {w} = [-1, 0, 1] \)</li>
<li>\(\bv {sw} = [0, -1, 1] \)</li>
<li>\(\bv {ew} = [1, -1, 0] \)</li>
</ul>
<p>If we start from a point, and go 3 units east, we arrive at a new point, which we can now calculate as follows:</p>
<p>$$\bv v + 3\bv{e} = [x, y, z] + 3 \times [1, 0, -1] = [x, y, z] + [3, 0, -3] = [x + 3, y, z &#8211; 3]$$</p>
<p>If we instead move 2 units ne, we calculate the new point as follows:</p>
<p>$$\bv v + 2\bv {ne} = [x, y, z] + 2 \times [0, 1, -1] = [x, y, z] + [0, 2, -2] = [x, y + 2, z &#8211; 2]$$</p>
<p>Any point can be reached from another point by moving a certain amount of units east (possibly negative), and a certain amount north-east. So we can always find integers \(m\) and \(n\) sothat for any two points u and v, we have</p>
<p>$$\bv u + m \bv e + n\bv {ne} = \bv v$$</p>
<p>Using a little algebra, we rewrite the above as</p>
<p>$$\bv u + [m, n, -m &#8211; n] = \bv v$$</p>
<p>Or</p>
<p>$$[m, n, -m &#8211; n] = \bv v – \bv u$$</p>
<p>In other words, the offset (translation) from \(\bv u\) to \(\bv v\) can be found by subtracting \(\bv u\) from \(\bv v\).</p>
<h3>Distance and magnitude</h3>
<p>The hex-distance between two cells is the number of cells you have to traverse if you move from cell to cell from one point to the next. This is generally different from the Euclidean distance between the points; it is similar to the taxicab distance for rectangular coordinates.</p>
<p>The hex distance from any point to the origin can be calculated as half the sum of the absolute values of the coordinates:</p>
<p>$$d([x, y, z], [0, 0, 0]) = \frac{|x| + |y| + |z|}{2}$$</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_124" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_124.png" alt="screen_124" width="625" height="450" border="0" /></p>
<p>The distance between any two points \(\bv{v}_1\) and \(\bv{v}_2\) is the same as the distance of \(\bv{v}_1 &#8211; \bv{v}_2\) from the origin:</p>
<p>$$d([x_1, y_1, z_1], [x_2, y_2, z_2]) = d([x_1 &#8211; x_2, y_1 &#8211; y_2, z_1 &#8211; z_2], [0, 0, 0])$$</p>
<p>$$ = |x_1 &#8211; x_2| + |y_1 &#8211; y_2| + |z_1 &#8211; z_2|$$</p>
<p>It is convenient to define the magnitude of a hex vector as the distance of that point from the origin:</p>
<p>$$|[x, y, z]| = d([x, y, z], [0, 0, 0]) = \frac{|x| + |y| + |z|}{2}$$</p>
<p>We can then rewrite the distance equations as:</p>
<p>$$d(\bv{v}_1, \bv{v}_2) = |\bv{v}_1 &#8211; \bv{v}_2|$$</p>
<h3>The equation of a line</h3>
<p>Lines in hex-coordinates work similar to lines in Cartesian coordinates. We will only consider the &#8220;proper&#8221; lines, that is, were there are no holes in the lines, and all points in the line have exactly two neighbors.</p>
<p>There are only three proper lines through any given point.</p>
<p>The three lines through the origin are given by the following equations:</p>
<ul>
<li>\(x = 0\)</li>
<li>\(y = 0\)</li>
<li>\(z = 0\)</li>
</ul>
<p>If we change the equations slightly, we get lines through arbitrary points:</p>
<ul>
<li>\(x = k\)</li>
<li>\(y = k\)</li>
<li>\(z = k\)</li>
</ul>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_125" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_125.png" alt="screen_125" width="625" height="450" border="0" /></p>
<p>The figure above shows tree lines: \(x = 2\) in orange, \(y = 2\) in yellow, and \(z = 2\) in green.</p>
<p>The value \(k\) corresponds with the number of unit cells the line has been translated in the positive direction from the axis to which it is parallel. This makes it very easy to write the equation of a line with inspection.</p>
<p>Note a few things:</p>
<ul>
<li>Lines of the form \(x = 0\) are all parallel to the \(y\)-axis. Thus, all lines of the form \(x = k\) are parallel to each other.</li>
<li>Lines of the form \(y = 0\) are all parallel to the \(x\)-axis. Thus, all lines of the form \(y = k\) are parallel to each other.</li>
<li>Lines of the form \(z = 0\) are parallel to neither the X nor Y axis. Thus, all lines of the form \(z = k\) are parallel to each other.</li>
<li>We can rewrite the equations of lines \(z = k\) as \(x + y = -k\).</li>
<li>Two distinct points on a line always have exactly one coordinate in common. If the line is of the form \(x = k\), then they have the \(x\)-coordinate in common, and so on.</li>
</ul>
<p>These facts make it very easy to write the equations of a line by inspection:</p>
<ul>
<li>Determine whether the line is parallel to the \(x\)-axis, the \(y\)-axis, or neither. From this determine whether the form is \(x = k\), \(y = k\), or \(z = k\)</li>
<li>Now calculate the (signed) distance \(k\) from the origin along the axis (the same as the variable in the equation).</li>
</ul>
<h3>The intersection of lines</h3>
<p>To determine the intersection of two lines in hex space is extremely easy. As always in geometry, we have several cases:</p>
<ul>
<li>The lines are coincident. In this case, the solution is of course all the points on the two lines (which are really one line).</li>
<li>The lines are not-coincident, but parallel. This is of course when the lines have the same form of the equation: both are \(x = \ldots\), or \(y =\ldots\) , or \(z = \ldots\). In this case, there are no solutions.</li>
<li>The lines are not parallel. In this case, the equations have different forms. The solution is a single point.</li>
</ul>
<p>The last case is the one we are really interested in. As an example, let&#8217;s find the intersection of the lines \(x = 3\) and \(y = 5\). The intersection is simply \([3, 5]\). The augmented point is then \([3, 5, -8]\) — remember, \(z = -x &#8211; y\). More generally, we can just fill in the two coordinates from the corresponding equations:</p>
<ul>
<li>If we have \(x = k\), the \(x\)-coordinate is \(k\).</li>
<li>If we have \(y = m\), the \(y\)-coordinate is \(m\).</li>
<li>If we have \(z = n\), the \(z\)-coordinate is \(n\).</li>
</ul>
<p>In general we have two equations, so we have two coordinates of the point. The third can be calculated from \(x + y + z = 0\).</p>
<p>Here are two more examples:</p>
<p>\(x = -3\), \(z = 3\). The intersection is \([-3, \ldots, 3]\), or after we calculated the \(y\), \([-3, 0, 3]\).</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_126" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_126.png" alt="screen_126" width="625" height="450" border="0" /></p>
<p>\(y = -2\), \(z = 2\). The intersection is \([\ldots, -2, 2]\), or after we calculated the \(x\), \([0, 2, -2]\).</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_127" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_127.png" alt="screen_127" width="625" height="450" border="0" /></p>
<h3>Half-planes</h3>
<p>A half-plane is all the points that fall on one side of the line, and includes the line itself as well.</p>
<p>Since there are only three types of proper line, there are also only six types of proper half-planes (one on each of the two sides of each line).</p>
<p>Their equations are given below:</p>
<ul>
<li>\(x \geq k\) and \(x \leq k\)</li>
<li>\(y \geq k\) and \(y \leq k\)</li>
<li>\(z \geq k\) and \(z \leq k\)</li>
</ul>
<p>Half-planes are useful to form polygons. Any convex polygon is the intersection of half-planes. This is true for normal Cartesian coordinates, as well as hex-coordinates.</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_128" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_128.png" alt="screen_128" width="625" height="450" border="0" /></p>
<p>$$x \geq 2$$</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_129" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_129.png" alt="screen_129" width="625" height="450" border="0" /></p>
<p>$$x \leq 2$$</p>
<h3>Triangles</h3>
<p>Triangles are bound by three lines, no two of which are parallel.</p>
<p>The equation for an up-triangle is the following:</p>
<p>$$(x \geq k) \cap (y \geq m) \cap (z \geq n)$$</p>
<p>And for a down-triangle, we have</p>
<p>$$(x \leq k) \cap (y \leq m) \cap (z \leq n)$$</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_130" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_130.png" alt="screen_130" width="625" height="450" border="0" /></p>
<p>The figure above shows two triangles. The up-triangle has this equation:</p>
<p>$$(x \geq 0) \cap (y \geq 1) \cap (z \geq -3)$$</p>
<p>and the down triangle has this equation:</p>
<p>$$(x \leq 0) \cap (y \leq -1) \cap (z \leq 3)$$</p>
<p><span style="line-height: 1.714285714; font-size: 1rem;">By taking the equations of the lines of the triangle sides two at a time, we can easily calculate the three vertices of the triangle:</span></p>
<ul>
<li>\([k, m, \ldots] \rightarrow [k, m, -k -m]\)</li>
<li>\([k, \ldots, n] \rightarrow [k, -k &#8211; n, n]\)</li>
<li>\([\ldots, m, n] \rightarrow [-m &#8211; n, m, n]\)</li>
</ul>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_131" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_131.png" alt="screen_131" width="625" height="450" border="0" /></p>
<p>The length of the sides can now be calculated. The distance between the first two vertices above is:</p>
<p>$$d([k, m], [k, -k &#8211; n] = \frac{|k &#8211; k| + |m + k + n| + |-k &#8211; m &#8211; n|}{2} = |k + m + n|$$</p>
<p>In fact, the other two sides have the same length.</p>
<ul>
<li>In hex-space, all triangles are equilateral.</li>
</ul>
<p>We can just as easily get the equations of a triangle from the vertices. But there is a catch:</p>
<ul>
<li>not any three points form a (proper) triangle.</li>
</ul>
<p>Three points form a triangle only when each pair of points have a coordinate in common, and the common coordinate is a different one (from x, y, or z) for each pair. In other words, two points must have their \(x\)-coordinate in common, two points must have their \(y\)-coordinate in common, and two points must have their \(z\)-coordinate in common.</p>
<p>To write the equation for the triangle, simply find the common \(x\)-coordinate \(k\), the common \(y\)-coordinate \(m\), and the common \(z\)-coordinate \(n\), determine whether the triangle is up or down, and then write the appropriate equation:</p>
<p>$$(x \geq k) \cap (y \geq m) \cap (z \geq n)$$</p>
<p>or</p>
<p>$$(x \leq k) \cap (y \leq m) \cap (z \leq n)$$</p>
<p>The triangle is up if the \(y\)-coordinate of the vertex not on the line \(y = m\) is bigger than \(m\). The \(y\)-coordinate of that vertex is \(-k -n\). So the triangle is up if \(-k -n &gt; m\); otherwise, it&#8217;s down.</p>
<h3>Quadrangles</h3>
<p>Quadrangles are bounded by four lines, and thus can be written as the intersection of four half planes. As with triangles, it is easy to determine the vertices from the equation, and vice versa, although you need to take a bit more care because at least one pair of lines will be parallel.</p>
<p><em>All quadrangles in hex-space are trapezoids (for people outside the US: trapeziums).</em></p>
<p>I give a few examples:</p>
<p>Trapezoid:</p>
<p>$$(x \geq -3) \cap (z \geq -3) \cap (y \leq 2) \cap (y \geq 0)$$</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_132" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_132.png" alt="screen_132" width="625" height="450" border="0" /></p>
<p>Parallelogram:</p>
<p>$$(x \geq -3) \cap (x \leq 3) \cap (y \leq 2) \cap (y \geq 0)$$</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_133" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_133.png" alt="screen_133" width="625" height="450" border="0" /></p>
<h3>General convex polygon</h3>
<p>In hex space, convex polygons can have up to six sides. The general equation for any convex polygon is the intersection of six half-planes:</p>
<p>$$(k_1 \leq x \leq k_2) \cap (m_1 \leq y \leq m_2) \cap (n_1 \leq z \leq n_2)$$</p>
<p>Note that we can also use this form of equation to represent triangles and quadrangle, although the equations then are not unique. For example, the following two equations represent the same triangle:</p>
<p>$$(-4 \leq x \leq 100) \cap (-4 \leq y \leq 100) \cap (-4 \leq z \leq 100)$$</p>
<p>$$(-4 \leq x \leq 200) \cap (-4 \leq y \leq 200) \cap (-4 \leq z \leq 200)$$</p>
<p>From the general equation we can make the following observations:</p>
<ul>
<li>Pentagons have two pairs of sides that are parallel.</li>
<li>Hexagons have three pairs of sides that are parallel.</li>
</ul>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_134" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_134.png" alt="screen_134" width="625" height="450" border="0" /></p>
<p>The figure above shows an irregular hexagon with the equation (the shape includes both orange and yellow points, I made the borders yellow so that it is easier to see the lines that form the sides):</p>
<p>$$(-4 \leq x \leq 3) \cap (–1 \leq y \leq 2) \cap (-1 \leq z \leq 4)$$</p>
<h3>Regular Hexagons</h3>
<p>The equation of a regular hexagon with centre c can be written in a very simple form:</p>
<p>$$|\bv v &#8211; \bv c| \leq r$$</p>
<p><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="screen_135" src="http://devmag.org.za/blog/wp-content/uploads/2013/08/screen_135.png" alt="screen_135" width="625" height="450" border="0" /></p>
<p>In the hex world, all points within a distance r of some point form a regular hexagon. The image above shows a hexagon with centre \([1, 1]\) and radius \(r = 2\).</p>
<h3>Rotation</h3>
<p>Using three coordinates, there is an easy trick to rotate a point by 60 degrees around the origin: rotate the coordinates left, and change all the signs:</p>
<p>$$[x, y, z] \rightarrow [-y, -z, -x]$$</p>
<p>(From here it&#8217;s easy to remove the \(z\)-coordinate, as usual, to find:</p>
<p>$$[x, y] \rightarrow [-y, x + y]$$</p>
<p>By applying the trick above repeatedly, we can find similar expressions for points rotated by 120, 180, 240, and 300 degrees.</p>
<p>It is also easy to see immediately whether a point is another point rotated by some multiple of 60. The two points must have the same coordinates (or the same <em>negative</em> coordinates), in the same order, but potentially shifted:</p>
<ul>
<li>\([2, 3, 4]\) and \([3, 4, 2]\) (Yes)</li>
<li>\([2, 3, 4]\) and \([2, 4, 3]\) (No &#8211; not in same order)</li>
<li>\([2, 3, 4]\) and \([-4, -2, -3]\) (Yes)</li>
<li>\([2, 3, 4]\) and \([-4, 2, 3]\) (No &#8211; signs not consistent)</li>
</ul>
<p>We can rotate a point \( n \times 60\) degrees around any point \(\bv {c}\):</p>
<p>$$R_{60n}(\bv {v} &#8211; \bv {c}) + \bv {c}$$</p>
<h3>Reflection</h3>
<p>Reflection about \(x = 0\) (\(y\)-axis)</p>
<ul>
<li>Flip \(x\), keep \(z\), recalculate \(y = -x &#8211; z\)</li>
</ul>
<p>Reflection about \(y = 0\) (\(x\)-axis)</p>
<ul>
<li>Flip \(y\), keep \(z\), recalculate \(x = -y &#8211; z\)</li>
</ul>
<p>Reflection about \(x + y = 0\) (\(z\)-axis)</p>
<ul>
<li>Flip both \(x\), \(y\), and \(z\)</li>
</ul>
<p>With suitable translations, we can reflect a point about any line.</p>
<p>For example, to reflect point about the line \(x = 1\), we translate the point by \([-1, 0]\), reflect it about the \(y\)-axis, and then translate it back by \([1, 0]\).</p>
<p>$$R_Y(\bv {v} &#8211; \bv {e}) + \bv{e}$$</p>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2013/08/31/geometry-with-hex-coordinates/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">5054</post-id>	</item>
		<item>
		<title>How to Choose Colours Procedurally (Algorithms)</title>
		<link>http://devmag.org.za/2012/07/29/how-to-choose-colours-procedurally-algorithms/</link>
				<comments>http://devmag.org.za/2012/07/29/how-to-choose-colours-procedurally-algorithms/#comments</comments>
				<pubDate>Sun, 29 Jul 2012 12:19:29 +0000</pubDate>
		<dc:creator><![CDATA[Herman Tulleken]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[palette]]></category>
		<category><![CDATA[procedural content]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4948</guid>
				<description><![CDATA[This article gives a set of algorithms for choosing colours procedurally.]]></description>
								<content:encoded><![CDATA[<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="colours" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/colours.jpg" alt="colours" width="680" height="340" border="0" /></p>
<p>Changing the colours of art can be a great way to increase the amount of content in your game, and add variety and richness. It is relatively easy to implement. What is not always as easy is to get a set of colours that looks <em>nice</em>. This article gives some ideas for choosing colour palettes that look nice.<span id="more-4948"></span></p>
<h3><a name="h.qma71twn8t4c"></a>A few things about colour</h3>
<p>Colour is surprisingly complex. How colour works is determined by the physics of light and materials, the biology of our eyes and brains, mixed with a bit of psychology.</p>
<p>Although you don’t need to know <em>all </em>about the physics, biology, and psychology of colour vision, it is useful to have some background information (which you can find references to at the end of this article).</p>
<p>For palette choosing, there are a few important points.</p>
<p><strong>Digital colour theory differs considerably from theories based on pigments (or chemicals, or metals in crystals).</strong> In fact, no system of colour mixing can produce all colours that occur in nature. You can buy a dark very bright green from a paint shop, but the closest colour your screen can reproduce will look desaturated (just look at <a href="https://www.google.co.za/search?q=painted+colour+wheel&amp;hl=en&amp;safe=off&amp;prmd=imvns&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ei=_KgNUOiJLsWChQfzjuD7CQ&amp;ved=0CE0Q_AUoAQ&amp;biw=1920&amp;bih=947">images of painted colour wheels</a>). When you research colour for algorithms, make sure that they apply to digital RGB colour.</p>
<p><strong>Vector distances in RGB and many other colour models don’t correspond to differences in perception.</strong></p>
<p><strong>Edit:</strong> Turns out I have fallen prey to the very thing I talk about. The descriptions below are true on my monitor, but need not be on your monitor. The main point stands though &#8211; RGB values and perception are different (especially when you throw in the variability of display devices).</p>
<p><em>Brightness</em><br />
<img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="grey" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/grey.png" alt="grey" width="680" height="78" border="0" /><br />
These greys are equally spaced. But notice how much easier it is to distinguish between lighter greys.</p>
<p><em>Hue differentiation.</em><br />
<img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="heu" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/heu.png" alt="heu" width="680" height="206" border="0" /><br />
In each row, the hue differs by 5%. Notice that certain colours cannot be distinguished. Also notice that it is different depending on the brightness. Lighter blues is more distinguishable than darker blues, while darker magentas are more distinguishable than lighter ones.</p>
<p>This fact becomes important when you try to select colours that look “equally” far apart; in general, it cannot be done without using a perception-based colour space (such as LAB colours), or making appropriate adjustments in other colour spaces.</p>
<p>Here is a bit more on the matter:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Color_difference#Tolerance">http://en.wikipedia.org/wiki/Color_difference#Tolerance</a></li>
</ul>
<p>Here is an a way of computing a useful colour distance that may come in handy later:</p>
<ul>
<li><a href="http://www.emanueleferonato.com/2009/08/28/color-differences-algorithm/">http://www.emanueleferonato.com/2009/08/28/color-differences-algorithm/</a></li>
<li><a href="http://www.emanueleferonato.com/2009/09/08/color-difference-algorithm-part-2/">http://www.emanueleferonato.com/2009/09/08/color-difference-algorithm-part-2/</a></li>
</ul>
<p><a href="http://en.wikipedia.org/wiki/Lab_color_space">Lab colour spaces</a> are intended to be perceptually more uniform, and may be the basis of colour selection algorithms that give visually more pleasing results. (Photoshop gurus will know that hue adjustments have fewer artefacts when manipulating LAB channels and not RGB channels).</p>
<p><strong>Colour perception is not absolute.</strong> Colours appear differently depending on surrounding colours. This is an important factor when selecting colour palettes that work with existing palettes, or combining more than one palette.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="color_relavance" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_relavance.png" alt="color_relavance" width="240" height="240" border="0" /></p>
<p>Here is more information on colour contrast effects:</p>
<ul>
<li><a href="http://www.uxmatters.com/mt/archives/2006/01/color-theory-for-digital-displays-a-quick-reference-part-ii.php#colorContrastEffects">http://www.uxmatters.com/mt/archives/2006/01/color-theory-for-digital-displays-a-quick-reference-part-ii.php#colorContrastEffects</a></li>
</ul>
<p><strong>Colour harmony theory.</strong> Although why certain combinations of colours look better than others is somewhat of a mystery, theories of colour harmony is a good place to start understanding many good-looking palettes.</p>
<p>See for example:</p>
<ul>
<li>Basic overview <a href="http://www.malanenewman.com/color_theory_color_wheel.html">http://www.malanenewman.com/color_theory_color_wheel.html</a></li>
<li>An overview of different theories <a href="http://colour-emotion.co.uk/harmony.html">http://colour-emotion.co.uk/harmony.html</a></li>
</ul>
<p><a name="h.pg8tmdy0a6l4"></a></p>
<h3>Uses of procedural palettes</h3>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="tinywings" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/tinywings.png" alt="tinywings" width="680" height="436" border="0" /></p>
<p>Procedural palettes can be used to:</p>
<ul>
<li>Get more variety in successively generated scenes,  such as in <em>Tiny Wings</em>.</li>
<li>To get more variety from a single asset, as shown below.</li>
<li>To get automatic colours for interface components, such as in the (notoriously ugly) graphs of earlier versions of Microsoft Excel or and Open Office Calc.</li>
</ul>
<h3>Considerations</h3>
<p>When selecting algorithms, you must think about what you need:</p>
<ul>
<li>How many colours do you need? A few, or many? A fixed number, or an arbitrary number?</li>
<li>How should the colours in the palette relate to one another? For example, should the colours form a harmonic triad?</li>
<li>Do you need a high contrasts palette or a palette with a minimum vector distance between colours?</li>
<li>What colours will be used with the procedurally selected colours?</li>
<li>Will you colour convey meaning? Do they need to match real-world elements? Are they used symbolically to distinguish between different types of elements?</li>
<li>What type of variety do you need? Variety in successive generations? Variety in a scene?</li>
</ul>
<h2><a name="h.owvwfo6ihqun"></a>7 Algorithms</h2>
<h3><a name="h.x93xw6yzqu2s"></a>1. Choosing random colours from a handpicked pre-set</h3>
<p>This very simple algorithm gives the most control, and is easy to implement. It is only useful for smaller palettes, and of course all palettes are limited to the original set. However, it can be combined with other algorithms to give bigger sets of colours.</p>
<h3>2. Uniform Random RGB</h3>
<p>The simplest algorithm for selecting colours procedurally is to simply choose random values for each of the three RGB channels.</p>
<pre>color = new Color(Random(), Random(), Random())</pre>
<p><img class="alignnone size-full wp-image-4950" title="Uniform_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Uniform_5_2.png" alt="" width="680" height="100" srcset="http://devmag.org.za/blog/wp-content/uploads/2012/07/Uniform_5_2.png 680w, http://devmag.org.za/blog/wp-content/uploads/2012/07/Uniform_5_2-300x44.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>This algorithm gives sets of colours the are usually quite ugly. There is no structure, no relationship among colours in the palette, no pattern that pleases the eye. All the algorithms below attempt to constrain the colours generated so that there are relationships or coherence among colours.</p>
<h4><a name="h.sq96mh5tr7wp"></a>3. Random Offset</h4>
<p>This algorithm computes a palette by computing a small random offset from a given colour.</p>
<p><img class="alignnone size-full wp-image-4951" title="Offset_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_0.png" alt="" width="680" height="100" srcset="http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_0.png 680w, http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_0-300x44.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p><img class="alignnone size-full wp-image-4952" title="Offset_5_1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_1.png" alt="" width="680" height="100" srcset="http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_1.png 680w, http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_1-300x44.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p><img class="alignnone size-full wp-image-4953" title="Offset_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_2.png" alt="" width="680" height="100" srcset="http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_2.png 680w, http://devmag.org.za/blog/wp-content/uploads/2012/07/Offset_5_2-300x44.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>An easy implementation simply calculates random offsets for each of RGB components. An alternative is to just change the value of the colour by a random offset.</p>
<pre>float value = (color.r + color.g + color.b)/3;
float newValue = value + 2*Random() * offset – offset;
float valueRatio = newValue / value;
Color newColor;
newColor.r = color.r * valueRatio;
newColor.g = color.g * valueRatio;
newColor.b = color.b * valueRatio;</pre>
<p>Changing the value randomly can in certain cases simulate shadows (see the middle row below), so that a scene looks like it has more depth than it really has.</p>
<p>In general, this algorithm is:</p>
<ul>
<li>Not good for small palettes where high contrast is desired.</li>
<li>Good for enriching a scene where the base colours are defined and repeated many times.</li>
<li>Good for colouring tiles with seams (to get more variance with seamless tiles requires a bit more work. See the section <em>Dynamic Colouring</em> in <a href="http://devmag.org.za/2009/05/28/getting-more-out-of-seamless-tiles/">Getting More from Seamless Tiles</a>).</li>
</ul>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="random_offset0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/random_offset0.png" alt="random_offset0" width="220" height="146" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="random_offset1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/random_offset1.png" alt="random_offset1" width="220" height="146" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="random_offset2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/random_offset2.png" alt="random_offset2" width="220" height="146" border="0" /></td>
</tr>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="random_offset0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/random_offset01.png" alt="random_offset0" width="220" height="146" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="random_offset3" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/random_offset3.png" alt="random_offset3" width="220" height="146" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="random_offset4" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/random_offset4.png" alt="random_offset4" width="220" height="146" border="0" /></td>
</tr>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_105" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_105.png" alt="screen_105" width="220" height="220" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_103" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_103.png" alt="screen_103" width="220" height="220" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_101" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_101.png" alt="screen_101" width="220" height="220" border="0" /></td>
</tr>
</tbody>
</table>
<h4><a name="h.xd2xto2wh2tt"></a></h4>
<p>The effect of the maximum offset you choose is different based on the base colour:</p>
<ul>
<li>The less saturated the base colour, the more colourful the result is perceived.</li>
<li>Different hues will have different perceived variance. For example, if the base colour is yellow, the result will be perceived as more colourful than if the base colour was green.</li>
</ul>
<h3>4. Selecting from a gradient</h3>
<p>In the code examples below, <code>Gradient.GetColor</code> takes a parameter between 0 and 1 and generate the corresponding colour on the gradient.</p>
<p><strong>Uniform Random </strong>Randomly select values between 0 and 1, and map this to the gradient to select colours. This gives little structure, except for that already inherent in the gradient.</p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="gradient0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/gradient0.png" alt="gradient0" width="220" height="146" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="gradient1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/gradient1.png" alt="gradient1" width="220" height="146" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="gradient2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/gradient2.png" alt="gradient2" width="220" height="146" border="0" /></td>
</tr>
</tbody>
</table>
<p><strong>Grid</strong> This is useful for selecting a known number of colours, with the assurance that no two colours will be closer to each other (along the gradient) than 1/n.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Grid_Rainbow_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Grid_Rainbow_5_2.png" alt="Grid_Rainbow_5_2" width="680" height="100" border="0" /></p>
<p>This is useful for colour which convey information, if the number of colours is small.</p>
<p><strong>Jittered Grid</strong> This is useful to get more variety with a small number of colours, where you know the number of colours up front. (The variety is not among the colours, but among different generations).</p>
<pre>for(int i = 0; i &lt; n; i++)
   color[i] = gradient.GetColor((i + Random.NextFloat()) * intervalSize)</pre>
<p>Using a jittered grid works well for a small selection of colours, so that multiple generations give different results. One disadvantage of using a jittered grid is that colours in the sequence are not guaranteed to be equally distinct from each other. You can address this by limiting the amount of jitter to guarantee a minimum distance between colours:</p>
<pre>maxJitter = ...//some value between 0 1nd 1

for(int i = 0; i &lt; n; i++)
   color[i] = gradient.GetColor(
      (i + 0.5 + (2 * Random.NextFloat() - 1) * maxJitter) * intervalSize);</pre>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="JitteredRainbow_5_2a" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/JitteredRainbow_5_2a.png" alt="JitteredRainbow_5_2a" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="JitteredRainbow_5_2b" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/JitteredRainbow_5_2b.png" alt="JitteredRainbow_5_2b" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="JitteredRainbow_5_2c" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/JitteredRainbow_5_2c.png" alt="JitteredRainbow_5_2c" width="680" height="100" border="0" /></p>
<p><strong>Golden Ratio </strong>This is a scheme to select a sequence of colours, not necessarily up front, so that consecutively selected colours are always far from each other. Colours never repeat (although, over time, colours become close to previously chosen colours).</p>
<pre>offset = Random.NextFloat();

for (int i = 0; i &lt; n; i++)
   color[i] = gradient.GetColor(offset + (0.618033988749895f * i) % 1);</pre>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="GoldenRatioGradient_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/GoldenRatioGradient_5_0.png" alt="GoldenRatioGradient_5_0" width="680" height="100" border="0" /></p>
<p>This algorithm is useful for selecting colours for contrast in an interface, where high contrast between successive colours is guaranteed.</p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image24" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/image24.png" alt="image24" width="335" height="197" border="0" /></td>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image43" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/image43.png" alt="image43" width="335" height="213" border="0" /></td>
</tr>
</tbody>
</table>
<p>Here is an article explaining why this works:</p>
<ul>
<li><a href="http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/">http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/</a></li>
</ul>
<h3>5. Selecting random channels in other colour spaces</h3>
<p>For example, good results can be obtained using the HSL colour space.</p>
<p><strong>Random Hue </strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Hue_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Hue_5_0.png" alt="Hue_5_0" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Hue_5_1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Hue_5_1.png" alt="Hue_5_1" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Hue_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Hue_5_2.png" alt="Hue_5_2" width="680" height="100" border="0" /></p>
<p><strong>Random Saturation</strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Saturation_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Saturation_5_2.png" alt="Saturation_5_2" width="680" height="100" border="0" /></p>
<p><strong>Random Luminance</strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Luminance_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Luminance_5_2.png" alt="Luminance_5_2" width="680" height="100" border="0" /></p>
<p><strong>Random Saturation and Luminance</strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Saturation_Luminance_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Saturation_Luminance_5_2.png" alt="Saturation_Luminance_5_2" width="680" height="100" border="0" /></p>
<p><a name="h.t00pnudemnhp"></a></p>
<h4>6. Standard Colour Harmonies</h4>
<p><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">http</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">://</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">www</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">.</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">websiteoptimization</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">.</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">com</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">/</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">speed</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">/</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">tweak</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">/</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">color</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">&#8211;</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">harmony</a><a href="http://www.websiteoptimization.com/speed/tweak/color-harmony/">/</a></p>
<p>Methods for choosing random colours for standard colour harmonies all work basically the same: limit the possible choices of hue, and control saturation and luminance. We can use a generic triadic algorithm with suitable parameters to generate a variety colour harmonies:</p>
<p>The algorithm takes a few parameters; the important ones are two offset angles, and two angle ranges.</p>
<p>The simplest form of the algorithm works as follows:</p>
<ul>
<li>Select a random reference angle.</li>
<li>Select a random angle in the total of the range (the three range angles added together)</li>
<li>If the angle is smaller than the first range, keep it</li>
<li>Otherwise, if the angle is bigger than the first range, but smaller than the sum of the first Two ranges, offset it by the first offset angle</li>
<li>Otherwise, offset it by the second offset angle</li>
<li>Add this angle to the reference angle</li>
<li>The colour with this angle as hue is a colour generated with the triad harmony</li>
</ul>
<p>Here is a C# implementation of this algorithm that generates a given number of colours with controlled saturation and luminance.</p>
<pre>public static List GenerateColors_Harmony(
   int colorCount,
   float offsetAngle1,
   float offsetAngle2,
   float rangeAngle0,
   float rangeAngle1,
   float rangeAngle2,
   float saturation, float luminance)
{
   List colors = new List();

   float referenceAngle = random.NextFloat() * 360;

   for (int i = 0; i &lt; colorCount; i++)
   {
      float randomAngle = 
         random.NextFloat() * (rangeAngle0 + rangeAngle1 + rangeAngle2);

      if (randomAngle &gt; rangeAngle0)
      {
         if (randomAngle &lt; rangeAngle0 + rangeAngle1)
         {
            randomAngle += offsetAngle1;
         }
         else
         {
            randomAngle += offsetAngle2;
         }
      }

      HSL hslColor = new HSL(
         ((referenceAngle + randomAngle) / 360.0f) % 1.0f,
         saturation, 
         luminance);

      colors.Add(hslColor.Color);
   }

   return colors;
}</pre>
<p>The algorithm can be made a bit more intuitive by centring the reference and offset angles in corresponding ranges.</p>
<ul>
<li>Select a random reference angle.</li>
<li>Select a random angle in the total of the range (the three range angles added together)</li>
<li>If the angle is smaller than the first range, reduce it by half the first range.</li>
<li>Otherwise, if the angle is bigger than the first range, but smaller than the sum of the first two ranges, offset it by the first offset angle minus the second range.</li>
<li>Otherwise, offset it by the second offset angle minus the third range.</li>
<li>Add this angle to the reference angle.</li>
<li>The colour with this angle as hue is a colour generated with the triad harmony.</li>
</ul>
<p><strong>More varieties</strong></p>
<ul>
<li>With the centred version of the algorithm, it is easy to supply (instead of generating) the reference angle, making it possible to chain the algorithm with other colour selection algorithms.</li>
<li>More variety can be added by selecting random saturation and random luminance (possibly within a range from given parameters). This can potentially change the harmonic scheme by fringe colours being emphasized by their saturation / luminance. In many cases this is ok.</li>
<li>The hue can be selected uniformly instead of randomly across the total range. This will insure colours are a minimum hue-distance apart.</li>
<li>Withsuitableparameters, we can generate common colour schemes:
<ul>
<li><strong>Analogous:</strong> Choose second and third ranges 0.</li>
<li><strong>Complementary:</strong> Choose the third range 0, and first offset angle 180.</li>
<li><strong>Split Complementary: </strong>Choose offset angles 180 +/- a small angle. The second and third ranges must be smaller than the difference between the two offset angles.</li>
<li><strong>Triad:</strong> Choose offset angles 120 and 240.</li>
</ul>
</li>
</ul>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Harmony2_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Harmony2_5_0.png" alt="Harmony2_5_0" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Harmony_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Harmony_5_0.png" alt="Harmony_5_0" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Harmony2_5_1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Harmony2_5_1.png" alt="Harmony2_5_1" width="680" height="100" border="0" /></p>
<h3>7. Triad Mixing</h3>
<p>This algorithm takes three colours, and mixes them randomly to create a palette.</p>
<p>The standard algorithm produces many grey colours. If this is not desired, the amount of greyness can be controlled by limiting the contribution of one of the three colours. This version of the algorithm is given here (if the greyControl is 1, it is equivalent to the standard algorithm).</p>
<pre>public static Color RandomMix(Color color1, Color color2, Color color3, 
   float greyControl)
{
   int randomIndex = random.NextByte() % 3;

   float mixRatio1 =
      (randomIndex == 0) ? random.NextFloat() * greyControl : random.NextFloat();

   float mixRatio2 = 
      (randomIndex == 1) ? random.NextFloat() * greyControl : random.NextFloat();

   float mixRatio3 = 
      (randomIndex == 2) ? random.NextFloat() * greyControl : random.NextFloat();

   float sum = mixRatio1 + mixRatio2 + mixRatio3;

   mixRatio1 /= sum;
   mixRatio2 /= sum;
   mixRatio3 /= sum;

   return Color.FromArgb(
      255,
      (byte)(mixRatio1 * color1.R + mixRatio2 * color2.R + mixRatio3 * color3.R),
      (byte)(mixRatio1 * color1.G + mixRatio2 * color2.G + mixRatio3 * color3.G),
      (byte)(mixRatio1 * color1.B + mixRatio2 * color2.B + mixRatio3 * color3.B));
}</pre>
<p>Different mixing algorithms can be used, for example subtractive mixing, or hue interpolation.</p>
<p><strong>Low Grey Value</strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix1_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix1_5_0.png" alt="Mix1_5_0" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix1_5_1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix1_5_1.png" alt="Mix1_5_1" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix1_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix1_5_2.png" alt="Mix1_5_2" width="680" height="100" border="0" /></p>
<p><strong>Medium Grey <strong>Value</strong></strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix5_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix5_5_0.png" alt="Mix5_5_0" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix5_5_1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix5_5_1.png" alt="Mix5_5_1" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix5_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix5_5_2.png" alt="Mix5_5_2" width="680" height="100" border="0" /></p>
<p><strong>High Grey <strong>Value</strong></strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix9_5_0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix9_5_0.png" alt="Mix9_5_0" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix9_5_1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix9_5_1.png" alt="Mix9_5_1" width="680" height="100" border="0" /></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Mix9_5_2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/Mix9_5_2.png" alt="Mix9_5_2" width="680" height="100" border="0" /></p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_137" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_137.png" alt="screen_137" width="220" height="137" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_142" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_142.png" alt="screen_142" width="220" height="137" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_130" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_130.png" alt="screen_130" width="220" height="137" border="0" /></td>
</tr>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_69" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_69.png" alt="screen_69" width="220" height="166" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_74" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_74.png" alt="screen_74" width="220" height="166" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_75" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_75.png" alt="screen_75" width="220" height="166" border="0" /></td>
</tr>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_10" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_10.png" alt="screen_10" width="220" height="153" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_11" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_11.png" alt="screen_11" width="220" height="153" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="screen_12" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/screen_12.png" alt="screen_12" width="220" height="153" border="0" /></td>
</tr>
</tbody>
</table>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="mix0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/mix0.png" alt="mix0" width="221" height="138" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="mix2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/mix2.png" alt="mix2" width="221" height="138" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="mix1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/mix1.png" alt="mix1" width="221" height="138" border="0" /></td>
</tr>
</tbody>
</table>
<p>Below you can see the effect of setting the grey value. On the left it is 0, on the right it is 1.</p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="mix_g0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/mix_g0.png" alt="mix_g0" width="335" height="202" border="0" /></td>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="mix_g1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/mix_g1.png" alt="mix_g1" width="335" height="202" border="0" /></td>
</tr>
</tbody>
</table>
<h2>Monochromatic Textures are Boring</h2>
<p>Unlike hand-painted textures, textures altered procedurally can look flat and uninteresting.</p>
<p>There are several ways to deal with this issue. All of them require intensive artist input, but it is important to understand the techniques and how they work (and how they will affect the art pipeline).</p>
<p><strong>Use coloured textures. </strong>The base textures need not be totally greyscale. Painting them with colours will offset the final colour, and can be used for local colour variations.</p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct0" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct0.png" alt="color_correct0" width="220" height="199" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct1" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct1.png" alt="color_correct1" width="220" height="199" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct2.png" alt="color_correct2" width="220" height="199" border="0" /></td>
</tr>
<tr>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="diffus_grey" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/diffus_grey.png" alt="diffus_grey" width="220" height="110" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="diffus_grey2" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/diffus_grey2.png" alt="diffus_grey2" width="220" height="110" border="0" /></td>
<td valign="top" width="226"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="diffus_grey3" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/diffus_grey3.png" alt="diffus_grey3" width="220" height="110" border="0" /></td>
</tr>
</tbody>
</table>
<p><strong>Channel independent colour correction.</strong> Sometimes a good effect can be obtained by adjusting values for channels independently, for example, by a post-effect. In the example below, for example, shadows have been made a bit redder. (The image without any colour correction is shown on the left).</p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct3" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct3.png" alt="color_correct3" width="335" height="303" border="0" /></td>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct4" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct4.png" alt="color_correct4" width="335" height="303" border="0" /></td>
</tr>
</tbody>
</table>
<p><strong>Using coloured lights. </strong>By using coloured lights at slightly different angles, flat textures become more nuanced. Below, the scenes below are lit with the same three lights, but on the right the lights are coloured red, blue and green (and 3 times the intensity to compensate for the missing channels in each light).</p>
<table border="0" width="680" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct5" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct5.png" alt="color_correct5" width="335" height="303" border="0" /></td>
<td valign="top" width="340"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="color_correct6" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/color_correct6.png" alt="color_correct6" width="335" height="303" border="0" /></td>
</tr>
</tbody>
</table>
<h2>Preparing Art</h2>
<p>Preparing the art requires careful planning. The biggest challenge is figuring out how to consistently separate textures. To give you an idea of what is involved, here is how I prepared the images for this article:</p>
<ul>
<li>The ferns use a single material. Each fern randomly selects a colour from the currently set up scheme, so I could just plunk the script on the colour selection script.</li>
<li>The flowers use different materials for each part. Only the petals must change colour, so I had to modify the script to link to a part of the mesh (the petals) to adjust the colours.</li>
<li>The room scene again uses separate materials for each part of the mesh. In this case I used a global script that sets the colours of all submeshes.</li>
</ul>
<p>You can see that it can become complicated, especially if you colour different elements using different algorithms, and have complicated objects.</p>
<p>There are a few other tips when it comes to preparing the art:</p>
<ul>
<li>If you multiply your grey textures with procedural colours, textures that covers a wide grey spectrum are more flexible. Your colour application algorithm or the colours you choose can always reduce the final contrast, but it’s much harder to put it back in.</li>
<li>Carefully plan how you will tweak the final result, to minimise back and forth. (This is a general art principle, but becomes even more important if you use this technique). For example, to there are at least four ways to make something darker: change the texture, change the input of the colour selection algorithm, or change the lighting, or change the post effects. You can easily land in a tweaking loop that can waste a lot of time. One strategy is to get base levels for all these, and then tweaking them in this order: texture, algorithm, lighting, post effects.</li>
<li>In some cases it may be useful to use index colours, where each index corresponds to a colour from the palette, instead of using separate materials for each colour.</li>
<li>To gain performance at the expense of disk space, you can pregenerate your textures.</li>
</ul>
<h2>Download</h2>
<p><a href="http://www.devmag.org.za/downloads/colour/ProceduralPalette.zip">C# source code</a> with all the algorithms explained here.</p>
<h2>Related</h2>
<p>(Plug) We (at Gamelogic) have implemented these algorithms as a <a href="http://gamelogic.co.za/colors/features/">Unity plugin</a>.</p>
<h2>Thanks</h2>
<ul>
<li><a href="http://jarredlunt.blogspot.com/">Jarred Lunt</a> made the art for the desert scene.</li>
<li>Ciaran Prince made the art for the room and flower scenes.</li>
</ul>
<p>Thanks guys!</p>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2012/07/29/how-to-choose-colours-procedurally-algorithms/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">4948</post-id>	</item>
		<item>
		<title>13 More Tips for Making a Fun Platformer</title>
		<link>http://devmag.org.za/2012/07/19/13-more-tips-for-making-a-fun-platformer/</link>
				<comments>http://devmag.org.za/2012/07/19/13-more-tips-for-making-a-fun-platformer/#comments</comments>
				<pubDate>Thu, 19 Jul 2012 19:33:49 +0000</pubDate>
		<dc:creator><![CDATA[Diorgo Jonkers]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Platform Game Design]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[platform game]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4685</guid>
				<description><![CDATA[This article gives more handy tips for designing a platformer. There are tips for movement on ladders and veins, jumping, ledges and platforms, the camera, interface, and other ways to make a fun game.]]></description>
								<content:encoded><![CDATA[<p><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/super-mario-level-wallpaper-1680-x-1050.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="super-mario-level-wallpaper-1680-x-1050" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/super-mario-level-wallpaper-1680-x-1050_thumb.jpg" alt="super-mario-level-wallpaper-1680-x-1050" width="680" height="340" border="0" /></a></p>
<p>This article is a follow-up of a previous article I wrote, <a href="http://devmag.org.za/2011/01/18/11-tips-for-making-a-fun-platformer/">11 Tips for making a fun platformer</a>. Once again, this article focuses on platformers, but the philosophy behind each idea can be applied to any type of game, whether 2D or 3D. This time there are a few more practical tips.<br />
<span id="more-4685"></span></p>
<h2>1. Keep the camera simple</h2>
<p>The most simple (and best) camera is the one that always keeps player in the middle of the screen. This gives the player equal time to react to objects appearing from the left and right edges of the screen. The camera stops moving when the player reaches the edge of the level. For example, if the player reaches the left edge of the level then the camera stops moving left. It will continue to follow the player horizontally when the player moves away from the left edge of the level.</p>
<p>An optional addition is to make the camera look ahead in the direction the player is moving. For example, when the player runs right then the camera shows more of the level on the right side of the player, so he can see ahead. When he stops moving then the camera slowly moves to position the player in the middle of the screen.</p>
<p>Ideally, the player should not be aware of the camera.</p>
<h2>2. Allow the player to move in the air when jumping</h2>
<p>The player should have at least the same manoeuvrability when he is jumping through the air, as he has when he is running on the ground.</p>
<p>This means that he should move left or right at the same speed, and be able to shoot or use items with the same ease as when he is running.</p>
<h2>3. Make it easy to climb ladders</h2>
<p>&nbsp;</p>
<table width="680" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td width="340"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/03_012.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="03_01" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/03_01_thumb2.png" alt="03_01" width="340" height="298" border="0" /></a></td>
<td style="text-align: center;" width="340"><em>The player can grab onto the ladder when he is in the green rectangle, even if he is in the air. The character grabs onto the ladder when the player presses up*. The rectangle is slightly bigger than the ladder to make it easier to grab onto the ladder.</em></td>
</tr>
<tr>
<td style="text-align: center;" width="340"><em>The player should be able to move up, down, left, right and diagonal when he is on a ladder. </em></td>
<td width="340"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/03_022.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="03_02" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/03_02_thumb2.png" alt="03_02" width="340" height="298" border="0" /></a></td>
</tr>
<tr>
<td width="340"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/03_032.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="03_03" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/03_03_thumb2.png" alt="03_03" width="340" height="298" border="0" /></a></td>
<td style="text-align: center;" width="340"><em>When the player moves up and bangs his head against collision (red rectangles), automatically move him towards the middle of the ladder (while he is pressing up). This will make it easier to get through narrow gaps.</em></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Allow the player to be able to shoot or use items while he is on a ladder.</p>
<p>At any time the player should be able to jump off the ladder by pressing the jump button. He can also fall off the ladder when he moves all the way to the left or right and no longer touches the ladder.</p>
<p>* To start climbing the player can press up, jump or a grab button, depending on the other mechanics of the game. Generally, pressing the up button to start climbing is the easiest and most intuitive. But it may not be ideal if your character has a gun which can aim up, so pressing up will aim the gun up to shoot upwards. In this case the jump button or an extra grab button can be used to start climbing up. Prototype it to find what is the easiest and most fun. (This also applies to vines and swinging ropes. See below.)</p>
<h2>4. Make it easy to climb vines on the side of a wall</h2>
<p>Ideally, climbing ladders and climbing vines will use the same code. Therefore climbing vines will be the same as climbing ladders, except, usually vines are wider and encourages more horizontal movement.</p>
<h2>5. Make it easy to swing on ropes</h2>
<table width="680" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td width="340"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/051.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="05" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/05_thumb1.png" alt="05" width="340" height="255" border="0" /></a></td>
<td style="text-align: center;" width="340"><em>The player can grab onto the rope when he is within the green rectangles and he presses up. Like the ladder earlier on, the green rectangles are slightly bigger than the rope to make it easier to grab onto the rope.</em></td>
</tr>
</tbody>
</table>
<p>When the player is swinging on the rope, allow him to move up or down the rope when he presses up or down, no matter what angle the rope is swinging at. For example, if the rope is swinging at a 45 degree angle, pressing up still moves the player up the rope.</p>
<p>Allow the player to be able to shoot or use items while he is swinging on a rope.</p>
<p>At any time the player should be able to jump off the rope by pressing the jump button.</p>
<h2>6. Let the player double jump whenever</h2>
<p>Usually the player is only allowed to do the second jump of a double jump when the first jump reaches a certain state (for example, specific height, within a certain time limit, or when she is moving up).</p>
<p>Allow the player to do the second jump at any time while he is in the air. It makes the game feel more responsive and fun. The only limit should be that he has to release the jump button and press it again to do the second jump.</p>
<h2>7. Avoid using inertia</h2>
<p>When the player stops pressing left or right then the character should stop moving immediately. Avoid giving the character inertia which causes him to move forward a short distance before stopping. Inertia is acceptable in an ice level where it adds to the challenge of the level. But avoid having it throughout the game. Inertia can lead to the player falling off ledges or running into enemies or hazards, therefore making the game feel unresponsive.</p>
<h2>8. Make moving platforms friendly</h2>
<p><strong>The first moving platform the player encounters should be easy to use</strong> and not have a big penalty for falling off or missing it (for example, the penalty can just be climbing up a short ladder to get back to where the platform is). The first platform makes the player aware there are moving platforms in the game.</p>
<p><strong>Avoid making moving platforms travel far.</strong> If the platform travels far and the player misses it then he has to wait a long time for the platform to return. When he has to travel via moving platforms over a large area (for example, over spikes) then have multiple moving platforms.</p>
<p>If you have a platform that constantly moves back and forth to take the player between two ledges, then <strong>only start moving the platform when the player clearly sees it</strong>. When he gets to the ledge and does not see the platform (because it is off screen) then he may not know there is a platform there, and leaves to explore the rest of the level. Alternatively, if you want to make sure the player does not miss seeing the moving platform, let the platform only start moving when the player climbs on it. Another option is to make the platforms move along rails, so that when the player sees a rail he knows there is a moving platform nearby.</p>
<h2>9. Avoid adding leaps of faith</h2>
<p>Generally, the player should see what lies at the bottom of the platform he is currently standing on. So that he knows if it is safe to jump off or not.</p>
<p>If the player cannot see what lies past the bottom of the screen&#8217;s edge, then add clues so the player knows what lies at the bottom.</p>
<p>Examples:</p>
<ul>
<li>Skulls, flies or blood indicates there are spikes or rotating blades at the bottom.</li>
<li>A red glow indicates there&#8217;s fire or lava at the bottom.</li>
<li>A power-up in mid-air is an invite to jump off safely.</li>
<li>An enemy&#8217;s head sticking out the bottom of the screen, and moving horizontally will give the player an idea of where there is ground to land on.</li>
</ul>
<p>If there are no clues, then most of the time the player should be able to jump off and land safely at the bottom.</p>
<p>If there is an enemy at the bottom and off screen, then position the enemy in such a way that the player will have time to react to the enemy when he lands on the ground (for example, the enemy may be in an idle pose and delay for about 2 seconds before he starts attacking the player).</p>
<p>Avoiding <strong>leaps of faith</strong> removes the sense that the game is unfair. The player will feel it is unfair for him to make decisions when he cannot see the possible outcomes.</p>
<table width="696" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td width="347"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/091.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="09" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/09_thumb1.png" alt="09" width="340" height="298" border="0" /></a></td>
<td width="347">
<p style="text-align: center;"><em>Some platformers have a </em>main ground<em>. Usually when the player falls out the bottom of the screen, past the main ground then he dies instantly. This is quickly learned by the player when it happens the first time. The </em>leaps of faith<em> generally apply to platforms above the main ground.</em></p>
</td>
</tr>
</tbody>
</table>
<h2>10. Remove frustrating elements</h2>
<p>By removing frustrating elements your game will become more fun.</p>
<p>Here are some examples of frustrating elements:</p>
<ul>
<li>A cut scene which you cannot skip before the boss fight. When the boss kills you then you are forced to watch the cut scene again.</li>
<li>Extremely difficult jumps that you have to retry countless times to get right.</li>
<li>Spending large amounts of time collecting items to achieve a goal (for example, collect 100 stars to get a special weapon) then losing all the items when you die.</li>
</ul>
<p>Complicated button combos which take too long to do a special attack and is interrupted when an enemy punches you.</p>
<ul>
<li>Losing health when you fall from a high height.</li>
<li>Being attacked by enemies who are still off screen.</li>
</ul>
<h2>11. Keep the background in the background</h2>
<p>Make sure the background does not interfere with the foreground. This will help the player see which platforms he can stand on and makes it easier to identify items and enemies.</p>
<p>Some tips on how to push the background backwards:</p>
<ul>
<li>Use less contrasts in the background (for example, reduce the background image&#8217;s contrast setting in GIMP or Photoshop).</li>
<li>Use cool colours in the background, such as shades of blues (for example, place a semi-transparent blue layer over the background image in GIMP or Photoshop).</li>
<li>Have less, slower or less frequent animations in the background. The animations should not distract the player.</li>
<li>Use <a href="http://en.wikipedia.org/wiki/Parallax_scrolling">parallax scrolling</a> (that is, the background scrolls slower than the foreground).</li>
</ul>
<table width="693" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td width="347"><a href="http://devmag.org.za/blog/wp-content/uploads/2012/07/111.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="11" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/11_thumb1.png" alt="11" width="340" height="255" border="0" /></a></td>
<td width="344"><em>Here it is easy to see what is in the background and it does not interfere with the foreground.</em></td>
</tr>
</tbody>
</table>
<h2>12. Emotion is more important than reason</h2>
<p>You can have the most brilliant, genius, unique, awesome ideas and mechanics or systems for a game. But what does it <em>feel</em> like when you play it?</p>
<p>In other words: prototype and let your emotions be the final judge.</p>
<h2>13. A fun game has a good user interface</h2>
<p>There are various definitions of what a user interface is, but most of them include the following:</p>
<ul>
<li>Information that allows a user to make a decision.</li>
<li>The user input system.</li>
<li>The feedback generated by the user input. This leads back to the first point: information to make the next decision.</li>
</ul>
<p>Examples of non-game user interfaces:</p>
<ul>
<li>The controls and dials of a car.</li>
<li>The LED, buttons and beeps of a washing machine.</li>
<li>The remote control of a television.</li>
<li>The buttons and highlighted floor number of a lift.</li>
</ul>
<p>What makes a good, non-game user interface?</p>
<ul>
<li>Clear information.</li>
<li>Easy to use.</li>
<li>Clear and instant feedback.</li>
</ul>
<p>These are also an important part of making a fun game.</p>
<h2>References</h2>
<ul>
<li><a href="http://searchsoa.techtarget.com/definition/user-interface" class="broken_link" rel="nofollow">http://searchsoa.techtarget.com/definition/user-interface</a></li>
<li><a href="http://www.pcmag.com/encyclopedia_term/0,2542,t=user+interface&amp;i=53558,00.asp" class="broken_link" rel="nofollow">http://www.pcmag.com/encyclopedia_term/0,2542,t=user+interface&amp;i=53558,00.asp</a></li>
<li><a href="http://en.wikipedia.org/wiki/User_interface">http://en.wikipedia.org/wiki/User_interface</a></li>
</ul>
<h2>Discuss</h2>
<p>Some more discussion of these tips on <a href="http://www.makegamessa.com/discussion/86/13-more-tips-for-making-a-fun-platformer#Item_1">Make Games SA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2012/07/19/13-more-tips-for-making-a-fun-platformer/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">4685</post-id>	</item>
		<item>
		<title>50 Tips for Working with Unity (Best Practices)</title>
		<link>http://devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/</link>
				<comments>http://devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/#comments</comments>
				<pubDate>Thu, 12 Jul 2012 08:00:43 +0000</pubDate>
		<dc:creator><![CDATA[Herman Tulleken]]></dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4647</guid>
				<description><![CDATA[This article gives a list of best practices for working with unity: it covers the process, working with art and prefabs, class design, project structure, and many others.]]></description>
								<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter  wp-image-4652" title="unityLogo" src="http://devmag.org.za/blog/wp-content/uploads/2012/07/unityLogo.png" alt="" width="680" height="340" srcset="http://devmag.org.za/blog/wp-content/uploads/2012/07/unityLogo.png 900w, http://devmag.org.za/blog/wp-content/uploads/2012/07/unityLogo-300x150.png 300w, http://devmag.org.za/blog/wp-content/uploads/2012/07/unityLogo-200x100.png 200w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<h2>About these tips</h2>
<p>(<strong>Edit: August 2016. </strong>I have revised these tips. You can find the new list <a href="http://www.gamasutra.com/blogs/HermanTulleken/20160812/279100/50_Tips_and_Best_Practices_for_Unity_2016_Edition.php">here</a>.)</p>
<p>These tips are not all applicable to every project.</p>
<ul>
<li>They are based on my experience with projects with small teams from 3 to 20 people.</li>
<li>There’s is a price for structure, re-usability, clarity, and so on — team size and project size determine whether that price should be paid.</li>
<li>Many tips are a matter of taste (there may be rivalling but equally good techniques for any tip listed here).</li>
<li>Some tips may fly in the face of conventional Unity development. For instance, using prefabs for specialisation instead of instances is very non-Unity-like, and the price is quite high (many times more prefabs than without it). Yet I have seen these tips pay off, even if they seem crazy.</li>
</ul>
<p><span id="more-4647"></span></p>
<h2>Process</h2>
<p><strong>1. Avoid branching assets.</strong> There should always only ever be one version of any asset. If you absolutely <em>have</em> to branch a prefab, scene, or mesh, follow a process that makes it very clear which is the <strong>right </strong>version. The “wrong” branch should have a funky name, for example, use a double underscore prefix: <code>__MainScene_Backup</code>. Branching prefabs requires a specific process to make it safe (see under the section <em>Prefabs</em>).</p>
<p><strong>2. Each team member should have a second copy of the project checked out for testing </strong>if you are using version control. After changes, this second copy, the clean copy, should be updated and tested. No-one should make any changes to their clean copies. This is especially useful to catch missing assets.</p>
<p><strong>3. Consider using external level tools for level editing.</strong> Unity is not the perfect level editor. For example, we have used <a href="http://www.diorgo.com/v1/?p=366">TuDee</a> to build levels for a 3D tile-based game, where we could benefit from the tile-friendly tools (snapping to grid, and multiple-of-90-degrees rotation, 2D view, quick tile selection). Instantiating prefabs from an XML file is straightforward. See <a href="http://devmag.org.za/2009/10/23/guerrilla-tool-development/">Guerrilla Tool Development</a> for more ideas.</p>
<p><strong>4. Consider saving levels in XML instead of in scenes.</strong> This is a wonderful technique:</p>
<ul>
<li>It makes it unnecessary to re-setup each scene.</li>
<li>It makes loading much faster (if most objects are shared between scenes).</li>
<li>It makes it easier to merge scenes (even with Unity&#8217;s new text-based scenes there is so much data in there that merging is often impractical in any case).</li>
<li>It makes it easier to keep track of data across levels.</li>
</ul>
<p>You can still use Unity as a level editor (although you need not). You will need to write some code to serialize and deserialize your data, and load a level both in the editor and at runtime, and save levels from the editor. You may also need to mimic Unity’s ID system for maintaining references between objects.</p>
<p><strong>5. Consider writing generic custom inspector code.</strong> To write custom inspectors is fairly straightforward, but Unity’s system has many drawbacks:</p>
<ul>
<li>It does not support taking advantage of inheritance.</li>
<li>It does not let you define inspector components on a field-type level, only a class-type level. For instance, if every game object has a field of type <code>SomeCoolType</code>, which you want rendered differently in the inspector, you have to write inspectors for <em>all</em> your classes.</li>
</ul>
<p>You can address these issues by essentially re-implementing the inspector system. Using a few tricks of reflection, this is not as hard as it seems, details are provided at the end of the article.</p>
<h2>Scene Organisation</h2>
<p><strong>6. Use named empty game objects as scene folders. </strong>Carefully organise your scenes to make it easy to find objects.</p>
<p><strong>7. Put maintenance prefabs and folders (empty game objects) at 0 0 0. </strong>If a transform is not specifically used to position an object, it should be at the origin. That way, there is less danger of running into problems with local and world space, and code is generally simpler.</p>
<p><strong>8. Minimise using offsets for GUI components.</strong> Offsets should always be used to layout components in their parent component only; they should not rely on the positioning of their grandparents. Offsets should not cancel each other out to display correctly. It is basically to prevent this kind of thing:</p>
<p>Parent container arbitrarily placed at (100, -50). Child, meant to be positioned at (10, 10), then placed at (90, 60) [relative to parent].</p>
<p>This error is common when the container is invisible, or does not have a visual representation at all.</p>
<p><strong>9. Put your world floor at y = 0.</strong> This makes it easier to put objects on the floor, and treat the world as a 2D space (when appropriate) for game logic, AI, and physics.</p>
<p><strong>10. Make the game runnable from every scene.</strong> This drastically reduces testing time. To make all scenes runnable you need to do two things:</p>
<p>First, provide a way to mock up any data that is required from previously loaded scenes if it is not available.</p>
<p>Second, spawn objects that must persist between scene loads with the following idiom:</p>
<pre lang="csharp" escaped="true">myObject = FindMyObjectInScene();

if (myObjet == null)
{
   myObject = SpawnMyObject();
}</pre>
<h2>Art</h2>
<p><strong>11. Put character and standing object pivots at the base, not in the centre. </strong>This makes it easy to put characters and objects on the floor precisely. It also makes it easier to work with 3D as if it is 2D for game logic, AI, and even physics when appropriate.</p>
<p><strong>12. Make all meshes face in the same direction (positive or negative z axis).</strong> This applies to meshes such as characters and other objects that have a concept of facing direction. Many algorithms are simplified if everything have the same facing direction.</p>
<p><strong>13. Get the scale right from the beginning.</strong> Make art so that they can all be imported at a scale factor of 1, and that their transforms can be scaled 1, 1, 1. Use a reference object (a Unity cube) to make scale comparisons easy. Choose a world to Unity units ratio suitable for your game, and stick to it.</p>
<p><strong>14. Make a two-poly plane</strong> to use for GUI components and manually created particles. Make the plane face the positive z-axis for easy billboarding and easy GUI building.</p>
<p><strong>15. Make and use test art</strong></p>
<ul>
<li>Squares labelled for skyboxes.</li>
<li>A grid.</li>
<li>Various flat colours for shader testing: white, black, 50% grey, red, green, blue, magenta, yellow, cyan.</li>
<li>Gradients for shader testing: black to white, red to green, red to blue, green to blue.</li>
<li>Black and white checkerboard.</li>
<li>Smooth and rugged normal maps.</li>
<li>A lighting rig (as prefab) for quickly setting up test scenes.</li>
</ul>
<h2>Prefabs</h2>
<p><strong>16. Use prefabs for everything.</strong> The only game objects in your scene that should not be prefabs should be folders. Even unique objects that are <em>used only once </em>should be prefabs. This makes it easier to make changes that don’t require the scene to change. (An additional benefit is that it makes building sprite atlases reliable when using <a href="http://www.anbsoft.com/middleware/ezgui/">EZGUI</a>).</p>
<p><strong>17. Use separate prefabs for specialisation; do not specialise instances. </strong>If you have two enemy types, and they only differ by their properties, make separate prefabs for the properties, and link them in. This makes it possible to</p>
<ul>
<li>make changes to each type in one place</li>
<li>make changes without having to change the scene.</li>
</ul>
<p>If you have too many enemy types, specialisation should still not be made in instances in the editor. One alternative is to do it procedurally, or using a central file / prefab for all enemies. A single drop down could be used to differentiate enemies, or an algorithm based on enemy position or player progress.</p>
<p><strong>18. Link prefabs to prefabs; do not link instances to instances. </strong>Links to prefabs are maintained when dropping a prefab into a scene; links to instances are not. Linking to prefabs whenever possible reduces scene setup, and reduce the need to change scenes.</p>
<p><strong>19. As far as possible, establish links between instances automatically.</strong> If you need to link instances, establish the links programmatically. For example, the player prefab can register itself with the <code>GameManager</code> when it starts, or the <code>GameManager</code> can find the <code>Player</code> prefab instance when it starts.</p>
<p><strong>Don&#8217;t put meshes at the roots of prefabs if you want to add other scripts.</strong> When you make the prefab from a mesh, first parent the mesh to an empty game object, and make <em>that</em> the root. Put scripts on the root, not on the mesh node. That way it is much easier to replace the mesh with another mesh without loosing any values that you set up in the inspector.</p>
<p><strong>Use linked prefabs as an alternative to nested prefabs.</strong> Unity does not support nested prefabs, and existing third-party solutions can be dangerous when working in a team because the relationship between nested prefabs is not obvious.</p>
<p><strong>20. Use safe processes to branch prefabs.</strong> The explanation use the Player prefab as an example.</p>
<p>Make a risky change to the Player prefab is as follows:</p>
<ol>
<li>Duplicate the <code>Player</code> prefab.</li>
<li>Rename the duplicate to <code>__Player_Backup</code>.</li>
<li>Make changes to the <code>Player</code> prefab.</li>
<li>If everything works, delete <code>__Player_Backup</code>.</li>
</ol>
<p>Do not name the duplicate Player_New, and make changes to it!</p>
<p>Some situations are more complicated. For example, a certain change may involve two people, and following the above process may break the working scene for everyone until person two finished. If it is quick enough, still follow the process above. For changes that take longer, the following process can be followed:</p>
<ol>
<li>Person 1:
<ol>
<li>Duplicate the <code>Player</code> prefab.</li>
<li>Rename it to <code>__Player_WithNewFeature</code> or <code>__Player_ForPerson2</code>.</li>
<li>Make changes on the duplicate, and commit / give to Person 2.</li>
</ol>
</li>
<li>Person 2:
<ol>
<li>Make changes to new prefab.</li>
<li>Duplicate <code>Player</code> prefab, and call it <code>__Player_Backup</code>.</li>
<li>Drag an instance of <code>__Player_WithNewFeature</code> into the scene.</li>
<li>Drag the instance onto the original <code>Player</code> prefab.</li>
<li>If everything works, delete <code>__Player_Backup</code> and <code>__Player_WithNewFeature</code>.</li>
</ol>
</li>
</ol>
<h2>Extensions and MonoBehaviourBase</h2>
<p><strong>21. Extend your own base mono behaviour, and derive all your components from it.</strong></p>
<p>This allows you to implement some general functionality, such as type safe Invoke, and more complicated Invokes (such as random, etc.).</p>
<p><strong>22. Define safe methods for Invoke, StartCoroutine and Instantiate.</strong></p>
<p>Define a delegate Task, and use it to define methods that don’t rely on string names. For example:</p>
<pre lang="csharp" escaped="true">public void Invoke(Task task, float time)
{
   Invoke(task.Method.Name, time);
}</pre>
<p><strong>23. Use extensions to work with components that share an interface. </strong>It is sometimes convenient to get components that implement a certain interface, or find objects with such components.</p>
<p>The implementations below uses <code>typeof</code> instead of the generic versions of these functions. The generic versions don’t work with interfaces, but <code>typeof</code> does. The methods below wraps this neatly in generic methods.</p>
<pre lang="csharp" escaped="true">//Defined in the common base class for all mono behaviours
public I GetInterfaceComponent&lt;I&gt;() where I : class
{
   return GetComponent(typeof(I)) as I;
}

public static List&lt;I&gt; FindObjectsOfInterface&lt;I&gt;() where I : class
{
   MonoBehaviour[] monoBehaviours = FindObjectsOfType&lt;MonoBehaviour&gt;();
   List&lt;I&gt; list = new List&lt;I&gt;();

   foreach(MonoBehaviour behaviour in monoBehaviours)
   {
      I component = behaviour.GetComponent(typeof(I)) as I;

      if(component != null)
      {
         list.Add(component);
      }
   }

   return list;
}</pre>
<p><strong>24. Use extensions to make syntax more convenient.</strong> For example:</p>
<pre lang="csharp" escaped="true">public static class CSTransform 
{
   public static void SetX(this Transform transform, float x)
   {
      Vector3 newPosition = 
         new Vector3(x, transform.position.y, transform.position.z);

      transform.position = newPosition;
   }
   ...
}</pre>
<p><strong>25. Use a defensive GetComponent alternative. </strong>Sometimes forcing component dependencies (through <code>RequiredComponent</code>) can be a pain. For example, it makes it difficult to change components in the inspector (even if they have the same base type). As an alternative, the following extension of <code>GameObject</code> can be used when a component is required to print out an error message when it is not found.</p>
<pre lang="csharp" escaped="true">public static T GetSafeComponent&lt;T&gt;(this GameObject obj) where T : MonoBehaviour
{
   T component = obj.GetComponent&lt;T&gt;();

   if(component == null)
   {
      Debug.LogError("Expected to find component of type " 
         + typeof(T) + " but found none", obj);
   }

   return component;
}</pre>
<h2>Idioms</h2>
<p><strong>26. Avoid using different idioms to do the same thing.</strong> In many cases there are more than one idiomatic way to do things. In such cases, choose one to use throughout the project. Here is why:</p>
<ul>
<li>Some idioms don’t work well together. Using one idiom well forces design in one direction that is not suitable for another idiom.</li>
<li>Using the same idiom throughout makes it easier for team members to understand what is going on. It makes structure and code easier to understand. It makes mistakes harder to make.</li>
</ul>
<p>Examples of idiom groups:</p>
<ul>
<li>Coroutines vs. state machines.</li>
<li>Nested prefabs vs. linked prefabs vs. God prefabs.</li>
<li>Data separation strategies.</li>
<li>Ways of using sprites for states in 2D games.</li>
<li>Prefab structure.</li>
<li>Spawning strategies.</li>
<li>Ways to locate objects: by type vs. name vs. tag vs. layer vs. reference (“links”).</li>
<li>Ways to group objects: by type vs. name vs. tag vs. layer vs. arrays of references (“links”).</li>
<li>Finding groups of objects versus self registration.</li>
<li>Controlling execution order (Using Unity’s execution order setup versus yield logic versus Awake / Start and Update / Late Update reliance versus manual methods versus any-order architecture).</li>
<li>Selecting objects / positions / targets with the mouse in-game: selection manager versus local self-management.</li>
<li>Keeping data between scene changes: through <a href="http://docs.unity3d.com/Documentation/ScriptReference/PlayerPrefs.html">PlayerPrefs</a>, or objects that are not Destroyed when a new scene is loaded.</li>
<li>Ways of combining (blending, adding and layering) animation.</li>
</ul>
<h2>Time</h2>
<p><strong>27. Maintain your own time class to make pausing easier.</strong> Wrap <code>Time.DeltaTime</code> and <code>Time.TimeSinceLevelLoad</code> to account for pausing and time scale. It requires discipline to use it, but will make things a lot easier, especially when running things of different clocks (such as interface animations and game animations).</p>
<h2>Spawning Objects</h2>
<p><strong>28. Don’t let spawned objects clutter your hierarchy when the game runs.</strong> Set their parents to a scene object to make it easier to find stuff when the game is running. You could use a empty game object, or even a singleton with no behaviour to make it easier to access from code. Call this object <code>DynamicObjects</code>.</p>
<h2>Class Design</h2>
<p><strong>29. Use singletons for convenience. </strong>The following class will make any class that inherits from it a singleton automatically:</p>
<pre lang="csharp" escaped="true">public class Singleton&lt;T&gt; : MonoBehaviour where T : MonoBehaviour
{
   protected static T instance;

   /**
      Returns the instance of this singleton.
   */
   public static T Instance
   {
      get
      {
         if(instance == null)
         {
            instance = (T) FindObjectOfType(typeof(T));

            if (instance == null)
            {
               Debug.LogError("An instance of " + typeof(T) + 
                  " is needed in the scene, but there is none.");
            }
         }

         return instance;
      }
   }
}</pre>
<p>Singletons are useful for managers, such as <code>ParticleManager</code> or <code>AudioManager</code> or <code>GUIManager</code>.</p>
<ul>
<li>Avoid using singletons for unique instances of prefabs that are not managers (such as the Player). Not adhering to this principle complicates inheritance hierarchies, and makes certain types of changes harder. Rather keep references to these in your <code>GameManager</code> (or other suitable God class <img src="https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> )</li>
<li>Define static properties and methods for public variables and methods that are used often from outside the class. This allows you to write <code>GameManager.Player</code> instead of <code>GameManager.Instance.player</code>.</li>
</ul>
<p><strong>30. For components, never make variables public that should not be tweaked in the inspector. </strong>Otherwise it <em>will</em> be tweaked by a designer, especially if it is not clear what it does. In some rare cases it is unavoidable. In that case use a two or even four underscores to prefix the variable name to scare away tweakers:</p>
<pre lang="csharp" escaped="true">public float __aVariable;</pre>
<p><strong>31. Separate interface from game logic. </strong>This is essentially the MVC pattern.</p>
<p><em>Any input controller should only give commands to the appropriate components to let them know the controller has been invoked.</em> For example in controller logic, the controller could decide which commands to give based on the player state. But this is bad (for example, it will lead to duplicate logic if more controllers are added). Instead, the Player object should be notified of the intent of moving forward, and then based on the current state (slowed or stunned, for example) set the speed and update the player facing direction. Controllers should only do things that relate to their own state (the controller does not change state if the player changes state; therefore, the controller should not know of the player state at all). Another example is the changing of weapons. The right way to do it is with a method on Player <code>SwitchWeapon(Weapon newWeapon)</code>, which the GUI can call. The GUI should not manipulate transforms and parents and all that stuff.</p>
<p><em>Any interface component should only maintain data and do processing related to it&#8217;s own state.</em> For example, do display a map, the GUI could compute what to display based on the player&#8217;s movements. However, this is game state data, and does not belong in the GUI. The GUI should merely display game state data, which should be maintained elsewhere. The map data should be maintained elsewhere (in the <code>GameManager</code>, for example).</p>
<p><em>Gameplay objects should know virtually nothing of the GUI.</em> The one exception is the pause behaviour, which is may be controlled globally through <code>Time.timeScale</code> (which is not a good idea as well&#8230; see ). Gameplay objects should know if the game is paused. But that is all. Therefore, no links to GUI components from gameplay objects.</p>
<p>In general, if you delete all the GUI classes, the game should still compile.</p>
<p>You should also be able to re-implement the GUI and input without needing to write any new game logic.</p>
<p><strong>32. Separate state and bookkeeping.</strong> Bookkeeping variables are used for speed or convenience, and can be recovered from the state. By separating these, you make it easier to</p>
<ul>
<li>save the game state, and</li>
<li>debug the game state.</li>
</ul>
<p>One way to do it is to define a <code>SaveData</code> class for each game logic class. The</p>
<pre lang="csharp" escaped="true">[Serializable]
PlayerSaveData
{
   public float health; //public for serialisation, not exposed in inspector
} 

Player
{
   //... bookkeeping variables

   //Don’t expose state in inspector. State is not tweakable.
   private PlayerSaveData playerSaveData; 
}</pre>
<p><strong>33. Separate specialisation configuration.</strong></p>
<p>Consider two enemies with identical meshes, but different tweakables (for instance different strengths and different speeds). There are different ways to separate data. The one here is what I prefer, especially when objects are spawned, or the game is saved. (Tweakables are not state data, but configuration data, so it need not be saved. When objects are loaded or spawned, the tweakables are automatically loaded in separately)</p>
<ul>
<li>Define a template class for each game logic class. For instance, for Enemy, we also define <code>EnemyTemplate</code>. All the differentiating tweakables are stored in <code>EnemyTemplate</code></li>
<li>In the game logic class, define a variable of the template type.</li>
<li>Make an Enemy prefab, and two template prefabs <code>WeakEnemyTemplate</code> and <code>StrongEnemyTemplate</code>.</li>
<li>When loading or spawning objects, set the template variable to the right template.</li>
</ul>
<p>This method can become quite sophisticated (and sometimes, needlessly complicated, so beware!).</p>
<p>For example, to better make use of generic polymorphism, we may define our classes like this:</p>
<pre lang="csharp" escaped="true">public class BaseTemplate
{
   ...
}

public class ActorTemplate : BaseTemplate
{
   ...
}

public class Entity&lt;EntityTemplateType&gt; where EntityTemplateType : BaseTemplate
{
   EntityTemplateType template;
   ...
}

public class Actor : Entity &lt;ActorTemplate&gt;
{
   ...
}</pre>
<p><strong>34. Don’t use strings for anything other than displayed text.</strong> In particular, do not use strings for identifying objects or prefabs etc. One unfortunate exception is animations, which generally are accessed with their string names.</p>
<p><strong>35. Avoid using public index-coupled arrays. </strong>For instance, do not define an array of weapons, an array of bullets, and an array of particles , so that your code looks like this:</p>
<pre lang="csharp" escaped="true">public void SelectWeapon(int index)
{ 
   currentWeaponIndex = index;
   Player.SwitchWeapon(weapons[currentWeapon]);
}

public void Shoot()
{
   Fire(bullets[currentWeapon]);
   FireParticles(particles[currentWeapon]);   
}</pre>
<p>The problem for this is not so much in the code, but rather setting it up in the inspector without making mistakes.</p>
<p>Rather, define a class that encapsulates the three variables, and make an array of that:</p>
<pre lang="csharp" escaped="true">[Serializable]
public class Weapon
{
   public GameObject prefab;
   public ParticleSystem particles;
   public Bullet bullet;
}</pre>
<p>The code looks neater, but most importantly, it is harder to make mistakes in setting up the data in the inspector.</p>
<p><strong>36. Avoid using arrays for structure other than sequences. </strong>For example, a player may have three types of attacks. Each uses the current weapon, but generates different bullets and different behaviour.</p>
<p>You may be tempted to dump the three bullets in an array, and then use this kind of logic:</p>
<pre lang="csharp" escaped="true">public void FireAttack()
{
   /// behaviour
   Fire(bullets[0]);
}

public void IceAttack()
{
   /// behaviour
   Fire(bullets[1]);
}

public void WindAttack()
{
   /// behaviour
   Fire(bullets[2]);
}</pre>
<p>Enums can make things look better in code&#8230;</p>
<pre lang="csharp" escaped="true">public void WindAttack()
{
   /// behaviour
   Fire(bullets[WeaponType.Wind]);
}</pre>
<p>&#8230;but not in the inspector.</p>
<p>It’s better to use separate variables so that the names help show which content to put in. Use a class to make it neat.</p>
<pre lang="csharp" escaped="true">[Serializable]
public class Bullets
{
   public Bullet FireBullet;
   public Bullet IceBullet;
   public Bullet WindBullet;
}</pre>
<p>This assumes there is no other Fire, Ice and Wind data.</p>
<p><strong>37. Group data in serializable classes to make things neater in the inspector.</strong> Some entities may have dozens of tweakables. It can become a nightmare to find the right variable in the inspector. To make things easier, follow these steps:</p>
<ul>
<li>Define separate classes for groups of variables. Make them public and serializable.</li>
<li>In the primary class, define public variables of each type defined as above.</li>
<li>Do not initialize these variables in Awake or Start; since they are serializable, Unity will take care of that.</li>
<li>You can specify defaults as before by assigning values in the definition;</li>
</ul>
<p>This will group variables in collapsible units in the inspector, which is easier to manage.</p>
<pre lang="csharp" escaped="true">[Serializable]
public class MovementProperties //Not a MonoBehaviour!
{
   public float movementSpeed;
   public float turnSpeed = 1; //default provided
}

public class HealthProperties //Not a MonoBehaviour!
{
   public float maxHealth;
   public float regenerationRate;
}

public class Player : MonoBehaviour
{
   public MovementProperties movementProeprties;
   public HealthPorperties healthProeprties;
}</pre>
<h2>Text</h2>
<p><strong>38. If you have a lot of story text, put it in a file.</strong> Don’t put it in fields for editing in the inspector. Make it easy to change without having to open the Unity editor, and especially without having to save the scene.</p>
<p><strong>39. If you plan to localise, separate all your strings to one location. </strong>There are many ways to do this. One way is to define a Text class with a public string field for each string, with defaults set to English, for example. Other languages subclass this and re-initialize the fields with the language equivalents.</p>
<p>More sophisticated techniques (appropriate when the body of text is large and / or the number of languages is high) will read in a spread sheet and provide logic for selecting the right string based on the chosen language.</p>
<h2>Testing and Debugging</h2>
<p><strong>40. Implement a graphical logger to debug physics, animation, and AI. </strong>This can make debugging considerably faster. See <a href="http://devmag.org.za/2011/01/25/make-your-logs-interactive-and-squash-bugs-faster/">here</a>.</p>
<p><strong>41. Implement a HTML logger.</strong> In some cases, logging can still be useful. Having logs that are easier to parse (are colour coded, has multiple views, records screenshots) can make log-debugging much more pleasant. See <a href="http://devmag.org.za/2011/02/09/using-graphs-to-debug-physics-ai-and-animation-effectively/">here</a>.</p>
<p><strong>42. Implement your own FPS counter.</strong> Yup. No one knows what Unity’s FPS counter really measures, but it is not frame rate. Implement your own so that the number can correspond with intuition and visual inspection.</p>
<p><strong>43. Implement shortcuts for taking screen shots.</strong> Many bugs are visual, and are much easier to report when you can take a picture. The ideal system should maintain a counter in <code>PlayerPrefs</code> so that successive screenshots are not overwritten. The screenshots should be saved outside the project folder to avoid people from accidentally committing them to the repository.</p>
<p><strong>44. Implement shortcuts for printing the player’s world position.</strong> This makes it easy to report the position of bugs that occur in specific places in the world, which in turns makes it easier to debug.</p>
<p><strong>45. Implement debug options for making testing easier.</strong> Some examples:</p>
<ul>
<li>Unlock all items.</li>
<li>Disable enemies.</li>
<li>Disable GUI.</li>
<li>Make player invincible.</li>
<li>Disable all gameplay.</li>
</ul>
<p><strong>46. For teams that are small enough, make a prefab for each team member with debug options.</strong> Put a user identifier in a file that is not committed, and is read when the game is run. This why:</p>
<ul>
<li>Team members do not commit their debug options by accident and affect everyone.</li>
<li>Changing debug options don’t change the scene.</li>
</ul>
<p><strong>47. Maintain a scene with all gameplay elements. </strong>For instance, a scene with all enemies, all objects you can interact with, etc. This makes it easy to test functionality without having to play too long.</p>
<p><strong>48. Define constants for debug shortcut keys, and keep them in one place. </strong>Debug keys are not normally (or conveniently) processed in a single location like the rest of the game input. To avoid shortcut key collisions, define constants in a central place. An alternative is to process all keys in one place regardless of whether it is a debug function or not. (The downside is that this class may need extra references to objects just for this).</p>
<h2>Documentation</h2>
<p><strong>49. Document your setup.</strong> Most documentation should be in the code, but certain things should be documented outside code. Making designers sift through code for setup is time-wasting. Documented setups improved efficiency (if the documents are current).</p>
<p>Document the following:</p>
<ul>
<li>Layer uses (for collision, culling, and raycasting – essentially, what should be in what layer).</li>
<li>Tag uses.</li>
<li>GUI depths for layers (what should display over what).</li>
<li>Scene setup.</li>
<li>Idiom preferences.</li>
<li>Prefab structure.</li>
<li>Animation layers.</li>
</ul>
<h3>Naming Standard and Folder Structure</h3>
<p><strong>50. Follow a documented naming convention and folder structure. </strong>Consistent naming and folder structure makes it easier to find things, and to figure out what things are.</p>
<p>You will most probably want to create your own naming convention and folder structure. Here is one as an example.</p>
<h3>Naming General Principles</h3>
<ol>
<li>Call a thing what it is. A bird should be called <span style="color: #37a32c;">Bird</span>.</li>
<li>Choose names that can be pronounced and remembered. If you make a Mayan game, do not name your level <span style="color: #c40f13;">QuetzalcoatisReturn</span>.</li>
<li>Be consistent. When you choose a name, stick to it.</li>
<li>Use Pascal case, like this: <span style="color: #37a32c;">ComplicatedVerySpecificObject</span>. Do not use spaces, underscores, or hyphens, with one exception (see <em>Naming Different Aspects of the Same Thing</em>).</li>
<li>Do not use version numbers, or words to indicate their progress (<span style="color: #c40f13;">WIP</span>, <span style="color: #c40f13;">final</span>).</li>
<li>Do not use abbreviations: <span style="color: #c40f13;">DVamp@W</span> should be <span style="color: #37a32c;">DarkVampire@Walk</span>.</li>
<li>Use the terminology in the design document: if the document calls the die animation <em>Die</em>, then use <span style="color: #37a32c;">DarkVampire@Die</span>, not <span style="color: #c40f13;">DarkVampire@Death</span>.</li>
<li>Keep the most specific descriptor on the left: <span style="color: #37a32c;">DarkVampire</span>, not <span style="color: #c40f13;">VampireDark</span>; <span style="color: #37a32c;">PauseButton</span>, not <span style="color: #c40f13;">ButtonPaused</span>. It is, for instance, easier to find the pause button in the inspector if not all buttons start with the word <em>Button</em>. [Many people prefer it the other way around, because that makes grouping more obvious visually. Names are not for grouping though, folders are. Names are to distinguish objects of the same type so that they can be located reliably and fast.]</li>
<li>Some names form a sequence. Use numbers in these names, for example, <span style="color: #37a32c;">PathNode0</span>, <span style="color: #37a32c;">PathNode1</span>. Always start with 0, not 1.</li>
<li>Do not use numbers for things that don’t form a sequence. For example, <span style="color: #c40f13;">Bird0</span>, <span style="color: #c40f13;">Bird1</span>, <span style="color: #c40f13;">Bird2</span> should be <span style="color: #37a32c;">Flamingo</span>, <span style="color: #37a32c;">Eagle</span>, <span style="color: #37a32c;">Swallow</span>.</li>
<li>Prefix temporary objects with a double underscore <span style="color: #37a32c;">__Player_Backup</span>.</li>
</ol>
<h3>Naming Different Aspects of the Same Thing</h3>
<p>Use underscores between the core name, and the thing that describes the “aspect”. For instance:</p>
<ul>
<li><strong>GUI buttons states</strong> EnterButton_Active, EnterButton_Inactive</li>
<li><strong>Textures</strong> DarkVampire_Diffuse, DarkVampire_Normalmap</li>
<li><strong>Skybox</strong> JungleSky_Top, JungleSky_North</li>
<li><strong>LOD Groups</strong> DarkVampire_LOD0, DarkVampire_LOD1</li>
</ul>
<p>Do not use this convention just to distinguish between different types of items, for instance Rock_Small, Rock_Large should be SmallRock, LargeRock.</p>
<h3>Structure</h3>
<p>The organisation of your scenes, project folder, and script folder should follow a similar pattern.</p>
<h4>Folder Structure</h4>
<pre>Materials
GUI
Effects
Meshes
   Actors
      DarkVampire
      LightVampire
      ...
   Structures
      Buildings
      ...
   Props
      Plants
      ...
   ...
Plugins
Prefabs
   Actors
   Items
   ...
Resources
   Actors
   Items
   ...
Scenes
   GUI
   Levels
   TestScenes
Scripts
Textures
GUI
Effects
...</pre>
<h4>Scene Structure</h4>
<pre>Cameras
Dynamic Objects
Gameplay
   Actors
   Items
   ...
GUI
   HUD
   PauseMenu
   ...
Management
Lights
World
   Ground
   Props
   Structure
   ...</pre>
<h4>Scripts Folder Structure</h4>
<pre>ThirdParty
   ...
MyGenericScripts
   Debug
   Extensions
   Framework
   Graphics
   IO
   Math
   ...
MyGameScripts
   Debug
   Gameplay
      Actors
      Items
      ...
   Framework
   Graphics
   GUI
   ...</pre>
<h2>How to Re-implement Inspector Drawing</h2>
<h3>1. Define a base class for all your editors</h3>
<pre lang="csharp" escaped="true">BaseEditor&lt;T&gt; : Editor 
where T : MonoBehaviour
{
   override public void OnInspectorGUI()
   {
      T data = (T) target;

      GUIContent label = new GUIContent();
      label.text = "Properties"; //

      DrawDefaultInspectors(label, data);

      if(GUI.changed)
      {         
         EditorUtility.SetDirty(target);
      }
   }
}</pre>
<h3>2. Use reflection and recursion to do draw components</h3>
<pre lang="csharp" escaped="true">public static void DrawDefaultInspectors&lt;T&gt;(GUIContent label, T target)
   where T : new()
{
   EditorGUILayout.Separator();
   Type type = typeof(T);      
   FieldInfo[] fields = type.GetFields();
   EditorGUI.indentLevel++;

   foreach(FieldInfo field in fields)
   {
      if(field.IsPublic)
      {
         if(field.FieldType == typeof(int))
         {
            field.SetValue(target, EditorGUILayout.IntField(
            MakeLabel(field), (int) field.GetValue(target)));
         }   
         else if(field.FieldType == typeof(float))
         {
            field.SetValue(target, EditorGUILayout.FloatField(
            MakeLabel(field), (float) field.GetValue(target)));
         }

         ///etc. for other primitive types

         else if(field.FieldType.IsClass)
         {
            Type[] parmTypes = new Type[]{ field.FieldType};

            string methodName = "DrawDefaultInspectors";

            MethodInfo drawMethod = 
               typeof(CSEditorGUILayout).GetMethod(methodName);

            if(drawMethod == null)
            {
               Debug.LogError("No method found: " + methodName);
            }

            bool foldOut = true;

            drawMethod.MakeGenericMethod(parmTypes).Invoke(null, 
               new object[]
               {
                  MakeLabel(field),
                  field.GetValue(target)
               });
         }      
         else
         {
            Debug.LogError(
               "DrawDefaultInspectors does not support fields of type " +
               field.FieldType);
         }
      }         
   }

   EditorGUI.indentLevel--;
}</pre>
<p>The above method uses the following helper:</p>
<pre lang="csharp" escaped="true">private static GUIContent MakeLabel(FieldInfo field)
{
   GUIContent guiContent = new GUIContent();      
   guiContent.text = field.Name.SplitCamelCase();      
   object[] descriptions = 
      field.GetCustomAttributes(typeof(DescriptionAttribute), true);

   if(descriptions.Length &gt; 0)
   {
      //just use the first one.
      guiContent.tooltip = 
         (descriptions[0] as DescriptionAttribute).Description;
   }

   return guiContent;
}</pre>
<p>Note that it uses an annotation in your class code to generate a tooltip in the inspector.</p>
<h3>3. Define new Custom Editors</h3>
<p>Unfortunately, you will still need to define a class for each MonoBehaviour. Fortunately, these definitions can be empty; all the actual work is done by the base class.</p>
<pre lang="csharp" escaped="true">[CustomEditor(typeof(MyClass))]
public class MyClassEditor : BaseEditor&lt;MyClass&gt;
{}</pre>
<p>In theory this step can be automated, but I have not tried it.</p>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/feed/</wfw:commentRss>
		<slash:comments>137</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">4647</post-id>	</item>
		<item>
		<title>I Want to Be a Game Artist!</title>
		<link>http://devmag.org.za/2012/06/26/i-want-to-be-a-game-artist-2/</link>
				<comments>http://devmag.org.za/2012/06/26/i-want-to-be-a-game-artist-2/#comments</comments>
				<pubDate>Tue, 26 Jun 2012 08:24:14 +0000</pubDate>
		<dc:creator><![CDATA[Jonathan Hau Yoon]]></dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[tertiary education]]></category>

		<guid isPermaLink="false">http://devmag.org.za/?p=4608</guid>
				<description><![CDATA[Tips for growing as a game artist and finding work in the game industry.]]></description>
								<content:encoded><![CDATA[<p><img style="float: none; margin-left: auto; margin-right: auto; border: 0px;" src="http://devmag.org.za/blog/wp-content/uploads/2012/06/IWantToBeAGameArtist1.png" alt="platfrom_banner" width="680" height="341" border="0" /><br />
That&#8217;s great! You&#8217;ll be flinging digital paint and shooting vertices, and making the game art world more beautiful as you go! But wait — a word of advice before you jump on the realtime rendering railway: you need three pieces of essential kit!</p>
<p><span id="more-4608"></span>Firstly, you need <strong>Artist Goggles</strong>. These art-tinted lenses directly affect the quality of your work by allowing you to look at your own and other people&#8217;s&nbsp;work and see what could make it more beautiful. They are also what all other artists will judge you by, and have a direct and overwhelming influence on your art portfolio — the key to getting yourself a job in the front lines! A sound knowledge of art principles, a great visual library, and having a thousand pieces of art to your name will keep your Goggles crystal clear.</p>
<p>You&#8217;ll also need the <strong>Map of Contraints</strong>. This map allows you to check whether your art can fit into a game on a technical level. As a game artist, your work needs to run in a game engine where lots of things need to be shown in real-time. Knowing how to optimize your art for games means freeing up resources that can be used for even <em>more</em> art, special effects, and other eyegasmic goodness.</p>
<p>Lastly, you&#8217;ll need <strong>Design Slippers</strong>, gained from the experiences of playing, studying and building game worlds. You&#8217;ll want to have thought about design, and how your art can help to craft great game experiences.</p>
<h2>I want me those Art Goggles!</h2>
<p>You upgrade your Art Goggles by gaining Art XP, which you earn by <strong>making art</strong>. It doesn&#8217;t really matter what kind of art you&#8217;re making, in any medium, as all art will improve&nbsp;your Art Goggles. However, some activities will earn you an XP BOOST. The most basic and most powerful one is drawing. <strong>Drawing</strong> teaches many art fundamentals that are vital to your XP growth, including (but not limited to!): gesture (the energy!), value (contrasts of light and dark), texture (what materials things are made of), form (describing things you&#8217;ve observed in the real, 3D world, on a 2D canvas, and using lighting and shading to get things looking good) and composition (how these all tie together).</p>
<p><strong>Painting</strong>&#8216;s also a great thing to learn, as it requires all of the above, but adds the concept of colour: how they work together, and how they (together with lighting) control the mood of your game.<strong></strong></p>
<p><strong>Photography</strong>&#8216;s also a great skill, often undervalued. Everything we see is made up of light, so studying how light behaves, different light setups for different situations and for bringing out the best of your subject matter, and how lighting can be used in composition are especially vital for environment work.<strong></strong></p>
<p><strong>Sculpting</strong> is also a great skill, particularly if you&#8217;re interested in being a 3D game artist.</p>
<p>While you may want to jump right into learning software, it&#8217;s a good idea to <strong>learn art independently to (and before) learning software</strong>. Learning software can be frustrating and slow your Art XP growth. You may find yourself spending more time trying to figure out how to do things using digital media than polishing your Art Goggles, so your work may end up looking shoddy, and you may not know why. While you&#8217;ll probably need to learn some software somewhere along the line, it shouldn&#8217;t be the focus of your efforts. Traditional media provide a more direct way of upgrading your Art Goggles.</p>
<p>Lastly, you&#8217;ll also want to <strong>grow your visual library</strong>. This means watching documentaries, reading books and being interested in the world around you. These are akin to allowing your Goggles to see a wider spectrum of colours. If you&#8217;ve studied anatomy, you can use that knowledge in your characters. If you&#8217;re a fan of WW2 weapons, you&#8217;ll make much more convincing guns. Having a great visual library means you don&#8217;t need to search for reference images as often (because you&#8217;ve got them in your head), and you&#8217;ll have lots of ideas to draw from (lolpun) when you&#8217;re making your game art.</p>
<h2>I want to make digital work!</h2>
<p>The software you learn should match the studios or teams you wish to join. In South Africa, <strong>Softimage</strong> (also called XSI) has a massive hold in the vast majority of 3D studios in film and advertising. If there isn&#8217;t enough game art work (our industry is still small, although growing) it will be really easy to transition to offline rendering jobs. (It&#8217;s generally quite easy to move from games to another 3D industry, because you&#8217;re working with fewer constraints; it&#8217;s generally harder to move the other way around. There are exceptions.) <strong>3ds Max</strong> is very popular in the visualization industry (product viz, arch viz). <strong>Maya</strong> has rapidly grown into an immensely popular package overseas because of it&#8217;s great toolset and extensibility in character animation, but only a handful of studios use it locally. <strong>Blender</strong> is free, and competent. <strong>ZBrush</strong> and <strong>Mudbox</strong> are widely used for sculpting and texture painting. You&#8217;ll also need a 2D app for painting textures for your 3D assets.</p>
<p>For 2D, <strong>Photoshop</strong> is by far the dominant software. However, most 2D programs can also handle Photoshop files, and there are far fewer issues with file compatibility in 2D than there is in 3D programs. You can probably get away with using <strong>whatever you&#8217;re comfortable with</strong>.</p>
<p>Many of the above software have educational versions (some of which are free) if you&#8217;re registered at a recognized school. If not, the free, open source stuff is great for learning, and once you&#8217;ve mastered them, switching to one of the others only takes a couple of weeks.</p>
<p>However, realize that <strong>if your Art Goggles are poorly maintained, your work will suffer tremendously regardless of what software you use</strong>. Although teams may build their own tools specific to the games they&#8217;re working on, there are only ever &#8220;magic buttons&#8221; for working faster &#8212; there are none that will make your art look better. It&#8217;s a good thing to be familiar with several packages, but it&#8217;s a great thing to be a specialist with at least one. Learning another package when one is already highly proficient with one already is a breeze.</p>
<h2>I want to study!</h2>
<p>There are a few things you should think about before signing up to any ol&#8217; 3D/art course. Firstly, realize that <strong>no school (to my knowledge) will teach you everything you&#8217;ll need to know when you&#8217;re working</strong>. It&#8217;s important to take an honest look at yourself, and see what you really want to get help with, and then look at what it is each school offers. Is it important to have a degree? (While this helps with work visas and emigration, the degree itself matters very little compared to your portfolio. Having options <em>is</em> nice though.) Are you looking for software training? Are you looking for help with upgrading your Goggles? (Most 3D courses seem to focus on the former, although a handful of courses do emphasize the importance of drawing.) Look at breakdowns of courses and see which needs they&#8217;re meeting.</p>
<p>Look at <strong>who&#8217;s lecturing</strong> the course. While you can get some mileage out of someone who&#8217;s really good at lecturing but has no real industry experience, I believe you can get much more out of someone who&#8217;s got industry experience but is a poor lecturer. You&#8217;ll have to work harder to get all the information you want, but at least the answers you&#8217;re getting are tried and tested. If a course description doesn&#8217;t mention who the lecturer is, that should be a big red flag.</p>
<p>Look for <strong>past students&#8217; work</strong>, and consider whether their work is better than you could do on your own. Ask about past students finding work in the game industry. (If you&#8217;re given names and names of studios, think about tracking down their details and asking them about the course.) Ask them, out of interest, how much of what they know came from the content the school covered, and how much they had to teach themselves.</p>
<p>Look for <strong>opportunities to intern</strong>. If it&#8217;s a good studio with artists that have been making game art for a few years, simply watching them work for 15 minutes a day will teach you countless methods of making assets faster, using not-so-obvious tools you may not have noticed before, workarounds to problematic software problems, how artists and programmers interact and how you would fit in in a game dev environment, and many other gems that you&#8217;re extremely unlikely to learn about in a school environment.</p>
<p>Finally, it definitely is <strong>possible to teach yourself</strong> everything you need to know without spending a fortune (if you spend some &nbsp;time interning too). Tutorials and software training given by globally respected industry pros can be purchased from many online stores. (Some good ones include The Gnomon Workshop, Eat3D and, if you&#8217;re an absolute beginner, DigitalTutors.) Realize that polishing your Goggles daily should be something you crave (I must draaaaw! Something like the <a title="MakeGamesSA Sketch Group Thread" href="http://makegamessa.com/discussion/9/makegames-sketchgroup" target="_blank">MakeGamesSA Sketch group</a> may encourage you).</p>
<p><strong>Feedback from industry veterans </strong>is also vital. (I highly recommend getting feedback and seeing what other people do on <a title="Polycount" href="http://www.polycount.com" target="_blank">Polycount</a>, where large number of members are working professionals, and there&#8217;s a culture of honest critique.) Even if you do attend a school, all of these self-teaching tools will help to push you even further, and are highly recommended.</p>
<p>That said, schools are useful though, for networking, for having deadlines that encourage discipline, for traditional art classes (if they offer this), and for being pushed to do things you wouldn&#8217;t normally be comfortable with that ultimately improve your versatility as an artist (mileage also varies per school). Having your own &#8220;style&#8221; is great if you&#8217;re pursuing fine art. However, having your own style because you can&#8217;t do anything else limits your usefulness as a production artist enormously. Good art schools don&#8217;t allow you to make the &#8220;but that&#8217;s my style&#8221; excuse. If you&#8217;re going the self-taught route, recognize these weaknesses and find ways to make up for them.</p>
<h2>I want a game art job!</h2>
<p>You nee a <strong>portfolio</strong>! Every employer, whether they&#8217;re an indie group or a giant corporation needs to see evidence that you can pull off the work that they&#8217;ll need you to be able to do. Make sure your portfolio matches the kind of studio you&#8217;re heading to, whether it&#8217;s pixel art, digital paintings or 3D. Some quick and dirty tips about putting together a portfolio:</p>
<ul>
<li>Only include your <strong>best work</strong>. It&#8217;s better to have <em>one</em> truly stellar piece of work than a lot of mediocre work.</li>
<li>If you know which studio you&#8217;re trying to get into, <strong>make work that is relevant</strong> to them. You should be able to hold your work up next to a shot of one of their games, and honestly tell yourself that your work would easily fit there, and look just as good, or better.</li>
<li><strong>Answer questions</strong> with your work. (Example questions might include: Does this person understand lighting? Does this person understand anatomy? Will this person be able to create good quality work on a tight deadline? Does this person understand the constraints of getting her work into a game engine? Answers to these questions might include full environment pieces, anatomy studies, competition entries and captures from a real-time renderer, respectively. Which questions you prioritize depends on what kind of artist you want to be.)</li>
</ul>
<p>Also realize that the majority of positions are filled by referrals or word-of-mouth. It&#8217;s a really good idea to <strong>be involved</strong> in game communities, to <strong>show work</strong> regularly, to <strong>take feedback and critique professionally</strong> (regardless of how savage the feedback might be), and to be the person that people think of when a position pops up. Don&#8217;t be isolated, or nobody will even know you&#8217;re keen for a job.</p>
<h2>Further reading</h2>
<ul>
<li><a href="http://wiki.polycount.com/">The Polycount wiki</a>. <strong>&nbsp;</strong>Many of these FAQs are answered there in more detail.</li>
<li><a href="http://conceptart.org/wiki/doku.php" class="broken_link" rel="nofollow">The ConceptArt wiki</a>. Awesome for those wanting to improve their Art Goggles.</li>
</ul>
<h2>Local schools</h2>
<p>A comprehensive list of art/3D/animation schools in South Africa can be found at <a href="http://www.animationsa.org/training-education/schools" target="_blank" class="broken_link" rel="nofollow">AnimationSA</a>. I&#8217;m making no recommendations —&nbsp;but it&#8217;s probably a good idea to filter them using the stuff in this article before you sign up. <img src="https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<h2>Header image</h2>
<p><a href="http://ambassadormann.deviantart.com/art/Steampunk-Goggles-11-1-166924592" class="broken_link" rel="nofollow">http://ambassadormann.deviantart.com/art/Steampunk-Goggles-11-1-166924592</a></p>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2012/06/26/i-want-to-be-a-game-artist-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">4608</post-id>	</item>
		<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><![CDATA[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[Loopholes: what they are, how to find them, how to fix them, and a big list of generic loopholes in games.]]></description>
								<content:encoded><![CDATA[<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/" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">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/" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">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/" class="broken_link" rel="nofollow">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/" class="broken_link" rel="nofollow">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/" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">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 playing 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" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow"><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>&#8211;</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" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow"><em>Halo</em></a><a href="http://www.wired.com/gaming/virtualworlds/magazine/15-09/ff_halo?currentPage=all" class="broken_link" rel="nofollow"><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" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">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/" class="broken_link" rel="nofollow">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" srcset="http://devmag.org.za/blog/wp-content/uploads/2012/05/clip_image005.jpg 614w, http://devmag.org.za/blog/wp-content/uploads/2012/05/clip_image005-300x171.jpg 300w" sizes="(max-width: 614px) 100vw, 614px" /></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" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">loophole abuses</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/SequenceBreaking" class="broken_link" rel="nofollow">sequence breaking</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/GameplayDerailment" class="broken_link" rel="nofollow">gameplay derailment</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/NotTheIntendedUse" class="broken_link" rel="nofollow">not the intended use</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/EasyLevelTrick" class="broken_link" rel="nofollow">easy level trick</a>, <a href="http://tvtropes.org/pmwiki/pmwiki.php/Main/RubberBandAI" class="broken_link" rel="nofollow">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>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2012/05/07/loopholes-in-game-design/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">4531</post-id>	</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><![CDATA[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[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.]]></description>
								<content:encoded><![CDATA[<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 />
<iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/h_fsM6LBi54?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></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 />
<iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/4DmsDICPnjg?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></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 />
<iframe class='youtube-player' type='text/html' width='1170' height='659' src='https://www.youtube.com/embed/i1QUX6--waA?version=3&#038;rel=1&#038;fs=1&#038;autohide=2&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' allowfullscreen='true' style='border:0;'></iframe></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/" class="broken_link" rel="nofollow">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" class="broken_link" rel="nofollow">game audio</a>.</li>
<li>Sander Huibert’s thesis <a href="http://download.captivatingsound.com/Sander_Huiberts_CaptivatingSound.pdf" class="broken_link" rel="nofollow">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/" class="broken_link" rel="nofollow">http://www.flickr.com/photos/frostnova/606822557/sizes/z/in/photostream/</a>.</p>
]]></content:encoded>
							<wfw:commentRss>http://devmag.org.za/2012/04/19/video-game-audio-diegesis-theory-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
						<post-id xmlns="com-wordpress:feed-additions:1">4482</post-id>	</item>
	</channel>
</rss>