<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>H1DD3N.R350URC3 &#187; D6</title>
	<atom:link href="http://blog.hexagonstar.com/tag/d6/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hexagonstar.com</link>
	<description>turn-based glory and pixel pleasure</description>
	<lastBuildDate>Sat, 10 Dec 2011 02:45:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ActionScript3 Dice Class</title>
		<link>http://blog.hexagonstar.com/diceclass/</link>
		<comments>http://blog.hexagonstar.com/diceclass/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 11:29:23 +0000</pubDate>
		<dc:creator>sascha</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Random Picks]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[D20]]></category>
		<category><![CDATA[D6]]></category>
		<category><![CDATA[Dice]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[SWF]]></category>

		<guid isPermaLink="false">http://blog.hexagonstar.com/aboutrollingdice/</guid>
		<description><![CDATA[<script type="text/javascript" src="http://blog.hexagonstar.com/wp-content/plugins/pb-embedflash/js/sbadapter/shadowbox-jquery.js"></script><script type="text/javascript" src="http://blog.hexagonstar.com/wp-content/plugins/pb-embedflash/js/shadowbox.js"></script><script type="text/javascript"><!--
window.onload = function() {var options ={assetURL:'',loadingImage:'http://blog.hexagonstar.com/wp-content/plugins/pb-embedflash/css/images/loading.gif',flvPlayer:'http://blog.hexagonstar.com/wp-content/plugins/pb-embedflash/swf/mediaplayer.swf',animate:true,animSequence:'wh',overlayColor:'#000',overlayOpacity:0.85,overlayBgImage:'http://blog.hexagonstar.com/wp-content/plugins/pb-embedflash/css/images/overlay-85.png',listenOverlay:true,autoplayMovies:true,showMovieControls:true,resizeDuration:0.35,fadeDuration:0.35,displayNav:true,continuous:false,displayCounter:true,counterType:'default',viewportPadding:20,handleLgImages:'resize',initialHeight:160,initialWidth:320,enableKeys:true,keysClose:['c', 'q', 27],keysPrev:['p', 37],keysNext:['n', 39],handleUnsupported:'',text: {cancel:'Cancel',loading: 'loading',close:'<span class="shortcut">C</span>lose',next:'<span class="shortcut">N</span>ext',prev:'<span class="shortcut">P</span>revious',errors:{single: 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',shared: 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',either: 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'}}};Shadowbox.init(options);}
--></script>In game development randomness is often necessary for certain tasks, be it the random distribution of graphic tiles, a random factor in NPC AI or random stats in a roleplaying game. Especially for the latter purpose the static Dice class provides a set of methods to roll dice as it is common in a Role-playing [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="alignnone size-full wp-image-217 aligncenter" src="http://blog.hexagonstar.com/wp-content/uploads/dice_collection.jpg" alt="" width="500" height="179" /></p>
<p>In game development randomness is often necessary for certain tasks, be it the random distribution of graphic tiles, a random factor in NPC AI or random stats in a roleplaying game. Especially for the latter purpose the static <em>Dice class</em> provides a set of methods to roll dice as it is common in a Role-playing game, to be exact four-, six-, eight-, ten-, twelve-, twenty-sided and percentile dice.</p>
<p><span id="more-162"></span></p>
<p>The Dice class (and it&#8217;s supporting classes) are rather elaborated, using for example the <a href="http://en.wikipedia.org/wiki/Linear_congruential_generator" target="_blank">Linear Congruential algorithm </a>in the process of generating &#8216;true&#8217; random numbers so it might not be the most speed-optimized method for calculating random numbers. For absolute performance the LCA and rounding routines can be removed to speed up calculations.</p>
<p>Using the Dice class is very simple! For example rolling two ten-sided dice can be done with the following call &#8230;</p>
<pre lang="actionscript3">var result:int = Dice.tenSided(2);</pre>
<p>&#8230; rolling the percentile die is even simpler as it does not need any arguments. It always returns a value between 1 and 100 &#8230;</p>
<pre lang="actionscript3">var result:int = Dice.percentile();</pre>
<p>&#8230; the class also provides the  <em>roll </em>method with that any x-sided die could be rolled, 3 sixteen-sided dice for instance &#8230;</p>
<pre lang="actionscript3">var result:int = Dice.roll(16, 3);</pre>
<p>The following small Flex application uses the Dice class and can be used to test dice throw probability according to the <a href="http://www.darkshire.net/jhkim/rpg/systemdesign/dice-methods.html" target="_blank">bell curve </a>(the more dice are used the lower the probability to roll boundary results).</p>
<p style="text-align: center;"><small>(Please open the article to see the Flash content.)</small></p>
<p><a href="http://blog.hexagonstar.com/download/diceclass.zip" title="Download AS3 Dice Class v1.0.0 (6.89 kB, downloaded 987 times)"><img src="http://blog.hexagonstar.com/wp-content/uploads/downloadbutton.png" alt="Download AS3 Dice Class v1.0.0 (6.89 kB, downloaded 987 times)" /></a></p>
<p>Update: The Dice class is now part of the hexagonLib and can be found <a href="http://code.google.com/p/hexagon/source/browse/trunk/hexagon/src/hexagonlib/flash/com/hexagonstar/util/Dice.as" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hexagonstar.com/diceclass/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

