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

<channel>
	<title>Sgt. Conker</title>
	<atom:link href="http://www.sgtconker.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sgtconker.com</link>
	<description>We are &#34;absolutely fine&#34;</description>
	<lastBuildDate>Wed, 06 Jul 2011 13:29:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ignoring a Hidden Clingerman to Visit Germany</title>
		<link>http://www.sgtconker.com/2011/07/ignoring-a-hidden-clingerman-to-visit-germany/</link>
		<comments>http://www.sgtconker.com/2011/07/ignoring-a-hidden-clingerman-to-visit-germany/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 13:29:44 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MVP Watch]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[#BoatForGeorge]]></category>
		<category><![CDATA[Jim Perry]]></category>
		<category><![CDATA[Roland Rosenkranz]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/07/ignoring-a-hidden-clingerman-to-visit-germany/</guid>
		<description><![CDATA[Looks like there were a new addition to the league of XNA/DirectX (didn’t that read DirectX/XNA once?) MVPs: the German Roland “Glatzemann” Rosenkranz, who is running amokcausing havockeeping posting on the XNA.mag and our beloved AppBuh forums. Congratulations, chap!
Meanwhile, in Jim “So Evil That Even George Ducks and Covers” Perry-land the Overlocker himself continues to [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like there were a new addition to the league of <a href="https://mvp.support.microsoft.com/communities/mvp.aspx?product=1&amp;competency=XNA%2fDirectX">XNA/DirectX (didn’t that read DirectX/XNA once?) MVPs</a>: the German <a href="http://www.mitohnehaare.de/">Roland “Glatzemann” Rosenkranz</a>, who is <strike>running amokcausing havoc</strike>keeping posting on the <a href="http://www.xnamag.de/">XNA.mag</a> and our beloved <a href="http://forums.create.msdn.com/forums/">AppBuh forums</a>. Congratulations, chap!</p>
<p>Meanwhile, in <a href="http://machxgames.com/blog/">Jim “So Evil That Even George Ducks and Covers” Perry</a>-land the Overlocker himself continues to spam his blog. This time, he covers <a href="http://machxgames.com/blog/?p=50">Spy Game Design – Multiplatform Issues/Capability</a> and <a href="http://machxgames.com/blog/?p=51">Spy Game Design – Character Training</a>. Lets see if he can keep up the pace while <a href="http://www.xnadevelopment.com/">The Hidden One</a> continues to, well, hide.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/07/ignoring-a-hidden-clingerman-to-visit-germany/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Replacement Clingerman</title>
		<link>http://www.sgtconker.com/2011/07/the-replacement-clingerman/</link>
		<comments>http://www.sgtconker.com/2011/07/the-replacement-clingerman/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 19:06:51 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[George W. Clingerman]]></category>
		<category><![CDATA[Jim Perry]]></category>
		<category><![CDATA[VoteForGeorge]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/07/the-replacement-clingerman-2/</guid>
		<description><![CDATA[As George W. “Father of an Army” Clingerman went quite quiet recently (conspiracy theorists claim he’s the XNA/XBLIG community manager now and hence is as quiet as the void that wasn’t a community manager…) we have to turn our head to the Evil MVP Jim “The Replacement Clingerman” Perry, who replaced locking with blogging what [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://www.xnadevelopment.com/">George W. “Father of an Army” Clingerman</a> went quite quiet recently (<em>conspiracy theorists claim he’s the XNA/XBLIG community manager now and hence is as quiet as the void that wasn’t a community manager…</em>) we have to turn our head to the Evil MVP Jim “The Replacement Clingerman” Perry, who replaced locking with blogging what seems to be some sort of <a href="http://machxgames.com/blog/?tag=spy-game">The Spy Game Design Series</a>:</p>
<ul>
<li><a href="http://machxgames.com/blog/?p=35">Spy Game Design – Agent Specialties</a> </li>
<li><a href="http://machxgames.com/blog/?p=37">Spy Game Design – Inventory and Related Areas</a> </li>
<li><a href="http://machxgames.com/blog/?p=38">Spy Game Design – Assignments/Missions</a> </li>
<li><a href="http://machxgames.com/blog/?p=39">Spy Game Design–Death</a> </li>
<li><a href="http://machxgames.com/blog/?p=40">Spy Game Design – Advancement</a> </li>
<li><a href="http://machxgames.com/blog/?p=41">Spy Game Design – Combat</a> </li>
<li><a href="http://machxgames.com/blog/?p=48">Spy Game Design – Identities</a> </li>
</ul>
<p>And, compared to the AppBuh Forums mess <a href="http://www.gpwiki.org/forums/viewforum.php?f=11">his forums</a> are alive and kicking.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/07/the-replacement-clingerman/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Catalin on 2D Skeletal Animations</title>
		<link>http://www.sgtconker.com/2011/06/catalin-on-2d-skeletal-animations/</link>
		<comments>http://www.sgtconker.com/2011/06/catalin-on-2d-skeletal-animations/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 19:15:16 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[2D]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[Catalin Zima]]></category>
		<category><![CDATA[Skeletons]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/06/catalin-on-2d-skeletal-animations/</guid>
		<description><![CDATA[Catalin “Too Proud To Self-promote” Zima (you might know him as our local XNA MVP Captain ZSquare) has a nice write-up of 2D Skeletal Animations over at his blog. So, if you ever wondered what the benefits of skeletal animations in the 2D world as compared to our beloved sprite sheets are, his post would [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.catalinzima.com/">Catalin “Too Proud To Self-promote” Zima</a> (you might know him as our local XNA MVP Captain ZSquare) has a nice write-up of <a href="http://www.catalinzima.com/2011/06/2d-skeletal-animations/">2D Skeletal Animations over at his blog</a>. So, if you ever wondered what the benefits of skeletal animations in the 2D world as compared to our beloved sprite sheets are, <a href="http://www.catalinzima.com/2011/06/2d-skeletal-animations/">his post would be your starting point</a> to explore this very topic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/06/catalin-on-2d-skeletal-animations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Joplin Tornado Fund for DeathmatchGames</title>
		<link>http://www.sgtconker.com/2011/05/the-joplin-tornado-fund-for-deathmatchgames/</link>
		<comments>http://www.sgtconker.com/2011/05/the-joplin-tornado-fund-for-deathmatchgames/#comments</comments>
		<pubDate>Sat, 28 May 2011 10:00:25 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/05/the-joplin-tornado-fund-for-deathmatchgames/</guid>
		<description><![CDATA[Via The Dead Pixel Society comes the word about the impact of the Joplin Tornado on the XNA community:
As you may or may not know (until now) a fellow XNA developer @DeathmatchGames and his family were victims of the May 22nd tornado that ravaged Joplin, MO. You can find extensive coverage of the tornado and [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://www.thedeadpixelsociety.com/">The Dead Pixel Society</a> comes the word about the impact of the Joplin Tornado on the XNA community:</p>
<blockquote cite="http://www.thedeadpixelsociety.com/joplin.html"><p>As you may or may not know (until now) a fellow XNA developer <a href="http://twitter.com/#!/DeathmatchGames">@DeathmatchGames</a> and his family were victims of the May 22nd tornado that ravaged Joplin, MO. You can find extensive coverage of the tornado and the devestation [sic] it's caused at <a href="http://www.cnn.com/search/?query=joplin%20tornado&amp;primaryType=mixed&amp;sortBy=date&amp;intl=false">CNN.com</a>, <a href="http://www.google.com/search?q=joplin+tornado&amp;hl=en&amp;safe=active&amp;prmd=ivnsum&amp;source=univ&amp;tbm=nws&amp;tbo=u&amp;ei=UIveTdWOCYqDtgeGtIHxCQ&amp;sa=X&amp;oi=news_group&amp;ct=title&amp;resnum=1&amp;ved=0CCAQqAIwAA">Google</a>, and everywhere else.</p>
</blockquote>
<p>Head over to the <a href="http://www.thedeadpixelsociety.com/joplin.html">DeathmatchGames - Joplin Tornado Fund</a> to read more and to learn about the ways to help.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/05/the-joplin-tornado-fund-for-deathmatchgames/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>High End Performance Optimizations on the Xbox 360 and Windows Phone 7</title>
		<link>http://www.sgtconker.com/2011/05/high-end-performance-optimizations-on-the-xbox-360-and-windows-phone-7/</link>
		<comments>http://www.sgtconker.com/2011/05/high-end-performance-optimizations-on-the-xbox-360-and-windows-phone-7/#comments</comments>
		<pubDate>Sun, 15 May 2011 06:21:19 +0000</pubDate>
		<dc:creator>Captain ZSquare</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[UberGeekGames]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/?p=1996</guid>
		<description><![CDATA[Ian Nicolades
Technical Director, UberGeekGames
For the Xbox or Windows Phone 7 programmer, performance is something that should always be kept in mind. For any moderately complex game, it can be very easy for framerate issues to crop up, and seeing as those pesky gamers insist on having a smooth playing experience, it can quickly become problematic.
Having [...]]]></description>
			<content:encoded><![CDATA[<h4 style="text-align: center;">Ian Nicolades</h4>
<h4 style="text-align: center;">Technical Director, UberGeekGames</h4>
<p>For the Xbox or Windows Phone 7 programmer, performance is something that should always be kept in mind. For any moderately complex game, it can be very easy for framerate issues to crop up, and seeing as those pesky gamers insist on having a smooth playing experience, it can quickly become problematic.</p>
<p>Having had quite a bit of experience in this area with our last few games, this article will be a “missing manual” of sorts; the kind of cheat sheet that would have saved me more than one headache! <img src='http://www.sgtconker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span id="more-1996"></span></p>
<h2>The target audience</h2>
<p>I’m going to make a couple of reasonable assumptions to guide us. First, you either have a game that currently has performance issues, or you’re planning a game that will most likely run into performance issues later on in development. Second, you’ve already read through Shawn’s blog posts on performance. If you haven’t, go read them now: <a href="http://msdn.com/blogs/shawnhar">http://msdn.com/blogs/shawnhar</a> I’ll wait.</p>
<p>Back? Excellent. You should already be familiar with the basic principles of profiling, how to use a profiler, rig up an FPS counter, and how to determine if you’re CPU or GPU bound. Without further ado, we will now dive into the deep end of the performance pool, so to speak. Each of the following sections will cover a technique that can help improve your game’s performance.</p>
<h2>Quadtrees, Grid Registration, and spatial partitioning</h2>
<p>Quadtrees are an oft-recommended improvement, and with good reason – they can vastly improve the performance of many different systems, the most popular being collision detection and view space culling.</p>
<p>For example, let’s say you’re building a shooter and will have a large number of bullets colliding with an even larger number of enemies. A naive approach would be to run your collision detection algorithm on every bullet against every enemy. This will take exponentially longer as the number of enemies and bullets increases.</p>
<p>By implementing a quadtree, you break the game world up into smaller chunks. Enemies, bullets, and anything else that needs to be collided with will be added to whichever chunk contains them. This way, you only need to check collisions against the bullets and enemies in the same chunk.</p>
<p>Quadtrees can be built in both 2D and 3D worlds. In 3D, they can also be used for efficient view space culling. They are typically known as “octrees” in 3D space.</p>
<h2>Garbage collection</h2>
<p>The CLR on the Xbox and WP7 have much slower garbage collectors than on the PC (soon this won’t be the case for WP7: <a href="http://blogs.msdn.com/b/abhinaba/archive/2011/04/13/generational-gc-in-windows-phone-mango.aspx">http://blogs.msdn.com/b/abhinaba/archive/2011/04/13/generational-gc-in-windows-phone-mango.aspx</a> – huzzah!). If your game has frequent stuttering or pauses, then you most likely have a garbage collection issue. This has been covered in Shawn’s blog, but here are a few additional tips I’ve picked up:</p>
<p>-          Beware of boxing. This can come from odd places, such as adding maintaining a list of interfaces; the following code will generate garbage:</p>
<pre class="brush: plain; title: ;">

interface ISomethingOrOther

{
    void Something();
}

struct Something : ISomethingOrOther
{
    public void Something()
   {
   }
}

List&lt;ISomethingOrOther&gt; ListOfInterfaces = new List&lt;ISomethingOrOther&gt;();

ListOfInterfaces.Add(new Something()); // boxing!
</pre>
<p>-          Boxing can also occur when you use an enum as a key in a Dictionary&lt;Enum, something&gt;. I usually use a Dictionary&lt;int, something&gt; and cast to int when indexing into it like so:</p>
<pre class="brush: plain; title: ;">
enum YourEnum

{

    A, B, C

}

//adding elements will cause boxing.

Dictionary&lt;YourEnum, string&gt; dictionaryWithBoxing = new Dictionary&lt;YourEnum, string&gt;()

{

    { YourEnum.A, &quot;a&quot; },

    { YourEnum.B, &quot;b&quot; },

    { YourEnum.C, &quot;c&quot; },

}

//no boxing!

Dictionary&lt;int, string&gt; yourDictionaryWithoutBoxing = new Dictionary&lt;int, string&gt;()

{

    { (int)YourEnum.A, &quot;a&quot; },

    { (int)YourEnum.B, &quot;b&quot; },

    { (int)YourEnum.C, &quot;c&quot; },

}
</pre>
<p>Nick has more info in this blog post: <a href="http://blog.nickgravelyn.com/2009/04/net-misconceptions-part-1/">http://blog.nickgravelyn.com/2009/04/net-misconceptions-part-1/</a></p>
<p>-          Make liberal use of pooling to avoid creating new objects at runtime. A simple template that I use:</p>
<pre class="brush: plain; title: ;">

class SomeObject
{
    //stuff
    public void Spawn(Vector2 position)
    {
    }
}

class SomeObjectPool

{
    public static bool[] isAlive;
    public static SomeObject[] pool;
    public static SomeObjectPool()
    {
        pool = new SomeObject[100];
        isAlive = new bool[100];
        for(int i=0;i&lt;pool.Length;i++)
        {
            isAlive[i] = false;
            pool[i] = new SomeObject();
        }
    }

public static void Spawn(Vector2 position)
{
    for(int i=0;i&lt;pool.Length;i++)
    {
        If(!isAlive[i])
        {
            isAlive[i] = true;
            pool[i].Spawn(position);
            break;
        }
    }
}
}
</pre>
<p>Nick also has a template for this: <a href="http://forums.create.msdn.com/forums/t/3375.aspx">http://forums.create.msdn.com/forums/t/3375.aspx</a></p>
<p>-          Pooling classes is almost always a better solution than switching to structs, unless you know exactly why you need them. Classes behave very differently from structs, sometimes in unintuitive ways if you are not familiar with the difference between value and reference types. This page contains a good primer on the differences: <a href="http://www.albahari.com/valuevsreftypes.aspx">http://www.albahari.com/valuevsreftypes.aspx</a></p>
<h2>Draw that 2D content most efficiently with Spritesheets</h2>
<p>If you draw sprites individually, loading them one at a time and drawing them, you will prevent the GPU from batching its draw calls in the most efficient manner. By using spritesheets, the GPU will not need to switch textures in between draw calls and can batch your drawing more efficiently. This post by Shawn succinctly explains the general idea: <a href="http://forums.create.msdn.com/forums/p/24254/131437.aspx#131437">http://forums.create.msdn.com/forums/p/24254/131437.aspx#131437</a></p>
<p>The spritesheet sample is here: <a href="http://create.msdn.com/en-US/education/catalog/sample/sprite_sheet">http://create.msdn.com/en-US/education/catalog/sample/sprite_sheet</a></p>
<p>And I’ve personally been using Nick’s SpriteSheetPacker tool to automate the packaging process, with great success: <a href="http://spritesheetpacker.codeplex.com/">http://spritesheetpacker.codeplex.com/</a></p>
<h2>Batch your SpriteBatches</h2>
<p>Efficient rendering is all about batching. Remember the elf in a box model: <a href="http://blogs.msdn.com/b/shawnhar/archive/2008/03/31/an-elf-in-a-box.aspx">http://blogs.msdn.com/b/shawnhar/archive/2008/03/31/an-elf-in-a-box.aspx</a></p>
<p>If you want to maximize GPU performance, use as few SpriteBatch batches as possible. There are, of course, many cases where you just have to end and begin a new SpriteBatch in order to switch renderstates or blend states, but for all other cases – use a single spritebatch!</p>
<h2>Multithreading</h2>
<p>On the Xbox 360, you have three separate processor cores and six hardware threads, four of which are available for you to use (one on core one, one on core two, and the two on core three; see this MSDN article <a href="http://msdn.microsoft.com/en-us/library/system.threading.thread.setprocessoraffinity.aspx">http://msdn.microsoft.com/en-us/library/system.threading.thread.setprocessoraffinity.aspx</a>).</p>
<p>If you are CPU bound, you might gain some performance by threading. Common tasks that are likely candidates for threading:</p>
<p>-          Particles; if your particles are updated on the CPU and take a significant amount of processing time, they will likely be one of the easiest things to multithread.</p>
<p>-          Collision detection; while this can be tricky to synchronize depending on what you’re it can work well.</p>
<p>-          The sky is the limit when it comes to what you can offload. With enough work you could theoretically offload most any system to another thread. The key is making sure that the performance gains will be high enough to warrant the overhead of managing the thread, and how easy it will be to synchronize data between threads.</p>
<p>On WP7, you are limited to a single core, 1GHz processor. Multithreading is unlikely to see any wins here, as it will just add overhead.</p>
<h2>Manually inlining high frequency code</h2>
<p>You may get to the point where you still have performance trouble but there are no more big wins left, or all the low hanging fruit has been picked, so to speak. At this point, manually inlining methods that are called at a high frequency could be the next best step. Manually inlining is nothing more than avoiding excess method calls when possible. Take the following piece of code:</p>
<pre class="brush: plain; title: ;">

foreach(Particle particle in ParticleList)
{
    particle.Update();
}

class Particle
{
    public void Update()
    {
        Position += Velocity
    }
}
</pre>
<p>There is a small amount of overhead when calling a method. This alternate version will be faster:</p>
<pre class="brush: plain; title: ;">

void Update()
{
    foreach(Particle particle in ParticleList)
    {
        particle.Position += particle.Velocity; //slightly faster
    }
}
</pre>
<p>The gains here are relatively small, but can make a difference in with lots of values such as particle engines.</p>
<h2>Cache values wherever possible</h2>
<p>Optimization, at its core, is just figuring out how to get the same or similar results while doing less work. Caching values is a perfect example of this. When drawing a texture, for example, how many times do you do this?</p>
<pre class="brush: plain; title: ;">

void Draw()
{
    Rectangle drawingRect = new Rectangle(foo, bar, foobar, barfoo);
    spriteBatch.Draw(Texture, drawingRectangle, Color);
}
</pre>
<p>What’s the point of recreating the rectangle each frame if the value doesn’t change? Define that outside of the loop like this:</p>
<pre class="brush: plain; title: ;">
Rectangle drawingRect = new Rectangle(foo, bar, foobar, barfoo);
void Draw()
{
    spriteBatch.Draw(Texture, drawingRectangle, Color);
}
</pre>
<h2>Properties</h2>
<p>Properties are roughly equivalent to a JIT method call. And we’ve already established that method calls take a nontrivial amount of time to execute. Therefore, properties are best to be avoided unless necessary.</p>
<p>“But, kind sir, all the C# style guides tell me to use properties! Why would they recommend such a thing if it’s so bad?”</p>
<p>Simply put, most guides I’ve seen which recommend this assume that you are either going for maximum readability and maintainability, and/or performance isn’t of much concern (eg, a winforms tool). And on the PC, you’re almost certainly not going to run into issues stemming from properties, as the latest processor can chew through them with ease. On hardware such as the WP7 or the Xbox 360, every cycle can count.</p>
<p>In other words, if you want to look at pretty code all day, you should stay far away from game development. <img src='http://www.sgtconker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Array indexing</h2>
<p>Another subtle improvement in tight loops is how you index into an array’s elements. An array index costs about the same as a JIT method call, plus some overhead for bounds checking. Take this code for example:</p>
<pre class="brush: plain; title: ;">

SomeObject[] objectArray;

Void DoSomeStuff()
{
    for(int i=0;i&lt;objectArray.Length;i++)
    {
        objectArray[i].Position += something;
        objectArray[i].Velocity *= whatever;
        objectArray[i].Counter++;
    }
}
</pre>
<p>You can cache the variable to avoid this overhead:</p>
<pre class="brush: plain; title: ;">

SomeObject[] objectArray;

Void DoSomeStuff()
{
    for(int i=0;i&lt;objectArray.Length;i++)
    {
        SomeObject obj = objectArray[i];
        obj.Position += something;
        obj.Velocity *= whatever;
        obj.Counter++;
    }
}
</pre>
<h2>Dictionaries vs Arrays</h2>
<p>Dictionaries are great. They are an invaluable coding tool that makes efficiently organizing data easy. However, it is quite possible for them to become a performance bottleneck, as they are about twice as slow as an array index, and can be even slower if you’re unnecessarily indexing into them more than once. Here’s some example code to explain this:</p>
<pre class="brush: plain; title: ;">

Dictionary&lt;int, Texture2D&gt; textureDictionary;
…

//this is the slowest way to use a Dictionary, as we are effectively doing two lookups for the same object. Slowness!

if(textureDictionary.ContainsKey(textureKey))
{
    Texture2D texture = textureDictionary[textureKey];
    //do something with texture
}

//this is faster as we are only doing one lookup.
Texture2D texture = null;
if(textureDictionary.TryGetValue(textureKey, out texture)
{
    //do something with texture here
}
</pre>
<h2>Vector operations</h2>
<p>When possible, use the Vector2.Whatever() methods that pass their arguments by reference and use out to supply their output. This will be faster than using the normal C# addition/subtract/multiplication/division operators. Take this example code:</p>
<pre class="brush: plain; title: ;">

//Easy to read, but slow!
someVector += anotherVector * someFloat;

//More verbose, yet faster
Vector2 tmp = new Vector2();
Vector2.Multiply(ref anotherVector, someFloat, out tmp);
Vector2.Add(ref someVector, ref tmp, out someVector);
</pre>
<p>Soon, this will be even faster on WP7: <a href="http://blogs.msdn.com/b/abhinaba/archive/2011/04/10/simd-support-in-netcf.aspx">http://blogs.msdn.com/b/abhinaba/archive/2011/04/10/simd-support-in-netcf.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/05/high-end-performance-optimizations-on-the-xbox-360-and-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Unleashed Hackathon</title>
		<link>http://www.sgtconker.com/2011/05/windows-phone-7-unleashed-hackathon/</link>
		<comments>http://www.sgtconker.com/2011/05/windows-phone-7-unleashed-hackathon/#comments</comments>
		<pubDate>Fri, 13 May 2011 00:30:48 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[Chris G. Williams]]></category>
		<category><![CDATA[Hackathon]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[WP7Dev]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/05/windows-phone-7-unleashed-hackathon/</guid>
		<description><![CDATA[Via Chris G. Williams comes the word of an upcoming Windows Phone 7 hackathon in Atlanta, Georgia. Quotes the Chris:
This is a &#34;hands on&#34; hackathon where you will learn from Windows Phone 7, XNA and Azure experts how to build, scale and publish your Windows Phone 7 app or game. If you are just a [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://geekswithblogs.net/cwilliams/Default.aspx">Chris G. Williams</a> comes the word of an upcoming <a href="http://geekswithblogs.net/cwilliams/archive/2011/05/11/145274.aspx">Windows Phone 7 hackathon</a> in Atlanta, Georgia. Quotes the Chris:</p>
<blockquote cite="http://geekswithblogs.net/cwilliams/archive/2011/05/11/145274.aspx"><p>This is a &quot;hands on&quot; hackathon where you will learn from Windows Phone 7, XNA and Azure experts how to build, scale and publish your Windows Phone 7 app or game. If you are just a beginner, or already have apps in the Marketplace this event will should not be missed. BYO Laptop!</p>
<p>RSVP early, space is limited to 300 attendees: <a href="http://bit.ly/RegWP7Hackathon">http://bit.ly/RegWP7Hackathon</a> <em>[Ed.: <a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032486873&amp;Culture=en-US">The unshortened URL for the event details is here</a>]</em></p>
<p><strong>(YOU DON'T HAVE TO BE A TECHED ATTENDEE TO COME TO THIS!)</strong></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/05/windows-phone-7-unleashed-hackathon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding a Clingerman to Talk Natively</title>
		<link>http://www.sgtconker.com/2011/04/hiding-a-clingerman-to-talk-natively/</link>
		<comments>http://www.sgtconker.com/2011/04/hiding-a-clingerman-to-talk-natively/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 13:00:25 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Direct3D]]></category>
		<category><![CDATA[Direct3D 11]]></category>
		<category><![CDATA[George W. Clingerman]]></category>
		<category><![CDATA[SharpDX]]></category>
		<category><![CDATA[SlimDX]]></category>
		<category><![CDATA[VoteForGeorge]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/?p=1988</guid>
		<description><![CDATA[ In Benchmarking C#/.Net Direct3D 11 APIs vs native C++ (a post from March 14, I wonder why I did not share this already…) Alexandre Mutel explores the cost of calling native APIs from managed code (AKA interop) via micro benchmarking various managed Direct3D 11 APIs. He does this because:
Hopefully, in SharpDX unlike any other [...]]]></description>
			<content:encoded><![CDATA[<p><img style="background-image: none; border-right-width: 0px; margin: 0px 8px 8px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Hiding a Clingerman" border="0" alt="Hiding a Clingerman" align="left" src="http://www.sgtconker.com/wp-content/uploads/2011/04/Hiding-a-Clingerman.jpg" width="244" height="184" /> In <a href="http://code4k.blogspot.com/2011/03/benchmarking-cnet-direct3d-11-apis-vs.html">Benchmarking C#/.Net Direct3D 11 APIs vs native C++</a> (a post from March 14, I wonder why I did not share this already…) <a href="http://www.blogger.com/profile/05096938106073079832">Alexandre Mutel</a> explores the cost of calling native APIs from managed code (AKA interop) via micro benchmarking various managed Direct3D 11 APIs. He does this because:</p>
<blockquote cite="http://code4k.blogspot.com/2011/03/benchmarking-cnet-direct3d-11-apis-vs.html"><p>Hopefully, in SharpDX unlike any other DirectX .NET APIs, this code has been written to be consistent over the whole generated code, and was carefully designed to be quite efficient… but still, It has obviously a cost, and we need to know it!</p>
</blockquote>
<p><strong>Spoiler:</strong> The offerings Microsoft has in store are, by far, slower than SlimDX/SharpDX.</p>
<p>In other news: There is <a href="http://forums.create.msdn.com/forums/t/81418.aspx">a thread over in the AppBuhAppHub forums praising the XNA MVPs</a>. We here in the barracks fully support that effort – mostly due to the fact that Captain ZSquare has access to various arms here and <em title="We means the Sarg">we</em> lost the keys to lock up the arsenal… – so you might head over to add to the +1 (none of the Google +1 stuff) choir.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/04/hiding-a-clingerman-to-talk-natively/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recommendations on Resuming</title>
		<link>http://www.sgtconker.com/2011/04/recommendations-on-resuming/</link>
		<comments>http://www.sgtconker.com/2011/04/recommendations-on-resuming/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 12:14:37 +0000</pubDate>
		<dc:creator>Captain ZSquare</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Bob Taco Ind]]></category>
		<category><![CDATA[Michael B. McLaughlin]]></category>
		<category><![CDATA[resuming games]]></category>
		<category><![CDATA[tombstoning]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/?p=1985</guid>
		<description><![CDATA[Coming hot from the freshly-awarded MVP Michael B. McLaughlin, a set of no less than eight (8= 2*4 = 3+5 = 10-2) tips to improve the experience of users when they need to close and resume your XNA game on Windows Phone 7. The article is a must read for everyone who doesn't want to [...]]]></description>
			<content:encoded><![CDATA[<p>Coming hot from the freshly-awarded MVP Michael B. McLaughlin, a set of no less than eight (8= 2*4 = 3+5 = 10-2) tips to improve the experience of users when they need to close and resume your XNA game on Windows Phone 7. The article is a must read for everyone who doesn't want to annoy their customers.</p>
<p>Go ahead and <a href="http://geekswithblogs.net/mikebmcl/archive/2011/04/14/wp7-games-recommendations-on-resuming.aspx">read it now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/04/recommendations-on-resuming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Posing a Clingerman to Welcome Our New Overlords</title>
		<link>http://www.sgtconker.com/2011/04/posing-a-clingerman-to-welcome-our-new-overlords/</link>
		<comments>http://www.sgtconker.com/2011/04/posing-a-clingerman-to-welcome-our-new-overlords/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 06:16:56 +0000</pubDate>
		<dc:creator>Captain boki</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MVP Watch]]></category>
		<category><![CDATA[George W. Clingerman]]></category>
		<category><![CDATA[John Defenbaugh]]></category>
		<category><![CDATA[Michael B. McLaughlin]]></category>
		<category><![CDATA[MVP]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/04/posing-a-clingerman-to-welcome-our-new-overlords/</guid>
		<description><![CDATA[That’s right: George W. Clingerman finally stopped pretending being a developer/programmer/someone who knows code to pursue a career as DJ now, going by the nick DJ Cling-Star. Meanwhile, there are three new additions to the happy bunch that is known as the Direct/XNA MVPs:
First, there’s Michael B. “Concise” McLaughlin of Bob Taco Industries fame. Expect [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sgtconker.com/wp-content/uploads/2011/04/DJ-Cling-Star.jpg"><img style="background-image: none; border-right-width: 0px; margin: 0px 8px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="DJ Cling-Star" border="0" alt="DJ Cling-Star" align="left" src="http://www.sgtconker.com/wp-content/uploads/2011/04/DJ-Cling-Star_thumb.jpg" width="244" height="184" /></a>That’s right: <a href="http://www.xnadevelopment.com/">George W. Clingerman</a> finally stopped pretending being a developer/programmer/someone who knows code to pursue a career as DJ now, going by the nick DJ Cling-Star. Meanwhile, there are three new additions to the happy bunch that is known as the Direct/XNA MVPs:</p>
<p style="overflow: hidden"><a href="http://www.sgtconker.com/wp-content/uploads/2011/04/mikebmcl-thumb.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 8px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="mikebmcl thumb" border="0" alt="mikebmcl thumb" align="left" src="http://www.sgtconker.com/wp-content/uploads/2011/04/mikebmcl-thumb_thumb.png" width="56" height="66" /></a>First, there’s <a title="Even an army of monkeys fail to keep up with his word count…" href="http://geekswithblogs.net/mikebmcl/Default.aspx">Michael B. “Concise” McLaughlin</a> of <a href="http://www.bobtacoindustries.com/">Bob Taco Industries</a> fame. Expect even more words coming from this man and his <a href="http://geekswithblogs.net/mikebmcl/Default.aspx">blog</a> (and now <em>his</em> <a href="http://forums.create.msdn.com/forums/p/80085/484493.aspx#484493">forums</a>).</p>
<p style="overflow: hidden"><a href="http://twitter.com/#!/sigilxna"><img style="background-image: none; border-right-width: 0px; margin: 0px 8px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="The Pale Impaled Thumb" border="0" alt="The Pale Impaled Thumb" align="left" src="http://www.sgtconker.com/wp-content/uploads/2011/04/The-Pale-Impaled-Thumb.jpg" width="56" height="66" /></a>Next up comes the <a title="The Texan" href="http://youtube.com/SigilXNA">John “The Pale Impaled” Defenbaugh</a>, joining <a title="Also know as “One Word”" href="http://twitter.com/#!/MachXGames">Jim “The Closer” Perry</a>, armed with his <strike>shut gun</strike><em>shotgun</em> the threads <em>will</em> fall left and right like clay pigeons. <a href="http://twitter.com/#!/SigilXNA/status/56500927221334017">Luckily he still ain’t havin’ the permissions</a>.</p>
<p><a href="http://www.armlessoctopus.com/2011/04/08/get-to-know-your-xna-mvps-part-1-what-is-an-mvp/">The third one is MIA currently</a>… <em>[<strong>Update</strong>: OK, our <strike>intelligent</strike>intelligence services managed to get ahold of his name now, <a href="https://mvp.support.microsoft.com/profile=236BF14F-6C6D-47F9-BC11-7C0AD6E36E30">Dr. Minh-Triet TRAN</a>, but not many more details…]</em></p>
<p>Lets hope <strike>this</strike><em>these</em> guys can fulfill the <a href="http://geekswithblogs.net/clingermangw/archive/2011/04/08/144771.aspx#572933"><strong><em>demands</em></strong> of the community</a>…</p>
<p><em>[<strong>Update:</strong> <a title="The previous sentence resulted in mental damage and has since been deleted to prevent any further damage" href="http://twitter.com/#!/madNinjaSkillz">Moo</a>]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/04/posing-a-clingerman-to-welcome-our-new-overlords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things go wrong! and now the news.</title>
		<link>http://www.sgtconker.com/2011/03/things-go-wrong-and-now-the-news/</link>
		<comments>http://www.sgtconker.com/2011/03/things-go-wrong-and-now-the-news/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 10:44:41 +0000</pubDate>
		<dc:creator>Sgt. Conker</dc:creator>
				<category><![CDATA["Absolutely fine"]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[#neoforce]]></category>
		<category><![CDATA[#ploobs]]></category>
		<category><![CDATA[#towerdefense]]></category>
		<category><![CDATA[Sunburn]]></category>
		<category><![CDATA[VoteForGeorge]]></category>

		<guid isPermaLink="false">http://www.sgtconker.com/2011/03/things-go-wrong-and-now-the-news/</guid>
		<description><![CDATA[Recently the Sgt. Conker server had a bit of a hiccup, our e-mails were getting clogged up and we missed a few things.
No major damage was done, and no soldiers were harmed in this unfortunate outbreak.
And now the news.
George continues his onslaught of posting all things XNA News by bringing you XNA Notes 012.
Ploobs Game [...]]]></description>
			<content:encoded><![CDATA[<p>Recently the Sgt. Conker server had a bit of a hiccup, our e-mails were getting clogged up and we missed a few things.</p>
<p>No major damage was done, and no soldiers were harmed in this unfortunate outbreak.</p>
<p>And now the news.</p>
<p><a href="http://geekswithblogs.net/clingermangw/archive/2011/03/25/144513.aspx" target="_blank">George continues</a> his onslaught of posting all things XNA News by bringing you XNA Notes 012.</p>
<p><a href="http://ploobsengine.codeplex.com/" target="_blank">Ploobs Game Engine</a> - another open source XNA Engine. The engine boasts a huge list of features which you can see just under the screenshots on the codeplex page.    <br />Unfortunately it’s for XNA 3.1, but it looks pretty, and hopefully wouldn’t take much to upgrade to XNA 4.0. Thanks go to Thiago Dias Pastor for bringing this to our attention. He also made me aware of a <a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=ploobsengine&amp;DownloadId=217469" target="_blank">downloadable document here</a> which is an extensive explanation of the techniques used in the engine. Unfortunately it’s in Portuguese which limits the audience some what.</p>
<p><a href="http://bobscodingcorner.blogspot.com/" target="_blank">Optimizing Bounding Boxes in XNA</a> – Robert Walter brings a decent article on how to optimize bounding box collisions in XNA.</p>
<p><a href="http://xnatd.blogspot.com/" target="_blank">Tower Defense Tutorials</a> -&#160; This website has 14.5 articles on how to build an XNA Tower Defense game. Looks like a nice resource. </p>
<p><a href="http://neoforce.codeplex.com/" target="_blank">Neoforce controls</a> – This is something I completely missed. A skinnable GUI library for XNA 4. Looks stunning, possibly a bit overkill but still … worth a try at least.    <br />Disclaimer : this project is no longer maintained or developed (but it’s open source)</p>
<p>And lastly, some support for a very cool XNA engine.</p>
<p><a href="http://www.synapsegaming.com/" target="_blank">SunBurn Game Engine is looking HOT!</a> – Here’s some news from the Synapse Gaming team.</p>
<p><strong>SunBurn Game Engine: Full Windows Phone 7 Support</strong></p>
<p>Synapse Gaming’s SunBurn Game Engine has led the pack when it comes to technology for XNA. And our latest SunBurn update solidifies that commitment with full support for Windows Phone 7.</p>
<p>This is not some add-on or a small subset of the engine. Instead it includes all of the features and systems the hardware is capable of supporting, and using the same api, content pipeline, and design as on Windows and Xbox. This allows a game to run across all three platforms without any modifications, while still being able to take advantage of SunBurn's advanced features like deferred rendering, HDR, and more on Windows and Xbox.</p>
<p>Windows Phone 7 features in SunBurn include:</p>
<ul>
<li>Diffuse and emissive mapping </li>
<li>Volume lighting </li>
<li>Bloom / post-processing </li>
<li>Baked-down lighting on static objects (see below) </li>
<li>Composite lighting on dynamic objects (see below) </li>
<li>Collisions </li>
<li>Use the same scenes, light rigs, code, tools, and api on Windows, Xbox, and Windows Phone 7 </li>
</ul>
<p>SunBurn 2.0 also includes in-editor baked-down lighting, which generates light maps that render with none of the overhead of the real-time lighting (rendering nearly for free). This makes highly detailed lighting and shadows possible on Windows Phone 7 (which does not support dynamic lighting and shadows).</p>
<p>To learn more, and see SunBurn WP7 games and demos in action, go to <a href="http://www.synapsegaming.com/blogs/johnk/archive/2010/11/16/sunburn-2-0-goes-mobile-on-windows-phone-7.aspx">http://www.synapsegaming.com/blogs/johnk/archive/2010/11/16/sunburn-2-0-goes-mobile-on-windows-phone-7.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sgtconker.com/2011/03/things-go-wrong-and-now-the-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

