<?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>The NekoCake notePad</title>
	<atom:link href="http://www.nekocake.com/pad/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nekocake.com/pad</link>
	<description>RamblingsOfADerangedShape.....</description>
	<pubDate>Sat, 17 Nov 2007 19:42:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>TileSets, now in XML</title>
		<link>http://www.nekocake.com/pad/2007/11/17/tilesets-now-in-xml/</link>
		<comments>http://www.nekocake.com/pad/2007/11/17/tilesets-now-in-xml/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 19:42:33 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/11/17/tilesets-now-in-xml/</guid>
		<description><![CDATA[over the passed two days ive cleaned up my tile engine to allow for it to be serialized in to Xml. now, TileSets are read in from xml sheets created in a new simple TileSet builder tool Ive made. Im now working on a map builder, which will beable to save out maps in Xml.
 [...]]]></description>
			<content:encoded><![CDATA[<p>over the passed two days ive cleaned up my tile engine to allow for it to be serialized in to Xml. now, TileSets are read in from xml sheets created in a new simple TileSet builder tool Ive made. Im now working on a map builder, which will beable to save out maps in Xml.</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/1.jpg"><img height="244" alt="1" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/1-thumb.jpg" width="235" border="0" /></a> </p>
<p>1. open up the TileSet Builder tool, small splash screen.</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/2.jpg"><img height="181" alt="2" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/2-thumb.jpg" width="244" border="0" /></a> </p>
<p>2. next, you select tile image file that holds the tiles</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/3.jpg"><img height="244" alt="3" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/3-thumb.jpg" width="235" border="0" /></a> </p>
<p>3. now we can input some basic info about the TileSet, such as the amount of tiles on the sheet, the size of any spacing between the tiles and the height and width of each tile. A preview of the tile set is shown as well, you can click on it to see it full size and unstreached. Later im going to try and a grid over the preview image so you can check if the inputs are correct.</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/4.jpg"><img height="244" alt="4" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/4-thumb.jpg" width="235" border="0" /></a> </p>
<p>4. next we define the base tile information</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/5.jpg"><img height="244" alt="5" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/5-thumb.jpg" width="235" border="0" /></a> </p>
<p>5. and then we can tweak it more in more detail! this is mainly for setting up anumated tile sets, you can remove a tile from the set(you only want the base animation frame to be part of the set), change the FPS and ID numer of a tile aswell as add and remove frames from the animation list.</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/6.jpg"><img height="244" alt="6" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/6-thumb.jpg" width="235" border="0" /></a> </p>
<p>6. finaly were all done, and can save out the TileSet</p>
<p>&#160;</p>
<p>At the moment the tool is a bit sloppy, you can probably tell its far from idea, but its great for buiding up XML files for quick testing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/11/17/tilesets-now-in-xml/feed/</wfw:commentRss>
		</item>
		<item>
		<title>First screenshot of CrimsonEngine&#8217;s new Tile based map support</title>
		<link>http://www.nekocake.com/pad/2007/11/12/first-screenshot-of-crimsonengines-new-tile-based-map-support/</link>
		<comments>http://www.nekocake.com/pad/2007/11/12/first-screenshot-of-crimsonengines-new-tile-based-map-support/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 07:03:31 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/11/12/first-screenshot-of-crimsonengines-new-tile-based-map-support/</guid>
		<description><![CDATA[ 
(note: mouse not showing up on screen shots :(, trust me, the tile location stuff is right  )
Currently Supports

- Maps of any size with any amount of layers 
- smooth scrolling 
- basic saving and loading 
- tile picking 
- multiple tile sheets 
- tiles with attached data 

Coming in the next few [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/crimsonenginealpha1-tiles.jpg"><img height="631" alt="CrimsonEngineAlpha1_tiles" src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/crimsonenginealpha1-tiles-thumb.jpg" width="799" border="0" /></a> </p>
<p>(note: mouse not showing up on screen shots :(, trust me, the tile location stuff is right <img src='http://www.nekocake.com/pad/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )</p>
<p>Currently Supports</p>
<ul>
<li>- Maps of any size with any amount of layers </li>
<li>- smooth scrolling </li>
<li>- basic saving and loading </li>
<li>- tile picking </li>
<li>- multiple tile sheets </li>
<li>- tiles with attached data </li>
</ul>
<p>Coming in the next few builds    <br />- better camera support (zooming, possibly rotation)     <br />- better file definition     <br />- quadtree based object renderer     <br />- intergration with CrimsonEngine&#8217;s object and console systems     <br />- improved resolution independance</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/11/12/first-screenshot-of-crimsonengines-new-tile-based-map-support/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A useful code snippit</title>
		<link>http://www.nekocake.com/pad/2007/11/10/a-useful-code-snippit/</link>
		<comments>http://www.nekocake.com/pad/2007/11/10/a-useful-code-snippit/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 15:59:46 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[C#]]></category>

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

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/11/10/a-useful-code-snippit/</guid>
		<description><![CDATA[Whenever i start a new codefile, alot of the time i find myself haveing to add all the xna refrences at the top, so i realised this would make an exilent snippit
save the following xml as UsingXNA.snippet

- &#60;CodeSnippets xmlns=&#8221;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&#8220;&#62;

- &#60;CodeSnippet Format=&#8221;1.0.0&#8220;&#62;

- &#60;Header&#62;

  &#60;Title&#62;XNA Using statments&#60;/Title&#62;

  &#60;Author&#62;NekoCake Industries&#60;/Author&#62;

  &#60;Description&#62;Inserts all the using statments needed for good [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever i start a new codefile, alot of the time i find myself haveing to add all the xna refrences at the top, so i realised this would make an exilent snippit</p>
<p>save the following xml as UsingXNA.snippet</p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em" class="c"><a href="file:///C:/Users/Tim/Documents/Visual%20Studio%202005/Code%20Snippets/Visual%20C#/My%20Code%20Snippets/XNAUsing.snippet#" onclick="return false" onfocus="h()" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">CodeSnippets</font></span><span class="ns"><font color="#ff0000"> xmlns</font></span><span class="m"><font color="#0000ff">=&#8221;</font></span><strong class="ns"><font color="#ff0000">http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet</font></strong><font color="#0000ff"><span class="m">&#8220;</span><span class="m">&gt;</span></font></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em" class="c"><a href="file:///C:/Users/Tim/Documents/Visual%20Studio%202005/Code%20Snippets/Visual%20C#/My%20Code%20Snippets/XNAUsing.snippet#" onclick="return false" onfocus="h()" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><font color="#990000"><span class="t">CodeSnippet</span><span class="t"> Format</span></font><span class="m"><font color="#0000ff">=&#8221;</font></span><strong>1.0.0</strong><font color="#0000ff"><span class="m">&#8220;</span><span class="m">&gt;</span></font></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em" class="c"><a href="file:///C:/Users/Tim/Documents/Visual%20Studio%202005/Code%20Snippets/Visual%20C#/My%20Code%20Snippets/XNAUsing.snippet#" onclick="return false" onfocus="h()" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">Header</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em"><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">Title</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>XNA Using statments</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Title</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em"><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">Author</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>NekoCake Industries</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Author</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em"><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">Description</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>Inserts all the using statments needed for good xna useage</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Description</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em"><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">HelpUrl</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>www.nekocake.com</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">HelpUrl</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em" class="c"><a href="file:///C:/Users/Tim/Documents/Visual%20Studio%202005/Code%20Snippets/Visual%20C#/My%20Code%20Snippets/XNAUsing.snippet#" onclick="return false" onfocus="h()" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">SnippetTypes</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em"><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">SnippetType</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>Expansion</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">SnippetType</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">SnippetTypes</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em"><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">Shortcut</font></span><span class="m"><font color="#0000ff">&gt;</font></span><span class="tx"><strong>UsingXNA</strong></span><span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Shortcut</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Header</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p style="margin-left: 1em; text-indent: -2em" class="c"><a href="file:///C:/Users/Tim/Documents/Visual%20Studio%202005/Code%20Snippets/Visual%20C#/My%20Code%20Snippets/XNAUsing.snippet#" onclick="return false" onfocus="h()" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><span class="t"><font color="#990000">Snippet</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p class="e">
<p class="c"><a href="file:///C:/Users/Tim/Documents/Visual%20Studio%202005/Code%20Snippets/Visual%20C#/My%20Code%20Snippets/XNAUsing.snippet#" onclick="return false" onfocus="h()" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;</font></span><font color="#990000"><span class="t">Code</span><span class="t"> Language</span></font><span class="m"><font color="#0000ff">=&#8221;</font></span><strong>CSharp</strong><font color="#0000ff"><span class="m">&#8220;</span><span class="m">&gt;</span></font></p>
<p class="k"><span><a onclick="return false" onfocus="h()" style="visibility: hidden" class="b"><strong><font color="#ff0000" face="Courier New">-</font></strong></a> <span class="m"><font color="#0000ff">&lt;![CDATA[</font></span></span> <span id="clean" class="di"></p>
<pre><font size="3">#region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; #endregion</font></pre>
<p></span><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <font color="#0000ff"><span class="m">]]&gt;</span><script>  f(clean);</script> </font></p>
<p><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Code</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">Snippet</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">CodeSnippet</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p><span class="b"><strong><font color="#ff0000" face="Courier New"> </font></strong></span> <span class="m"><font color="#0000ff">&lt;/</font></span><span class="t"><font color="#990000">CodeSnippets</font></span><span class="m"><font color="#0000ff">&gt;</font></span></p>
<p><span class="m"></span></p>
<p><span class="m">Then start up GSE, click tools -&gt; code snippet manager -&gt; add then find where you saved the xml, and load it in. whenever you need the xna refences, just type UsingXNA and press tab twice when intelesence picks it up!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/11/10/a-useful-code-snippit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Im still alive</title>
		<link>http://www.nekocake.com/pad/2007/11/06/im-still-alive/</link>
		<comments>http://www.nekocake.com/pad/2007/11/06/im-still-alive/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 19:25:26 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[C#]]></category>

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

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

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/11/06/im-still-alive/</guid>
		<description><![CDATA[
Still alive, still makeing progress! i started a rewite on Crimson Engine last month. Wanted to reimplement my object system and other things i thought wernt flexible enough. Just finished re implementing animated sprites last night, so its high time for an &#8216;im still alive&#8217; post. I plan to write up some new tutorials and engine [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/11/crimsonenginealpha1.jpg" title="Crimson Engine alphabuild"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/11/crimsonenginealpha1.jpg" alt="Crimson Engine alphabuild" /></a></p>
<p>Still alive, still makeing progress! i started a rewite on Crimson Engine last month. Wanted to reimplement my object system and other things i thought wernt flexible enough. Just finished re implementing animated sprites last night, so its high time for an &#8216;im still alive&#8217; post. I plan to write up some new tutorials and engine design posts over the next few weeks, and clean up the site abit!<br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/VaJneJn1-yI&amp;color1=0x3a3a3a&amp;color2=0x999999&amp;border=0"></param><param name="wmode" value="transparent"></param></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/11/06/im-still-alive/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The current state of crimson</title>
		<link>http://www.nekocake.com/pad/2007/07/23/the-current-state-of-crimson/</link>
		<comments>http://www.nekocake.com/pad/2007/07/23/the-current-state-of-crimson/#comments</comments>
		<pubDate>Mon, 23 Jul 2007 22:38:49 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Crimson]]></category>

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

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/07/23/the-current-state-of-crimson/</guid>
		<description><![CDATA[Two months ago i last posted about my progress with my game engine, Crimson. Things have changed since then.  As I&#8217;ve previously mentioned, not done much coding has been done on the engine since because of real life and hardware problems (t minus 10 days till laptop returns!). Because of that, most of the progress has [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago i last posted about my progress with my game engine, Crimson. Things have changed since then.  As I&#8217;ve previously mentioned, not done much coding has been done on the engine since because of real life and hardware problems (t minus 10 days till laptop returns!). Because of that, most of the progress has been in design. Here is what my class layout looked like back at that last update (all these classes were coded up when i posted this originally)</p>
<p align="center"><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/old.jpg" title="old layout"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/07/old.thumbnail.jpg" alt="old layout" /></a></p>
<p align="left">Well, as you can see, I&#8217;ve crossed off everything that doesn&#8217;t exist in my current design. That&#8217;s not to say this old functionality is being removed, just that its being moved around and redesigned to be a lot more powerful that it ever was before. I&#8217;m also trying to decouple the game simulation from the world view, a trick that i learned from reading <a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.co.uk%2FGame-Coding-Complete-M-McShaffrey%2Fdp%2F1932111913&amp;tag=nekocakeindus-21&amp;linkCode=ur2&amp;camp=1634&amp;creative=6738">Game Coding Complete </a><img border="0" width="1" src="http://www.assoc-amazon.co.uk/e/ir?t=nekocakeindus-21&amp;l=ur2&amp;o=2" height="1" style="margin: 0px; border: medium none" />by Mike McShaffry. (This is a great book not only on the technical side of game development, but also things like how to manage the project, testing, folder layout&#8230;. the sheer amount of information in this book is mind-blowing! My personal favorite thing about it is the little &#8216;tales from the pixel mines&#8217; inserts, where Mike shares stories for the development on games he did at origin (Ultima!) and Microsoft. You can learn so much from reading about the choices and problems in these sections! Do yourself a favor, and get this book)</p>
<p align="left"> So, &#8220;how does it look now!?!&#8221; i hear you shout, well like this.</p>
<p align="center"><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/detail1.JPG" title="high level"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/07/detail1.JPG" alt="high level" /></a></p>
<p align="left">Each icon represents a different core area of the engine. Authority is the game rules, its where the simulation takes place. This will include a physics engine, the information on the current level, the data structures containing all the current entities in the world and things like that. You could almost think of it as a server (infact, this architecture is very good for extending your game to be multi-player). It also contains the command interpreter, which is very important! (shall all become clear soon)</p>
<p align="left">The view is not a single piece of code like the authority, There is actually loads of em. Im implementing a base view which can be extended for more specialized purposes. They are basically filters on the game state(held in the authority). The most obvious example on one would be the player view. It has all the code in it for drawing the world to the screen, converting button presses in to commands, making music play and stuff like that. You could also make one to command a team of A.I players. It wouldn&#8217;t need any drawing code, but it would need to be able to sense whats happening in the area of world-space it can see (filtering everything it cant out)and then sending commands to the authority for the next step in simulation.</p>
<p align="left">That&#8217;s where it comes exciting for me. The game I&#8217;m designing this engine to build will rely alot on A.I&#8230; good A.I that doesnt cheat. This system lets the A.I only get the same information a human player would, and use the exact same methods to interact with the game world a human is. For me, that&#8217;s big!</p>
<p align="left"> So whats that last bit all about? have a closer look!</p>
<p align="center"> <a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/detail2.jpg" title="System close up"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/07/detail2.thumbnail.jpg" alt="System close up" /></a></p>
<p>Please remember this is still far from done, its in a kind of half way state between class layout and program flow diagram!<a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/detail2.jpg" title="System close up"></a> Whats important is that the class CrimsonEng is the engines entry point, create an instance and throw it a start-up script and the game shall load! Its basically a massive collection on managers which will be available for the other systems to use (via the interfaces and core libs). My current plan is to not use the default game class that xna ships with, as it wont fit very well with my engines design (maby more on this next time).  Some interesting things here are things like eventMan and MessengerMan. Messages are going to be from entity to entity, good for A.I characters or triggers. Events will be for wider reaching things, like state changes or button presses. I think its important to separate and specialises these kind of messaging functionalities. Well, Thats it for this installment! Cant wait to get my laptob back to start building this thing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/07/23/the-current-state-of-crimson/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Re: Rotation along a Bezier Curve</title>
		<link>http://www.nekocake.com/pad/2007/07/17/re-rotation-along-a-bezier-curve/</link>
		<comments>http://www.nekocake.com/pad/2007/07/17/re-rotation-along-a-bezier-curve/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 01:50:11 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[C#]]></category>

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

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/07/17/re-rotation-along-a-bezier-curve/</guid>
		<description><![CDATA[A while ago i wrote an article for ziggyware on moving a sprite over a bezier curve. Well, i recently received an email (hi John!) asking a question, and i remembered a problem i discovered in my code after the article was published!
I included a method for calculating what angle the sprite should be rendered at to produce [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago i wrote an article for <a href="http://www.ziggyware.com/readarticle.php?article_id=92">ziggyware </a>on moving a sprite over a bezier curve. Well, i recently received an email (hi John!) asking a question, and i remembered a problem i discovered in my code after the article was published!</p>
<p>I included a method for calculating what angle the sprite should be rendered at to produce a cool looking animation. It used a mathematical function called arc tan to calculate this angle.</p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/05/quadraticrotate.PNG" title="quadraticrotate.PNG"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/05/quadraticrotate.PNG" alt="quadraticrotate.PNG" /></a></p>
<p>To tell you the truth, i cant really remember what the actual problem was, but I&#8217;m fairly sure that if the control points were not layed out in a perfect right angled triangle shape, the red lines imposed on the image wouldn&#8217;t meet at the bottom to form a right angle&#8230;. which my method relied on to produce a correct angle (going by memory, as i say, i might be remembering this wrong). it would produce slightly odd results with some quadratic curves, like the one pictured and would definitely screw up on higher order curves.</p>
<p>A much nicer way of doing it would be to store a heading. Every time you update the position of the sprite over the curve, if you normalise its position (presuming your useing a vector for its position) and the calculate the dot product of that heading with the previous heading, you should get the angle between them in radians&#8230;. you should beable to use that to create a better looking movement over a curve, of any order.  (please note, i havent got xna installed and working at the moment because of my previously mentioned computer problems, so i cant test out this theory!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/07/17/re-rotation-along-a-bezier-curve/feed/</wfw:commentRss>
		</item>
		<item>
		<title>long time no post!</title>
		<link>http://www.nekocake.com/pad/2007/07/16/long-time-no-post/</link>
		<comments>http://www.nekocake.com/pad/2007/07/16/long-time-no-post/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 01:06:30 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Ramble]]></category>

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/07/16/long-time-no-post/</guid>
		<description><![CDATA[been a while since ive posted! sorry about that! With all the exams and end of term, miveing up and down the country, moving in to my new flat and finaly coming home for the summer, its been a hard month or so! So heres whats been going down recently in the world of NekoCake!
 
Fist [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02467.JPG" title="tshirt2"></a>been a while since ive posted! sorry about that! With all the exams and end of term, miveing up and down the country, moving in to my new flat and finaly coming home for the summer, its been a hard month or so! So heres whats been going down recently in the world of NekoCake!</p>
<p align="center"><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02465.JPG" title="tshirt"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02465.thumbnail.JPG" alt="tshirt" /></a> <a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02467.JPG" title="tshirt2"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02467.thumbnail.JPG" alt="tshirt2" /></a></p>
<p align="left">Fist off, a big thanks to Dan Fernandez for the cool visual studio tshirt he sent me! Its allso go the Lego nxt robot on it. Cool stuff <img src='http://www.nekocake.com/pad/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p align="left">Next up i moved in to my new flat in durham, and then came back down south to spend some of the summer at home, set up my laptop and xbox up in my room, ready to code!</p>
<p align="center"><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02471.JPG" title="my room"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/07/dsc02471.thumbnail.JPG" alt="my room" /></a></p>
<p align="left">Then, as im about to start working on Crimson again, my laptop overheats! i check  everything, make sure all the vents are free from dust, and again, it overheats. Phone up alienware, they sent me some new thermal compound. redid the seal between the cpu and the hsf&#8230; overheats! Got a returns box coming next week, then it will take 5 days for a fully repaired flabtop to work its way back to my home <img src='http://www.nekocake.com/pad/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p align="left"> Good news is, ive been working stuff out on paper, and ive got a better idea of the layout  for the engine code. not a full design yet, im going to read loads more articles and browse through some other engines to sure up any doubts i still have. The current plan is to have loads of little virtual machines in my code, and for entity&#8217;s and engine code to beable to register processes with them. This should allow me to handle threads quite well, and use some of the knowledge ive learned at uni in the operating systems lectures!</p>
<p align="left"> Allso, you might just have noticed, ive changed the theme! i hated the old one, this ones alot more consistant with the main site&#8230; and lets you see more than one post a page!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/07/16/long-time-no-post/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Traveling Biologist Problem</title>
		<link>http://www.nekocake.com/pad/2007/06/06/the-traveling-biologist-problem/</link>
		<comments>http://www.nekocake.com/pad/2007/06/06/the-traveling-biologist-problem/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 23:33:00 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/06/06/the-traveling-biologist-problem/</guid>
		<description><![CDATA[Today i check my email and found a list of end of term challenge questions sent to us by our programming lecturer. Naturally, the traveling salesman was one of the challenges.&#160;I&#8217;ve never implemented a solution to it before, so&#160;I thought id give it a shot. I remembered reading an article on implementing a genetic algorithm [...]]]></description>
			<content:encoded><![CDATA[<p>Today i check my email and found a list of end of term challenge questions sent to us by our programming lecturer. Naturally, the traveling salesman was one of the challenges.&nbsp;I&#8217;ve never implemented a solution to it before, so&nbsp;I thought id give it a shot. I remembered reading an article on implementing a genetic algorithm to solve it, so I decided to give it a shot. I&#8217;m half way through at the moment and its brilliant fun! Anyone interested in AI and GA should give it a shot! only problem is that it has to be in java. I keep writing c# syntax!</p>
<p>ahh well, if it goes well&nbsp;I might post it! wish me luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/06/06/the-traveling-biologist-problem/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adventures in Pefromance 2: Profiling</title>
		<link>http://www.nekocake.com/pad/2007/06/05/adventures-in-pefromance-2-profiling/</link>
		<comments>http://www.nekocake.com/pad/2007/06/05/adventures-in-pefromance-2-profiling/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 22:36:18 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[C#]]></category>

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

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/06/05/adventures-in-pefromance-2-profiling/</guid>
		<description><![CDATA[Well, I&#8217;ve finished all my  exams at uni now, so its back to playing around with XNA! Its high time for an article again, so I&#8217;m going to finish up my performance article I started weeks ago. During my first stab at performance monitering code, I wanted to include an in game profiler but I didn&#8217;t have enough time [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;ve finished all my  exams at uni now, so its back to playing around with XNA! Its high time for an article again, so I&#8217;m going to finish up my performance article I started weeks ago. During my first stab at <a href="http://www.nekocake.com/pad/2007/04/28/fps-frame-time-and-you-adventures-in-performance/"><font color="#800080">performance monitering code,</font></a> I wanted to include an in game profiler but I didn&#8217;t have enough time to try and implement one. Things are different now!</p>
<p>First of, whats a profiler? A profiler is a tool that can tell you what your code is actualy doing. It tells you how much time it spends in each piece of code. You can get external programs which can profile your .Net application. So why bother writing our own? because games are different to office applications! We want to know what our game is doing frame by frame. External profilers will sample your game application over a few seconds and tell you what happend over thoese seconds, we want to know what happend on a frame by frame basis.</p>
<p>So, what should the profiler be? The profiler component should collect every imaginable piece of data about how the game is currently running, it should include stuff we might want accessible in any game build (I always like to have FPS and Frame Time easily accessible in pc games) and stuff we might want to use in &#8216;profiling&#8217; builds, like a print out of exactly which pieces of code are being called, how many times they get called and how they relate to another (execution hierarchy). Basically I want to be able to get code to compile into a build of my game which will print out what my game is doing.</p>
<p>How will the profiler know a piece of code is starting and stopping its execution? The constructor for the class registers all the counters to be used in that class and gets id numbers for each performance check, and then at the beginning and end of each method we want to measure we check in and out with the profiler. The code to do all this can be shoved inside a #IF statement so it only gets compiled in if we want a profile build. This means normal release and debug builds are not affected by the new code, and hopefully it will have a small enough footprint not to change the characteristics of the code too much when it is compled in. Is it just me or does this seem far too simple?</p>
<p>As it turns out, yes. Recently I&#8217;d been browsing Amazon for some game programming books to buy, and I remembered that some volumes of <em>Game Programming Gems</em> had articles on this very subject listed in their indeces. One quick check of the Durham University library website revelaed that they did in fact have all the books in the main library, on the 4th floor in the fine arts section for some odd reason, and the articles in the first two volumes of the books confirmed my suspicions. It really is that easy&#8230; if you have a good clock. The implementation I present to you implements some ideas from the articles mashed in with what I had been working on before I read them.</p>
<p>So first we tackle the problem of a clock. why not use XNAs gameTime I hear you ask? It&#8217;s not high res enough! That may sound silly, but gameTime only gives us millisecond resolution. We need a better clock. As discussed earlier, we need to draw every frame in about 16 miliseconds in order to get 60 fps. so we need a clock that can tell us the time in much smaller units than that in order to measure how long it takes each part of the update and drawing cycle to run. At the worst we want a clock that updates every 1 millisecond, better would be microsecond, jackpot would be nanoseconds (its not just how low it goes, but how quickly it updates, theres no point if it can tell us the time in nanoseconds if we can only read it every 4 milliseconds!).</p>
<p>Lucky for us System.Diagnostics.Stopwatch exists (it should work on the xbox as well but I haven&#8217;t tested it myself). This is a good and proper high res clock. I wrote a small test app to test it out, you can grab it <a href="http://www.nekocake.com/pad/code/profile/GrabClockFrq.exe"><font color="#800080">here</font></a>. from what I gather it is hardware dependant, so I built this test app and bullied a few people into running it, and the news is good: it doesn&#8217;t seem to differ much at all! Stopwatch has a base <a href="https://msdn2.microsoft.com/en-us/library/system.diagnostics.stopwatch.frequency(VS.80).aspx"><font color="#800080">frequency</font></a>, which is how many times the clock ticks a second. So the first test was to check if the frequency of the ticks was at all constant over different processors. I managed to test it on two different athlon 64, athlon 64 mobile, celeron m, PIII and an intel T2300. All of the had the same frequency of 3579545 ticks a second, which equates to about 1 tick every 279 nano seconds!</p>
<p><font size="2"><font size="3">The second part of the test sees how quickly we can access the clock. I did this with a simple loop:</font></font><br />
<code>watch.Start();<br />
for (int i = 0; i &lt; 10000; i++)<br />
{<br />
  nano[i] = watch.ElapsedTicks;<br />
}<br />
watch.Stop();</code><br />
<font face="Georgia"> We just check the elapsed ticks 10,000 times and put the elapsed time into an array. I then found out the average time between the checks and it turned out to be about 5 ticks between every check, giving 1395 ns or 1.3 microsecond. Why did I do all this? Just to prove to myself that I was able to get a good reading from the clock. It&#8217;s unrealistic to presume we can check the clock every tick. Seeing as 1.3 microseconds is a good estimate for the smallest unit of time we can grab from the clock, and its allot smaller that 16 miliseconds, Stopwatch has passed the test and we can use it to time our game loop and hopefully I&#8217;ve proved to you that its quick enough for the task!</font></p>
<p>Just to let you know now, I won&#8217;t release the code for this componet myself, as what I have at the moment was written very quickly and is not fit to be released, but if you ask I&#8217;ll redo it and post it. Instead im going to describe how to implement a profiler. I decided to use performanceMan as a base for this component. First I cleaned up the code, pulling out all the unnecessary things in it so it just handled gametime and fps and printed it to the screen, no more GUI. Next up was adding an instance of stopwatch to the class and instancing it in the constructor. Now, one of the problems we wanted to tackle is if were not running a profiling build, we don&#8217;t even want the profile code to compile in to the game, we don&#8217;t want it there at all! How do we manage this? All the code to do with profiler we put in a #if preprocessor block. for example, this is what I have in my constructor.<br />
<code><br />
<font size="2" color="#0000ff">#if</font><font size="2"> profile<br />
</font><font size="2" color="#808080">               watch = new System.Diagnostics.Stopwatch();<br />
               watch.Start();<br />
               <font size="2">nanosecondsPerTick = 1000000000 /System.Diagnostics.</font><font size="2" color="#2b91af">Stopwatch</font><font size="2">.Frequency; //1 tick in nanoseconds</font></font></code><code><br />
<font size="2" color="#0000ff">#endif</font></code></p>
<p><font face="Georgia">Now we need to tell Visual Studio how to build a profile build of our game. On the drop down box where you can select &#8216;debug&#8217; or &#8216;release&#8217; choose configuration manager. In here you can make a new configuration, call it profile and tell it to copy settings from release. This way we wont have the debug features in the profile build, but from my experience when you profile you game, you&#8217;re not checking for bugs, you&#8217;re finding out where it spends its time, so you want it to run as fast as possible. Next you have to open your project properties and go to the build tab and set the configuration to profile. In the &#8216;conditional compilation symbols&#8217; box add &#8216;profile&#8217;. This lets us use profile as the switch in the preprocessor if&#8217;s.</font></p>
<p>Next we need an object to represent each counter. We can use a class because garbage should not be an problem here as we don&#8217;t allocate and deallocate loads of these every frame, we tend to keep our counters for the whole life cycle of the game. Now, what do we need to track in a counter? We definetly need to keep some identifiers, a string for the name of the counter and an integer to hold its id number. We also need some fields to hold the frame by frame action.  Something like the following shall suffice.</p>
<p><font size="2"><font size="2" color="#0000ff">public</font><font size="2"> </font><font size="2" color="#0000ff">int</font><font size="2"> calls; </font><font size="2" color="#008000">// number of times this counter has been used this frame<br />
</font><font size="2" color="#0000ff">public</font><font size="2"> </font><font size="2" color="#0000ff">bool</font><font size="2"> open; </font><font size="2" color="#008000">// is this counter running<br />
</font><font size="2" color="#0000ff">public</font><font size="2"> </font><font size="2" color="#0000ff">long</font><font size="2"> startTick; </font><font size="2" color="#008000">// the tick we started this counter on<br />
</font><font size="2" color="#0000ff">public</font><font size="2"> </font><font size="2" color="#0000ff">long</font><font size="2"> accumulatedTicks; </font><font size="2" color="#008000">// ammount of ticks we have run this counter for this frame</font></font></p>
<p><font size="2"><font size="3">So, the idea here is when we start a timer, we check if the counter is already open. If it is, throw an error or something. We only want each counter to be running once. If it&#8217;s free, we set open to false, increment calls and set startTick to ElapsedTicks (which we get from the stopwatch).  When we finish the code and stop the counter, first we grab the current ElaspsedTicks and take away the start ticks, the remainder is the amount of ticks the code took to run. Add this to accumulatedTicks, oh and set open to close.</font></font></p>
<p>If we run a piece of code over and over, the calls stack up and the accumulatedTicks holds the combined time that the counter has been running, so we need some variables to handle some basic statistics. I decided to keep track of high and low points and the average running time over a frame. If we had 12 enemies in our game, there update code will run 12 times and obviously calls would be 12, so if we divide the accumulatedTicks by calls we get the amount of time (in ticks) it took on average for each update cycle to run, which is a good stat to print. We can also then test this against a variable holding the shortest and longest time it took to run, and update as appropriate. Remember before you draw them to multiply the number of tics by nanosecondsPerTick to get the amount of nanoseconds that passed. your probably then going to end up with some silly big times though, so you can divide you time in nanoseconds by 1000 to get it in microseconds or by 1000000 to get it in milliseconds. a simple if statement in your drawing code to decided which division to use and what unit to print will help, too. The last thing you should track in each counter is an integer to hold the id of a parent counter. In this we will store the id the counter that contains this counter.</p>
<p><font size="2"><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/06/relationship.jpg" title="relationship.jpg"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/06/relationship.jpg" alt="relationship.jpg" /></a></font></p>
<p><font size="2"> This allows us to print out counters in the correct order, as seen in this image (the nuber in the brackets is the id for each counter). I&#8217;ll describe how this works in a bit!</font></p>
<p><font size="2">Ok so far we have a profiler class that has a stopwatch and keeps track of the fps and frametime, and a class to represnt a counter. We need to add the profiler logic to our profiler class, and define a interface for it to use so we can use it as a global service. Let&#8217;s look at the interface first.</font></p>
<p><font size="2"><font size="2"><font size="2" color="#0000ff">interface</font><font size="2"> </font><font size="2" color="#2b91af">Iprofile<br />
</font><font size="2">{<br />
        </font><font size="2" color="#0000ff">int</font><font size="2"> AddCounter(</font><font size="2" color="#0000ff">string</font><font size="2"> counterName);<br />
        </font><font size="2" color="#0000ff">int</font><font size="2"> GetCounterID(</font><font size="2" color="#0000ff">string</font><font size="2"> counterName);<br />
        </font><font size="2" color="#0000ff">void</font><font size="2"> DeleteCounter(</font><font size="2" color="#0000ff">int</font><font size="2"> id);<br />
</font><font size="2">        <font size="2" color="#0000ff">void</font><font size="2"> UnDeleteCounter(</font><font size="2" color="#0000ff">int</font><font size="2"> id);</font><br />
        </font><font size="2" color="#0000ff">void</font><font size="2"> StartCounting(</font><font size="2" color="#0000ff">int</font><font size="2"> counter);<br />
        </font><font size="2" color="#0000ff">void</font><font size="2"> StopCounting(</font><font size="2" color="#0000ff">int</font><font size="2"> counter);<br />
        </font><font size="2" color="#0000ff">string</font><font size="2"> EndOfFrame();<br />
}</font></font></font><font size="2"><font size="2"><font size="2">Anything of note here? Not really, everything acts as expected. Ive already discussed what start and stop counting do, add and get counter act as you would imagine. DeleteCounter doesn&#8217;t delete a counter, rather moves it to a different list of counters. This allows you to change the behavior of the profiler as it runs. You can stop a counter from being updated (start and stop should fail silently) so you can change the depth of the profiling as you want. undelete simply puts the counter back in the active counters list. Now, back to the relationship thing! We need a third list of counters, every time startCouning is called a counter is added to the runningCounters list. If there are any other counters in the list, the one at the top is assigned the parent of the new counter. StopCounting removes a counter from the running list aswell. This allows EndOfFrame to do its job. The draw method for the profiler calls EndOfFrame to gather all the information from the counters and format it in to a string. We have allread discussed most of its job so I won&#8217;t reiterate it, the only thing left to tackle what it does with related counters. First it iterates through the list counters for one which doesn&#8217;t have a parent. It adds this to the string first, then it looks for one that has the current counter as a parent. It now adds this one to the string (spritebatch.DrawString will use \n to draw on a new line, so remember to add them!). it keeps running through the list of counters, finding the children, adding to the list, fining the next parent and so on till all the counters are in the string, at which point we return it. Doing it like this puts the counters in the correct order, so AI update in the previous example would sort under update. It&#8217;s a good idea to add an indent to the children so you can see they are children. Format the output string like a table and it should be fairly pleasing to the eye</font><font size="2">.</font></font></font><font size="2"><font size="2"><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/06/profiler.png" title="profiler.png"><img src="http://www.nekocake.com/pad/wp-content/uploads/2007/06/profiler.png" alt="profiler.png" /></a></font></font><font size="2"><font size="2">As you can see, I have some work to do on the output. The units are currently mixed up (average is in microseconds, the min and max are in miliseconds) and the table doesn&#8217;t line up stably, but it does demonstrate what we&#8217;re after. It doesn&#8217;t seem to have any effect on performance either, so that&#8217;s all good!</p>
<p></font></font>Well, there you have it, a description of how to implement a Profiler into your game. As it stands some things could be tweaked here and there, I&#8217;ve hardly touched on error detection, it won&#8217;t work with recursive methods and there are probably hundreds of ways you can tweak it to work better with your game. Well, have fun adding one to your game engine, and tell me how it goes!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/06/05/adventures-in-pefromance-2-profiling/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Crimson Update: Vasculitis (v0.0.2.24380)</title>
		<link>http://www.nekocake.com/pad/2007/05/10/crimson-update-vasculitis-v00224380/</link>
		<comments>http://www.nekocake.com/pad/2007/05/10/crimson-update-vasculitis-v00224380/#comments</comments>
		<pubDate>Thu, 10 May 2007 14:22:25 +0000</pubDate>
		<dc:creator>cubed2D</dc:creator>
		
		<category><![CDATA[Crimson]]></category>

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

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

		<guid isPermaLink="false">http://www.nekocake.com/pad/2007/05/10/crimson-update-vasculitis-v00224380/</guid>
		<description><![CDATA[ So heres the layout of my engine at the moment 

Without any diagrams, things get messy quickly. I had the thing planned out in my head, i had no paper in my room, my windows were too small to write on (at home i design programs on my windows with dry wipe markers) so i decided to [...]]]></description>
			<content:encoded><![CDATA[<p> So heres the layout of my engine at the moment </p>
<p><a href="http://www.nekocake.com/pad/wp-content/uploads/2007/05/classdiagram.png" title="classdiagram.png"><img width="501" src="http://www.nekocake.com/pad/wp-content/uploads/2007/05/classdiagram.png" alt="classdiagram.png" height="253" /></a></p>
<p>Without any diagrams, things get messy quickly. I had the thing planned out in my head, i had no paper in my room, my windows were too small to write on (at home i design programs on my windows with dry wipe markers) so i decided to go ahead anyway, and not so surprisingly it got messy. I then decided to use blue J (a java ide we use in university) to draw down what id written so far. Now i know how things connect and i can visualize it better. Id say a visual program designer is a good tool, you can pull things and its cool, but not as cool as using a window!</p>
<p> Animated sprites have been a fun feature to add, my implementation hangs around the concept of an animation sheet. my orc test sprite has some animations in separate.png files and some bunched together on the same .png. So how do i handle them? every animation gets a animation sheet, which contains its start frame, end frame and a reference to its texture. these are held in a dictionary as a value, the key to that dictionary is a CompassDirection (north, NorthEast ect).  I have a load of these in a list, and i keep there indexes in another dictionary with a AnimationState(move, idle, jump etc). To get the correct animation sheet you just need to know what direction and animation you currently in and pull em out. More difficult problems were finding out the current direction and grabbing the current frame from a texture. At the moment i only support the xbox controller, so i needed a way to turn the vector2 returned from the thumb stick in to a cardinal direction. I did this using the magic of dot product. The dot product between two vectors will give you the angle between them. All i needed to do was to have a list of all the directions i wanted to test, try the dot product between them all and then use the animation with the smallest dot product (which would be the closet to the angle of the stick) Heres some code for you!<br />
<code><br />
public class DirectionSet // the 8 compass directions represented in vectors<br />
  {<br />
  public Dictionary<int,></int,> directions = new Dictionary<int,></int,>();<br />
  public DirectionSet()<br />
  {<br />
  directions.Add(0, new Vector2(0f, 1f));<br />
  directions.Add(1, new Vector2(0.5f, 0.5f));<br />
  directions.Add(2, new Vector2(1f, 0f));<br />
  directions.Add(3, new Vector2(0.5f, -0.5f));<br />
  directions.Add(4, new Vector2(0f, -1f));<br />
  directions.Add(5, new Vector2(-0.5f, -1f));<br />
  directions.Add(6, new Vector2(-1f, 0f));<br />
  directions.Add(7, new Vector2(-1f, 1f));<br />
  }<br />
  }<br />
</code><br />
Use this function to get the sticks direction:<br />
<code><br />
public int GrabAnimationDirection(Vector2 stick)<br />
  {<br />
  float bestDot = -100;<br />
  int bestAnim = 0;<br />
  for (int i = 0; i &lt; 8; i++)<br />
  {<br />
  Vector2 normal = Vector2.Normalize(directionSet.directions[i]);//normalise the directions<br />
  float dot = Vector2.Dot(velocity, normal); //find the angle<br />
  if (dot &gt;= bestDot) //if its smaller, save it<br />
  {<br />
  bestDot = dot;<br />
  bestAnim = i;<br />
  }<br />
  }<br />
  return besttAnim;<br />
  }</code></p>
<p>Then i just cast the returned int to my CompassDirection enum for use!</p>
<p>The other problem is alot easier, how do we choose the tile? First, we need a frame counter to increment. I increment it every 33ms (30fps).  we also need to know the number of columns in the sprite sheet and the height and width of each sprite. with this info we can find the top left corner of each frame<br />
<code><br />
int x = (frame % column) * width;<br />
int y = (frame / column) * height;</code></p>
<p>Its really simple when you think about it, just grab a sprite sheet, and try these for a frame in the middle, I&#8217;m sure your understand how it works straight away!</p>
<p>The other useful thing i learned is how to cast a string in to a enum. Which is really useful when reading info out of an xml file.</p>
<p>(<font color="#2b91af">CompassDirection</font>)<font color="#2b91af">Enum</font>.Parse(<font color="#0000ff">typeof</font>(<font color="#2b91af">CompassDirection</font>), &#8220;North&#8221;);<br />
remember to test its going to work first!<br />
<font color="#2b91af">Enum</font>.IsDefined(<font color="#0000ff">typeof</font>(<font color="#2b91af">CompassDirection</font>),&#8221;apples&#8221;);<br />
would return false, because apples just arn&#8217;t directions no matter how hard they try.</p>
<p>anyways, Crimson 0.0.2.24380 new features!</p>
<p>Features:</p>
<ul>
<li>Better, more flexible animation system, which supports:
<ul>
<li>Idle animations</li>
<li>Movement</li>
<li>Shooting</li>
<li>Death</li>
<li>and flexible to add others!</li>
</ul>
</li>
<li>Loading XML files which describe an animation, and serializing them in to actual animation sprites.</li>
<li>early prototype of the input manager.</li>
<li>updates to my content manager</li>
</ul>
<div class="flvPlayer"><object type="application/x-shockwave-flash" width="500" height="320" data="https://media.dreamhost.com/mediaplayer.swf?file=http://www.nekocake.com/pad/flv/CrimsonVasculitis0_0_2_3114.flv&amp;autoStart=false;"><param name="movie" value="https://media.dreamhost.com/mediaplayer.swf?file=http://www.nekocake.com/pad/flv/CrimsonVasculitis0_0_2_3114.flv&amp;autoStart=false;" /></object></div>
<p></flv></p>
<p>also, for anyone who is interested, heres a short demo. It only works with an xbox controller at the moment. left stick moves you around, B jumps and A kills you. If anyone can run it and tell me how it runs on there pc id be grateful!</p>
<p><a href="http://www.nekocake.com/pad/demo/crimson0_0_2.zip">Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nekocake.com/pad/2007/05/10/crimson-update-vasculitis-v00224380/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.365 seconds -->
<!-- Cached page served by WP-Cache -->
