<?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"
	>

<channel>
	<title>Focused Games</title>
	<atom:link href="http://focusedgames.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://focusedgames.com</link>
	<description>Focused Games.</description>
	<pubDate>Tue, 14 Oct 2008 18:54:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Galactic Wars (2.0) - Menus</title>
		<link>http://focusedgames.com/2008/10/14/galactic-wars-20-menus/</link>
		<comments>http://focusedgames.com/2008/10/14/galactic-wars-20-menus/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 18:54:17 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<category><![CDATA[Zune]]></category>

		<category><![CDATA[Galactic Wars]]></category>

		<category><![CDATA[Galactic Wars 3]]></category>

		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=93</guid>
		<description><![CDATA[I am taking a different approach to the menus in the next version of Galactic Wars (formally known as Galactic Wars 3). The previous version (1.3) used a new sliding menu that shifted to seemingly random points on an image and displayed some text for the point. It made sense since Galactic Wars does take [...]]]></description>
			<content:encoded><![CDATA[<p>I am taking a different approach to the menus in the next version of Galactic Wars (formally known as Galactic Wars 3). The previous version (1.3) used a new sliding menu that shifted to seemingly random points on an image and displayed some text for the point. It made sense since Galactic Wars does take place in space (each menu choice was a star in a galaxy). However the graphics required to do this were a big drawback, even on the Zune. This is because you can&#8217;t really have a low resolution image and have to make it much larger than the screen to get the sliding effect to look good. Because the game is going to the PC and Xbox 360 platforms, to carry over this idea would require even bigger images. In the end, it just doesn&#8217;t make sense.</p>
<p>So the new idea is to keep it sleak and simple. On the PC/360 version the menus will drill down a little differently but the idea is the same.</p>
<div style="text-align:center;"><embed src="http://images.video.msn.com/flash/soapbox1_1.swf" width="432" height="364" id="8kqkbbtv" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" pluginspage="http://macromedia.com/go/getflashplayer" flashvars="c=v&#038;v=eb945ef8-ae67-45a4-bb83-fe3c17657729&#038;ifs=true&#038;fr=msnvideo&#038;mkt=en-US"></embed><noembed><a href="http://video.msn.com/video.aspx?vid=eb945ef8-ae67-45a4-bb83-fe3c17657729" target="_new" title="Galactic Wars - New Menus">Video: Galactic Wars - New Menus</a></noembed></div>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/14/galactic-wars-20-menus/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GMS Alpha Available</title>
		<link>http://focusedgames.com/2008/10/13/gms-alpha-available/</link>
		<comments>http://focusedgames.com/2008/10/13/gms-alpha-available/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 16:38:37 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<category><![CDATA[Zune]]></category>

		<category><![CDATA[GMS]]></category>

		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=92</guid>
		<description><![CDATA[A very early version of Gato Muy Splato is now available for download one the Zune Games page.
]]></description>
			<content:encoded><![CDATA[<p>A very early version of Gato Muy Splato is now available for download one the <a href="http://focusedgames.com/games/"><b>Zune Games</b></a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/13/gms-alpha-available/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Building an Xml Serialization Provider</title>
		<link>http://focusedgames.com/2008/10/13/building-an-xml-serialization-provider/</link>
		<comments>http://focusedgames.com/2008/10/13/building-an-xml-serialization-provider/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 15:45:19 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Data]]></category>

		<category><![CDATA[Deserialization]]></category>

		<category><![CDATA[FGF]]></category>

		<category><![CDATA[Serialization]]></category>

		<category><![CDATA[Xml]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=91</guid>
		<description><![CDATA[While building Galactic Wars 3 version 2.0, I quickly ran into a serious problem with Xml serialization and more specifically deserialization. A few months ago I rolled my own solution for serializing data to and from Xml because the built in classes were bloated and yet not feature rich. A week or two ago I [...]]]></description>
			<content:encoded><![CDATA[<p>While building Galactic Wars 3 version 2.0, I quickly ran into a serious problem with Xml serialization and more specifically deserialization. A few months ago I rolled my own solution for serializing data to and from Xml because the built in classes were bloated and yet not feature rich. A week or two ago I managed to get my class (XmlProvider) to compile for the Zune and Xbox 360. But there was still a problem&#8230;</p>
<ol>
<li><b>References</b><br/><br />
The first problem (the reason for the creation of XmlProvider) was that the built-in classes could not handle references. Every object had to be serialized straight through from top to bottom. Thus if you had an object with two properties that referenced the same object (in memory), the object would be serialized twice.</li>
<li><b>Inheritance</b><br/><br />
The new problem is that with XmlProvider, deserialization was based on the information given by property attributes in your code. This is limiting because you may not know at compile time what exact type of object your property will be holding a reference to. In Galactic Wars 3 this is a problem when I am saving the profile of the user and want to save his specific ship.</li>
</ol>
<p>So what is the solution? Start from scratch of course and solve these two problems at once! The first one is easy: provide a mechanism with which to uniquely identify any objects in memory and in Xml. We can then build a cache which we can reference from as we find objects with references. The solution to the second problem is also simple: rely on the type name in the Xml rather than the type on the property&#8217;s attributes.<span id="more-91"></span></p>
<p>To start us off, we will need an attribute with which we can decorate our classes. We will call this class XmlNodeAttribute since anything utilizing it will become an XmlNode. The code is fairly straight forward as shown below. We need a simple enumeration to define what type of Xml node to create because objects with properties need to be treated differently than simple types like boolean, string, int, et cetera.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('912');">[<span id="912_symbol">-</span>]</a></span><span class="codebox_left"><span id="l91code2"><a href="javascript:;" onclick="javascript:showCodeTxt('91code2'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="912"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="91code2"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> XmlNodeAttribute <span style="color: #008000;">:</span> Attribute<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> XmlNodeAttribute<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> name, XmlNodeType nodeType<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        Name <span style="color: #008000;">=</span> name;
        NodeType <span style="color: #008000;">=</span> nodeType;
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> XmlNodeType NodeType <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name <span style="color: #000000;">&#123;</span> get; set; <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">enum</span> XmlNodeType<span style="color: #000000;">&#123;</span>
    Complex,
    Simple
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Next we can setup our XmlProvider class&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/13/building-an-xml-serialization-provider/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FGF 1.2 Available</title>
		<link>http://focusedgames.com/2008/10/04/fgf-12-available/</link>
		<comments>http://focusedgames.com/2008/10/04/fgf-12-available/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 23:42:00 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[FGF]]></category>

		<category><![CDATA[Thrust]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=89</guid>
		<description><![CDATA[Get it on the FGF page! This should fix the problems from the previous version.
]]></description>
			<content:encoded><![CDATA[<p>Get it on the <a href="http://focusedgames.com/fg-framework/"><b>FGF page</b></a>! This should fix the problems from the previous version.</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/04/fgf-12-available/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thrust v1.2</title>
		<link>http://focusedgames.com/2008/10/04/thrust-v1/</link>
		<comments>http://focusedgames.com/2008/10/04/thrust-v1/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 15:35:16 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[FGF]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Thrust]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=88</guid>
		<description><![CDATA[Before people start reporting problems with Thrust v1.1, let me say that version 1.2 is already on its way. I have caught a few bugs in the InputManager that are demanding a quick release. I will also be including some new GUI functionality.
In the meantime, catch up on the tutorials and samples about using the [...]]]></description>
			<content:encoded><![CDATA[<p>Before people start reporting problems with Thrust v1.1, let me say that version 1.2 is already on its way. I have caught a few bugs in the InputManager that are demanding a quick release. I will also be including some new GUI functionality.</p>
<p>In the meantime, catch up on the tutorials and samples about <a href="http://jsedlak.homedns.org:6666/FGDN/fgf-samples"><b>using the Focused Games Framework</b></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/04/thrust-v1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Advanced State System: Queues and Removal</title>
		<link>http://focusedgames.com/2008/10/01/ats-queues-and-removal/</link>
		<comments>http://focusedgames.com/2008/10/01/ats-queues-and-removal/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 18:45:08 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[XNA]]></category>

		<category><![CDATA[State Management]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=85</guid>
		<description><![CDATA[During the last part of this little article series I mentioned how I used a queue in each state object to allow for continuous transitioning to occur. The reason for this is to allow for complex transitioning to occur. One example for this is a logo screen where it needs to fade in, stay on [...]]]></description>
			<content:encoded><![CDATA[<p>During the <a href="http://focusedgames.com/2008/10/01/ats-concept-and-base/">last part</a> of this little article series I mentioned how I used a queue in each state object to allow for continuous transitioning to occur. The reason for this is to allow for complex transitioning to occur. One example for this is a logo screen where it needs to fade in, stay on screen and then fade out again. Rather than relying on managing the states manually, we can add states on to a queue so they occur automatically.</p>
<p><span id="more-85"></span></p>
<p>In the StateObject class, let’s add a private queue to the list of private fields.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8510');">[<span id="8510_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code10"><a href="javascript:;" onclick="javascript:showCodeTxt('85code10'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8510"><td width="1%" class="line_numbers"><pre>1
</pre></td><td class="code" id="85code10"><pre class="csharp"><span style="color: #0600FF;">private</span> Queue<span style="color: #008000;">&lt;</span>State<span style="color: #008000;">&gt;</span> statesToTransition <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Queue<span style="color: #008000;">&lt;</span>State<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>Next up, we need to fix the Transition function to take into consideration the queue. Instead of beginning the transition immediately, we need to add it to the queue and then check if we can use it.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8511');">[<span id="8511_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code11"><a href="javascript:;" onclick="javascript:showCodeTxt('85code11'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8511"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="85code11"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #0600FF;">void</span> Transition<span style="color: #000000;">&#40;</span>State newState<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    statesToTransition.<span style="color: #0000FF;">Enqueue</span><span style="color: #000000;">&#40;</span>newState<span style="color: #000000;">&#41;</span>;
&nbsp;
    CheckForNewTransition<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Note that we have removed the transitioning code and put it inside a new function that we need to create.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8512');">[<span id="8512_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code12"><a href="javascript:;" onclick="javascript:showCodeTxt('85code12'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8512"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="85code12"><pre class="csharp"><span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">virtual</span> <span style="color: #0600FF;">void</span> CheckForNewTransition<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>CurrentState <span style="color: #008000;">==</span> States.<span style="color: #0000FF;">Transitioning</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">return</span>;
&nbsp;
    <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>statesToTransition.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CurrentState <span style="color: #008000;">=</span> States.<span style="color: #0000FF;">Transitioning</span>;
        NextState <span style="color: #008000;">=</span> statesToTransition.<span style="color: #0000FF;">Dequeue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
        transitionTime <span style="color: #008000;">=</span> NextState.<span style="color: #0000FF;">Time</span>;
        currentTime <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>.0f;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>This function checks to make sure that the object isn’t already transitioning because if it is, we can’t start a new transition. It then checks the queue for a new state to transition to and if so, starts that transition. Because we do not want it to transition only when we add a new state on the queue, we need to add a call to this function in the Update method.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8513');">[<span id="8513_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code13"><a href="javascript:;" onclick="javascript:showCodeTxt('85code13'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8513"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="85code13"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #0600FF;">void</span> Update<span style="color: #000000;">&#40;</span>GameTime gameTime<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    CheckForNewTransition<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
    UpdateTransition<span style="color: #000000;">&#40;</span>gameTime<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>This, unfortunately, is just not good enough! No, we need to add a function so we can adjust the transition time for each state change. This allows us to avoid creating new states just to change their timing. To do this, we simply add an overload to the Transition function.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8514');">[<span id="8514_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code14"><a href="javascript:;" onclick="javascript:showCodeTxt('85code14'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8514"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="85code14"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #0600FF;">void</span> Transition<span style="color: #000000;">&#40;</span>State newState, <span style="color: #FF0000;">float</span> time<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    newState.<span style="color: #0000FF;">Time</span> <span style="color: #008000;">=</span> time;
&nbsp;
    Transition<span style="color: #000000;">&#40;</span>newState<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Now that we can do some fancy transitioning, we also want to make sure we handle when the state changes. We will modify a method in our StateObject, OnStateChanged, which will handle when this situation occurs. What we want to handle is when a special state comes to pass, the RemoveReady state.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8515');">[<span id="8515_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code15"><a href="javascript:;" onclick="javascript:showCodeTxt('85code15'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8515"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="85code15"><pre class="csharp"><span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">virtual</span> <span style="color: #0600FF;">void</span> OnStateChanged<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">if</span><span style="color: #000000;">&#40;</span>CurrentState <span style="color: #008000;">==</span> States.<span style="color: #0000FF;">RemoveReady</span><span style="color: #000000;">&#41;</span>
        StateManager.<span style="color: #0000FF;">Remove</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Now we need to adjust StateManager to make sure each state object is given a reference to the manager so this is possible. To do this, we will modify the Load method as follows.</p>

<div class="wp_codebox_msgheader"><span class="codebox_right"><a href="javascript:;" onclick="toggle_collapse('8516');">[<span id="8516_symbol">-</span>]</a></span><span class="codebox_left"><span id="l85code16"><a href="javascript:;" onclick="javascript:showCodeTxt('85code16'); return false;">View Code</a> CSHARP</span></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="8516"><td width="1%" class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="85code16"><pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> Load<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">params</span> IStateObject<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> objectsToLoad<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>; i <span style="color: #008000;">&lt;</span> objectsToLoad.<span style="color: #0000FF;">Length</span>; i<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
        objectsToLoad<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">StateManager</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">this</span>;
&nbsp;
    currentObjects.<span style="color: #0000FF;">AddRange</span><span style="color: #000000;">&#40;</span>objectsToLoad<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>And there you have it. You can download the updated source code below.</p>
<p><a href="http://focusedgames.com/wp-content/plugins/download-monitor/download.php?id=18" title="Downloaded 20 times" >ATS: Part 2 (20) - 115.95 KB</a></p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/01/ats-queues-and-removal/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Advanced State System: Concept and Base</title>
		<link>http://focusedgames.com/2008/10/01/ats-concept-and-base/</link>
		<comments>http://focusedgames.com/2008/10/01/ats-concept-and-base/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 17:36:23 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[XNA]]></category>

		<category><![CDATA[State Management]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=84</guid>
		<description><![CDATA[There comes a time when simple state management just will not cut it anymore. I found this out while building up the code base for Thrust’s GUI library. As the objects on the screen became more complex, so did their states. This article covers a new way of thinking about an object’s state, a design [...]]]></description>
			<content:encoded><![CDATA[<p>There comes a time when simple state management just will not cut it anymore. I found this out while building up the code base for Thrust’s GUI library. As the objects on the screen became more complex, so did their states. This article covers a new way of thinking about an object’s state, a design that has been proven in Thrust (v1.x). The goals of this state system include the following:</p>
<p><span id="more-84"></span></p>
<ol>
<li><b>Easy to use</b><br/>
<p>The system needs to be abstract enough that developers can easily integrate it with their current code. It should be transparent and simple in its most basic form. This means that the idea of an object having a state should require no special implementation code for the developer introducing states to his or her objects.</p>
</li>
<li><b>Easy to extend</b><br/>
<p>What base layer we build has to be open enough that new states can be defined on the fly or hardcoded. This implies that no constants should be used (Enumerations) and the base layer should understand new states.</p>
</li>
<li><b>Powerful</b><br/>
<p>This is a very general term, but the point is clear. The state system must be able to have some guaranteed affect on the code we introduce it to. The state system must introduce some way of controlling the objects.</p>
</li>
</ol>
<p>These three guiding rules will help us understand exactly how to design the system. As we understand the implications of each, we need to make some specific assumptions about the platform we are writing for and what each state or object needs to have.</p>
<ol>
<li><b>Support for interfaces, structs and classes</b><br/>
<p>In this case we are using C# and the XNA Framework, but this state system can be applied elsewhere. Thus we need to make the assumption that the platform (and language) we are implementing the system in is Object Oriented and has support for interfaces, structs, classes, inheritance and more.</p>
</li>
<li><b>Each object will know how to control itself</b><br/>
<p>In Thrust I made the assumption that each object knows how to control itself. This simple means that an object that has a state knows what to do with that state. To understand this better, let’s apply it to humans. A human can be considered to have many states, among them “Asleep” and “Awake”. When a human being is sleeping, it knows to dream, to rest, et cetera. We do not have some outside source telling us to dream. In a similar manor, objects that have state must know what to do in each state.</p>
</li>
<li><b>Each object has some known functionality</b><br/>
<p>Because we are applying this to XNA, we are going to assume that each object’s known functionality is to be drawn and to be updated. Knowing this functionality will help the state system to understand what to do with each object. You can ignore this assumption in order to implement it in a dynamic manor, but we will save that for a future article.</p>
</li>
</ol>
<p>Now that we understand the goals of the system and what assumptions we need to make, we can start designing the system itself. I will, unfortunately, catch a lot of flak for saying this, but I believe that manager classes do have a place in modern game development. In the situation this article presents, we can utilize a manager class to help objects transition between states. Each object, according to goal number one and two, must be generic in some way. Thus we introduce an interface to define the common functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/10/01/ats-concept-and-base/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FGF Beta, Folder Kill Installers</title>
		<link>http://focusedgames.com/2008/09/30/fgf-beta-folder-kill-installers/</link>
		<comments>http://focusedgames.com/2008/09/30/fgf-beta-folder-kill-installers/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 12:21:56 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Applications]]></category>

		<category><![CDATA[FGF]]></category>

		<category><![CDATA[Folder Kill]]></category>

		<category><![CDATA[General]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[FGDN]]></category>

		<category><![CDATA[IIS]]></category>

		<category><![CDATA[Thrust]]></category>

		<category><![CDATA[Vodka]]></category>

		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=82</guid>
		<description><![CDATA[I have put up a new version of the Focused Games Framework for download. This release includes Thrust v1.1 and Vodka Alpha files. I have also released X86 and X64 installers for Folder Kill. Below is a more complete list of the changes made.
Thrust

Created Content Pipeline Project
Terrain Content
Cleaned some StateObject &#38; Menu code
Added repeat states [...]]]></description>
			<content:encoded><![CDATA[<p>I have put up a new version of the <a href="http://focusedgames.com/fg-framework/">Focused Games Framework</a> for download. This release includes Thrust v1.1 and Vodka Alpha files. I have also released X86 and X64 installers for <a href="http://focusedgames.com/applications/">Folder Kill</a>. Below is a more complete list of the changes made.</p>
<h3>Thrust</h3>
<ul>
<li>Created Content Pipeline Project</li>
<li>Terrain Content</li>
<li>Cleaned some StateObject &amp; Menu code</li>
<li>Added repeat states for GamePad</li>
<li>Added Xbox 360 projects</li>
<li>Added Camera components</li>
<li>Added Console component</li>
<li>Diagnostics
<ul>
<li>Added Stats component</li>
<li>Added Thumbstick Throttle Component</li>
</ul>
</li>
</ul>
<h3>Vodka</h3>
<ul>
<li>Created core Vodka project</li>
<li>Added core interfaces</li>
<li>Implemented a few providers</li>
<li>Added Services project.</li>
</ul>
<p>Finally, I urge you to keep an eye on <a href="http://jsedlak.homedns.org:6666/FGDN"><b>FGDN</b></a> as I continue to add to it over the next couple of months.</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/09/30/fgf-beta-folder-kill-installers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Donation Time!</title>
		<link>http://focusedgames.com/2008/09/27/donation-time/</link>
		<comments>http://focusedgames.com/2008/09/27/donation-time/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 12:58:05 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=80</guid>
		<description><![CDATA[Ziggy of Ziggyware, as many of you know, has been hit really badly by the latest hurricanes and storms. Please consider taking the time to donate a few bucks to help keep his site and contests alive. If you do not care for donating, perhaps now would be a good time to buy an XNA [...]]]></description>
			<content:encoded><![CDATA[<p>Ziggy of <a href="http://www.ziggyware.com/news.php?readmore=346"><b>Ziggyware</b></a>, as many of you know, has been hit really badly by the latest hurricanes and storms. Please consider taking the time to donate a few bucks to help keep his site and contests alive. If you do not care for donating, perhaps now would be a good time to buy an XNA book from Amazon through his site&#8217;s many book links. You can read more on his <a href="http://www.ziggyware.com/news.php?readmore=346">website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/09/27/donation-time/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Galactic Wars 3 v1.3</title>
		<link>http://focusedgames.com/2008/09/25/galactic-wars-3-v13/</link>
		<comments>http://focusedgames.com/2008/09/25/galactic-wars-3-v13/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 15:44:04 +0000</pubDate>
		<dc:creator>John Sedlak</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<category><![CDATA[Zune]]></category>

		<category><![CDATA[GW3]]></category>

		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://focusedgames.com/?p=79</guid>
		<description><![CDATA[I have upgraded GW3 for Xna 3.0 Beta and Thrust v1.1. I have included a fifth level that should be very hard and attempted to fix a few bugs. If you run into any issues, please do not hesitate to let me know. You can download the GW3 source code from the following link:
Galactic Wars [...]]]></description>
			<content:encoded><![CDATA[<p>I have upgraded <a href="http://focusedgames/games">GW3</a> for Xna 3.0 Beta and Thrust v1.1. I have included a fifth level that should be very hard and attempted to fix a few bugs. If you run into any issues, please do not hesitate to let me know. You can download the GW3 source code from the following link:</p>
<p><a href="http://focusedgames.com/wp-content/plugins/download-monitor/download.php?id=12" title="Version 1.3 downloaded 2431 times" >Galactic Wars 3 (2431) - 7.46 MB</a></p>
]]></content:encoded>
			<wfw:commentRss>http://focusedgames.com/2008/09/25/galactic-wars-3-v13/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
