<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 - Entries tagged with Gaming</title>
    <atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Tags/gaming/RSS"/>
    <itunes:summary></itunes:summary>
    <itunes:author>Microsoft</itunes:author>
    <itunes:subtitle></itunes:subtitle>
    <image>
      <url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
      <title>Channel 9 - Entries tagged with Gaming</title>
      <link>http://channel9.msdn.com/Tags/gaming</link>
    </image>
    <itunes:image href=""/>
    <itunes:category text="Technology"/>
    <description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
    <link>http://channel9.msdn.com/Tags/gaming</link>
    <language>en</language>
    <pubDate>Sun, 12 Feb 2012 13:08:38 GMT</pubDate>
    <lastBuildDate>Sun, 12 Feb 2012 13:08:38 GMT</lastBuildDate>
    <generator>Rev9</generator>
    <c9:totalResults>171</c9:totalResults>
    <c9:pageCount>7</c9:pageCount>
    <c9:pageSize>25</c9:pageSize>
  <item>
      <title>Show Us Your Tech: &#39;Softie Builds 737 Cockpit In His House</title>
      <description><![CDATA[ <p>Microsoft employees are often as passionate about their hobbies as they are with their work. Salvador Patuel is an&nbsp;ADM out of our UK office during the day, but he's a hobbiest commercial airline pilot at night. Salvador loves flying so much he decided to build an elaborate controller to make his flying a bit more realistic, except this&nbsp;controller includes a full flight deck. Salvador shot a short video tour of his pet project himself for&nbsp;Show Us Your Tech&nbsp;and he's answered some of my email questions below.</p><p><strong>Who are you? What do you do at Microsoft?<br></strong>My name is Salvador Alvarez Patuel, I am a Principal Application Development Manager (ADM). I am responsible for helping customers to develop better solutions using Microsoft technologies. I am currently based in the Microsoft campus in the United Kingdom.</p><p><strong>What’s your flight background that made you decide to do this? <br></strong>I have a private pilot license, obtained 15 years ago, always loved flying and had the opportunity to fly on several different birds, from single piston to multi turbo-prop engines. I have flown several jet planes on real simulators and I try to fly at least once a month on the B737 simulator at British Airways. I have used Microsoft Flight Simulator from the early 90s, always using different hardware devices to enhance my experience, to make it more real.</p><p><strong>How did&nbsp;you start this project? <br></strong>Well, my wife does not like me flying, as she is quite afraid of flying. When we got married she asked me to fly less hours so I tried to negotiate a win-win situation, I said to her “Ok, but can I develop my flight simulator in my studio?”, she obviously answered yes, thinking that I was going to buy some kind of joystick and a bigger monitor <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' />. I was aware that there was a small group of people around the world that have built some homemade cockpits in their houses, and started browsing for some ideas. At the beginning it was quite hard, as you can imagine there are not a lot of suppliers that offer affordable parts, so I decided to purchase what I could, and develop what it was missing.</p><p><strong>How long did this take you? <br></strong>I am not considered it done, but I started 3 years ago and started flying just a year ago. That means that it took me 2 years to get some decent parts ready to start experiencing the simulation!</p><p><strong>Where did you get all the hardware?<br></strong>As some parts where available, I try to leverage on affordable products, but sooner realized that I had to create some of the parts. The good thing is that the internet and the community provides most of the diagrams, with measures and materials so it wasn’t very difficult to get what I needed, but it was much harder to make those custom parts using new suppliers. For the structure, I have used <a href="http://www.flightdecksolutions.com">Flight Deck Solutions</a>, today they have a very rich set of parts but wasn’t like this when I first started, seems that the hobby is growing!. Some parts are actual real from airplanes, like the yoke which I rewire, add some potentiometers connected to a USB board to get the values from it. My latest addition, the throttles where custom made by a third party company called <a href="http://www.revolution-simproducts.com">Revolution Sim Products</a> as with my new baby boy I didn’t have time to build it myself.</p><p><strong>How did you get it all to work with FSX?<br></strong>That was the interesting part, as I am a software developer I had all the necessary skills. I started developing all the software by myself, reading real Boeing 737 manuals with more technical drawings than the space shuttle (trust me!) I coded the aircraft logic as I was just using the 737 models in flight simulator. I knew about <a href="http://www.schiratti.com/dowson.html">FSUIPC library</a>, written by Peter Dawson&nbsp;and I start interfacing my software with FSX using the available offsets. For the visual avionics I wrote components using DirectX, but rapidly found myself diverting a lot of energy getting the visual rights, and not enough time on the logic. Therefore, I decided to buy <a href="http://www.sim-avionics.com">a visual package from Sim Avionics</a>, at that time it was a very cheap option compared with <a href="http://www.projectmagenta.com/">Project Magenta</a>, one of the leaders on this area, now they are similar prices. I use my system logic to interact with Sim-Avionics using FSUIPC offsets, this is a very fast input/output model that allows me to link 3 computers in near real time. The other hard part was to write components that read USB values, from all my hardware. I have managed to connect everything together but trust me, it was quite hard</p><p><strong>What do you use for your primary displays?<br></strong>My first idea was to use a set of projectors, I bought one but I found that without a proper cockpit shell it didn’t look real, just a big image on the wall. So I decided to take a different approach, using several monitors. The problem was that a decent graphic accelerator card will have two outputs, and the performance degrades when you increase the resolution and detail, so I found another way to do it. I found the Matrox triple head device as an excellent alternative, as it takes the feed from one output and spread it across 3 screens, without degrading the performance, now it looks like I have proper cockpit windows!</p><p>As you may know, FSX is hungry for resources so I must admit that I have invested on the main machine that only runs FSX. It has an i7 processor, 8Gb DDR3 RAM , solid state drives and an nvidia GTX 570 graphic card. I am getting 40fps nearly full detail, sweet.</p><p><strong>How much of the controls actually work compared to just being “eye candy”?&nbsp;<br></strong>Practically everything I have works as the real plane, even the lights dimmer. The motored throttles have given it the final touch, as follows the autopilot logic that I have also coded. I have some dummy parts still, but just because I didn’t have the time, like the chronometer and the yaw dumper gauge. The other area where software is replacing hardware is the overhead panel and the pedestal area (with radio controls), I don’t have the space to do it but once I have more space I will definitely jump into them.</p><p><strong>What do you have left that you’d like to add?<br></strong>I want to add another computer to manage the CDU (as is quite intensive) and the lower display unit, just beside it. It will require a custom LCD screen (as the upper display unit that I already have) and some wiring. That will allow me to display secondary information, like tire pressure, doors, etc. Also I want to add the first officer side, not that I needed but it will look nicer. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p><p><strong>Do you think you could fly a real 737 </strong><strong>now after having this?</strong>&nbsp;&nbsp;<br>I already fly the real 737 simulators, therefore my answer will be “Probably yes”. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:76498881ba904dc38bdc9ea7015a32b2">]]></description>
      <comments>http://channel9.msdn.com/Series/Show-Us-Your-Tech/Softie-Builds-737-Cockpit-In-His-House</comments>
      <itunes:summary> Microsoft employees are often as passionate about their hobbies as they are with their work. Salvador Patuel is an&amp;nbsp;ADM out of our UK office during the day, but he&#39;s a hobbiest commercial airline pilot at night. Salvador loves flying so much he decided to build an elaborate controller to make his flying a bit more realistic, except this&amp;nbsp;controller includes a full flight deck. Salvador shot a short video tour of his pet project himself for&amp;nbsp;Show Us Your Tech&amp;nbsp;and he&#39;s answered some of my email questions below.Who are you? What do you do at Microsoft?My name is Salvador Alvarez Patuel, I am a Principal Application Development Manager (ADM). I am responsible for helping customers to develop better solutions using Microsoft technologies. I am currently based in the Microsoft campus in the United Kingdom.What’s your flight background that made you decide to do this? I have a private pilot license, obtained 15 years ago, always loved flying and had the opportunity to fly on several different birds, from single piston to multi turbo-prop engines. I have flown several jet planes on real simulators and I try to fly at least once a month on the B737 simulator at British Airways. I have used Microsoft Flight Simulator from the early 90s, always using different hardware devices to enhance my experience, to make it more real.How did&amp;nbsp;you start this project? Well, my wife does not like me flying, as she is quite afraid of flying. When we got married she asked me to fly less hours so I tried to negotiate a win-win situation, I said to her “Ok, but can I develop my flight simulator in my studio?”, she obviously answered yes, thinking that I was going to buy some kind of joystick and a bigger monitor . I was aware that there was a small group of people around the world that have built some homemade cockpits in their houses, and started browsing for some ideas. At the beginning it was quite hard, as you can imagine there are not a lot of suppliers that offer aff</itunes:summary>
      <itunes:duration>607</itunes:duration>
      <link>http://channel9.msdn.com/Series/Show-Us-Your-Tech/Softie-Builds-737-Cockpit-In-His-House</link>
      <pubDate>Tue, 26 Apr 2011 17:05:06 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Series/Show-Us-Your-Tech/Softie-Builds-737-Cockpit-In-His-House</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_100_ch9.jpg" height="75" width="100"/>
      <media:thumbnail url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_220_ch9.jpg" height="165" width="220"/>
      <media:thumbnail url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_512_ch9.jpg" height="384" width="512"/>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_2MB_ch9.wmv" expression="full" duration="607" fileSize="385027740" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_ch9.mp3" expression="full" duration="607" fileSize="4863939" type="audio/mp3" medium="audio"/>
        <media:content url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_ch9.wma" expression="full" duration="607" fileSize="4922527" type="audio/x-ms-wma" medium="audio"/>
        <media:content url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_ch9.wmv" expression="full" duration="607" fileSize="133977075" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_high_ch9.mp4" expression="full" duration="607" fileSize="266594172" type="video/mp4" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_low_ch9.mp4" expression="full" duration="607" fileSize="61418423" type="video/mp4" medium="video"/>
        <media:content url="http://smooth.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit.ism/manifest" expression="full" duration="607" fileSize="8458" type="video/x-ms-wmv" medium="video"/>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/32b2/76498881-ba90-4dc3-8bdc-9ea7015a32b2/MSFTFSXCockpit_ch9.wmv" length="133977075" type="video/x-ms-wmv"/>
      <dc:creator>Larry Larsen</dc:creator>
      <itunes:author>Larry Larsen</itunes:author>
      <slash:comments>14</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Series/Show-Us-Your-Tech/Softie-Builds-737-Cockpit-In-His-House/RSS</wfw:commentRss>
      <category>DIY</category>
      <category>Flight Sim</category>
      <category>Gaming</category>
      <category>Flight Simulator X</category>
    </item>
  <item>
      <title>Bytes by MSDN: Nickolas Landry and Rob Cameron on cool Apps for Windows Phone 7</title>
      <description><![CDATA[ <p>Don’t miss this dynamic interview with Nickolas Landry, Practice Manager for Infusion. Rob Cameron, Senior Architect Evangelist for Microsoft, has great dialog with Nick around enterprise mobility, location intelligence applications and Windows Phone 7. Nick’s team builds cool applications using Bing maps and is now bringing those apps to Windows Phone 7. And what does Nick do in his spare time? He’s also developing games for Windows Phone 7 and uploading them to Marketplace. Whether it’s locator, mobile or gaming applications you’re interested in, this is a good discussion to listen in on.</p><h3>About Nickolas Landry</h3><table border="0" cellspacing="2" cellpadding="0" width="100%"><tbody><tr align="left" valign="top"><td>&nbsp;</td><td>Nickolas Landry is a Principal Architect and Practice Manager in New York for Infusion Development, a Microsoft Gold Partner which offers quality software development services, developer training and consulting services for large corporations and agencies in the North America, the UK and Dubai (<a href="http://www.infusion.com/">www.infusion.com</a>). Known for his dynamic and engaging style, he is a frequent speaker at major software development conferences worldwide, a member of both the INETA and the MSDN Canada Speakers Bureaus, a Microsoft MVP on Device Application Development, and a former Microsoft Regional Director in Montreal. He is the Vice-President of IASA New York (<a href="http://www.iasahome.org/">www.iasahome.org</a>), and is a Founding Member of WWISA (<a href="http://www.wwisa.org/">www.wwisa.org</a>). His primary goal is to help businesses connect their information, systems, and people together in a seamless integration to achieve complete enterprise agility. Aside from his work in designing business solution architectures using .NET technologies, Nick provides mentoring services in architecture, design and .NET development, authors and teaches .NET classes, performs system audits, and profiles technologies for various enterprise scenarios. With over 17 years of professional experience – starting with Visual Basic 1.0 – and a career almost entirely dedicated to Microsoft technologies, Nick specializes in .NET mobility, Bing Maps, SOA, architecture &amp; design patterns, High-Performance Computing (HPC), game development with XNA, and smart clients. He wrote multiple articles for CODE Magazine and several .NET mobility courses for Microsoft, has been a technical editor for many books, and holds several professional certifications from Microsoft and IBM. Contact and blog: <a href="http://home.infusionblogs.com/nlandry">http://home.infusionblogs.com/nlandry</a>.</td></tr></tbody></table><p>&nbsp;</p><h3>About Rob Cameron</h3><table border="0" cellspacing="2" cellpadding="0" width="100%"><tbody><tr align="left" valign="top"><td>&nbsp;</td><td>Employed by Microsoft since 2001, Rob Cameron is an Industry Architect Evangelist with Microsoft Corporation based out of Atlanta, Georgia. As part of Microsoft's Communication Sector Developer &amp; Platform Evangelism team, Rob focuses on development tools and technologies focused on mobile devices, gaming, and embedded devices for telecommunications, cable, and media &amp; entertainment companies. Rob co-authored several titles including Building ASP.NET Server Controls, Pro ASP.NET 3.5 Server Controls and AJAX Components, Silverlight 2 Recipes, and most recently Silverlight 3 Recipes. He has a master's degree in information technology management and a bachelor's degree in computer science. Visit Rob's blog at <a href="http://blogs.msdn.com/RobCamer">http://blogs.msdn.com/RobCamer</a>.</td></tr></tbody></table><p>&nbsp;</p><h3>Nickolas Landry and Rob Cameron recommend you check out</h3><ul><li><a href="http://clk.atdmt.com/MRT/go/249592544/direct/01/">Download the Windows Phone 7 developer tools</a></li><li><a href="http://developer.windowsphone.com/Signup-Create-Account.aspx">Register for Marketplace and upload your app</a></li><li><a href="http://create.msdn.com/en-US/">App Hub Windows Phone 7 Developer Portal</a></li><li><a href="http://msdn.microsoft.com/en-us/gg243438.aspx">Learn more about Windows Phone 7 development with &quot;&quot;How Do I&quot;&quot; videos</a></li><li><a href="http://msdn.microsoft.com/en-us/wp7trainingcourse.aspx">Windows Phone 7 Developer Training Kit</a></li><li><a href="http://channel9.msdn.com/blogs/egibson/windows-phone-7-jump-start-session-1-of-12-introduction">Windows Phone 7 Jump Start video training</a></li><li><a href="http://www.silverlight.net/">Silverlight</a> </li><li><a href="http://www.microsoft.com/getsilverlight/Get-Started/Install/Default.aspx">Microsoft Silverlight 4 Download</a></li><li><a href="http://home.infusionblogs.com/nlandry/default.aspx">Nick's blog</a> </li><li><a href="http://www.infusion.com/Default.aspx">Infusion</a> </li></ul> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:4f2045510cea4490b50d9e8600ef616e">]]></description>
      <comments>http://channel9.msdn.com/Blogs/Bytes+by+MSDN/Bytes-by-MSDN-Nickolas-Landry-and-Rob-Cameron-on-cool-Apps-for-Windows-Phone-7</comments>
      <itunes:summary> Don’t miss this dynamic interview with Nickolas Landry, Practice Manager for Infusion. Rob Cameron, Senior Architect Evangelist for Microsoft, has great dialog with Nick around enterprise mobility, location intelligence applications and Windows Phone 7. Nick’s team builds cool applications using Bing maps and is now bringing those apps to Windows Phone 7. And what does Nick do in his spare time? He’s also developing games for Windows Phone 7 and uploading them to Marketplace. Whether it’s locator, mobile or gaming applications you’re interested in, this is a good discussion to listen in on.About Nickolas Landry&amp;nbsp;Nickolas Landry is a Principal Architect and Practice Manager in New York for Infusion Development, a Microsoft Gold Partner which offers quality software development services, developer training and consulting services for large corporations and agencies in the North America, the UK and Dubai (www.infusion.com). Known for his dynamic and engaging style, he is a frequent speaker at major software development conferences worldwide, a member of both the INETA and the MSDN Canada Speakers Bureaus, a Microsoft MVP on Device Application Development, and a former Microsoft Regional Director in Montreal. He is the Vice-President of IASA New York (www.iasahome.org), and is a Founding Member of WWISA (www.wwisa.org). His primary goal is to help businesses connect their information, systems, and people together in a seamless integration to achieve complete enterprise agility. Aside from his work in designing business solution architectures using .NET technologies, Nick provides mentoring services in architecture, design and .NET development, authors and teaches .NET classes, performs system audits, and profiles technologies for various enterprise scenarios. With over 17 years of professional experience – starting with Visual Basic 1.0 – and a career almost entirely dedicated to Microsoft technologies, Nick specializes in .NET mobility, Bing Maps, SOA, architectur</itunes:summary>
      <itunes:duration>368</itunes:duration>
      <link>http://channel9.msdn.com/Blogs/Bytes+by+MSDN/Bytes-by-MSDN-Nickolas-Landry-and-Rob-Cameron-on-cool-Apps-for-Windows-Phone-7</link>
      <pubDate>Thu, 10 Feb 2011 14:57:01 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/Bytes+by+MSDN/Bytes-by-MSDN-Nickolas-Landry-and-Rob-Cameron-on-cool-Apps-for-Windows-Phone-7</guid>
      <media:thumbnail url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_100_ch9.jpg" height="75" width="100"/>
      <media:thumbnail url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_220_ch9.jpg" height="165" width="220"/>
      <media:thumbnail url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_320_ch9.jpg" height="240" width="320"/>
      <media:thumbnail url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_512_ch9.jpg" height="384" width="512"/>
      <media:thumbnail url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_85_ch9.jpg" height="64" width="85"/>
      <media:group>
        <media:content url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_2MB_ch9.wmv" expression="full" duration="368" fileSize="127247723" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_ch9.wmv" expression="full" duration="368" fileSize="67799639" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_high_ch9.mp4" expression="full" duration="368" fileSize="99815424" type="video/mp4" medium="video"/>
        <media:content url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_low_ch9.mp4" expression="full" duration="368" fileSize="32841858" type="video/mp4" medium="video"/>
        <media:content url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_Zune_ch9.wmv" expression="full" duration="368" fileSize="52215694" type="video/x-ms-wmv" medium="video"/>
      </media:group>      
      <enclosure url="http://files.ch9.ms/ch9/616e/4f204551-0cea-4490-b50d-9e8600ef616e/BytesbyMSDNNickolasLandry_ch9.wmv" length="67799639" type="video/x-ms-wmv"/>
      <dc:creator>Bytes by MSDN</dc:creator>
      <itunes:author>Bytes by MSDN</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/Bytes+by+MSDN/Bytes-by-MSDN-Nickolas-Landry-and-Rob-Cameron-on-cool-Apps-for-Windows-Phone-7/RSS</wfw:commentRss>
      <category>Bytes by MSDN</category>
      <category>Gaming</category>
      <category>Rob Cameron</category>
      <category>Windows Phone 7</category>
      <category>Apps</category>
      <category>Application</category>
    </item>
  <item>
      <title>CES 2011: Beer, gaming rigs, and 3D everything with NVIDIA</title>
      <description><![CDATA[ <p>David Ragones, Director of Marketing at <a href="http://www.nvidia.com" target="_blank">NVIDIA</a>, took Ben through their booth to show all of the amazing things that you can do with NVIDIA’s new GPU lineup while at CES.&nbsp;Not only did he show Ben the 3D video wall that was playing 500 Windows-only 3D games, but he also poured him a cold one off of the liquid cooled, multi-GPU packing “Kegputer” gaming rig. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:0283922084c64edf824a9e6500534920">]]></description>
      <comments>http://channel9.msdn.com/Blogs/Windows-Blog/Windows-at-CES-2011-NVIDIA</comments>
      <itunes:summary> David Ragones, Director of Marketing at NVIDIA, took Ben through their booth to show all of the amazing things that you can do with NVIDIA’s new GPU lineup while at CES.&amp;nbsp;Not only did he show Ben the 3D video wall that was playing 500 Windows-only 3D games, but he also poured him a cold one off of the liquid cooled, multi-GPU packing “Kegputer” gaming rig. </itunes:summary>
      <itunes:duration>277</itunes:duration>
      <link>http://channel9.msdn.com/Blogs/Windows-Blog/Windows-at-CES-2011-NVIDIA</link>
      <pubDate>Sat, 08 Jan 2011 05:49:54 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/Windows-Blog/Windows-at-CES-2011-NVIDIA</guid>
      <media:thumbnail url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_100_ch9.jpg" height="75" width="100"/>
      <media:thumbnail url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_220_ch9.jpg" height="165" width="220"/>
      <media:thumbnail url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_512_ch9.jpg" height="384" width="512"/>
      <media:thumbnail url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_custom_ch9.jpg" height="384" width="512"/>
      <media:group>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_2MB_ch9.wmv" expression="full" duration="277" fileSize="125876324" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_ch9.mp3" expression="full" duration="277" fileSize="2220575" type="audio/mp3" medium="audio"/>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_ch9.wma" expression="full" duration="277" fileSize="2248967" type="audio/x-ms-wma" medium="audio"/>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_ch9.wmv" expression="full" duration="277" fileSize="60951095" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_high_ch9.mp4" expression="full" duration="277" fileSize="74539109" type="video/mp4" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_low_ch9.mp4" expression="full" duration="277" fileSize="28068079" type="video/mp4" medium="video"/>
        <media:content url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_Zune_ch9.wmv" expression="full" duration="277" fileSize="32151150" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://smooth.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA.ism/manifest" expression="full" duration="277" fileSize="8554" type="video/x-ms-wmv" medium="video"/>
      </media:group>      
      <enclosure url="http://media.ch9.ms/ch9/4920/02839220-84C6-4EDF-824A-9E6500534920/WindowsCES2011NVIDIA_ch9.wmv" length="60951095" type="video/x-ms-wmv"/>
      <dc:creator>Brandon LeBlanc</dc:creator>
      <itunes:author>Brandon LeBlanc</itunes:author>
      <slash:comments>3</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/Windows-Blog/Windows-at-CES-2011-NVIDIA/RSS</wfw:commentRss>
      <category>CES</category>
      <category>Gaming</category>
      <category>PC</category>
      <category>Windows7</category>
      <category>NVIDIA</category>
    </item>
  <item>
      <title>Halo Madness Starts in NYC</title>
      <description><![CDATA[ <p>The launch of the next installment in the popular Halo series is almost upon us. At 12:10 AM on Tuesday, September 14th, millions of fans will at last be able to purchase Halo:Reach, the prequel to the trilogy of Halo games already released. But for those fans who live in New York City, there’s an event that can’t be missed: the Best Buy Theater in Times Square will be hosting a marquee event where fans will get to play the game just before it goes on sale, meet the creators of “Halo,” win Halo-themed prizes and experience a “surprise” musical performance. </p><p>West coast fans won’t be missing out though – at the Music Project | Science Fiction Museum and Hall of Fame in Seattle, Bungie developers will greet fans on Sept. 13th during the countdown to launch. There will also be prizes and fans will get to play the game early there, too. </p><p>Even if you’re not located in one of these cities, a number of retailers will be holding their own celebrations, including Best Buy, GameStop, Wal-Mart, Toys”R”Us and many others, so check out your own local shops for details. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:391ff7029d1743dab5709e0e00fd1a41">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Halo-Madness-Starts-in-NYC</comments>
      <itunes:summary> The launch of the next installment in the popular Halo series is almost upon us. At 12:10 AM on Tuesday, September 14th, millions of fans will at last be able to purchase Halo:Reach, the prequel to the trilogy of Halo games already released. But for those fans who live in New York City, there’s an event that can’t be missed: the Best Buy Theater in Times Square will be hosting a marquee event where fans will get to play the game just before it goes on sale, meet the creators of “Halo,” win Halo-themed prizes and experience a “surprise” musical performance. West coast fans won’t be missing out though – at the Music Project | Science Fiction Museum and Hall of Fame in Seattle, Bungie developers will greet fans on Sept. 13th during the countdown to launch. There will also be prizes and fans will get to play the game early there, too. Even if you’re not located in one of these cities, a number of retailers will be holding their own celebrations, including Best Buy, GameStop, Wal-Mart, Toys”R”Us and many others, so check out your own local shops for details. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Halo-Madness-Starts-in-NYC</link>
      <pubDate>Wed, 08 Sep 2010 15:21:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Halo-Madness-Starts-in-NYC</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/100/on10_70529_100x75.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/220/on10_70529_220x165.jpg" height="165" width="220"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_1297c387-b9f1-4bd6-bf26-ab02a7a14551.jpg" height="336" width="512"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_4322b131-9f04-4b35-9354-c29a769f09f7.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Halo-Madness-Starts-in-NYC/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Halo</category>
    </item>
  <item>
      <title>Flight Simulator Returns!</title>
      <description><![CDATA[
<p>Microsoft’s classic game Flight Simulator is returning 28 years after its debut, then called “Microsoft Flight Simulator 1.0.” Today, it will just be known as “Microsoft Flight.” In the new vision, Flight will reinvent itself for the era of modern PC gaming,
 inviting both long-time fans and new users to “experience the magic of flight,” reads the teaser on the website at
<a shape="rect" href="http://www.microsoft.com/games/flight" shape="rect">www.microsoft.com/games/flight</a>.
</p>
<p>The game is still in development, but an alpha version is almost ready for internal testing, Kevin Unangst, a senior director in Microsoft's game unit, recently told CNET News. But don’t expect a public beta this year, he said.
</p>
<p>Details on gameplay are few, as are screenshots, but the “Flight” website does have
<a shape="rect" href="http://www.microsoft.com/games/flight/" shape="rect">a&nbsp; teaser video</a> available which shows a prop plane soaring over sparkling water as the sun rises, casting everything with a an orange-ish glow.
</p>
<p>“Flight” isn’t the only game to be resurrected. Another classic, “Age of Empires,” is also returning in a new online version and
<a shape="rect" href="http://www.ageofempiresonline.com/" shape="rect">it is taking sign ups</a> for its beta launching in 2010. According to the news release, Age of Empires invites players to watch their own Greek civilization grow from village to empire,
 while embarking on quests and adventures, either solo or with friends. </p>
<p>You can learn more about all these games and other new releases at microsoft.com/games.
</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:7959bea54ef9456b9dde9dec0026a538">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Flight-Simulator-Returns</comments>
      <itunes:summary>
Microsoft’s classic game Flight Simulator is returning 28 years after its debut, then called “Microsoft Flight Simulator 1.0.” Today, it will just be known as “Microsoft Flight.” In the new vision, Flight will reinvent itself for the era of modern PC gaming,
 inviting both long-time fans and new users to “experience the magic of flight,” reads the teaser on the website at
www.microsoft.com/games/flight.

The game is still in development, but an alpha version is almost ready for internal testing, Kevin Unangst, a senior director in Microsoft&#39;s game unit, recently told CNET News. But don’t expect a public beta this year, he said.

Details on gameplay are few, as are screenshots, but the “Flight” website does have
a&amp;nbsp; teaser video available which shows a prop plane soaring over sparkling water as the sun rises, casting everything with a an orange-ish glow.

“Flight” isn’t the only game to be resurrected. Another classic, “Age of Empires,” is also returning in a new online version and
it is taking sign ups for its beta launching in 2010. According to the news release, Age of Empires invites players to watch their own Greek civilization grow from village to empire,
 while embarking on quests and adventures, either solo or with friends. 
You can learn more about all these games and other new releases at microsoft.com/games.

</itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Flight-Simulator-Returns</link>
      <pubDate>Fri, 20 Aug 2010 13:50:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Flight-Simulator-Returns</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_060d9d5e-d284-4eb9-9c91-3c5abc867504.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_7b7ad380-8f6d-4eb3-a95c-4af80b7a050e.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Flight-Simulator-Returns/RSS</wfw:commentRss>
      <category>Games</category>
      <category>Gaming</category>
      <category>game</category>
    </item>
  <item>
      <title>Settlers of Catan on Microsoft Surface</title>
      <description><![CDATA[ <p>The popular “Settlers of Catan” board game has been transported to Microsoft Surface, according to <a shape="rect" href="http://blog.seattlepi.com/microsoft/archives/216807.asp?source=rss" shape="rect">SeattlePi</a>. The game, which typically involves a physical board, die and cards, has been made entirely digital thanks to Vectorform, a multi-platform design company and Microsoft partner. Reporter Nick Eaton got to see the Surface-enabled game up close and personal in Seattle, after stopping by the Vectorform offices for a demo. </p><p>The traditional analog elements of the game are now touchable, interactive graphics appearing on the Surface computer’s screen. And the game also hooks up to the Web, allowing for gamer accounts, leader boards and more. Users can even play each other over the Internet. </p><p>To see what Catan looks like on Surface, check out this <a shape="rect" href="http://www.seattlepi.com/photos/gallery.asp?SubID=5959&amp;page=1&amp;GTitle=%27Settlers%20of%20Catan%27%20for%20Microsoft%20Surface&amp;pubdate=7/28/2010" shape="rect">photo gallery</a> or this <a shape="rect" href="http://www.youtube.com/watch?v=sdUFT01vzyI&amp;feature=player_embedded" shape="rect">YouTube video</a>. It definitely looks like fun!</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:6a16298a400848fea9399e0e007a9099">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Settlers-of-Catan-on-Microsoft-Surface</comments>
      <itunes:summary> The popular “Settlers of Catan” board game has been transported to Microsoft Surface, according to SeattlePi. The game, which typically involves a physical board, die and cards, has been made entirely digital thanks to Vectorform, a multi-platform design company and Microsoft partner. Reporter Nick Eaton got to see the Surface-enabled game up close and personal in Seattle, after stopping by the Vectorform offices for a demo. The traditional analog elements of the game are now touchable, interactive graphics appearing on the Surface computer’s screen. And the game also hooks up to the Web, allowing for gamer accounts, leader boards and more. Users can even play each other over the Internet. To see what Catan looks like on Surface, check out this photo gallery or this YouTube video. It definitely looks like fun!</itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Settlers-of-Catan-on-Microsoft-Surface</link>
      <pubDate>Wed, 11 Aug 2010 13:40:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Settlers-of-Catan-on-Microsoft-Surface</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_e8c913fc-5b9b-4eca-b260-45b5408e376a.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_47cc8b7f-b096-43e5-913f-61666fecf59c.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Settlers-of-Catan-on-Microsoft-Surface/RSS</wfw:commentRss>
      <category>Games</category>
      <category>Gaming</category>
      <category>Surface</category>
      <category>Surface Computer</category>
      <category>surface computing</category>
    </item>
  <item>
      <title>Bing Gets Games</title>
      <description><![CDATA[ <p>As promised, the Bing “<a shape="rect" href="http://www.bing.com/community/blogs/search/archive/2010/06/22/a-new-entertainment-experience-for-bing.aspx" shape="rect">entertainment experience</a>” is getting into gear with updates for music, tv, movies, and now more games, too. According to <a shape="rect" href="http://www.bing.com/community/blogs/search/archive/2010/07/27/new-games-come-to-bing.aspx" shape="rect">this post</a> on the Bing blog, those searching for free games on Bing have several new options, including <a shape="rect" href="http://www.bing.com/games/online/gb/bing/belles/default/en-us?q=belle's&#43;beauty&#43;boutique&amp;form=DTPGAA" shape="rect">Belle's Beauty Boutique</a>, <a shape="rect" href="http://www.bing.com/games/online/gb/bing/carnib/default/en-us?q=Carniball&amp;form=DTPGAA" shape="rect">Carniball</a>,<a shape="rect" href="http://www.bing.com/games/online/gb/bing/fispsp/default/en-us?q=Fishdom&#43;Spooky&#43;Splash&amp;form=DTPGAA" shape="rect">Fishdom Spooky Splash</a>, <a shape="rect" href="http://www.bing.com/games/online/gb/bing/jigsaw/default/en-us?q=Jigsaw&amp;form=DTPGAA" shape="rect">Jigsaw</a>, <a shape="rect" href="http://www.bing.com/games/online/gb/bing/pool/default/en-us?q=8&#43;ball&#43;champion&amp;form=DTPGAA" shape="rect">8 Ball Champion</a>, <a shape="rect" href="http://www.bing.com/games/online/gb/bing/pyrsol/default/en-us?q=Pyramid&#43;Solitaire&amp;form=DTPGAA" shape="rect">Pyramid Solitaire</a> and <a shape="rect" href="http://www.bing.com/games/online/gb/bing/garsca/default/en-us?q=Gardenscapes&amp;form=DTPGAA" shape="rect">Gardenscapes</a>. </p><p>But don’t worry if you’re not sure what game to search for by name – I discovered that you can simply type in “games” into Bing and the top result will link you directly to the Games themselves (click either the link’s heading or just “Play Now.”) Here you’ll find all the games housed on Bing, like the ever-popular Bejeweled, for example, and Plants vs. Zombies, just to name a couple. </p><p>The <a shape="rect" href="http://www.bing.com/games" shape="rect">bing.com/games</a> site also groups games into categories like “most popular,” “action favorites,” “puzzle favorites,” “word favorites,” and more, so you can find just the sort of game you’re looking for, even&nbsp; if you don’t know what it’s called. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:34c466e7e815471e87469e0e007a3880">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-Games</comments>
      <itunes:summary> As promised, the Bing “entertainment experience” is getting into gear with updates for music, tv, movies, and now more games, too. According to this post on the Bing blog, those searching for free games on Bing have several new options, including Belle&#39;s Beauty Boutique, Carniball,Fishdom Spooky Splash, Jigsaw, 8 Ball Champion, Pyramid Solitaire and Gardenscapes. But don’t worry if you’re not sure what game to search for by name – I discovered that you can simply type in “games” into Bing and the top result will link you directly to the Games themselves (click either the link’s heading or just “Play Now.”) Here you’ll find all the games housed on Bing, like the ever-popular Bejeweled, for example, and Plants vs. Zombies, just to name a couple. The bing.com/games site also groups games into categories like “most popular,” “action favorites,” “puzzle favorites,” “word favorites,” and more, so you can find just the sort of game you’re looking for, even&amp;nbsp; if you don’t know what it’s called. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-Games</link>
      <pubDate>Wed, 28 Jul 2010 15:52:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-Games</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_c6b1110f-0e12-40ba-a6fe-64e5c22ec9fc.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_5eab6cb2-2841-4c15-acf1-8f1351b082d7.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>2</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-Games/RSS</wfw:commentRss>
      <category>bing</category>
      <category>Games</category>
      <category>Gaming</category>
      <category>casual games</category>
      <category>game</category>
    </item>
  <item>
      <title>Bing Gets into Entertainment with Music, TV, Movies and Games</title>
      <description><![CDATA[ <p>Bing’s <a shape="rect" href="http://www.bing.com/community/blogs/search/archive/2010/06/22/a-new-entertainment-experience-for-bing.aspx" shape="rect">latest update</a> expands the search service from being a simple “decision engine” to being a Web destination in and of itself. With the new upgrade, rolling out now, Bing has added an entertainment vertical featuring music, TV shows, movies and games. You can land on Bing’s new entertainment offering via a traditional search or you can browse through them at <a shape="rect" href="http://www.bing.com/entertainment" shape="rect">www.bing.com/entertainment</a>. </p><p>In the music section, you can find lyrics, photos, videos and tour dates for your favorite artist or band, but even more notable, you can <em>stream music</em>. By integrating Zune into Bing, there’s access to over 5 million songs available for your listening pleasure. And if you want to buy a track, Bing points you to Zune, iTunes and Amazon.com’s MP3 store.</p><p>A second integration from Microsoft Games provides access to detailed information on over 35,000 games including reviews, cheats, walkthroughs and more. Plus, almost 100 casual games are available to play right from within Bing. Just search for a game and then click the “Play Now” button that appears under the listing. </p><p><a shape="rect" href="http://on10.net/Link/22c6be14-0b99-49de-959d-93f9ef3ff2c8/" shape="rect"><img width="345" height="247" width="345" height="247" title="5270.bejeweled2_thumb_4A0AFE7C" alt="5270.bejeweled2_thumb_4A0AFE7C" src="http://on10.net/Link/64e49e8a-dd1b-4a81-a017-a13267104a57/" border="0"></a></p><p>Finally, there’s video. Bing now offers thousands of episodes from 1500&#43; shows, thanks to new partnerships with Hulu, Viacom and CBS. This “Bing TV” section will serve as a one-stop-shop for online TV viewing, offering everything from clips to full episodes and even local listings. </p><p>Movies aren’t left out either: reviews from critics, Facebook and Twitter sentiment, and other info from Bing Maps that helps you navigate to your favorite theater are included here. </p><p>Everything except the TV listings should be <a shape="rect" href="http://www.bing.com/entertainment" shape="rect">live now</a> – those will come over the next couple of weeks. Zune music playback is also ramping up now – more songs will be available in a few days. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:9820510ed3f34069b0c69e0e00240cc4">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-into-Entertainment-with-Music-TV-Movies-and-Games</comments>
      <itunes:summary> Bing’s latest update expands the search service from being a simple “decision engine” to being a Web destination in and of itself. With the new upgrade, rolling out now, Bing has added an entertainment vertical featuring music, TV shows, movies and games. You can land on Bing’s new entertainment offering via a traditional search or you can browse through them at www.bing.com/entertainment. In the music section, you can find lyrics, photos, videos and tour dates for your favorite artist or band, but even more notable, you can stream music. By integrating Zune into Bing, there’s access to over 5 million songs available for your listening pleasure. And if you want to buy a track, Bing points you to Zune, iTunes and Amazon.com’s MP3 store.A second integration from Microsoft Games provides access to detailed information on over 35,000 games including reviews, cheats, walkthroughs and more. Plus, almost 100 casual games are available to play right from within Bing. Just search for a game and then click the “Play Now” button that appears under the listing. Finally, there’s video. Bing now offers thousands of episodes from 1500&amp;#43; shows, thanks to new partnerships with Hulu, Viacom and CBS. This “Bing TV” section will serve as a one-stop-shop for online TV viewing, offering everything from clips to full episodes and even local listings. Movies aren’t left out either: reviews from critics, Facebook and Twitter sentiment, and other info from Bing Maps that helps you navigate to your favorite theater are included here. Everything except the TV listings should be live now – those will come over the next couple of weeks. Zune music playback is also ramping up now – more songs will be available in a few days. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-into-Entertainment-with-Music-TV-Movies-and-Games</link>
      <pubDate>Wed, 23 Jun 2010 14:34:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-into-Entertainment-with-Music-TV-Movies-and-Games</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_2b34aecd-1fc7-47e0-bd59-d3ea86ac084a.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_42136e7f-f0e8-4172-98df-0d54768516d3.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Bing-Gets-into-Entertainment-with-Music-TV-Movies-and-Games/RSS</wfw:commentRss>
      <category>bing</category>
      <category>Bing Maps</category>
      <category>Gaming</category>
      <category>TV</category>
      <category>Movies</category>
    </item>
  <item>
      <title>Creating a Shuffleboard Game using Silverlight</title>
      <description><![CDATA[<p>In this walkthrough, we will create a <a href="http://en.wikipedia.org/wiki/Table_shuffleboard">
table shuffleboard</a> style game for Windows Phone 7 using Silverlight. Many bars feature these long wooden table games, in which players slide metal pucks down the length of the table, attempting to get as close as possible to the far end without sliding
 off the edge.</p>

<h3><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/6378.image_5F00_28FB581F.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/2086.image_5F00_thumb_5F00_2F422EAD.png" width="223" height="435"></a>
 Multi-Targeting</h3>
<p>Windows Phone 7 uses a version of Silverlight 3 with a few bonus features. Because this version of Silverlight is so close to the Web version of Silverlight 3, we'll take the approach of
<i>Multitargeting</i> a solution for both platforms. To do so, start with a Silverlight 3 (web) application template, and then add in a Windows Phone project with linked files that re-use the Silverlight 3 solution. This allows us to deploy to many different
 platforms using the same code base.</p>
<p>Let's get started by creating our Solution in this way.</p>
<h3>Creating the Solution and MainPage</h3>
<ol>
<li>In Expression Blend 4, create a new Silverlight Application &#43; Website template named Shuffleboard. Be sure to select “3.0” from the Version dropdown, as this is what is supported by Windows Phone (in a little bit we'll add in the Windows Phone project template
 as well). <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/4721.image_5F00_740E52E1.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/3731.image_5F00_thumb_5F00_2599C077.png" width="465" height="427"></a>
</li><li>In the Objects and Timeline Panel, select the main UserControl and set its Width to 480 and its Height to 800. This is the size of a Windows Phone UI in Portrait mode.
</li><li>Select the LayoutRoot Grid and set its Width to 480 and its Height to 800. </li><li>For games, a Canvas layout container is better than a Grid, so let's change the LayoutRoot container type. Right-click LayoutRoot and select Change Layout Type/Canvas.
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0820.image_5F00_57252E0C.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8865.image_5F00_thumb_5F00_5DD8378F.png" width="299" height="304"></a>
</li><li>Since some parts of our UI can appear outside of the game area, we want to add a Clip to this main canvas so that the user does not see these outside elements. Add the following just under the LayoutRoot Canvas:
<br>
This XAML is snippet “<b>MainPage Clip</b>” inside snippets.txt.
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Canvas.Clip</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">RectangleGeometry</span> <span class="attr">Rect</span><span class="kwrd">=&quot;0,0,480,800&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">Canvas.Clip</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
 {font-size:small;
 color:black;
 font-family:consolas,"Courier New",courier,monospace;
 background-color:#ffffff}
.csharpcode 
 {margin:0em}
.csharpcode .rem
 {color:#008000}
.csharpcode .kwrd
 {color:#0000ff}
.csharpcode .str
 {color:#006080}
.csharpcode .op
 {color:#0000c0}
.csharpcode .preproc
 {color:#cc6633}
.csharpcode .asp
 {background-color:#ffff00}
.csharpcode .html
 {color:#800000}
.csharpcode .attr
 {color:#ff0000}
.csharpcode .alt
 {background-color:#f4f4f4;
 width:100%;
 margin:0em}
.csharpcode .lnum
 {color:#606060}
-->
</style></li><li>We'll be using some pre-built Behaviors that make it easy to introduce physics into Silverlight using the Farseer Physics Library. Right-click the Silverlight project and select Add Reference. Select the following assemblies, located in the sample download:
<br>
<br>
\ShuffleBoard\Bin\Debug\FarseerPhysics.dll <br>
\ShuffleBoard\Bin\Debug\Spritehand.FarseerHelper.dll <br>
\ShuffleBoard\Bin\Debug\Spritehand.PhysicsBehaviors.dll <br>
<br>
<strong>NOTE: </strong>To learn more about the Physics Helper Library, visit <a href="http://physicshelper.codeplex.com">
http://physicshelper.codeplex.com</a> </li></ol>
<p align="center"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384">
<param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" />
<param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/8/9/1/6/5/5/ShuffleboardPart1_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/8/9/1/6/5/5/ShuffleboardPart1_512_ch9.png, postid=556198" />
<param name="background" value="#00FFFFFF" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object></p>
<h3>Creating the Game User Control</h3>
<p>Next we'll create a separate user control that will contain the core game logic. By creating a separate user control, we can easily target different platforms by placing the user control inside different MainPage elements.
</p>
<ol>
<li>Right-click the Shuffleboard Silverlight project and select Add New Item. Select UserControl and name the control “ucMainGame”.
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0523.image_5F00_127893CB.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/7701.image_5F00_thumb_5F00_1616AEA8.png" width="299" height="324"></a>
</li><li>Change the LayoutRoot element from a Grid to a Canvas. </li><li>Set the Width to 480 and the Height to 800 for both the UserControl and LayoutRoot Canvas elements.
</li><li>Set the Background color to Black for the LayoutRoot Canvas. </li><li>Build the project by pressing Ctrl&#43;Shift&#43;B. </li><li>Back on MainPage, add an instance of ucMainGame to the page by going to the Assets Panel and expanding Controls/All. Drag an instance of ucMainGame to the artboard.
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/1513.image_5F00_5C939EB0.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/6305.image_5F00_thumb_5F00_432B9B76.png" width="496" height="296"></a>
</li><li>Rename the ucMainGame control to ucMainGame1. </li><li>Set the Left and Top properties of ucMainGame1 to 0. </li></ol>
<h3>Creating the Table</h3>
<p>We'll use a pre-rendered PNG image for the shuffleboard table.</p>
<ol>
<li>Create a new subfolder in the Silverlight project named “images”. </li><li>Add the following JPG image into the new images subfolder, located in the sample download:
<br>
\ShuffleBoard\images\shuffleboardTable.jpg </li><li>Open the ucMainGame user control. </li><li>Insert a new Canvas element named cnvTable, and set the following attributes:
<ol>
<li>Width = 480 </li><li>Height = 800 </li><li>Left = 0 </li><li>Top = 0 </li></ol>
</li><li>In the Assets Panel, expand the Behaviors category and drag a PhysicsControllerBehavior on the cnvTable. This behavior introduces the core physics simulation into the game. Set the properties of the Physics Contoller as follows (this turns of gravity and
 sets some other physics parms): <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/1512.image_5F00_14D215C9.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/7701.image_5F00_thumb_5F00_49727204.png" width="333" height="293"></a>
</li><li>Inside the cnvTable Canvas, add a second Canvas named cnvTableInner, which will hold the table image. Set the following properties on cnvTableInner:
<ol>
<li>Width = 360 </li><li>Height = 1077 </li><li>Left = 60 </li><li>Top = -277 </li></ol>
</li><li>Drag the shuffleboardTable.jpg image from the Projects Panel into cnvTableInner. Set the following properties on the image:
<ol>
<li>Width = 360 </li><li>Height = 1077 </li><li>Left = 0 </li><li>Top = 0 </li></ol>
</li><li>The Objects and Timeline Panel should look like so: <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0042.image_5F00_223828CF.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8468.image_5F00_thumb_5F00_0144B628.png" width="278" height="221"></a>
</li><li>We will need to detect when a puck hits the edge of the table and “falls off.” Let's add in some Rectangle elements and add Physics Behaviors to them.
</li><li>Add a new Rectangle named rectSensorLeft and size it so that it covers the entire left side of the table. Set the following properties:<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0042.image_5F00_6EFBEF65.png"><img title="image" border="0" alt="image" align="right" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/7701.image_5F00_thumb_5F00_5FE5108B.png" width="122" height="240"></a>
<ol>
<li>Width = 60 </li><li>Height = 1190 </li><li>Left = -40 </li><li>Top = -334 </li><li>Opacity = 20% </li></ol>
</li><li>Drag a PhysicsObjectBehavior from the Assets Panel Behaviors onto rectSensorLeft, and then set its IsStatic property to true.
</li><li>Add three more Rectangles by copying rectSensorLeft, so that they surround the borders of the table:
<ol>
<li>rectSensorRight </li><li>rectSensorTop </li><li>rectSensorBottom </li></ol>
</li><li>Your artboard should look similar to the following: <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8054.image_5F00_467D0D51.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/2110.image_5F00_thumb_5F00_4C57B0EA.png" width="195" height="412"></a>
</li><li>Now we'll add in the goal Rectangles at the end of the table. These will be used to determine the number of points a puck receives. Draw out three Rectangles that cover the width of the board and are 100 pixels high. Name these rectPoints3, rectPoints2,
 and rectPoints1. Set their Stroke to Red and their Fill to No brush. </li><li>Add a TextBlock element inside each Rectangle to depict the points. Set the text properties to 3, 2, and 1 so that the artboard looks similar to the following:
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/7416.image_5F00_647B1B45.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/3603.image_5F00_thumb_5F00_099865B2.png" width="430" height="353"></a>
</li><li>We'll also need a Rectangle representing the “slide zone” where players can legally slide a puck (we don't want to allow sliding all of the way down the table!). Add a Rectangle named rectInBounds and position it at the lower end of the table:
<ol>
<li>Width=360 </li><li>Height=292 </li><li>Left = 60 </li><li>Top = 508 </li><li>Fill = No Brush </li><li>Stroke = Red </li></ol>
</li></ol>
<p align="center"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384">
<param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" />
<param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/9/9/1/6/5/5/ShuffleboardPart2_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/9/9/1/6/5/5/ShuffleboardPart2_512_ch9.png, postid=556199" />
<param name="background" value="#00FFFFFF" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object></p>
<h3>Adding the Pucks</h3>
<p>For the pucks, we are going to add in an existing control which has the artwork completed.
</p>
<ol>
<li>Right-click the project and select Add Existing Item. </li><li>Browse to the following two files in the sample code download: <br>
\ShuffleBoard\ucPuck.xaml <br>
\ShuffleBoard\ucPuck.xaml.cs </li><li>Open ucPuck.xaml on the artboard and notice the following in the Objects and Timeline Panel:
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/4572.image_5F00_286ED990.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8308.image_5F00_thumb_5F00_1A3060A0.png" width="494" height="179"></a>
<ol>
<li>There is a Canvas named Puck that has a PhysicsObjectBehavior applied to it. This allows each instance of this Canvas to behave like a Physics Object so it animates with velocity and force and participates in collisions. Note that this Behavior has a large
 MomentOfInertia value. This keeps the object from rotating due to torque and collisions. Also note the RestitutionCoefficient, which gives the object some “bounce.”
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/6330.image_5F00_67CC8D20.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/3108.image_5F00_thumb_5F00_7289E475.png" width="328" height="198"></a>
</li><li>There is a “cnvInner” Canvas that defines the look of the Puck. </li><li>There is a StoryBoard defined, sbLostPuck, which we will execute when the puck “falls off the edge” of the table.
</li><li>Open the code-behind file, ucPuck.xaml.cs, and note the get / set property for the color of the puck. This will allow us to create both Red and Blue pucks for each player.
</li></ol>
</li><li>Build the project by hitting Ctrl&#43;Shift&#43;F5 and go back to ucMainGame. </li><li>From the Assets Panel, expand Controls/All and find the ucPuck control. Drag an instance of this onto the artboard. Name this
<b>bluePuck1</b>. </li><li>Copy and paste bluePuck1 twice so that you have three blue pucks. Name the new pucks
<b>bluePuck2</b> and <b>bluePuck3</b>. </li><li>Copy and paste a fourth puck and name it <b>redPuck1</b>. In the Properties Panel, go to the Miscellaneous Category and change the ColorHighlight and ColorMain properties to a Red color:
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/5340.image_5F00_4B4F9B40.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/2438.image_5F00_thumb_5F00_66F42736.png" width="334" height="217"></a>
</li><li>Copy and Paste <b>redPuck1</b> two times and rename these new pucks <b>redPuck2</b> and
<b>redPuck3</b>. </li><li>Let's test our table. Find the PhysicsControllerBehavior just under the cnvTable Canvas in the Objects and Timeline Panel and set the MousePickEnabled property to true.
</li><li>Run the project by clicking F5. Try dragging some pucks around with the mouse.
</li></ol>
<p align="center"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384">
<param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" />
<param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/1/0/2/6/5/5/ShuffleboardPart3_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/1/0/2/6/5/5/ShuffleboardPart3_512_ch9.png, postid=556201" />
<param name="background" value="#00FFFFFF" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object></p><h3>Adding the Scoreboard</h3>
<p>We need a way of tracking players' scores, so let's add in a simple scoreboard for Blue vs. Red.</p>
<ol>
<li>Right-click the project and select Add Existing Item. </li><li>Browse to the following two files in the download: <br>
\ShuffleBoard\ShuffleBoard\ucScoreBoard.xaml <br>
\ShuffleBoard\ShuffleBoard\ucScoreBoard.xaml.cs </li><li>Open ucScoreBoard and notice the following:
<ol>
<li>It has a TextBlock for Red scores and a TextBlock for Blue scores. </li><li>In the code-behind, there are setters and getters to set the score. </li></ol>
</li><li>Build the project by selecting Ctrl&#43;Shift&#43;B. </li><li>Switch back to ucMainGame. </li><li>Drag an instance of ucScoreBoard from the Assets Panel onto into LayoutRoot. </li><li>Name the element <b>ucScoreBoard1</b>, and position it at the top left of the Canvas like so:
</li></ol>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/3286.image_5F00_2AC85B8E.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8080.image_5F00_thumb_5F00_257974DD.png" width="227" height="373"></a>
</p>
<h3>Adding a Player Up Display</h3>
<p>We'll need a simple control that displays which player's turn it is. </p>
<ol>
<li>Right-click the Silverlight project and select Add/Existing Item. </li><li>Browse to and select the following two files in the sample folder: <br>
\ShuffleBoard\ucPlayerUp.xaml <br>
\ShuffleBoard\ucPlayerUp.xaml.cs </li><li>Note the following about ucPlayerUp:
<ol>
<li>The code-behind file has a simple property, IsBlueTurn, which shows the appropriate message in the UI.
</li></ol>
</li><li>Build the project by clicking Ctrl&#43;Shift&#43;B </li><li>Back on ucMainGame, drag an instance of ucPlayerUp into cnvTableInner. </li><li>Name the control <b>ucPlayerUp1</b> , and set the following properties: <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/5661.image_5F00_4F797305.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/5672.image_5F00_thumb_5F00_43E3B5C6.png" width="296" height="229"></a>
</li></ol>
<h3>Adding a 3D Look</h3>
<p>Let's give our table a bit of a 3D look by adding a Perspective transform so the table appears to go off into the distance.
</p>
<ol>
<li>Create a new StoryBoard named sbRotateTable. <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/2541.image_5F00_4781D0A3.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/2134.image_5F00_thumb_5F00_4E34DA26.png" width="388" height="151"></a>
</li><li>Select the cnvTable Canvas element. </li><li>Advance the timeline ahead one second. </li><li>In the Properties Panel, under Projection, set the X value to -40. <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0871.image_5F00_54E7E3A9.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/1464.image_5F00_thumb_5F00_46A96AB9.png" width="327" height="138"></a>
</li><li>Your artboard should now look something like this: <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8802.image_5F00_3460A3F7.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/3531.image_5F00_thumb_5F00_01909D83.png" width="352" height="428"></a>
</li><li>Close the Storyboard to end recording. <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/3124.image_5F00_59EA2158.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0003.image_5F00_thumb_5F00_04C2856B.png" width="300" height="129"></a>
</li><li>We want to rotate the table after the PhysicsController is initialized so the Physics Helper can determine the boundaries of the physics objects properly. Start by adding in some Using statements at the top of ucMainGame.xaml.cs:
<br>
This code is snippet “<b>ucMainGame Imports</b>” inside snippets.txt.
<pre class="csharpcode"><span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> Spritehand.FarseerHelper;
<span class="kwrd">using</span> FarseerGames.FarseerPhysics.Mathematics;
<span class="kwrd">using</span> System.ComponentModel;</pre>
</li><li>Next, let's add in some class-level declarations, which will store the physics controller, list of pucks, and some variables used to track shooting and scoring:
<br>
This code is snippet “<b>ucMainGame Declarations</b>” inside snippets.txt.
<pre class="csharpcode">PhysicsControllerMain _physicsController;
List&lt;PhysicsSprite&gt; _pucks = <span class="kwrd">new</span> List&lt;PhysicsSprite&gt;();
List&lt;PhysicsSprite&gt; _redPucks = <span class="kwrd">new</span> List&lt;PhysicsSprite&gt;();
Point _ptStartShot;
<span class="kwrd">bool</span> _draggingPuck;
<span class="kwrd">int</span> _draggingStartTick;

<span class="kwrd">int</span> _currentPuckToShoot = 0;
<span class="kwrd">int</span> _currentPuckShot = -1;
<span class="kwrd">int</span> _gameOverScore = 15;</pre>
</li><li>In the ucMainGame() constructor, add some code to set the MaxFrameRate to 30 (Windows Phone will be limited to 30 FPS) and wire up the Loaded event handler.
<br>
This code is snippet “<b>ucMainGame Constructor</b>” inside snippets.txt.
<pre class="csharpcode"><span class="kwrd">this</span>.Loaded &#43;= <span class="kwrd">new</span> RoutedEventHandler(ucMainGame_Loaded);
Application.Current.Host.Settings.MaxFrameRate = 30;</pre>
</li><li>Implement the ucMainGame_Loaded event handler, which gets a reference to the Physics Controller and wires up our event handlers.
<br>
This code is snippet “<b>ucMainGame Loaded</b>” inside snippets.txt.
<pre class="csharpcode"><span class="kwrd">void</span> ucMainGame_Loaded(<span class="kwrd">object</span> sender, RoutedEventArgs e)
{
    <span class="kwrd">if</span> (DesignerProperties.GetIsInDesignMode(<span class="kwrd">this</span>))
        <span class="kwrd">return</span>;

    _physicsController = 
        cnvTable.GetValue(
            PhysicsControllerMain.PhysicsControllerProperty
        ) <span class="kwrd">as</span> PhysicsControllerMain;
    _physicsController.Initialized &#43;= _physicsController_Initialized;
    _physicsController.Collision &#43;= _physicsController_Collision;
    _physicsController.TimerLoop &#43;= _physicsController_TimerLoop;
}</pre>
</li><li>Next, we'll add in the event handlers that we just wired up in the loaded event. Note that the Initialized event starts the Rotate Table StoryBoard.
<br>
This code is “<b>ucMainGame Event Handlers</b>” inside snippets.txt.
<pre class="csharpcode"><span class="kwrd">void</span> _physicsController_Initialized(<span class="kwrd">object</span> source)
{
    sbRotateTable.Begin();
}

<span class="kwrd">void</span> _physicsController_Collision(<span class="kwrd">string</span> sprite1, <span class="kwrd">string</span> sprite2)
{ }

<span class="kwrd">void</span> _physicsController_TimerLoop(<span class="kwrd">object</span> source)
{ }</pre>
</li><li>Run the Project by clicking F5. Note the 3D look and try manipulating the pucks with the mouse.
</li></ol>
<h3>Controlling the Pucks</h3>
<p>Next, we'll add logic to control the player's turn and control and along with score. Note that, when we implement the Windows Phone version in a bit, we can take advantage of Multitouch Manipulation events. But since these events are not available in the
 Web version of Silverlight 3, we'll use a simple mouse input mechanism.</p>
<ol>
<li>Let's turn off the default mouse manipulation. Select the PhysicsControllerBehavior just under the cnvTable Canvas and set the MousePickEnabled property to false.
</li><li>We need to get references to our Pucks, which the Physics Helper has translated into PhysicsSprite objects. A Physics Sprite contains the XAML UI for the Physics Object, plus the Physics Engine attributes for the underlying physics objects–including boundary
 shape, mass, velocity, etc. <br>
This code is “<b>ucMainGame Initialized</b>” inside snippets.txt. </li><li>Now we need to handle the Mouse events on the pucks in order to control the player's shot. When the player clicks the mouse down on a puck, we track the position along with time that they clicked. When the player moves the mouse, we update the puck position
 and also check if the player paused or moved backwards. We do this in case the player is just adjusting the puck position and not yet sliding the puck for a shot. Finally, in the Mouse up event, we release the puck in the specified direction and apply an appropriate
 amount of force to it.&nbsp; Copy in the snippet “<b>Puck Mouse Control</b>” from snippets.txt.&nbsp; Code is not shown here for brevity.
</li><li>When the Physics Helper Library does its magic, it translates existing UI Elements into PhysicsSprite objects. So what if we want to get at the original controls, perhaps to execute a StoryBoard that we defined on them? We can do this by using the FindName
 method to get the original user control instance. So, add the code below, which we'll use to get a reference to the Puck Storyboard “sbLostPuck”.
<pre class="csharpcode">ucPuck GetPuckControl(<span class="kwrd">string</span> spriteName)
{
    ucPuck puck;
    var parent = PhysicsControllerMain.ParentCanvas;
    <span class="kwrd">switch</span> (spriteName)
    {
        <span class="kwrd">case</span> <span class="str">&quot;Puck&quot;</span>:
            puck = parent.FindName(<span class="str">&quot;bluePuck1&quot;</span>) 
                    <span class="kwrd">as</span> ucPuck;
            <span class="kwrd">break</span>;
        <span class="kwrd">case</span> <span class="str">&quot;Puck_1&quot;</span>:
            puck = parent.FindName(<span class="str">&quot;bluePuck2&quot;</span>) 
                    <span class="kwrd">as</span> ucPuck;
            <span class="kwrd">break</span>;
        <span class="kwrd">case</span> <span class="str">&quot;Puck_2&quot;</span>:
            puck = parent.FindName(<span class="str">&quot;bluePuck3&quot;</span>) 
                    <span class="kwrd">as</span> ucPuck;
            <span class="kwrd">break</span>;
        <span class="kwrd">case</span> <span class="str">&quot;Puck_3&quot;</span>:
            puck = parent.FindName(<span class="str">&quot;redPuck1&quot;</span>) 
                    <span class="kwrd">as</span> ucPuck;
            <span class="kwrd">break</span>;
        <span class="kwrd">case</span> <span class="str">&quot;Puck_4&quot;</span>:
            puck = parent.FindName(<span class="str">&quot;redPuck2&quot;</span>) 
                    <span class="kwrd">as</span> ucPuck;
            <span class="kwrd">break</span>;
        <span class="kwrd">default</span>:
            puck = parent.FindName(<span class="str">&quot;redPuck3&quot;</span>) 
                    <span class="kwrd">as</span> ucPuck;
            <span class="kwrd">break</span>;
    }

    <span class="kwrd">return</span> puck;
}</pre>
</li><li>Finally, to score, we'll determine if the puck lies between any of the Rectangles in the end zone.
<br>
This code is the snippet “Get Points for Puck” in snippets.txt.
<pre class="csharpcode"><span class="kwrd">int</span> GetPointsForPuck(PhysicsSprite puck)
{
    <span class="kwrd">int</span> score = 0;
    Vector2 puckPos = puck.BodyObject.Position;

    <span class="kwrd">double</span> left = Convert.ToDouble(
        rectPoints3.GetValue(Canvas.LeftProperty));
    <span class="kwrd">double</span> top = Convert.ToDouble(
        rectPoints3.GetValue(Canvas.TopProperty));

    <span class="kwrd">if</span> ((puckPos.X &gt; left &amp;&amp; puckPos.X &lt; left &#43; rectPoints3.Width) 
     &amp;&amp; (puckPos.Y &gt; top &amp;&amp; puckPos.Y &lt; top &#43; rectPoints3.Height))
        score = 3;

    left = Convert.ToDouble(rectPoints2.GetValue(Canvas.LeftProperty));
    top = Convert.ToDouble(rectPoints2.GetValue(Canvas.TopProperty));
    <span class="kwrd">if</span> ((puckPos.X &gt; left &amp;&amp; puckPos.X &lt; left &#43; rectPoints2.Width) 
     &amp;&amp; (puckPos.Y &gt; top &amp;&amp; puckPos.Y &lt; top &#43; rectPoints2.Height))
        score = 2;

    left = Convert.ToDouble(rectPoints1.GetValue(Canvas.LeftProperty));
    top = Convert.ToDouble(rectPoints1.GetValue(Canvas.TopProperty));
    <span class="kwrd">if</span> ((puckPos.X &gt; left &amp;&amp; puckPos.X &lt; left &#43; rectPoints1.Width) 
     &amp;&amp; (puckPos.Y &gt; top &amp;&amp; puckPos.Y &lt; top &#43; rectPoints1.Height))
        score = 1;

    <span class="kwrd">return</span> score;
}</pre>
</li></ol>
<h3>Implement the “Game Loop”</h3>
<p>Most games are controlled by a “Game Loop” that executes many times per second. Within this Game Loop, we can check for collisions, perform enemy AI, and scoring. The PhysicsController fires an event called “TimerLoop” that we can use for this purpose.</p>
<ol>
<li>Replace the existing TimerLoop and Collision events with the following code snippet, which checks to see if any pucks have been shot and if we are ready for the next shot. Do this by seeing if the puck velocity has slowed down to nearly a stop…
<br>
This code is snippet “<b>Timer Loop</b>” inside snippets.txt.
<pre class="csharpcode"><span class="kwrd">void</span> _physicsController_TimerLoop(<span class="kwrd">object</span> source)
{
    <span class="rem">// check to see if the current shot is completed</span>
    <span class="kwrd">if</span> (_currentPuckShot &gt;= 0)
    {
    var puck = _pucks[_currentPuckShot].BodyObject;

        <span class="kwrd">if</span> (puck.Enabled == <span class="kwrd">false</span> ||
          Math.Abs(puck.LinearVelocity.X) &lt; 3                                   
          &amp;&amp; 
          Math.Abs(puck.LinearVelocity.Y) &lt; 3)
        {
            <span class="rem">// did the shot clear the end zone?</span>
            <span class="kwrd">if</span> (!PointWithinBounds(
              <span class="kwrd">new</span> Point(puck.Position.X, 
                       puck.Position.Y)))
            {
                _currentPuckShot = -1;
                _currentPuckToShoot&#43;&#43;;
                SetupThePuck();
            }
        }
    }
}

<span class="kwrd">void</span> _physicsController_Collision(<span class="kwrd">string</span> sprite1, <span class="kwrd">string</span> sprite2)
{
    <span class="rem">// check for puck off sides</span>
    <span class="kwrd">if</span> (sprite1.StartsWith(<span class="str">&quot;rectSensor&quot;</span>) &amp;&amp; sprite2.StartsWith(<span class="str">&quot;Puck&quot;</span>))
    {
        ucPuck puck = GetPuckControl(sprite2);

        _physicsController.PhysicsObjects[sprite2].
            BodyObject.Enabled = <span class="kwrd">false</span>;

        puck.sbLostPuck.Begin();
    }
}</pre>
</li></ol>
<h3>Targeting Windows Phone</h3>
<p>So far, we've created a Silverlight 3, web-based version of a shuffleboard game. Next we'll quickly port this to Windows Phone, taking advantage of some of the platform's capabilities, such as multitouch. We'll do this by using
<i>linked files</i> that point back to our existing Silverlight 3 project.</p>
<ol>
<li>Right-click the Silverlight solution in Blend and select Add New Project. </li><li>Select Windows Phone Application and enter <b>ShuffleBoard.WindowsPhone</b> for the name.
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/6266.image_5F00_0B758EEE.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8738.image_5F00_thumb_5F00_51F27EF6.png" width="416" height="382"></a>
</li><li>Delete the <b>TitleGrid</b> and <b>ContentGrid</b> elements from the Objects and Timeline Panel.
</li><li>Convert LayoutRoot to a Canvas by right-clicking it and selecting Change Layout Type/Canvas.
</li><li>Right-click the project and select Add Reference. Browse to the following assemblies located in the sample download (these are the WindowsPhone versions of the Physics Helper and Farseer):
<br>
<br>
\ShuffleBoard.WindowsPhone\Bin\Debug\FarseerPhysics.dll <br>
\ShuffleBoard.WindowsPhone\Bin\Debug\Spritehand.FarseerHelper.dll <br>
\ShuffleBoard.WindowsPhone\Bin\Debug\Spritehand.PhysicsBehaviors.dll <br>
</li><li>We need references to the assemblies used for Behaviors. An easy way to do this is to add a Behavior to an element and then delete it. From the Assets panel, drag a PhysicsControllerBehavior onto LayoutRoot and then delete it. Note that this adds a reference
 to System.Windows.Interactivity to the project. </li><li>Next, we'll add in the linked files from the existing Silverlight 3 project. Right-click the ShuffleBoard.WindowsPhone project and select Add/Link to Existing Item. Select the following files:
<ol>
<li>ucMainGame.xaml </li><li>ucMainGame.xaml.cs </li><li>ucPlayerUp.xaml </li><li>ucPlayerUp.xaml.cs </li><li>ucPuck.xaml </li><li>ucPuck.xaml.cs </li><li>ucScoreBoard.xaml </li><li>ucScoreBoard.xaml.cs </li></ol>
</li><li>8. Add a new folder to the project named images. </li><li>9. Right-click the images folder and select Link to Existing item, then navigate to the following image in the sample folder:
<br>
\ShuffleBoard\images\shuffleboardTable.jpg <br>
</li><li>Build the project by clicking Ctrl&#43;Shift&#43;B. </li><li>From the Assets Panel, under Controls/All, find ucMainGame and drag an instance onto LayoutRoot. Set the Left and Top properties to 0.
</li><li>Right-click the WindowsPhone project and select “Startup” to set this as the startup project.
</li><li>Run the project by clicking F5. </li></ol><p align="center"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384">
<param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" />
<param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/5/0/2/6/5/5/ShuffleboardPart4_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/5/0/2/6/5/5/ShuffleboardPart4_512_ch9.png, postid=556205" />
<param name="background" value="#00FFFFFF" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object></p><h3>Windows Phone Touch Input</h3>
<p>So far, we've used a simple mouse-event-based input mechanism for shooting the pucks. But on the Windows Phone 7 platform, we can do better than that by using Multitouch events. These events include an inertia property that will make our puck physics more
 realistic.</p>
<ol>
<li>Since we are going to need to support two different platforms now (Web and Windows Phone), we need to introduce a Conditional Compilation Symbol so that the compiler can differentiate between each platform's code.
</li><li>Open the solution inside Visual Studio by right-clicking it in the Projects Panel and then select “Edit in Visual Studio”
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/0410.image_5F00_7F739EB9.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/4604.image_5F00_thumb_5F00_78546241.png" width="215" height="189"></a>
</li><li>Right-click the ShuffleBoard.WindowsPhone Project and select Properties. </li><li>4. Add in a new compilation symbol for WINDOWS_PHONE. <br>
NOTE: Future releases of WP7 Tools will likely define a default compilation symbol, so you may already see one defined here.
<br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/6366.image_5F00_713525C9.png"><img title="image" border="0" alt="image" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10025512/8726.image_5F00_thumb_5F00_09C4C31A.png" width="550" height="128"></a>
</li><li>Now we'll add in the Windows Phone-specific events for manipulation using touch. Open ucMainGame.xaml.cs and find the _physicsController_Initialized event handler. Replace the events for the mouse events with the following, which will wire up either the
 manipulation events (for Windows Phone) or the mouse events (for Silverlight Web):
<br>
This code is snippet “<b>Manipulation Events</b>” inside snippets.txt.
<pre class="csharpcode"><span class="preproc">#if</span> WINDOWS_PHONE
    puck.ManipulationStarted &#43;= 
      <span class="kwrd">new</span> EventHandler&lt;ManipulationStartedEventArgs&gt;
      (puck_ManipulationStarted);
    puck.ManipulationCompleted &#43;= 
      <span class="kwrd">new</span> EventHandler&lt;ManipulationCompletedEventArgs&gt;
      (puck_ManipulationCompleted);
    puck.ManipulationDelta &#43;= 
      <span class="kwrd">new</span> EventHandler&lt;ManipulationDeltaEventArgs&gt;
      (puck_ManipulationDelta);
<span class="preproc">#else</span>
    puck.MouseLeftButtonDown &#43;= 
      <span class="kwrd">new</span> MouseButtonEventHandler(puck_MouseLeftButtonDown);
    puck.MouseMove &#43;= 
      <span class="kwrd">new</span> MouseEventHandler(puck_MouseMove);
    puck.MouseLeftButtonUp &#43;= 
      <span class="kwrd">new</span> MouseButtonEventHandler(puck_MouseLeftButtonUp);
<span class="preproc">#endif</span></pre>
</li><li>Now we just need to implement those event handlers for manipulation. The main consideration here is that the ManipulationCompleted event passes in a FinalVelocity.LinearVelocity parameter, which we can use to create realistic physics from the user's shot:
<p>Add the code snippet “Manipulation Event Handlers” from snippets.txt</p>
<pre class="csharpcode">Vector2 force = <span class="kwrd">new</span> Vector2(
    (<span class="kwrd">float</span>)(e.FinalVelocities.LinearVelocity.X * scalePower), 
    (<span class="kwrd">float</span>)(e.FinalVelocities.LinearVelocity.Y * scalePower));</pre>
</li><li>Run the project by clicking F5, and try sliding some pucks. </li></ol>
<h3>Performance</h3>
<p>Depending on your configuration, you may experience poor performance for the shuffleboard game when running it in the Windows Phone emulator. There are different reasons for this, including video card drivers and virtualization settings. Please refer to
<a href="http://www.andybeaulieu.com/Home/tabid/67/EntryID/196/Default.aspx">this blog post</a>, which details these performance considerations.</p>
<ol>
<li>1. Inside the ucMainGame constructor, let's turn on the Frame Rate counter so we can see our current frame rate. This code is snippet “Frame Rate Counter” inside snippets.txt
<pre class="csharpcode">Application.Current.Host.Settings.EnableFrameRateCounter = <span class="kwrd">true</span>;</pre>
</li><li>Run the project by hitting F5, and note the current frame rate. <br>
<b>NOTE: Your development configuration may prevent you from having an adequate framerate in the Windows Phone Emulator! Please refer to
</b><a href="http://www.andybeaulieu.com/Home/tabid/67/EntryID/196/Default.aspx"><b>this blog post</b></a><b> for tips on emulator performance.</b>
</li></ol>
<p>One performance tweak we can easily make is taking advantage of hardware acceleration. Silverlight enables us to use the video card to render elements, which can greatly increase performance. To do this, we add a Cachemode=”BitmapCache” attribute to any
 elements we want to hardware accelerate.</p>
<ol>
<li>Open ucPuck.xaml and note that there is a CacheMode attribute on the Puck Canvas.
</li><li>Open ucMainGame.xaml and add a CacheMode attribute to the cnvTable Canvas element.
<pre class="csharpcode">&lt;Canvas x:Name=<span class="str">&quot;cnvTable&quot;</span> Width=<span class="str">&quot;480&quot;</span> Height=<span class="str">&quot;800&quot;</span> 
d:LayoutOverrides=<span class="str">&quot;Width, Height&quot;</span> CacheMode=<span class="str">&quot;BitmapCache&quot;</span>&gt;</pre>
</li><li>Run the project and note the frame rate change. </li></ol>
<p align="center"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384">
<param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" />
<param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/5/1/2/6/5/5/ShuffleboardPart6_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/5/1/2/6/5/5/ShuffleboardPart6_512_ch9.png, postid=556215" />
<param name="background" value="#00FFFFFF" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object></p>
<h3>Adding Sound</h3>
<p>Sound is one area where Windows Phone and Web Silverlight differ a bit. Under Silverlight for Web, we can use the MediaElement class to play back WMA and MP3 format audio. Multiple instances of the MediaElement class can be played simultaneously, and the
 sound output will be automatically mixed.</p>
<p>However, on Windows Phone we have access to the XNA game libraries, including sound support. This is a much more efficient way to add mixed sound to a Silverlight game on Windows Phone, but it only supports WAV format sound files.
</p>
<p>The Physics Helper Library has a useful class wrapper for sounds, which we'll use to play a “hit puck” sound on both platforms.</p>
<ol>
<li>In the ShuffleBoard (Silverlight Web) project, right-click and select Add Folder.
</li><li>Name the folder sounds. </li><li>Add an existing item to the sounds folder from this location: <br>
\ShuffleBoard\ShuffleBoard\sounds\hitPuck.wma </li><li>Set the Build Action of the file to Content. </li><li>In the ShuffleBoard.WindowsPhone project, right-click and select Add Folder. </li><li>Name the folder sounds. </li><li>Add an existing item to the sounds folder from this location: <br>
\ShuffleBoard.WindowsPhone\sounds\hitPuck.wav </li><li>Set the Build Action of the file to Content. </li><li>Inside ucMainGame.xaml.cs, add a class-level declaration for a SoundMain class (this is defined in the Physics Helper Library):
<br>
This snippet is “<b>Declare the Sound</b>” inside snippets.txt.
<pre class="csharpcode">SoundMain _soundPuckHit;</pre>
</li><li>10. Inside the ucMainGame_Loaded event, add code to declare the two sounds. Note that Windows Phone uses a WAV format sound without a “/” prefix for the root.
<br>
This snippet is “<b>Declare the Sound</b>” inside snippets.txt.
<pre class="csharpcode"><span class="preproc">#if</span> WINDOWS_PHONE
    _soundPuckHit = <span class="kwrd">new</span> SoundMain(<span class="kwrd">this</span>.LayoutRoot,
                   <span class="str">&quot;sounds/hitPuck.wav&quot;</span>, 2, 0);
<span class="preproc">#else</span>
    _soundPuckHit = <span class="kwrd">new</span> SoundMain(<span class="kwrd">this</span>.LayoutRoot, 
                   <span class="str">&quot;/sounds/hitPuck.wma&quot;</span>, 2, 0);
<span class="preproc">#endif</span></pre>
</li><li>Inside the _physicscontroller_collision event, add code to play the sound if a puck-to-puck collision occurs and the velocity is &gt; 10:
<br>
This snippet is “<b>Play the Sound</b>” inside snippets.txt.
<pre class="csharpcode"><span class="rem">// check for puck to puck collsion</span>
<span class="kwrd">if</span> (sprite1.StartsWith(<span class="str">&quot;Puck&quot;</span>) &amp;&amp; sprite2.StartsWith(<span class="str">&quot;Puck&quot;</span>))
{
    PhysicsSprite sprite = _physicsController.PhysicsObjects[sprite1];

    <span class="kwrd">if</span> (Math.Abs(sprite.BodyObject.LinearVelocity.X) &gt; 10
        || Math.Abs(sprite.BodyObject.LinearVelocity.Y) &gt; 10)
    {
        _soundPuckHit.Play();
    }
}</pre>
</li><li>Run the project and try hitting pucks together. </li></ol>
<p align="center"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384">
<param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" />
<param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/9/0/2/6/5/5/ShuffleboardPart5_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/9/0/2/6/5/5/ShuffleboardPart5_512_ch9.png, postid=556209" />
<param name="background" value="#00FFFFFF" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object></p>
<h3>Summary</h3>
<p>Since the 1.1 Alpha release, Silverlight has offered a compelling casual game development environment. With the addition of Windows Phone, along with demos of Silverlight running on other embedded devices, you can bet the future of Silverlight for gaming
 is bright.</p>
<p>Here are a few resources for more information:</p>
<blockquote>
<p>Andy's blog <br>
<a href="http://www.andybeaulieu.com">http://www.andybeaulieu.com</a></p>
<p>Andy's Silverlight Demos <br>
<a href="http://www.spritehand.com">http://www.spritehand.com</a></p>
<p>The Physics Helper Library <br>
<a href="http://physicshelper.codeplex.com">http://physicshelper.codeplex.com</a></p>
<p>Great free resource for learning Expression Blend and Silverlight <br>
<a href="http://www.microsoft.com/design/toolbox/">http://www.microsoft.com/design/toolbox/</a></p>
</blockquote>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:30175390e92d402d81c69e7600c925c0">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Creating-a-Shuffleboard-Game-using-Silverlight</comments>
      <itunes:summary>In this walkthrough, we will create a 
table shuffleboard style game for Windows Phone 7 using Silverlight. Many bars feature these long wooden table games, in which players slide metal pucks down the length of the table, attempting to get as close as possible to the far end without sliding
 off the edge.


 Multi-Targeting
Windows Phone 7 uses a version of Silverlight 3 with a few bonus features. Because this version of Silverlight is so close to the Web version of Silverlight 3, we&#39;ll take the approach of
Multitargeting a solution for both platforms. To do so, start with a Silverlight 3 (web) application template, and then add in a Windows Phone project with linked files that re-use the Silverlight 3 solution. This allows us to deploy to many different
 platforms using the same code base.
Let&#39;s get started by creating our Solution in this way.
Creating the Solution and MainPage

In Expression Blend 4, create a new Silverlight Application &amp;#43; Website template named Shuffleboard. Be sure to select “3.0” from the Version dropdown, as this is what is supported by Windows Phone (in a little bit we&#39;ll add in the Windows Phone project template
 as well). 

In the Objects and Timeline Panel, select the main UserControl and set its Width to 480 and its Height to 800. This is the size of a Windows Phone UI in Portrait mode.
Select the LayoutRoot Grid and set its Width to 480 and its Height to 800. For games, a Canvas layout container is better than a Grid, so let&#39;s change the LayoutRoot container type. Right-click LayoutRoot and select Change Layout Type/Canvas.


Since some parts of our UI can appear outside of the game area, we want to add a Clip to this main canvas so that the user does not see these outside elements. Add the following just under the LayoutRoot Canvas:

This XAML is snippet “MainPage Clip” inside snippets.txt.
&amp;lt;Canvas.Clip&amp;gt;
    &amp;lt;RectangleGeometry Rect=&amp;quot;0,0,480,800&amp;quot;/&amp;gt;
&amp;lt;/Canvas.Clip&amp;gt;


We&#39;ll be using some pre-built Behaviors t</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Creating-a-Shuffleboard-Game-using-Silverlight</link>
      <pubDate>Tue, 15 Jun 2010 21:23:23 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Creating-a-Shuffleboard-Game-using-Silverlight</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10025512_100.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10025512_220.jpg" height="165" width="220"/>      
      <dc:creator>Andy Beaulieu </dc:creator>
      <itunes:author>Andy Beaulieu </itunes:author>
      <slash:comments>8</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Creating-a-Shuffleboard-Game-using-Silverlight/RSS</wfw:commentRss>
      <category>Expression Blend</category>
      <category>Gaming</category>
      <category>Mobile</category>
      <category>Physics</category>
      <category>Silverlight</category>
      <category>Windows Phone</category>
      <category>XAML</category>
    </item>
  <item>
      <title>E3 on MTV</title>
      <description><![CDATA[ <p>Can’t make it to the upcoming video game mecca that is the E3 Expo 2010? Not to worry, MTV Networks has you covered. According to <a shape="rect" href="http://www.microsoft.com/presspass/press/2010/may10/05-13msmtvxboxpr.mspx?rss_fdn=Press%20Releases" shape="rect">this recent announcement</a>, MTV is partnering with Microsoft to deliver coverage of the event’s key moments, including the premiere of Project Natal, the innovative controller-free add-on for Xbox 360. </p><p>MTV properties will also cover Xbox 360 game announcements, world premieres and other breaking news throughout the conference.&nbsp; </p><p>But wait, it gets even better: Cirque du Soleil will be there too, turning E3’s media circus into a real one. Apparently, the Cirque du Soleil performers will be helping to introduce Natal, which captures body motions via sensors and a camera and translates those into in-game actions. That should be interesting! </p><p>On Monday June 14th, Spike TV will cover E3 media briefings and game launches live at 10:30 AM PDT. On Tuesday, June 15th, MTV will cover Natal’s launch starting at 12:30 PM PDT. That coverage will be rebroadcast on Nick at Nite, mtvU, MTV Hits and Logo at 6 PM PDT later that day.&nbsp; Also, MTV Networks’ <a shape="rect" href="http://www.gametrailers.com/" shape="rect">GameTrailers.com</a> will provide live, high-definition video streams of both these events and more. </p><p>Or if you must be there in person, E3 will be held at the Los Angeles Convention Center from June 13th to 18th. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:bf2f158eceee427190a39e0e0021faa0">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/E3-on-MTV</comments>
      <itunes:summary> Can’t make it to the upcoming video game mecca that is the E3 Expo 2010? Not to worry, MTV Networks has you covered. According to this recent announcement, MTV is partnering with Microsoft to deliver coverage of the event’s key moments, including the premiere of Project Natal, the innovative controller-free add-on for Xbox 360. MTV properties will also cover Xbox 360 game announcements, world premieres and other breaking news throughout the conference.&amp;nbsp; But wait, it gets even better: Cirque du Soleil will be there too, turning E3’s media circus into a real one. Apparently, the Cirque du Soleil performers will be helping to introduce Natal, which captures body motions via sensors and a camera and translates those into in-game actions. That should be interesting! On Monday June 14th, Spike TV will cover E3 media briefings and game launches live at 10:30 AM PDT. On Tuesday, June 15th, MTV will cover Natal’s launch starting at 12:30 PM PDT. That coverage will be rebroadcast on Nick at Nite, mtvU, MTV Hits and Logo at 6 PM PDT later that day.&amp;nbsp; Also, MTV Networks’ GameTrailers.com will provide live, high-definition video streams of both these events and more. Or if you must be there in person, E3 will be held at the Los Angeles Convention Center from June 13th to 18th. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/E3-on-MTV</link>
      <pubDate>Mon, 17 May 2010 15:03:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/E3-on-MTV</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_274d8df4-3b9d-4d7d-b508-33c4f3c86ad3.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_65f5ff84-6b76-44fd-abb1-bf2fc83bda7b.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/E3-on-MTV/RSS</wfw:commentRss>
      <category>E3</category>
      <category>Gaming</category>
      <category>project natal</category>
      <category>Xbox</category>
      <category>Xbox 360</category>
      <category>Video Games</category>
      <category>video game</category>
    </item>
  <item>
      <title>Augmented Reality Domino Knock-Down Game</title>
      <description><![CDATA[
<p>This article provides step-by-step instructions about how to create a simple, yet interesting, augmented reality game called “domino knock-down game” using an open source framework called Goblin XNA.
</p>
<h3>Introduction</h3>
<p>This is an advanced tutorial, and as such we expect that you are already familiar with XNA and scene graph based 3D programming. The game is a single player game in which the player shoots virtual balls into a real-world environment to knock down all of
 the virtual dominos overlaid on top of a board. The player holds a webcam in one hand and shoots the virtual ball by clicking a mouse using the other hand. Before the game starts, the player is allowed to add virtual dominos or modify the positions and orientations
 of the existing ones overlaid on the board as desired.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10012840/clip_image002_5B4_5D.jpg"><img title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10012840/clip_image002_5B4_5D_thumb.jpg" width="499" height="372"></a></p>
<h3>How To Compile and Run The Game</h3>
<p>After you download the Goblin XNA distribution from <a href="http://goblinxna.codeplex.com">
http://goblinxna.codeplex.com</a>, as well as all other necessary libraries indicated in the installation guide, compile the Goblin XNA project under the /src directory. If you're not familiar with Goblin XNA framework, it is strongly recommended that you first
 go through the tutorials in the /tutorials directory. Then, find the ARDominos directory under /projects directory and open up the solution file in order to build and run the game.</p>
<h3>How To Play</h3>
<p>Before you run the application, you need to print out the marker array. The marker array can be found in the DominoGroud.ppt file. The 1<sup>st</sup> slide is for the ARTag library, and the 2<sup>nd</sup> one is for the ALVAR library. The size of the PowerPoint
 slide is set to 25.6 x 17.52 inches, so if you want the entire marker array to fit in A4 size paper, you should choose &quot;Scale to fit&quot; option when you print. Once you have the print out, you're ready to run the game.</p>
<p>The virtual dominos are overlaid around the center of the marker array (referred to as ‘game board' from now on), so you need to aim your webcam around the center of the game board. If you move your mouse cursor around on top of the game window, you will
 see a yellow-green cross-hair cursor, and this cursor position will be used to control the game play. All of the mouse-based interactions are handled by the left mouse button.
</p>
<p>The initial game mode is ‘Add' (as indicated on the upper-right corner of the game window), so if you click on any part on the game board, a new domino will be added. If you press-and-hold, then you can move the newly added domino around, and once you release
 the mouse the domino will be added at the released position. While the domino is rendered in transparent, you are allowed to modify its orientation along the normal vector of the game board by using the ‘Left' and ‘Right' arrow keys. You are not, however,
 allowed to add a domino outside of the gameboard, and you are initially limited to maximum of 40 dominos on the game board (you can change this limit in the code if you want).
</p>
<p>If you want to edit the current position or orientation of an existing domino on the game board, change the game mode to ‘Edit' by clicking the ‘E' key. To modify the position, press-and-hold the mouse on the desired domino, and drag it around (again, it
 won't allow you to place the domino outside of the game board). The selected domino is rendered transparent, and it remains selected until you select another domino or change to a different game mode. If a domino is selected, you can change its orientation
 by using the ‘Left' and ‘Right' arrow keys. If you want to delete a domino, select the domino you want to delete and press the ‘D' or ‘Delete' key.</p>
<p>Once you are satisfied with the current domino configuration, start the game by pressing the ‘P' key. If you want to reset the configuration to the original one, then press the ‘R' key. Once the game starts, the elapsed time will display in the upper-right
 corner and the number of balls shot will display in the lower-right corner. The goal of the game is to knock all of the virtual dominos off the game board by shooting as many virtual balls as necessary, and you will get different trophies based on the elapsed
 time. </p>
<p>The virtual ball is shot from the cursor location when you click the mouse. You can move the webcam around to move closer to certain dominos and improve your chances of hitting your target. However, if the game board becomes invisible to the camera, the
 game doesn't allow you to shoot any balls. </p>
<p>Once you win, you need to press the ‘P' key to restart the game. </p>
<p><b><u>List of command keys used in the game:</u></b></p>
<p>· 'H' -- Display short-cut key help menu</p>
<p>· 'A' -- Switch to &quot;Add&quot; mode</p>
<p>· 'E' -- Switch to &quot;Edit&quot; mode</p>
<p>· 'P' -- Switch to &quot;Play&quot; mode. If pressed during &quot;Play&quot; mode, it restarts the game.</p>
<p>· 'R' -- Reset the game to the initial state</p>
<p>· 'S' -- Toggles the shadow mapping (NOTE: On non-NVidia graphics cards, the shadow mapping may have some aliasing problem)</p>
<p>· 'G' -- Toggles the GUI</p>
<p>· 'D' -- Delete selected dominos during &quot;Edit&quot; mode</p>
<p>· 'C' -- Toggle center cursor mode during &quot;Play&quot; mode</p>
<h3>Step 1. Setup Scene Basics</h3>
<p>First, you need to setup the basics for the scene, such as lighting and ground plane where the virtual dominos will be placed. Usually, you also need to setup a camera for the scene, but since you will setup the marker tracking system later on, the camera
 will be created and added to the scene automatically.</p>
<p>NOTE: Before going through this part, we strongly recommend that you go through Tutorial 1 and Tutorial 5 that comes with the Goblin XNA distribution.
</p>
<h4>Add Lighting Sources</h4>
<p>We will add two directional lights to the scene, each coming from different directions. We also set the ambient light color to a dark gray color so that none of the objects in the scene will appear totally black.
</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// Create a directional light source</span>
LightSource lightSource = <span class="kwrd">new</span> LightSource();
lightSource.Direction = <span class="kwrd">new</span> Vector3(-1, -1, -1);
lightSource.Diffuse = Color.White.ToVector4();
lightSource.Specular = <span class="kwrd">new</span> Vector4(0.6f, 0.6f, 0.6f, 1);

LightSource lightSource2 = <span class="kwrd">new</span> LightSource();
lightSource2.Direction = <span class="kwrd">new</span> Vector3(1, -1, -1);
lightSource2.Diffuse = Color.White.ToVector4();
lightSource2.Specular = <span class="kwrd">new</span> Vector4(0.6f, 0.6f, 0.6f, 1);

<span class="rem">// Create a light node to hold the light source</span>
LightNode lightNode = <span class="kwrd">new</span> LightNode();
lightNode.AmbientLightColor = <span class="kwrd">new</span> Vector4(0.3f, 0.3f, 0.3f, 1);
lightNode.LightSources.Add(lightSource);
lightNode.LightSources.Add(lightSource2);

<span class="rem">// Add this light node to the root node</span>
scene.RootNode.AddChild(lightNode);</pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
	{font-size:small;
	color:black;
	font-family:consolas,"Courier New",courier,monospace;
	background-color:#ffffff}
.csharpcode 
	{margin:0em}
.csharpcode .rem
	{color:#008000}
.csharpcode .kwrd
	{color:#0000ff}
.csharpcode .str
	{color:#006080}
.csharpcode .op
	{color:#0000c0}
.csharpcode .preproc
	{color:#cc6633}
.csharpcode .asp
	{background-color:#ffff00}
.csharpcode .html
	{color:#800000}
.csharpcode .attr
	{color:#ff0000}
.csharpcode .alt
	{background-color:#f4f4f4;
	width:100%;
	margin:0em}
.csharpcode .lnum
	{color:#606060}
-->
</style>
<p></p>
<h4>Create a Ground Plane</h4>
<p>Since the game will have physics simulation, we will need a ground plane where the dominos will be placed. We will create a GeometryNode to hold the cubic geometry that represents a flat ground plane, and assign physics properties to this ground. Since we
 want to show the game board rather than this virtual ground plane, we set <b>IsOcculder</b> property to true. If this property is set to true, this geometry won't be rendered in the frame buffer; rather, it will be used for z-buffer testing. This means that
 you won't see this ground plane, but if any virtual objects go behind this ground plane, those virtual objects won't be rendered. Since this ground plane won't be visible, we won't assign any materials to it. Finally, we add this ground to the marker node
 that tracks the game board. </p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">GeometryNode groundNode = <span class="kwrd">new</span> GeometryNode(<span class="str">&quot;Ground&quot;</span>);
groundNode.Model = <span class="kwrd">new</span> Box(129.5f, 99, 0.2f);

groundNode.Physics.Collidable = <span class="kwrd">true</span>;
groundNode.Physics.Shape = ShapeType.Box;
groundNode.Physics.MaterialName = <span class="str">&quot;Ground&quot;</span>;
groundNode.Physics.Pickable = <span class="kwrd">true</span>;
groundNode.AddToPhysicsEngine = <span class="kwrd">true</span>;

groundNode.IsOccluder = <span class="kwrd">true</span>;

groundNode.Model.ReceiveShadows = <span class="kwrd">true</span>;

markerNode.AddChild(groundNode);</pre>
<p></p>
<h3>Step 2. Setup Capture Device and Marker Tracker</h3>
<p>We need to have a video capture device (e.g., a webcam) to capture the real-world environment, and an optical marker tracking system to track the marker array printed on the game board.
</p>
<p>NOTE: Before going through this part, we strongly recommend that you go through Tutorial 8, which comes with the Goblin XNA distribution.</p>
<h4>Setup Capture Device</h4>
<p>Since we're using a webcam to capture the live video, we'll use the DirectShowCapture class. We then initialize this capture device with deviceID = 0, 30Hz framerate, and 640-by-480 resolution, and attach it to our scene. Since we want to show the live video
 stream in the background, we set <b>ShowCameraImage</b> to true.</p>
<p>If your computer has only one webcam attached (including the embedded cameras on laptop computers), then using deviceID = 0 will work fine. However, if you have more than one webcam, then you need to change this ID to indicate which webcam you want to use.
</p>
<p><b>C# </b></p>
<pre class="csharpcode">DirectShowCapture captureDevice = <span class="kwrd">new</span> DirectShowCapture();
captureDevice.InitVideoCapture(0, FrameRate._30Hz, 
    Resolution._640x480, ImageFormat.R8G8B8_24, <span class="kwrd">false</span>);

scene.AddVideoCaptureDevice(captureDevice);

scene.ShowCameraImage = <span class="kwrd">true</span>;</pre>
<p></p>
<h4>Setup Optical Marker Tracking System</h4>
<p>We will use the ALVAR optical marker tracking library from VTT (<a href="http://virtual.vtt.fi/virtual/proj2/multimedia/alvar.html">http://virtual.vtt.fi/virtual/proj2/multimedia/alvar.html</a>). We initialize the tracker with the size of the image we'll
 be passing for the tracker to analyze, the camera calibration file generated by SampleCamCalib project that comes with ALVAR (you should perform calibration for each of your webcams in order to achieve optimal tracking performance), and the pixel size of the
 square marker (9.0 means that if you overlay a cube with size of 9x9x9 pixels, then the cube will overlay exactly on top of the marker square). Finally, we assign this tracking system to our scene.
</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">ALVARMarkerTracker tracker = <span class="kwrd">new</span> ALVARMarkerTracker();
tracker.MaxMarkerError = 0.02f;
tracker.InitTracker(captureDevice.Width, captureDevice.Height, <span class="str">&quot;calib.xml&quot;</span>, 9.0);
scene.MarkerTracker = tracker;</pre>
<p></p>
<h4>Create a MarkerNode To Track Gameboard</h4>
<p>Since we want to overlay the dominos on top of a game board with marker arrays printed on it, we need to create a MarkerNode that holds the information of the marker configuration we want to track. Then, any geometry attached to this node will be overlaid
 on top the game board. We create a MarkerNode by denoting which marker tracker will be used to track this marker, the marker configuration file, and a list of marker IDs in this marker configuration. Finally, we add this node to our scene's root node.</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// Create a marker node to track the ground plane</span>
<span class="kwrd">int</span>[] ids = <span class="kwrd">new</span> <span class="kwrd">int</span>[54];
<span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; ids.Length; i&#43;&#43;)
    ids[i] = i;

markerNode = <span class="kwrd">new</span> MarkerNode(
scene.MarkerTracker, <span class="str">&quot;ARDominoALVAR.txt&quot;</span>, ids);

scene.RootNode.AddChild(markerNode);</pre>
<p></p>
<h3>Step 3. Create 3D Dominos and Balls</h3>
<p>Now, we are ready to add 3D objects on top of the game board.</p>
<h4>Create 3D Dominos</h4>
<p>We'll add textured mapped cubic geometries that represent dominos, and lay them out in a circle. We also need to assign appropriate physics properties to each domino so that they will behave correctly in the physics simulation. Finally, we add all dominos
 to the marker node that tracks the game board. </p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">dominoModel = <span class="kwrd">new</span> DominoBox(
    <span class="kwrd">new</span> Vector3(dominoSize.X, dominoSize.Z, dominoSize.Y),
    <span class="kwrd">new</span> Vector2(0.663f, 0.707f));

dominoModel.CastShadows = <span class="kwrd">true</span>;
dominoModel.ReceiveShadows = <span class="kwrd">true</span>;

<span class="kwrd">float</span> radius = 18;
<span class="kwrd">for</span> (<span class="kwrd">int</span> x = 0; x &lt; 360; x &#43;= 30)
{
    GeometryNode dominoNode = 
        <span class="kwrd">new</span> GeometryNode(<span class="str">&quot;Domino &quot;</span> &#43; dominos.Count);
    dominoNode.Model = dominoModel;

    dominoNode.Physics.Mass = 20;
    dominoNode.Physics.Shape = ShapeType.Box;
    dominoNode.Physics.MaterialName = <span class="str">&quot;Domino&quot;</span>;
    dominoNode.Physics.Pickable = <span class="kwrd">true</span>;
    dominoNode.AddToPhysicsEngine = <span class="kwrd">true</span>;

    Material dominoMaterial = <span class="kwrd">new</span> Material();
    dominoMaterial.Diffuse = Color.White.ToVector4();
    dominoMaterial.Specular = Color.White.ToVector4();
    dominoMaterial.SpecularPower = 10;
    dominoMaterial.Texture = cguiLogoTexture;

    dominoNode.Material = dominoMaterial;

    TransformNode dominoTransNode = <span class="kwrd">new</span> TransformNode();
    dominoTransNode.Translation = <span class="kwrd">new</span> Vector3(
        (<span class="kwrd">float</span>)(radius * Math.Cos(MathHelper.ToRadians(x))),
        radius * (<span class="kwrd">float</span>)(Math.Sin(MathHelper.ToRadians(x))), 
        dominoSize.Y / 2);
    dominoTransNode.Rotation = 
        Quaternion.CreateFromAxisAngle(Vector3.UnitZ, 
            MathHelper.ToRadians(x &#43; 90));

    markerNode.AddChild(dominoTransNode);

    dominoTransNode.AddChild(dominoNode);

    dominos.Add(dominoNode);
}</pre>
<h4>Create 3D Balls</h4>
<p>We will create a list of 3D balls and add them to the scene even before the player shoots the ball in order to have best performance. Since we don't want to show these balls yet, we'll add them outside of the view frustum. When the player shoots a ball,
 we'll simply pick a ball from this list and give it a new position and velocity. Since the code is quite similar to creating 3D dominos, we will omit the codes here (see CreateBalls() function from line 1459)</p>
<h3>Step 4. Setup Physics Simulation and Sound Effect</h3>
<p>It is very easy to setup the physics simulation using Goblin XNA as well as use a sound effect when two objects collide into each other. The physics properties set to the GeometryNode in the previous steps are used by the physics engine. There are many properties
 associated with GeometryNode.Physics, but there are only few properties that you really have to define to make the simulation work.
</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">dominoNode.Physics.Mass = 20;
dominoNode.Physics.Shape = ShapeType.Box;
dominoNode.Physics.MaterialName = <span class="str">&quot;Domino&quot;</span>;
dominoNode.Physics.Pickable = <span class="kwrd">true</span>;
dominoNode.AddToPhysicsEngine = <span class="kwrd">true</span>;</pre>
<p></p>
<p>Taking the domino geometry as an example, we need to define its mass, the shape primitive used in the physics simulation, the material name is necessary only if we're going to modify its physics material later on, which is the case for this game), and whether
 this geometry can be picked (we want to pick and manipulate the dominos in certain game modes, so we set this to true). Actually, we also need to set
<b>Collidable</b> and <b>Interactable</b> properties to true for the geometry to collide and have physical response when other geometry hits this geometry. However, the game mode starts with ‘Add' mode, which will be explained later, and we don't want the geometry
 to collide and react on the collision when we move the selected domino around on the game board using mouse. So we leave them as false when we create them, and then set those two properties to true once the game starts.</p>
<p>NOTE: Before going through this part, we strongly recommend that you go through Tutorial 5 and Tutorial 9, which come with the Goblin XNA distribution.</p>
<h4>Setup Physics Simulation</h4>
<p>Since Goblin XNA supports Newton dynamics library, we will use NewtonPhysics implementation for our physics simulation. The default simulation space defined by Newton library is 200x200x200 centered at the origin, and if any objects go outside of this bound,
 those objects won't be simulated for optimization purposes. Since our scene is larger than this default space size, we'll set it to 500x500x500 centered at the center. The default gravity is 9.8, but this is quite slow for a realistic simulation, so we'll
 increase the gravity to 30. We will also increase the maximum simulation sub-steps to 5 so that even if the frame rate gets below 60 FPS, the physics engine will simulate as many as 5 sub-steps to simulate at least 60 FPS.</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">scene.PhysicsEngine = <span class="kwrd">new</span> NewtonPhysics();
<span class="rem">// Make the physics simulation space larger </span>
<span class="rem">// to 500x500x500 centered at the origin</span>
((NewtonPhysics)scene.PhysicsEngine).WorldSize =
    <span class="kwrd">new</span> BoundingBox(Vector3.One * -250, Vector3.One * 250);
<span class="rem">// Increase the gravity</span>
scene.PhysicsEngine.Gravity = 30.0f;

((NewtonPhysics)scene.PhysicsEngine).MaxSimulationSubSteps = 5;</pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
	{font-size:small;
	color:black;
	font-family:consolas,"Courier New",courier,monospace;
	background-color:#ffffff}
.csharpcode 
	{margin:0em}
.csharpcode .rem
	{color:#008000}
.csharpcode .kwrd
	{color:#0000ff}
.csharpcode .str
	{color:#006080}
.csharpcode .op
	{color:#0000c0}
.csharpcode .preproc
	{color:#cc6633}
.csharpcode .asp
	{background-color:#ffff00}
.csharpcode .html
	{color:#800000}
.csharpcode .attr
	{color:#ff0000}
.csharpcode .alt
	{background-color:#f4f4f4;
	width:100%;
	margin:0em}
.csharpcode .lnum
	{color:#606060}
-->
</style>
<p></p>
<h4>Setup Physics Material and Sound Effect</h4>
<p>We will setup some material properties for each physics entity that define how each entity will behave when they collide. Each entity is defined by a material name (for example, “Domino” for domino geometries), and in the example code below, this material
 definition is applied between “Ground” and “Ball” entities. For detailed explanation of each material properties (e.g., elasticity, friction, etc), please see the user manual that comes with the Goblin XNA distribution. When we set the material properties
 between two physics entities, we can also define a callback function, which will be invoked when the two entities collide. For our game, we want to add a sound effect to indicate the collision. For better performance, we limit the number of concurrent sound
 effects, and we only play a sound effect if the contact speed between the two entities is greater than certain speed (e.g., in the code example below, it will only play sound effect if the contact speed is above 3 pixels/sec). We also change the volume of
 the sound effect based on its contact speed. </p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">NewtonMaterial physMat2 = <span class="kwrd">new</span> NewtonMaterial();
<span class="rem">// Gound to ball material interaction</span>
physMat2.MaterialName1 = <span class="str">&quot;Ground&quot;</span>;
physMat2.MaterialName2 = <span class="str">&quot;Ball&quot;</span>;
physMat2.Elasticity = 0.7f;
physMat2.ContactProcessCallback = <span class="kwrd">delegate</span>(Vector3 contactPosition, 
    Vector3 contactNormal, <span class="kwrd">float</span> contactSpeed, 
    <span class="kwrd">float</span> colObj1ContactTangentSpeed, <span class="kwrd">float</span> colObj2ContactTangentSpeed,
    Vector3 colObj1ContactTangentDirection, 
    Vector3 colObj2ContactTangentDirection)
{
    <span class="kwrd">if</span> (contactSpeed &gt; 3f)
    {
        <span class="kwrd">if</span> (soundsPlaying.Count &gt;= SOUND_LIMIT)
            <span class="kwrd">return</span>;

        <span class="kwrd">try</span>
        {
            Sound.SetVolume(<span class="str">&quot;Default&quot;</span>, contactSpeed * volume);
        }
        <span class="kwrd">catch</span> (Exception exp) { }
        <span class="kwrd">try</span>
        {
            Sound.Play(<span class="str">&quot;rubber_ball_01&quot;</span>);
            soundsPlaying.Add(DateTime.Now.TimeOfDay.TotalMilliseconds);
        }
        <span class="kwrd">catch</span> (Exception exp) { }
    }

};
((NewtonPhysics)scene.PhysicsEngine).AddPhysicsMaterial(physMat2);</pre>
<p>The above code only defines the material properties between “Ground” and “Ball” entities. In the actual game code, however, it defines the material properties for each pair of existing physics entities.
</p>
<h3>Step 5. Add User Interaction System</h3>
<p>Now, we have all of the components necessary to start playing the AR domino knock-down game except for a way of interacting with the game for the player. Ideally, we want to play the game using a touch-sensitive mobile device with an embedded camera, such
 as an iPhone or an Ultra-Mobile-PC. Due to platform restriction and the high cost of those devices, we will use a webcam with mouse and keyboard based interaction for this demo. But first, we will add several callback functions for mouse and keyboard events.</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">MouseInput.Instance.MousePressEvent &#43;= 
    <span class="kwrd">new</span> HandleMousePress(MousePressHandler);
MouseInput.Instance.MouseDragEvent &#43;= <span class="kwrd">new</span> HandleMouseDrag(MouseDragHandler);
MouseInput.Instance.MouseReleaseEvent &#43;= 
    <span class="kwrd">new</span> HandleMouseRelease(MouseReleaseHandler);
MouseInput.Instance.MouseMoveEvent &#43;= <span class="kwrd">new</span> HandleMouseMove(MouseMoveHandler);

KeyboardInput.Instance.KeyPressEvent &#43;= <span class="kwrd">new</span> HandleKeyPress(KeyPressHandler);
KeyboardInput.Instance.KeyReleaseEvent &#43;= 
    <span class="kwrd">new</span> HandleKeyRelease(KeyReleaseHandler); </pre>
<p>For this game, we have implemented three different modes, “Add”, “Edit”, and “Play”.
</p>
<h4>Add Mode</h4>
<p>In “Add” mode, we want the players to be able to add dominoes anywhere on the game board by clicking the mouse and dragging the newly added domino around to finalize its position. We also want the players to be able to rotate the added domino along the normal
 vector of the game board by pressing “Left” and “Right” arrow keys. </p>
<p>NOTE: The following codes are in the MousePressHandler function.</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">Vector3 nearSource = 
    <span class="kwrd">new</span> Vector3(mouseLocation.X, mouseLocation.Y, 0);
Vector3 farSource = 
    <span class="kwrd">new</span> Vector3(mouseLocation.X, mouseLocation.Y, 1);

Matrix viewMatrix = 
    markerNode.WorldTransformation * State.ViewMatrix;

Vector3 nearPoint = 
    graphics.GraphicsDevice.Viewport.Unproject(
        nearSource, State.ProjectionMatrix, 
        viewMatrix, Matrix.Identity);
Vector3 farPoint = 
    graphics.GraphicsDevice.Viewport.Unproject(farSource, 
        State.ProjectionMatrix, viewMatrix, Matrix.Identity);
<span class="rem">// Cast a ray to the scene to pick a point on the ground where </span>
<span class="rem">// the domino will be added</span>
List&lt;PickedObject&gt; pickedObjects = 
    ((NewtonPhysics)scene.PhysicsEngine).PickRayCast(nearPoint, farPoint);

<span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; pickedObjects.Count; i&#43;&#43;)
{
    <span class="kwrd">if</span> (((GeometryNode)pickedObjects[i].PickedPhysicsObject.Container).
        Name.Equals(<span class="str">&quot;Ground&quot;</span>))
    {
        Vector3 intersectPoint = nearPoint * (1 – 
            pickedObjects[i].IntersectParam) &#43;
            pickedObjects[i].IntersectParam * farPoint;

        dominoTransNode.Translation = intersectPoint &#43; Vector3.UnitZ * 
            dominoSize.Y / 2;
        <span class="kwrd">break</span>;
    }
}</pre>
<p>Before we add a domino, we need to figure out the 3D point on the gameboard that corresponds to the 2D mouse click point on the screen. To do this, we need to create a 3D ray originating from the 3D point on the near clipping plane to the 3D point on the
 far clipping plane, both of which correspond to the clicked 2D point on the screen. XNA's Viewport class supports the Unproject function that performs this 2D to 3D mapping, which requires the 3D plane to map to (in this case, it's the nearSource and farSource),
 the projection matrix, the view matrix, and the world matrix. The tricky part here is the concept of the computation of the view matrix. In Goblin XNA, to make things simple, we decided not to have the marker transformation affect the physics simulation by
 default, so even if the marker transformation changes, nothing changes in the physics simulation world. However, if we want to figure out the actual view matrix in the physics simulation world, we need to multiply the marker transformation with the current
 view matrix, which is the State.ViewMatrix. </p>
<p>Once we get the 3D ray, we simply pass it to Newton library to perform the picking and then it will return a list of intersecting objects. We then check to see if there is an intersecting geometry named “Ground,” which is the gameboard. If the game board
 is intersected, then we calculate the 3D intersection point on the game board and put the newly added domino in that intersection point. In the MouseDragHandler function, you will see similar areas of code that let the player drag the newly added domino around
 on the game board. </p>
<p>There are also codes that let the player rotate the new domino along the normal vector of the game board in KeyPressHandler and Update functions, but we will omit the explanation here since the codes are self-explanatory.</p>
<h4>Edit Mode</h4>
<p>In “Edit” mode, we want the players to be able to pick an existing domino on the gameboard and drag it around. We also want the players to be able to rotate the selected domino along the normal vector of the game board by pressing “Left” or “Right” arrow
 keys. </p>
<p>NOTE: The following codes are in the MousePressHandler function.</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// Cast a ray to the scene to select the closest </span>
<span class="rem">// object (to the eye location) that hits the ray</span>
List&lt;PickedObject&gt; pickedObjects =   
    ((NewtonPhysics)scene.PhysicsEngine).PickRayCast(nearPoint, farPoint);

<span class="rem">// If one or more objects intersect with our ray vector</span>
<span class="kwrd">if</span> (pickedObjects.Count &gt; 0)
{
    <span class="rem">// Sort the picked objects in ascending order of intersection parameter</span>
    <span class="rem">// (the closest to the eye is the first one in the sorted list)</span>
    pickedObjects.Sort();

    <span class="rem">// If the closest object is the ground, then don't do anything</span>
    <span class="kwrd">if</span> (((GeometryNode)pickedObjects[0].PickedPhysicsObject.Container).
        Name.Equals(<span class="str">&quot;Ground&quot;</span>))
        <span class="kwrd">return</span>;

    selectedDominos.Add(
        (GeometryNode)pickedObjects[0].PickedPhysicsObject.Container);
    
    GeometryNode domino = selectedDominos[0];
    Vector4 mod = domino.Material.Diffuse;
    domino.Material.Diffuse = 
        <span class="kwrd">new</span> Vector4(mod.X, mod.Y, mod.Z, 0.5f);
}</pre>
<p>The picking codes are the same as before, but now we want to pick an existing domino instead of the game board. Since there are multiple dominoes on the game board, it is possible that the picking ray intersects with more than one domino (and most likely
 the game board as well). Thus, we need to sort the intersected geometries based on their distances from the camera, and then we want to select the one closest to the camera. If the closest geometry is not the game board, then we add this domino to the list
 of selected dominoes and set its transparency to half-transparent to indicate the selection. Then, in the MouseDragHandler function, we will see similar codes with “Add” mode that let the player drag the selected domino around.</p>
<h4>Play Mode</h4>
<p>In “Play” mode, we want the players to be able to shoot balls from the clicked location. We allow the player to shoot either heavy or normal balls depending on whether the click was on the right or left mouse button.
</p>
<p>NOTE: The following code snippets are in the MouseReleaseHandler function since we allow the player to inject additional speed when pushing the camera forward while press-and-holding the mouse button, and then releasing the button (this interaction makes
 more sense when the game is played on an UMPC).</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">bool</span> heavy = (button == MouseInput.RightButton);

<span class="kwrd">float</span> additionalSpeed = 0;

<span class="rem">// Add extra speed to the ball being shot if the camera point is moved from </span>
<span class="rem">// far point to closer point (to the ground)</span>
<span class="kwrd">float</span> ballReleaseDistance = 
    markerNode.WorldTransformation.Translation.Length();

<span class="kwrd">if</span> (ballReleaseDistance &lt; ballPressDistance)
    additionalSpeed = ballPressDistance - ballReleaseDistance;

Vector3 nearSource = 
    <span class="kwrd">new</span> Vector3(uiManager.CrossHairPoint.X, 
        uiManager.CrossHairPoint.Y, 0);
Vector3 farSource = 
    <span class="kwrd">new</span> Vector3(uiManager.CrossHairPoint.X, 
        uiManager.CrossHairPoint.Y, 1);

Matrix viewMatrix = markerNode.WorldTransformation * State.ViewMatrix;

Vector3 nearPoint = 
    graphics.GraphicsDevice.Viewport.Unproject(nearSource,
        State.ProjectionMatrix, viewMatrix, Matrix.Identity);
Vector3 farPoint = 
    graphics.GraphicsDevice.Viewport.Unproject(farSource,
        State.ProjectionMatrix, viewMatrix, Matrix.Identity);

ballCount&#43;&#43;;
uiManager.BallCount&#43;&#43;;
<span class="rem">// Create a ball and shoot it</span>
CreateBallCharactor(nearPoint, farPoint, additionalSpeed, heavy);</pre>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">Vector3 linVel = far - near;
linVel.Normalize();

GeometryNode ballNode = (heavy) ? heavyBalls[curHeavyBall] : balls[curBall];
ballNode.Model.CastShadows = <span class="kwrd">true</span>;
ballNode.Model.ReceiveShadows = <span class="kwrd">true</span>;
Vector4 orig = ballNode.Material.Diffuse;
ballNode.Material.Diffuse = 
    <span class="kwrd">new</span> Vector4(orig.X, orig.Y, orig.Z, 1);

Vector3 v = near &#43; linVel * 10;

<span class="rem">// Forces the physics engine to 'transport' </span>
<span class="rem">// this ball to the location 'v' in the simulation world</span>
((NewtonPhysics)scene.PhysicsEngine).SetTransform(
    ballNode.Physics, Matrix.CreateTranslation(v));

<span class="rem">// Apply a linear velocity to this ball</span>
((NewtonPhysics)scene.PhysicsEngine).ApplyLinearVelocity(
    ballNode.Physics, linVel * (50f &#43; additionalSpeed));

<span class="kwrd">if</span> (heavy)
{
    curHeavyBall&#43;&#43;;
    <span class="rem">// Circles through if we run out of heavy balls</span>
    <span class="kwrd">if</span> (curHeavyBall &gt;= BALL_NUM / 2)
        curHeavyBall = 0;
}
<span class="kwrd">else</span>
{
    curBall&#43;&#43;;
    <span class="rem">// Circles through if we run out of normal balls</span>
    <span class="kwrd">if</span> (curBall &gt;= BALL_NUM / 2)
        curBall = 0;
}</pre>
<p></p>
<h3>Step 6. Add Heads-Up-Display (HUD)</h3>
<p>Finally, we add a HUD for displaying information such as elapsed game time, number of balls used, and a victory message when the game is over. We also add a cross hair to indicate the position of the mouse on the screen.</p>
<p>NOTE: The above codes are in the Draw function of UIManager class.</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// Count the time elapsed in the play mode if game is not over yet</span>
<span class="kwrd">if</span> (gameState.CurrentGameMode == GameState.GameMode.Play &amp;&amp;  
    !gameState.GameOver)
{
    gameState.ElapsedSecond &#43;= gameTime.ElapsedRealTime.TotalSeconds;
    <span class="kwrd">if</span> (gameState.ElapsedSecond &gt;= 60)
    {
        gameState.ElapsedMinute&#43;&#43;;
        gameState.ElapsedSecond = 0;
    }
    <span class="rem">// Update the time elapsed label with the new elapsed time</span>
    modeStatusLabel = <span class="str">&quot;Play: &quot;</span> &#43; (<span class="kwrd">int</span>)gameState.ElapsedMinute &#43; <span class="str">&quot;:&quot;</span> &#43;  
        String.Format(<span class="str">&quot;{0:D2}&quot;</span>, (<span class="kwrd">int</span>)gameState.ElapsedSecond) &#43; <span class="str">&quot;  &quot;</span>;
}

<span class="rem">// Draws the cross hair mark to indicate the mouse position which is used for</span>
<span class="rem">// ball shooting, domino addition, domino edition, and GUI interaction (if </span>
<span class="rem">// GUI is shown)</span>
UI2DRenderer.FillRectangle(<span class="kwrd">new</span> Rectangle(crossHairPoint.X - 10, 
    crossHairPoint.Y, 23, 3), <span class="kwrd">null</span>, <span class="kwrd">new</span> Color(50, 205, 50, 150));
UI2DRenderer.FillRectangle(<span class="kwrd">new</span> Rectangle(crossHairPoint.X, crossHairPoint.Y -  
    10, 3, 23), <span class="kwrd">null</span>, <span class="kwrd">new</span> Color(50, 205, 50, 150));

UI2DRenderer.WriteText(Vector2.Zero, modeStatusLabel, 
    Color.White, labelFont,
    GoblinEnums.HorizontalAlignment.Right, 
    GoblinEnums.VerticalAlignment.Top);

<span class="rem">// Displays how many balls are used so far</span>
<span class="kwrd">if</span> (gameState.CurrentGameMode == GameState.GameMode.Play)
{
    UI2DRenderer.WriteText(Vector2.Zero, 
        <span class="str">&quot;Balls Used: &quot;</span> &#43; ballCount, Color.Red, 
        labelFont, GoblinEnums.HorizontalAlignment.Right,       
        GoblinEnums.VerticalAlignment.Bottom);
}

<span class="rem">// Shows the victory texts as well as play the victory sound if won</span>
<span class="kwrd">if</span> (gameState.GameOver)
{
    UI2DRenderer.WriteText(<span class="kwrd">new</span> Vector2(0, 130), <span class="str">&quot;Victory!! You Won!!&quot;</span>, 
        Color.Red, victoryFont, GoblinEnums.HorizontalAlignment.Center, 
        GoblinEnums.VerticalAlignment.None);

    UI2DRenderer.WriteText(<span class="kwrd">new</span> Vector2(0, 180), 
        <span class="str">&quot;Time: &quot;</span> &#43; (<span class="kwrd">int</span>)gameState.ElapsedMinute &#43; <span class="str">&quot;:&quot;</span> &#43; 
        String.Format(<span class="str">&quot;{0:D2}&quot;</span>, (<span class="kwrd">int</span>)gameState.ElapsedSecond), 
        Color.Red,victoryFont, 
        GoblinEnums.HorizontalAlignment.Center, 
        GoblinEnums.VerticalAlignment.None);

    UI2DRenderer.WriteText(<span class="kwrd">new</span> Vector2(0, 220), 
        <span class="str">&quot;Balls Used: &quot;</span> &#43; ballCount, Color.Red, 
        victoryFont, GoblinEnums.HorizontalAlignment.Center, 
        GoblinEnums.VerticalAlignment.None);

    Texture2D trophy = <span class="kwrd">null</span>;
    <span class="kwrd">if</span> (gameState.ElapsedMinute &lt; 1 &amp;&amp; 
        gameState.ElapsedSecond &lt;= 14)
        trophy = trophyGold;
    <span class="kwrd">else</span> <span class="kwrd">if</span> (gameState.ElapsedMinute &lt; 1 &amp;&amp; 
        gameState.ElapsedSecond &lt;= 25)
        trophy = trophySilver;
    <span class="kwrd">else</span>
        trophy = trophyBronze;

    UI2DRenderer.FillRectangle(<span class="kwrd">new</span> Rectangle(
        (State.Width - trophy.Width) / 2, 280, 
        trophy.Width, trophy.Height), 
        trophy, Color.White);
}</pre>
<h3>Conclusion</h3>
<p>This article demonstrated how to implement a simple yet interesting interactive AR game. Since this article is rather advanced, and most of the codes are specific to Goblin XNA framework, you will have a better understanding of the source codes if you go
 through some of the suggested tutorials first. If you have an UMPC (Ultra-Mobile-PC) with you, then you can also run the same code, and you can shoot the balls by tapping on the screen rather than using a mouse.
</p>
<p>If you want to try this out, download the source code via the link at the top of the article!</p>
<h3>About The Author</h3>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10012840/clip_image004_5B4_5D.jpg"><img title="clip_image004[4]" border="0" hspace="12" alt="clip_image004[4]" align="right" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10012840/clip_image004_5B4_5D_thumb.jpg" width="132" height="175"></a>Ohan
 Oda is a Ph.D student at Columbia University studying Computer Science. He specializes in designing systems and user interaction techniques for entertainment in Augmented Reality. He is the lead developer of Goblin XNA framework, and has worked on several
 Augmented Reality projects using this framework. Please contact <a href="mailto:ohan@cs.columbia.edu">
ohan@cs.columbia.edu</a> for any questions.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:4c989aa298ab4222a2219e7600c952e8">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Augmented-Reality-Domino-Knock-Down-Game</comments>
      <itunes:summary>
This article provides step-by-step instructions about how to create a simple, yet interesting, augmented reality game called “domino knock-down game” using an open source framework called Goblin XNA.

Introduction
This is an advanced tutorial, and as such we expect that you are already familiar with XNA and scene graph based 3D programming. The game is a single player game in which the player shoots virtual balls into a real-world environment to knock down all of
 the virtual dominos overlaid on top of a board. The player holds a webcam in one hand and shoots the virtual ball by clicking a mouse using the other hand. Before the game starts, the player is allowed to add virtual dominos or modify the positions and orientations
 of the existing ones overlaid on the board as desired.

How To Compile and Run The Game
After you download the Goblin XNA distribution from 
http://goblinxna.codeplex.com, as well as all other necessary libraries indicated in the installation guide, compile the Goblin XNA project under the /src directory. If you&#39;re not familiar with Goblin XNA framework, it is strongly recommended that you first
 go through the tutorials in the /tutorials directory. Then, find the ARDominos directory under /projects directory and open up the solution file in order to build and run the game.
How To Play
Before you run the application, you need to print out the marker array. The marker array can be found in the DominoGroud.ppt file. The 1st slide is for the ARTag library, and the 2nd one is for the ALVAR library. The size of the PowerPoint
 slide is set to 25.6 x 17.52 inches, so if you want the entire marker array to fit in A4 size paper, you should choose &amp;quot;Scale to fit&amp;quot; option when you print. Once you have the print out, you&#39;re ready to run the game.
The virtual dominos are overlaid around the center of the marker array (referred to as ‘game board&#39; from now on), so you need to aim your webcam around the center of the game board. If you move your mous</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Augmented-Reality-Domino-Knock-Down-Game</link>
      <pubDate>Thu, 13 May 2010 21:06:44 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Augmented-Reality-Domino-Knock-Down-Game</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10012840_100.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10012840_220.jpg" height="165" width="220"/>      
      <dc:creator>Ohan Oda</dc:creator>
      <itunes:author>Ohan Oda</itunes:author>
      <slash:comments>8</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Augmented-Reality-Domino-Knock-Down-Game/RSS</wfw:commentRss>
      <category>augmented  reality</category>
      <category>Gaming</category>
      <category>XNA</category>
    </item>
  <item>
      <title>XNA Effects – ASCII Art in 3D</title>
      <description><![CDATA[
<p>In this article, I'll demonstrate how to create a post-processing effect to turn 3D renders into ASCII Art.
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="157">
<p><strong>Louis Ingenthron <br>
FV Productions</strong></p>
</td>
<td valign="top" width="481">
<p><b>Code It:</b> <a href="http://xnaascii.codeplex.com/">http://xnaascii.codeplex.com/</a>
<br>
<b>Run It:</b> <a href="http://xnaascii.codeplex.com/">http://xnaascii.codeplex.com/</a></p>
<p><b>Difficulty:</b> Intermediate <br>
<b>Time Required:</b> 1-4 hours <br>
<b>Cost:</b> FREE <br>
<b>Software Needed: </b><a href="http://www.microsoft.com/express/download/">Visual C# Express</a>,
<a href="http://msdn.microsoft.com/en-us/netframework/default.aspx">.NET Framework 3.5</a>,
<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=80782277-D584-42D2-8024-893FCD9D3E82&amp;displaylang=en">
XNA Game Studio 3.1</a> <br>
<b>Hardware:</b> Windows PC</p>
</td>
</tr>
</tbody>
</table>
</p>
<h3>Introduction</h3>
<p>Back in November of 2009, I was met with an interesting challenge. Those of you who frequent the XNA Community Forums have probably heard of Nick Gravelyn. He was an XNA MVP, and now he works for the XNA team. He started a little contest called xna7day,
 which was designed to challenge developers to make a game in 7 days using a pre-defined theme.</p>
<p>The theme in November was “Text Based” and its rule was that you were only allowed to use text in the visuals of your game. I saw some of the cool stuff other developers were working on, including one that looked like it had text characters that could walk
 and talk, like people. But my mind immediately went to a different solution: I wanted to make a game that was fully 3D (effectively breaking the rule of rendering text), but then post-process the render into ASCII art, so it would look like it was text.</p>
<p>In this article, I'm going to show you how to do just that:</p>
<p align="center"><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image002_2.jpg"><img title="clip_image002" border="0" alt="clip_image002" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image002_thumb.jpg" width="240" height="180"></a><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image004_2.jpg"><img title="clip_image004" border="0" alt="clip_image004" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image004_thumb.jpg" width="240" height="180"></a></p>
<h4>Setup</h4>
<p>Alright, let's dive right in. Open up the base project. It should compile and run as is. It's a simple, if ugly, first-person shooter. Play through the first level. Go ahead, I'll wait. Bonus points to anyone who recognizes the level design!</p>
<p>Okay, got a playthrough? Let's start! I separated this into three projects so the ASCII stuff can be extracted into other games. We'll be doing most of our work in the ASCII_Renderer project, so let's open that up and add a new class to the Source\ascii
 folder called “Renderer.” I use the namespace “ASCII3D” for all files in this project, so get rid of the extra folder sub-namespaces. Add these using statements, too:</p>
<p><b>C# </b></p>
<pre class="csharpcode"><span class="kwrd">using</span> Microsoft.Xna.Framework;
<span class="kwrd">using</span> Microsoft.Xna.Framework.Content;
<span class="kwrd">using</span> Microsoft.Xna.Framework.Graphics; </pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
	{font-size:small;
	color:black;
	font-family:consolas,"Courier New",courier,monospace;
	background-color:#ffffff}
.csharpcode 
	{margin:0em}
.csharpcode .rem
	{color:#008000}
.csharpcode .kwrd
	{color:#0000ff}
.csharpcode .str
	{color:#006080}
.csharpcode .op
	{color:#0000c0}
.csharpcode .preproc
	{color:#cc6633}
.csharpcode .asp
	{background-color:#ffff00}
.csharpcode .html
	{color:#800000}
.csharpcode .attr
	{color:#ff0000}
.csharpcode .alt
	{background-color:#f4f4f4;
	width:100%;
	margin:0em}
.csharpcode .lnum
	{color:#606060}
-->
</style>
<p>This is going to be a post-processing effect, so we'll try to make it portable. Add the following empty function declarations:</p>
<p><b>C# </b></p>
<pre class="csharpcode"><span class="kwrd">public</span> Renderer(ContentManager content, <span class="kwrd">int</span> xRes, <span class="kwrd">int</span> yRes)
{ }

<span class="kwrd">public</span> <span class="kwrd">void</span> StartScene()
{ }

<span class="kwrd">public</span> <span class="kwrd">void</span> EndScene()
{ }</pre>
<p>The constructor takes three arguments: The ContentManager, which we will use to load in our font and post-processing shader, and the resolution variables, which will basically tell us how many lines of text to draw and how many characters in each line. Since
 we have these prototyped, we'll make our only edits to the ASCIIFPS project in the Source\Game1.cs file. But first, we need to define and initialize a new Renderer object. Add a new class variable:<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">/// &lt;summary&gt;</span>
<span class="rem">/// This is what handles the ASCII conversion</span>
<span class="rem">/// &lt;/summary&gt;</span>
<span class="kwrd">private</span> Renderer renderer; </pre>
<p>And at the end of the LoadContent function:</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// and initialize our ASCII renderer</span>
<span class="rem">// the variables we pass make each character</span>
<span class="rem">// appx 10x14 which seems to be the smallest</span>
<span class="rem">// readable size</span>
renderer = <span class="kwrd">new</span> Renderer(Content, Global.ScreenWidth/10,Global.ScreenHeight/14);</pre>
<p></p>
<p>Finally, call the BeginScene and EndScene functions. Modify Game1's Draw function to look like this:<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> Draw(GameTime gameTime)
{
    <span class="rem">// notice we only wrap StartScene and</span>
    <span class="rem">// EndScene if we are UsingASCII</span>
    <span class="kwrd">if</span> (UsingASCII)
        renderer.StartScene();

    currentState.Draw(gameTime);

    <span class="kwrd">if</span> (UsingASCII)
        renderer.EndScene();

    <span class="kwrd">base</span>.Draw(gameTime);
}</pre>
<p>The Boolean variable UsingASCII is defined for us. It defaults to false and can be toggled any time in-game by pressing the [M] key. If you want to default it to true for testing purposes, just change its value in Game1's Initialize function. At this point,
 the Renderer is all hooked up, so changes will go right in.</p>
<p>I skimmed over the other classes earlier in the article, but I need to touch on a few of them. Almost everything in GlobalModules is fairly standard utility stuff. We'll be using it, so you might want to glance at the Global class. The ASCIIFPS has the FPS
 engine in it and is almost entirely irrelevant to this article, except that it offers a fun test-bed for our effect. Feel free to go through the code, but I'll warn you: I wrote it for a 7-day contest, so some of it looks like gibberish and is only incidentally
 functional. Finally, we have the ASCII_Renderer project. This already has two files in it: BitmapFontGenerator and Letter. The latter are for generating a bitmap font map that we'll use in a bit.</p>
<p>The functionality isn't specific to this article, since any artist could easily make this. But I'm no artist, which is why I had the computer do it for me. Basically, BitmapFontGenerator has a static function that will take a texture of letters (see the
 Content project in ASCII_Renderer), trim them, sort them by how much they fill their space, and print them into a new Texture for our functions. Feel free to read through the code for this process; I commented it pretty well.</p>
<h4>Post-Processing Basics</h4>
<p>We need to cover the basics of post-processing before we start coding the next part. When post-processing a scene, you first render the entire scene off-screen on a RenderTarget. Then, you can apply any effects you want to the resolved texture before putting
 it on the screen. That's it. Here's how in XNA:<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> Renderer
{
    <span class="kwrd">private</span> RenderTarget2D SrcImage;

    <span class="kwrd">public</span> Renderer(ContentManager content, <span class="kwrd">int</span> xRes, <span class="kwrd">int</span> yRes)
    {
        SrcImage = <span class="kwrd">new</span> RenderTarget2D(Global.Graphics, 
            xRes, yRes, 1, SurfaceFormat.Color);
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> StartScene()
    {
        Global.Graphics.SetRenderTarget(0, SrcImage);
        Global.Graphics.Clear(Color.Black);
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> EndScene()
    {
        Global.Graphics.SetRenderTarget(0, <span class="kwrd">null</span>);
        Global.Graphics.Clear(Color.Black);

        <span class="rem">// TODO: draw the texture from the RenderTarget</span>
    }
}</pre>
<p>We create the RenderTarget2D we need in the constructor. Notice that the size of the RenderTarget is the same as the number of ASCII characters we plan to draw on screen. I'll explain that in the next section. In the StartScene function, we set the RenderTarget
 on the device so that all draw calls will actually draw to it. Then we clear the buffer, because RenderTargets' content from frame to frame is undefined. In EndScene, the RenderTarget is set to null, which is DirectX's way of saying “use the screen's framebuffer.”
 Now we need to actually draw the rendered image. XNA requires shaders for all draw calls, even if they're veiled by BasicEffect and SpriteBatch. We need to create a very simple shader to draw the texture to screen. Create a new Effect file in ASCII_Renderer's
 Content project and name it TextEffect. We'll start it out with this:<b></b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">texture2D sourceTex;
sampler2D SourceTextureSampler = sampler_state
{
    Texture = &lt;sourceTex&gt;;
    MinFilter = point;
    MagFilter = point;
    MipFilter = point;
    AddressU = wrap;
    AddressV = wrap;
};

<span class="kwrd">struct</span> VertexShaderInput
{
    float4 Position : POSITION0;
    float2 TexCoords : TEXCOORD0;
};

<span class="kwrd">struct</span> VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 TexCoords : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    
    output.Position = input.Position;
    output.TexCoords = input.TexCoords;

    <span class="kwrd">return</span> output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float4 sourceColor = tex2D(SourceTextureSampler,input.TexCoords);
    
    <span class="kwrd">return</span> sourceColor;
}

technique Technique1
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}</pre>
<p>There are a couple things I want to note about the base shader. First, notice that we use point filtering. I'll explain why in the next section, but it's important to see where we did it. Next, notice that we took out all the default transformation matrices.
 We're going to be drawing a single full screen quad, so we can just pass in the coordinates in screen-space—no processing required. Now we need to make a few changes to the Renderer class to use this Effect and draw the rendered game. First, we need to add
 some new class variables:<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">private</span> Effect effect;

<span class="kwrd">private</span> VertexPositionTexture[] verts;
<span class="kwrd">private</span> VertexDeclaration vd;</pre>
<p></p>
<p>The vertices are going to be for a simple quad that takes up the whole screen. They should be initialized in the LoadContent function like this:<b>
</b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">effect = content.Load&lt;Effect&gt;(<span class="str">&quot;TextEffect&quot;</span>);

verts = <span class="kwrd">new</span> VertexPositionTexture[6];
verts[0] = <span class="kwrd">new</span> VertexPositionTexture(
    <span class="kwrd">new</span> Vector3(-1, -1, 0), <span class="kwrd">new</span> Vector2(0, 1));
verts[1] = <span class="kwrd">new</span> VertexPositionTexture(
    <span class="kwrd">new</span> Vector3(1, -1, 0), <span class="kwrd">new</span> Vector2(1, 1));
verts[2] = <span class="kwrd">new</span> VertexPositionTexture(
    <span class="kwrd">new</span> Vector3(-1, 1, 0), <span class="kwrd">new</span> Vector2(0, 0));
verts[3] = verts[1];
verts[4] = verts[2];
verts[5] = <span class="kwrd">new</span> VertexPositionTexture(
    <span class="kwrd">new</span> Vector3(1, 1, 0), <span class="kwrd">new</span> Vector2(1, 0));

vd = <span class="kwrd">new</span> VertexDeclaration(
    Global.Graphics, VertexPositionTexture.VertexElements);</pre>
<p></p>
<p>And finally, we add our draw code to the Draw function:<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">effect.Begin();
effect.CurrentTechnique.Passes[0].Begin();

effect.Parameters[<span class="str">&quot;sourceTex&quot;</span>].SetValue(SrcImage.GetTexture());
effect.CommitChanges();
Global.Graphics.RenderState.CullMode = CullMode.None;

Global.Graphics.VertexDeclaration = vd;
Global.Graphics.DrawUserPrimitives&lt;VertexPositionTexture&gt;
     (PrimitiveType.TriangleList, verts, 0, 2);

effect.CurrentTechnique.Passes[0].End();
effect.End();</pre>
<p></p>
<p>We set the texture we got from the RenderTarget, turn off culling (what would be culled in this geometry?), and draw it. Run the project. You should be able to toggle a difference in-game with the [M] key.<b></b></p>
<p><b><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image006_2.jpg"><img title="clip_image006" border="0" alt="clip_image006" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image006_thumb.jpg" width="322" height="242"></a></b></p>
<h3>Drawing Some Text</h3>
<p>“Okay,” you say, “it runs at a lower resolution with the [M] key. So what?” Remember what we set the resolution to in the RenderTarget? Yes, every pixel on this low-resolution version will be a character in the final image. How do we turn these big pixels
 into characters? First we need to define a texture bitmap font. Let's add a Texture2D class variable to Renderer and a const int for the BitmapFontGenerator:
</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">public</span> Texture2D text; 
<span class="kwrd">private</span> <span class="kwrd">const</span> <span class="kwrd">int</span> NUM_SLOTS = 256;</pre>
<p></p>
<p>Then we'll use the BitmapFontGenerator to construct this texture:</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">text = BitmapFontGenerator.GenerateTextTexture(content, NUM_SLOTS);</pre>
<p></p>
<p>Okay, that's all for now. Let's go back to the TextEffect.fx. We need to add a few variables:<b></b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float2 dstLetterSize;

<span class="kwrd">int</span> numLetters;

texture2D textTex;
sampler2D TextTextureSampler = sampler_state
{
    Texture = &lt;textTex&gt;;
    MinFilter = point;
    MagFilter = point;
    MipFilter = point;
    AddressU = wrap;
    AddressV = wrap;
};</pre>
<p>The variable “dstLetterSize” will tell us how big the letters on the screen are. The “numLetters” variable will tell us how many letters are in the font texture. And then there's the font texture itself. Here's how we draw actual characters in the Pixel
 Shader:<b></b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
     float4 sourceColor = tex2D(SourceTextureSampler,input.TexCoords);
    
     float2 texCoords = float2(
          input.TexCoords.x-((<span class="kwrd">int</span>)
               (input.TexCoords.x/dstLetterSize.x)*dstLetterSize.x),
          input.TexCoords.y-((<span class="kwrd">int</span>)
               (input.TexCoords.y/dstLetterSize.y)*dstLetterSize.y));
     texCoords /= dstLetterSize;
     texCoords.x /= numLetters;
    
     float4 letterColor = tex2D(TextTextureSampler,texCoords);
    
     <span class="kwrd">return</span> letterColor;
}</pre>
<p></p>
<p>We've already seen the source color line. The next line will get the offset into the letter in letter size by subtracting the rounded-down (or integer-casted) texture coordinates scaled down. The line after that scales it back up to a 0-1 range. So now we
 have the new variable texCoords that is filled with the texture coordinates of the letter in 0-1 terms. We divide the x by numLetters because our texture is one long horizontal line of letters. Finally we get the letter color with these new texture coordinates.
 This letter color is grayscale, and when multiplied by the source color, we've assured that each letter is rendered in its own slot with the color from the original 3D render. The last thing we have to do is set those effect variables we defined from Renderer's
 EndScene function. Where we once just set the source texture, we now set these:<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">effect.Parameters[<span class="str">&quot;dstLetterSize&quot;</span>].SetValue(
     <span class="kwrd">new</span> Vector2(1.0f/(<span class="kwrd">float</span>)SrcImage.Width, 1.0f/(<span class="kwrd">float</span>)SrcImage.Height));
effect.Parameters[<span class="str">&quot;numLetters&quot;</span>].SetValue(NUM_SLOTS);
effect.Parameters[<span class="str">&quot;sourceTex&quot;</span>].SetValue(SrcImage.GetTexture());
effect.Parameters[<span class="str">&quot;textTex&quot;</span>].SetValue(text);
effect.CommitChanges();</pre>
<p></p>
<p>Most of these are self explanatory, but the dstLetterSize is a bit more complicated. To get the size of the letter in the 0-1 texture space, you take the total size (0 to 1) divided by the number of letters in that axis which, in our case, is the RenderTarget
 size.<b></b></p>
<p><b></b></p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image008_2.jpg"><img title="clip_image008" border="0" alt="clip_image008" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image008_thumb.jpg" width="322" height="242"></a></p>
<h3>Wheel of Fortune</h3>
<p>‘M's aren't very interesting. In traditional ASCII art, the whole point is that you use characters that take more space or less space to handle shading. Let's add this code after the multiplication of the texCoords.x:<b></b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">float</span> lum = (sourceColor.r&#43;sourceColor.g&#43;sourceColor.b)/3.0; 
<span class="kwrd">float</span> val = max(fullValueColor.r,
     max(fullValueColor.g,fullValueColor.b));
    
<span class="kwrd">int</span> ind = ((numLetters-1)-
     max(0,min((numLetters-1),(<span class="kwrd">int</span>)(lum*numLetters))));

texCoords.x &#43;= ind*(1.0/numLetters);</pre>
<p></p>
<p><b></b></p>
<p>The first line gets the luminosity of the source color. The next gets the value. The next line gets the letter index from the luminosity. Subtracting it from (numLetters-1) reverses the index, because we want luminosity=1 to equate to index=0, because that
 has the letter that takes up the most space. Run the game. You'll see it now shows value, but it's still pretty hard to tell what's on the screen:</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image010_2.jpg"><img title="clip_image010" border="0" alt="clip_image010" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image010_thumb.jpg" width="322" height="242"></a></p>
<p>The last thing we can do is colorize it. You could just multiply it by the source color and get something like this…</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image012_2.jpg"><img title="clip_image012" border="0" alt="clip_image012" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image012_thumb.jpg" width="322" height="242"></a></p>
<p>…but everything looks too dark because the source color still has its value. Plus we're already practically multiplying it by choosing the letter. So we need to get the full value color first:</p>
<p><b></b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float4 fullValueColor = sourceColor * (1.0/val);</pre>
<p></p>
<p>We just multiply the original color by the inverse of the value. And then multiply that fullValueColor by the letter color in the return:<b></b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">return</span> fullValueColor * letterColor;</pre>
<p></p>
<p>That should produce a nice result:</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image014_2.jpg"><img title="clip_image014" border="0" alt="clip_image014" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9994745/clip_image014_thumb.jpg" width="407" height="305"></a><b></b></p>
<h3>Conclusion</h3>
<p>And there it is! We have a real-time 3D render transformed into ASCII art. It's difficult to see and it's not very useful, but it's sure neat, eh? Why not add it as an unlockable easter egg in your next XBL Indie Game? I'm looking forward to seeing how people
 use this effect! If you use it, please <a href="mailto:louisingenthron@fvproductions.org">
send me an email</a> with a screenshot!</p>
<h3>About The Author</h3>
<p>Louis Ingenthron is a Game Developer in Orlando, FL. He works on commercial Console and PC titles, but runs his own Indie Games company, FV Productions, on the side. He is best known for his open source XNA rhythm game Unsigned and specializes in real-time
 Graphics programming. He has been working with XNA since the 2.0 Beta and with .NET C# for just as long. He is also familiar with several other development languages, such as C, C&#43;&#43;, and Java. Occasionally, he can even be found doing web development and Flash.
 Louis also writes for MSDN's Coding4Fun website, contributing articles on a monthly basis.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:bfa52c016c3640c7a8699e7600c99302">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/XNA-Effects--ASCII-Art-in-3D</comments>
      <itunes:summary>
In this article, I&#39;ll demonstrate how to create a post-processing effect to turn 3D renders into ASCII Art.




Louis Ingenthron 
FV Productions


Code It: http://xnaascii.codeplex.com/

Run It: http://xnaascii.codeplex.com/
Difficulty: Intermediate 
Time Required: 1-4 hours 
Cost: FREE 
Software Needed: Visual C# Express,
.NET Framework 3.5,

XNA Game Studio 3.1 
Hardware: Windows PC





Introduction
Back in November of 2009, I was met with an interesting challenge. Those of you who frequent the XNA Community Forums have probably heard of Nick Gravelyn. He was an XNA MVP, and now he works for the XNA team. He started a little contest called xna7day,
 which was designed to challenge developers to make a game in 7 days using a pre-defined theme.
The theme in November was “Text Based” and its rule was that you were only allowed to use text in the visuals of your game. I saw some of the cool stuff other developers were working on, including one that looked like it had text characters that could walk
 and talk, like people. But my mind immediately went to a different solution: I wanted to make a game that was fully 3D (effectively breaking the rule of rendering text), but then post-process the render into ASCII art, so it would look like it was text.
In this article, I&#39;m going to show you how to do just that:

Setup
Alright, let&#39;s dive right in. Open up the base project. It should compile and run as is. It&#39;s a simple, if ugly, first-person shooter. Play through the first level. Go ahead, I&#39;ll wait. Bonus points to anyone who recognizes the level design!
Okay, got a playthrough? Let&#39;s start! I separated this into three projects so the ASCII stuff can be extracted into other games. We&#39;ll be doing most of our work in the ASCII_Renderer project, so let&#39;s open that up and add a new class to the Source\ascii
 folder called “Renderer.” I use the namespace “ASCII3D” for all files in this project, so get rid of the extra folder sub-namespaces. Add these using statements, too:
</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/XNA-Effects--ASCII-Art-in-3D</link>
      <pubDate>Wed, 14 Apr 2010 13:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/XNA-Effects--ASCII-Art-in-3D</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9994745_100.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9994745_220.jpg" height="165" width="220"/>      
      <dc:creator>Louis Ingenthron </dc:creator>
      <itunes:author>Louis Ingenthron </itunes:author>
      <slash:comments>11</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/XNA-Effects--ASCII-Art-in-3D/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>media</category>
      <category>XNA</category>
      <category>Mash Up</category>
    </item>
  <item>
      <title>Surface + Dungeons and Dragons = Surfacescapes</title>
      <description><![CDATA[I met with the folks from Carnegie Mellon who created the Dungeons and Dragons game
<a shape="rect" href="http://blogs.msdn.com/surface/archive/2009/10/19/dungeons-dragons-done-right-on-microsoft-surface.aspx" shape="rect">
on Microsoft Surface</a>&nbsp;called <a shape="rect" href="http://www.etc.cmu.edu/projects/surfacescapes/index.html" shape="rect">
Surfacescapes</a>, which is a double helping of geek. I asked them about some of the challenges they faced, some of the decisions they made (like virtual dice), and where they hope to go with it in the future. If you're a D&amp;D or Surface fan, don't miss it at&nbsp;<a shape="rect" href="http://www.paxsite.com/paxeast/index.php" shape="rect">Penny
 Arcade</a> on March 26th. <br /><br />In this game, the DM sits off to the side with a laptop or touch slate while the application tracks combat states and statistics. Best of all you can still use your favorite miniatures on the table!
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:8a165d9a016d4253a4949deb000d62cc">]]></description>
      <comments>http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes</comments>
      <itunes:summary>I met with the folks from Carnegie Mellon who created the Dungeons and Dragons game

on Microsoft Surface&amp;nbsp;called 
Surfacescapes, which is a double helping of geek. I asked them about some of the challenges they faced, some of the decisions they made (like virtual dice), and where they hope to go with it in the future. If you&#39;re a D&amp;amp;D or Surface fan, don&#39;t miss it at&amp;nbsp;Penny
 Arcade on March 26th. In this game, the DM sits off to the side with a laptop or touch slate while the application tracks combat states and statistics. Best of all you can still use your favorite miniatures on the table!
</itunes:summary>
      <itunes:duration>924</itunes:duration>
      <link>http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes</link>
      <pubDate>Mon, 22 Mar 2010 01:54:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/100/536217_100x75.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/220/536217_220x165.jpg" height="165" width="220"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_320_ch9.png" height="240" width="320"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_512_ch9.png" height="384" width="512"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_85_ch9.png" height="64" width="85"/>
      <media:group>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_2MB_ch9.wmv" expression="full" duration="924" fileSize="282187234" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.mp3" expression="full" duration="924" fileSize="7397513" type="audio/mp3" medium="audio"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.mp4" expression="full" duration="924" fileSize="121759049" type="video/mp4" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.wma" expression="full" duration="924" fileSize="7481933" type="audio/x-ms-wma" medium="audio"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.wmv" expression="full" duration="924" fileSize="180066469" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_Zune_ch9.wmv" expression="full" duration="924" fileSize="128962521" type="video/x-ms-wmv" medium="video"/>
      </media:group>      
      <enclosure url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.wmv" length="180066469" type="video/x-ms-wmv"/>
      <dc:creator>Larry Larsen</dc:creator>
      <itunes:author>Larry Larsen</itunes:author>
      <slash:comments>5</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes/RSS</wfw:commentRss>
      <category>Game Design</category>
      <category>Gaming</category>
      <category>Surface</category>
    </item>
  <item>
      <title>Techfest: NUI Movement</title>
      <description><![CDATA[At TechFest this year I met with&nbsp;<a shape="rect" href="http://research.microsoft.com/en-us/people/desney/" shape="rect">Desney Tan</a> and&nbsp;<a shape="rect" href="http://research.microsoft.com/en-us/um/people/dan/" shape="rect">Dan Morris</a> who showed
 me several very interesting systems, each of which allows your body to become the input device for hardware. Granted, this hardware was literally put together with tape and exposed wires (that just increases the cool, IMHO), but this proof of concept worked
 incredibly well considering its fragility. Also, Desney really could use a metronome and some time spent practicing Guitar Hero. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' /><br /><br />Dan showed us how we might interact with devices by using our body as a control device. By tapping in a specific area on your arm you are able to navigate, read email, or play games.
<br /> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:e039af04839a48789f8a9deb000d52ac">]]></description>
      <comments>http://channel9.msdn.com/Blogs/LarryLarsen/Techfest-NUI-Movement</comments>
      <itunes:summary>At TechFest this year I met with&amp;nbsp;Desney Tan and&amp;nbsp;Dan Morris who showed
 me several very interesting systems, each of which allows your body to become the input device for hardware. Granted, this hardware was literally put together with tape and exposed wires (that just increases the cool, IMHO), but this proof of concept worked
 incredibly well considering its fragility. Also, Desney really could use a metronome and some time spent practicing Guitar Hero. Dan showed us how we might interact with devices by using our body as a control device. By tapping in a specific area on your arm you are able to navigate, read email, or play games.
</itunes:summary>
      <itunes:duration>495</itunes:duration>
      <link>http://channel9.msdn.com/Blogs/LarryLarsen/Techfest-NUI-Movement</link>
      <pubDate>Thu, 18 Mar 2010 14:56:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/LarryLarsen/Techfest-NUI-Movement</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/100/536220_100x75.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/220/536220_220x165.jpg" height="165" width="220"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_320_ch9.png" height="240" width="320"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_512_ch9.png" height="384" width="512"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_85_ch9.png" height="64" width="85"/>
      <media:group>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_2MB_ch9.wmv" expression="full" duration="495" fileSize="151792433" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_ch9.mp3" expression="full" duration="495" fileSize="3961310" type="audio/mp3" medium="audio"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_ch9.mp4" expression="full" duration="495" fileSize="88404546" type="video/mp4" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_ch9.wma" expression="full" duration="495" fileSize="4009309" type="audio/x-ms-wma" medium="audio"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_ch9.wmv" expression="full" duration="495" fileSize="109612449" type="video/x-ms-wmv" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_Zune_ch9.wmv" expression="full" duration="495" fileSize="70076501" type="video/x-ms-wmv" medium="video"/>
      </media:group>      
      <enclosure url="http://ecn.channel9.msdn.com/o9/ch9/0/2/2/6/3/5/NatMovement_ch9.wmv" length="109612449" type="video/x-ms-wmv"/>
      <dc:creator>Larry Larsen</dc:creator>
      <itunes:author>Larry Larsen</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/LarryLarsen/Techfest-NUI-Movement/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>NUI</category>
      <category>TechFest</category>
    </item>
  <item>
      <title>Surface + Dungeons and Dragons = Surfacescapes</title>
      <description><![CDATA[I met with the folks from Carnegie Mellon who created the Dungeons and Dragons game <a shape="rect" href="http://blogs.msdn.com/surface/archive/2009/10/19/dungeons-dragons-done-right-on-microsoft-surface.aspx" shape="rect">on Microsoft Surface</a> called <a shape="rect" href="http://www.etc.cmu.edu/projects/surfacescapes/index.html" shape="rect">Surfacescapes</a>, which is a double helping of geek. I asked them about some of the challenges they faced, some of the decisions they made (like virtual dice), and where they hope to go with it in the future. If you're a D&amp;D or Surface fan, don't miss it at <a shape="rect" href="http://www.paxsite.com/paxeast/index.php" shape="rect">Penny Arcade</a> on March 26th. <br><br>In this game, the DM sits off to the side with a laptop or touch slate while the application tracks combat states and statistics. Best of all you can still use your favorite miniatures on the table! <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:32ebf6d1ba0d413aa64c9e100101edaf">]]></description>
      <comments>http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes</comments>
      <itunes:summary>I met with the folks from Carnegie Mellon who created the Dungeons and Dragons game on Microsoft Surface called Surfacescapes, which is a double helping of geek. I asked them about some of the challenges they faced, some of the decisions they made (like virtual dice), and where they hope to go with it in the future. If you&#39;re a D&amp;amp;D or Surface fan, don&#39;t miss it at Penny Arcade on March 26th. In this game, the DM sits off to the side with a laptop or touch slate while the application tracks combat states and statistics. Best of all you can still use your favorite miniatures on the table!</itunes:summary>
      <itunes:duration>924</itunes:duration>
      <link>http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes</link>
      <pubDate>Mon, 15 Mar 2010 18:27:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/100/on10_70124_100x75.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/220/on10_70124_220x165.jpg" height="165" width="220"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_320_ch9.png" height="240" width="320"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_85_ch9.png" height="64" width="85"/>
      <media:group>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.mp3" expression="full" duration="924" fileSize="7397513" type="audio/mp3" medium="audio"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.mp4" expression="full" duration="924" fileSize="121759049" type="video/mp4" medium="video"/>
        <media:content url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.wma" expression="full" duration="924" fileSize="7481933" type="audio/x-ms-wma" medium="audio"/>
      </media:group>      
      <enclosure url="http://ecn.channel9.msdn.com/o9/ch9/7/1/2/6/3/5/DNDSurface_ch9.mp4" length="121759049" type="video/mp4"/>
      <dc:creator>Larry Larsen</dc:creator>
      <itunes:author>Larry Larsen</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/LarryLarsen/Surface--Dungeons-and-Dragons--Surfacescapes/RSS</wfw:commentRss>
      <category>Game Design</category>
      <category>Gaming</category>
      <category>Surface</category>
    </item>
  <item>
      <title>Microsoft Demos Game Playing on Windows Phone 7 Series, Xbox, and PC</title>
      <description><![CDATA[ <p>At <a shape="rect" href="http://www.teched.ae/" shape="rect">TechEd Middle East</a>, Microsoft's Eric Rudder showed the potential of Windows Phone 7 Series when he demoed a game that could run on the mobile phone, Windows PCs, and the Xbox 360. The game, in this case Indiana Jones, was created using Visual Studio which allows developers to share 90% of the game’s code across the three platforms: Xbox, Windows, and Windows Phone 7. The additional 10% of the code changes required are to implement features unique to each platform – like touch sensitivity and accelerometer support for phones or mouse support on PCs, for example. </p><p>What’s even more amazing, perhaps, than the cross-platform support was that Rudder was able to continue playing his game on the Xbox from where he left off on the mobile device. Amazing!</p><p>You can see a video of Rudder’s demo <a shape="rect" href="http://www.youtube.com/watch?v=LQv_3fwopo8&amp;feature=player_embedded" shape="rect">here</a>. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:d3a8b2c6afba49edbeb79e0e00784e9a">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Microsoft-Demos-Game-Playing-on-Windows-Phone-7-Series-Xbox-and-PC</comments>
      <itunes:summary> At TechEd Middle East, Microsoft&#39;s Eric Rudder showed the potential of Windows Phone 7 Series when he demoed a game that could run on the mobile phone, Windows PCs, and the Xbox 360. The game, in this case Indiana Jones, was created using Visual Studio which allows developers to share 90% of the game’s code across the three platforms: Xbox, Windows, and Windows Phone 7. The additional 10% of the code changes required are to implement features unique to each platform – like touch sensitivity and accelerometer support for phones or mouse support on PCs, for example. What’s even more amazing, perhaps, than the cross-platform support was that Rudder was able to continue playing his game on the Xbox from where he left off on the mobile device. Amazing!You can see a video of Rudder’s demo here. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Microsoft-Demos-Game-Playing-on-Windows-Phone-7-Series-Xbox-and-PC</link>
      <pubDate>Tue, 09 Mar 2010 19:00:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Microsoft-Demos-Game-Playing-on-Windows-Phone-7-Series-Xbox-and-PC</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_1cbaf42c-cb92-4445-92d5-c3e66cec6191.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_db37cfb6-d63e-469b-9562-bcfb12309ee6.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Microsoft-Demos-Game-Playing-on-Windows-Phone-7-Series-Xbox-and-PC/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Windows Mobile</category>
      <category>Xbox 360</category>
      <category>game</category>
    </item>
  <item>
      <title>TweetCraft 2.0 source code posted!</title>
      <description><![CDATA[
<p>Just posted the updated source code to TweetCraft 2.0.&nbsp; Head over to <a title="http://tweetcraft.codeplex.com/SourceControl/list/changesets" href="http://tweetcraft.codeplex.com/SourceControl/list/changesets">
http://tweetcraft.codeplex.com/SourceControl/list/changesets</a> to check it out.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:1dcfc8d7ae684f0eb2bf9e7600ca0f44">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-source-code-posted</comments>
      <itunes:summary>
Just posted the updated source code to TweetCraft 2.0.&amp;nbsp; Head over to 
http://tweetcraft.codeplex.com/SourceControl/list/changesets to check it out.
</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-source-code-posted</link>
      <pubDate>Wed, 17 Feb 2010 17:16:49 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-source-code-posted</guid>      
      <dc:creator>Clint Rutkas</dc:creator>
      <itunes:author>Clint Rutkas</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-source-code-posted/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Web Services</category>
      <category>c4fnews</category>
      <category>LUA</category>
      <category>TweetCraft</category>
    </item>
  <item>
      <title>TweetCraft 2.0 released!</title>
      <description><![CDATA[
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9964773/WowTweetCraftUI_1.1_5B1_5D_2.jpg"><img title="WowTweetCraftUI_1.1[1]" border="0" alt="WowTweetCraftUI_1.1[1]" align="right" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9964773/WowTweetCraftUI_1.1_5B1_5D_thumb.jpg" width="179" height="240"></a>
 If you like twitter and World of Warcraft, check out the Coding4Fun project, <a href="http://tweetcraft.codeplex.com/">
TweetCraft</a>.&nbsp; </p>
<p>Version 2.0 brings some new features and bug fixes.</p>
<p><b>Bug fixes</b></p>
<ul>
<li>Fixed: Twitter connection and authentication issues </li><li>Removed: The Windows pop-up messages whenever Twitter's service goes down. You can now right-click on the TweetCraft icon to see what the current status is
</li><li>Removed: The use of LibDataBroker (LDB) for anything besides registering ourselves for other addons like ChocolateBar.
</li></ul>
<br>
<b>New Features</b>
<ul>
<li>In-game help, setup information and how to use TweetCraft </li><li>Auto-updates: The TweetCraft client will now check for and let you know when updates are available.
</li><li>Curse deployment: The TweetCraft add-on is also now distributed through the Curse client so that you can easily get changes to just the addon without having to install TweetCraft again. Note that you will still need to have the TweetCraft Client installed
 in addition to the TweetCraft Wow AddOn for TweetCraft to work properly. </li><li>Auto-screenshot Achievements: You can optionally have TweetCraft automatically take a screenshot of when you receive an achievement and have it posted using TwitPic.
</li></ul>
<p><a href="http://tweetcraft.codeplex.com/SourceControl/list/changesets">Full source code will be available on CodePlex shortly for TweetCraft</a> version 2.0 and if you want to know how this was build, check out the
<a href="http://www.amazon.com/Coding4fun-Programming-Projects-Wiimote-Warcraft/dp/0596520743/">
World of Warcraft RSS Feeder in the Coding4Fun book</a>.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:76d1c24c5bc344c0817e9e7600ca1aec">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-released</comments>
      <itunes:summary>

 If you like twitter and World of Warcraft, check out the Coding4Fun project, 
TweetCraft.&amp;nbsp; 
Version 2.0 brings some new features and bug fixes.
Bug fixes

Fixed: Twitter connection and authentication issues Removed: The Windows pop-up messages whenever Twitter&#39;s service goes down. You can now right-click on the TweetCraft icon to see what the current status is
Removed: The use of LibDataBroker (LDB) for anything besides registering ourselves for other addons like ChocolateBar.


New Features

In-game help, setup information and how to use TweetCraft Auto-updates: The TweetCraft client will now check for and let you know when updates are available.
Curse deployment: The TweetCraft add-on is also now distributed through the Curse client so that you can easily get changes to just the addon without having to install TweetCraft again. Note that you will still need to have the TweetCraft Client installed
 in addition to the TweetCraft Wow AddOn for TweetCraft to work properly. Auto-screenshot Achievements: You can optionally have TweetCraft automatically take a screenshot of when you receive an achievement and have it posted using TwitPic.

Full source code will be available on CodePlex shortly for TweetCraft version 2.0 and if you want to know how this was build, check out the

World of Warcraft RSS Feeder in the Coding4Fun book.
</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-released</link>
      <pubDate>Tue, 16 Feb 2010 23:19:41 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-released</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9964773_100.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9964773_220.jpg" height="165" width="220"/>      
      <dc:creator>Clint Rutkas</dc:creator>
      <itunes:author>Clint Rutkas</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/blog/TweetCraft-20-released/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Web Services</category>
      <category>c4fnews</category>
      <category>LUA</category>
      <category>TweetCraft</category>
    </item>
  <item>
      <title>New Sidewinder Keyboard Solves Ghosting Problem</title>
      <description><![CDATA[ <p>“Ghosting” is a problem which refers to the inability of most keyboards to read more than two key presses at once. Because of the way keyboards are designed – with a stack of plastic sheets to create a grid of wires underneath – pressing more than a couple of keys the same time leads problems in the keyboard’s ability to know what other keys were pressed. Only the first two are reported and the others become “ghosts.” (See a more thorough explanation of this over on <a shape="rect" href="http://www.techflash.com/seattle/2010/02/microsoft_keyboard_will_let_gamers_smoosh_26_keys_at_once.html">TechFlash</a>).&nbsp; </p><p>For gamers, ghosting can be a major problem. Previous attempts at solving the issue have resulted in anti-ghosting keyboards from Razer and Logitech which have allowed between 5 and 10 simultaneous key presses. However, the new Microsoft SideWinder X4 gaming keyboard is the first to offer an all-over anti-ghosting solution. </p><p>With this new device, you can press up to 26 keys at the same time. That may be a bit of overkill, actually. I don’t know of any games that require you to push <em>that </em>many buttons at once, but gamers will certainly appreciate the possibility. </p><p>The new keyboard is due out in March of this year and will sell for $59.99. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:b34ceab0485f46619db79e0e00f910b9">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/New-Sidewinder-Keyboard-Solves-Ghosting-Problem</comments>
      <itunes:summary> “Ghosting” is a problem which refers to the inability of most keyboards to read more than two key presses at once. Because of the way keyboards are designed – with a stack of plastic sheets to create a grid of wires underneath – pressing more than a couple of keys the same time leads problems in the keyboard’s ability to know what other keys were pressed. Only the first two are reported and the others become “ghosts.” (See a more thorough explanation of this over on TechFlash).&amp;nbsp; For gamers, ghosting can be a major problem. Previous attempts at solving the issue have resulted in anti-ghosting keyboards from Razer and Logitech which have allowed between 5 and 10 simultaneous key presses. However, the new Microsoft SideWinder X4 gaming keyboard is the first to offer an all-over anti-ghosting solution. With this new device, you can press up to 26 keys at the same time. That may be a bit of overkill, actually. I don’t know of any games that require you to push that many buttons at once, but gamers will certainly appreciate the possibility. The new keyboard is due out in March of this year and will sell for $59.99. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/New-Sidewinder-Keyboard-Solves-Ghosting-Problem</link>
      <pubDate>Wed, 03 Feb 2010 19:41:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/New-Sidewinder-Keyboard-Solves-Ghosting-Problem</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/100/on10_70028_100x75.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/220/on10_70028_220x165.jpg" height="165" width="220"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_33bb27de-d75f-4ff9-bd02-1a6f8814a5fc.jpg" height="161" width="320"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_cd89b299-7152-4754-9632-9b98699bbed3.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/New-Sidewinder-Keyboard-Solves-Ghosting-Problem/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>keyboard</category>
      <category>keyboards</category>
      <category>Sidewinder</category>
      <category>Gaming hardware</category>
    </item>
  <item>
      <title>Making an Ocean with XNA</title>
      <description><![CDATA[
<p>In this article, Louis Ingenthron will show you how to create a simple endless ocean for an XNA C# game.</p>
<h3>Introduction</h3>
<p>Every game needs boundaries, such as a window separating the player from space or a brick wall. When I first played Splinter Cell: Double Agent's Cozumel Cruise level, I spent a good 5 minutes just looking at the ocean that kept the player in bounds. It
 was a beautiful sunset with waves moving across the ocean endlessly outward... and it was neat.</p>
<p>When I was tasked with creating a great ocean for a Caribbean pirate game, I knew it had to look great, like Splinter Cell's. Too many games, especially indie games, just put a cheap texture or two on a blue quad. But in my opinion, having a great looking
 boundary like an ocean can really tie your environment together and add a layer of polish.</p>
<p>Now, just to clarify: we aren't going for the ocean in Crysis here. We want something that looks good and seems to be endless, so most of our work will be in the DirectX 9 Shaders. We will be using C# and XNA to build a project around it (XNA is fantastic
 for rapid development and tech demos, as well as its full Indie Games Distribution system).</p>
<h4>Getting Started</h4>
<p>Let's take a look at the base project. You should be able to compile and run it on the spot. When you get in, you will be able to turn the camera with the mouse and move with WASD (or use the first gamepad with standard FPS controls if you converted to run
 on Xbox360), but all that's there is the skybox at an infinite distance away. I won't go into rendering skyboxes in this article because there are
<a href="http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Skybox.php">many</a>
<a href="http://www.miszalok.de/C_3D_XNA/C6_Skybox/XNAC6_e.htm">articles</a> <a href="http://www.toymaker.info/Games/XNA/html/xna_skybox.html">
about it</a> <a href="http://www.dotnetkicks.com/xna/Skybox_in_XNA_using_only_Two_Triangles">
already</a>. But you should be familiar with the concept of Cube Maps, which are basically six square textures representing the six faces of a cube.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image002_2.jpg"><img title="clip_image002" border="0" alt="clip_image002" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image002_thumb.jpg" width="422" height="317"></a></p>
<p>So, let's get right into the code. We'll start with a big blue plane. Open up Ocean.cs. You will notice that we already have some code in here. We have some vertices set up in the Load() function and a vertex declaration created (Again, in this article I
 assume you have a basic understanding of 3D rendering). These vertices will create two triangles that make a very large XZ plane at Y=0. Since our ocean will be processed only in the pixel shader, the plane should be much larger than your far-clip plane set
 up in your projection matrix. So let's draw the plane. In the Ocean's Draw() function, add these lines:</p>
<p><b>C# </b></p>
<pre class="csharpcode">Global.Graphics.VertexDeclaration = OceanVD;
Global.Graphics.DrawUserPrimitives&lt;VertexPositionNormalTexture&gt;
    (PrimitiveType.TriangleList, OceanVerts, 0, 2);</pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
	{font-size:small;
	color:black;
	font-family:consolas,"Courier New",courier,monospace;
	background-color:#ffffff}
.csharpcode 
	{margin:0em}
.csharpcode .rem
	{color:#008000}
.csharpcode .kwrd
	{color:#0000ff}
.csharpcode .str
	{color:#006080}
.csharpcode .op
	{color:#0000c0}
.csharpcode .preproc
	{color:#cc6633}
.csharpcode .asp
	{background-color:#ffff00}
.csharpcode .html
	{color:#800000}
.csharpcode .attr
	{color:#ff0000}
.csharpcode .alt
	{background-color:#f4f4f4;
	width:100%;
	margin:0em}
.csharpcode .lnum
	{color:#606060}
-->
</style>
<p>This code tells the graphics device what kind of vertex we are using, and tells it to draw two consecutive triangles. But XNA uses only Shaders; it doesn't support fixed function.</p>
<p>Let's go over to our Solution Explorer. Right click on the Content project in our game project, and click Add -&gt; New Item. Choose the &quot;Effect File&quot; template and name it OceanShader.fx. We are just testing to get the quads on there now, so we won't do much
 in this effect file yet. I cleaned up the pre-generated comments and changed the pixel shader return value to float4(0,0,1,1) to make it blue instead of red.</p>
<p>Now, let's go back to Ocean.cs. We need to add a new class variable for the shader. This is encompassed by the Microsoft.Xna.Framework.Graphics.Effect class. We add this to the top of the class:<b>
</b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// the ocean's required content</span>
<span class="kwrd">private</span> Effect oceanEffect; </pre>
<p>And we actually link that to our FX file in the load function with this:<b> </b>
</p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// load the shader</span>
oceanEffect = Content.Load&lt;Effect&gt;(<span class="str">&quot;OceanShader&quot;</span>); </pre>
<p></p>
<p>Now we just need to set the shader variables in the draw function and tell the shader to begin and end. Our draw function now looks like this:<b>
</b></p>
<p><b>C# </b></p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">void</span> Draw(GameTime gameTime, Camera cam, 
        TextureCube skyTexture, Matrix proj)
{
    <span class="rem">// start the shader</span>
    oceanEffect.Begin();
    oceanEffect.CurrentTechnique.Passes[0].Begin();

    <span class="rem">// set the transforms</span>
    oceanEffect.Parameters[<span class="str">&quot;World&quot;</span>].SetValue(Matrix.Identity);
    oceanEffect.Parameters[<span class="str">&quot;View&quot;</span>].SetValue(cam.GetViewMatrix());
    oceanEffect.Parameters[<span class="str">&quot;Projection&quot;</span>].SetValue(proj);

    oceanEffect.CommitChanges();

    <span class="rem">// draw our geometry</span>
    Global.Graphics.VertexDeclaration = OceanVD;
    Global.Graphics.DrawUserPrimitives&lt;VertexPositionNormalTexture&gt;
        (PrimitiveType.TriangleList, OceanVerts, 0, 2);

    <span class="rem">// and we're done!</span>
    oceanEffect.CurrentTechnique.Passes[0].End();
    oceanEffect.End();
}</pre>
<style type="text/css">
<!--
.csharpcode, .csharpcode 
	{font-size:small;
	color:black;
	font-family:consolas,"Courier New",courier,monospace;
	background-color:#ffffff}
.csharpcode 
	{margin:0em}
.csharpcode .rem
	{color:#008000}
.csharpcode .kwrd
	{color:#0000ff}
.csharpcode .str
	{color:#006080}
.csharpcode .op
	{color:#0000c0}
.csharpcode .preproc
	{color:#cc6633}
.csharpcode .asp
	{background-color:#ffff00}
.csharpcode .html
	{color:#800000}
.csharpcode .attr
	{color:#ff0000}
.csharpcode .alt
	{background-color:#f4f4f4;
	width:100%;
	margin:0em}
.csharpcode .lnum
	{color:#606060}
-->
</style>
<p>Before we draw, we must first begin an Effect and an EffectPass. Since we only have one pass in our shader, we can just begin the first one. Next, we set the Transform matrices defined in the shader (<a href="http://drunkenhyena.com/cgi-bin/view_cpp_article.pl?chapter=2;article=27">Read
 here</a> for more information on the transform matrices). Then we tell the Effect to CommitChanges(), which basically flushes the parameter changes down the tube to the graphics card so we can draw. Now we see our old code to draw the plane. Finally, we end
 the EffectPass and the Effect. The program should run now, with a big blue plane where your ocean is.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image004_2.jpg"><img title="clip_image004" border="0" alt="clip_image004" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image004_thumb.jpg" width="423" height="317"></a></p>
<h4>Skymap Reflections</h4>
<p>One of the best ways to make water look really neat is to add reflection. Ever seen a snow-covered mountain reflected on the surface of a lake? It's gorgeous. Let's make our ocean reflect the sky. Go back to the OceanShader.fx file. This is where we will
 do the majority of our work. We need to give the shader the sky cubemap. Add this parameter to the top of the FX file:<b>
</b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">textureCUBE cubeTex;
samplerCUBE CubeTextureSampler = sampler_state
{
    Texture = &lt;cubeTex&gt;;
    MinFilter = anisotropic;
    MagFilter = anisotropic;
    MipFilter = anisotropic;
    AddressU = wrap;
    AddressV = wrap;
};</pre>
<p>Next, we need to replace the Vertex structures with ones that match the actual vertices. They should look something like this:<b>
</b></p>
<p><b>HLSL </b></p>
<pre class="csharpcode"><span class="kwrd">struct</span> VertexShaderInput
{
    float3 Position            : POSITION0;
    float3 normal              : NORMAL0;
    float2 texCoord            : TEXCOORD0;
};

<span class="kwrd">struct</span> VertexShaderOutput
{
    float4 Position            : POSITION0;
    float2 texCoord            : TEXCOORD0;
    float3 worldPos         : TEXCOORD1;
};</pre>
<p>We've now added two variables. The texCoord is pretty simple. We just pass it along (and multiply it). The worldPos is already calculated for us, so we can just assign it. Since it's an ocean, we can just assume that the normal vector is straight up (why
 would we have a slanted ocean?). Our vertex shader should look like this:<b> </b>
</p>
<p><b>HLSL </b></p>
<pre class="csharpcode">VertexShaderOutput output;

float4 worldPosition = mul(float4(input.Position,1), World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
    
output.texCoord = input.texCoord*100;
output.worldPos = worldPosition.xyz;

<span class="kwrd">return</span> output;</pre>
<p>To do reflections, we need one more variable. A reflection off a surface requires a source vector and a surface normal vector. We can create our source vector by subtracting the camera position from the input's world position. To get the camera position,
 we could extract it from the View Matrix, but that's a pain. Instead, we'll just add a float3 variable to the top of our FX file like so:<b>
</b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float3 EyePos; </pre>
<p></p>
<p>Now we update our pixel shader function:<b> </b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float3 diffuseColor = float4(0,0,1,1);
float3 normal = float3(0,1,0);
float3 cubeTexCoords = reflect(input.worldPos-EyePos,normal);
float3 cubeTex = texCUBE(CubeTextureSampler,cubeTexCoords).rgb;

<span class="kwrd">return</span> float4((cubeTex*0.8)&#43;(diffuseColor*0.2),1); </pre>
<p></p>
<p>So what is this actually doing? First we set up the diffuseColor, which is the color of the ocean itself, blue, which keeps it from looking like a big mirror. Next we assume the normal is straight up (We'll change this later). Then we need to get the texture
 coordinates for the skymap. We will reflect the vector from the eye off of the surface normal. Cubemaps take 3-component vectors, and don't even need them to be normalized, so that's all we need there. Then we use those coordinates and actually store the texture
 lookup's RGB values (what sky has an alpha?). Finally, we combine 80% of the reflected sky color with 20% of the diffuse color. Can we run it now? Well, no. We defined those variables up top, but never set them. Let's go back to the Ocean.cs and add in some
 more parameter mutators:<b> </b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode">oceanEffect.Parameters[<span class="str">&quot;EyePos&quot;</span>].SetValue(cam.Position);
<span class="rem">// set the sky texture</span>
oceanEffect.Parameters[<span class="str">&quot;cubeTex&quot;</span>].SetValue(skyTexture); </pre>
<p></p>
<p>Now we can run it! You should see a big flat body of blue water that reflects the sky. Cool, huh? But it's not very watery yet, is it?</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image006_2.jpg"><img title="clip_image006" border="0" alt="clip_image006" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image006_thumb.jpg" width="428" height="321"></a></p>
<h3>Normal Mapping</h3>
<p>Let's add some chop to the surface. Four normal maps are already be included in the Content project, so we just need to add a Texture2D array to our Ocean class and load in these textures. We'll call the texture array OceanNormalMaps:<b>
</b></p>
<p><b>C# </b></p>
<pre class="csharpcode"><span class="kwrd">private</span> Texture2D[] OceanNormalMaps; </pre>
<p>And load them in the Load() function like this:<b> </b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// load the normal maps</span>
OceanNormalMaps = <span class="kwrd">new</span> Texture2D[4];
<span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; 4; i&#43;&#43;)
    OceanNormalMaps[i] = Content.Load&lt;Texture2D&gt;(<span class="str">&quot;Ocean&quot;</span> &#43; (i &#43; 1) &#43; <span class="str">&quot;_N&quot;</span>);</pre>
<p></p>
<p>What are we going to do with these textures? It's simple really: we'll lerp between them. Switch to the FX file and add two new texture registers (we'll only be lerping between two at any given time) and a float for the actual lerping value:<b>
</b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">float</span> textureLerp;

texture2D normalTex;
sampler2D NormalTextureSampler = sampler_state
{
    Texture = &lt;normalTex&gt;;
    MinFilter = anisotropic;
    MagFilter = anisotropic;
    MipFilter = anisotropic;
    AddressU = wrap;
    AddressV = wrap;
};

texture2D normalTex2;
sampler2D NormalTextureSampler2 = sampler_state
{
    Texture = &lt;normalTex2&gt;;
    MinFilter = anisotropic;
    MagFilter = anisotropic;
    MipFilter = anisotropic;
    AddressU = wrap;
    AddressV = wrap;
};</pre>
<p>Next, we change our pixel shader code:<b> </b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float3 diffuseColor = float4(0,0,1,1);
    
float4 normalTexture1 = tex2D(NormalTextureSampler, input.texCoord);
float4 normalTexture2 = tex2D(NormalTextureSampler2, input.texCoord);
float4 normalTexture = (textureLerp*normalTexture1)&#43;
            ((1-textureLerp)*normalTexture2);
    
float3 normal = ((normalTexture)*2)-1;
normal.xyz = normal.xzy;
normal = normalize(normal);
    
float3 cubeTexCoords = reflect(input.worldPos-EyePos,normal);
    
float3 cubeTex = texCUBE(CubeTextureSampler,cubeTexCoords).rgb;
    
<span class="kwrd">return</span> float4((cubeTex*0.8)&#43;(diffuseColor*0.2),1); </pre>
<p>Alright, let's take a look at this. The first new thing we do is sample the new normal maps and lerp between them with the value declared earlier. Nothing too complex there. But then we need to convert the RGB value into a normal. You'll notice that we take
 the RGB, multiply by 2 and subtract by one. This simply takes the compressed RGB [0:1] value and converts it to [-1:1] for a full range of normals. The next line re-orders the normal's components. This is because the normal map is traditionally on the XY plane,
 but our ocean is on the XZ plane—so we swap the Y and Z components. Finally, we normalize our normal. Always normalize your normals! Everything after that is the same as before. Let's go set these variables we defined and get this thing working. Go back to
 Ocean.cs and add this code to the draw:<b> </b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// choose and set the ocean textures</span>
<span class="kwrd">int</span> oceanTexIndex = ((<span class="kwrd">int</span>)(gameTime.TotalGameTime.TotalSeconds) % 4);
oceanEffect.Parameters[<span class="str">&quot;normalTex&quot;</span>].SetValue(
    OceanNormalMaps[(oceanTexIndex &#43; 1) % 4]);

oceanEffect.Parameters[<span class="str">&quot;normalTex2&quot;</span>].SetValue(
    OceanNormalMaps[(oceanTexIndex) % 4]);

oceanEffect.Parameters[<span class="str">&quot;textureLerp&quot;</span>].SetValue(
    (((((<span class="kwrd">float</span>)gameTime.TotalGameTime.TotalSeconds) - 
    (<span class="kwrd">int</span>)(gameTime.TotalGameTime.TotalSeconds)) * 2 - 1) * 0.5f) 
    &#43; 0.5f); </pre>
<p>You can do the math on this if you want, but basically it just cycles through the four textures and sets the lerp value so it's a continuous shift. After all that, you should have an interesting image when you run the program!</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image008_2.jpg"><img title="clip_image008" border="0" alt="clip_image008" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image008_thumb.jpg" width="428" height="321"></a></p>
<h3>Animate and Blend</h3>
<p>Now we have something that resembles water. But when was the last time you saw water that just moved up and down—especially in the ocean? Let's animate this a bit! The first thing we'll do is make the texture coordinates scroll based on time. Let's add a
 time float to the top of the FX file:<b> </b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode"><span class="kwrd">float</span> time = 0;</pre>
<p></p>
<p><b></b></p>
<p>Next, let's scroll the texture coordinates in the normal map lookup:<b> </b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float4 normalTexture1 = tex2D(NormalTextureSampler, 
    input.texCoord&#43;float2(time,time));
float4 normalTexture2 = tex2D(NormalTextureSampler2, 
    input.texCoord&#43;float2(time,time));</pre>
<p></p>
<p>Now, simply set the time parameter in the Ocean.cs's Draw():<b></b></p>
<p><b>C# <br>
</b></p>
<pre class="csharpcode"><span class="rem">// set the time used for moving waves</span>
oceanEffect.Parameters[<span class="str">&quot;time&quot;</span>].SetValue(
    (<span class="kwrd">float</span>)gameTime.TotalGameTime.TotalSeconds * 0.02f);</pre>
<p></p>
<p>Your water should be moving now if you run it.</p>
<p>There is one more enhancement we can do. What's better than having one moving surface? How about two? It's basically parallax normal mapping. We will change our pixel shader code to look like this:<b>
</b></p>
<p><b>HLSL <br>
</b></p>
<pre class="csharpcode">float3 diffuseColor = float4(0,0,1,1);
    
float4 normalTexture1 = tex2D(NormalTextureSampler, 
    input.texCoord*0.1&#43;float2(time,time));

float4 normalTexture2 = tex2D(NormalTextureSampler2, 
    input.texCoord*0.1&#43;float2(time,time));

float4 normalTexture = (textureLerp*normalTexture1) &#43;
    ((1-textureLerp)*normalTexture2);

float4 normalTexture3 = tex2D(NormalTextureSampler, 
    input.texCoord*2&#43;float2(-time,-time*2));

float4 normalTexture4 = tex2D(NormalTextureSampler2, 
    input.texCoord*2&#43;float2(-time,-time*2));

float4 normalTextureDetail = (textureLerp*normalTexture3) &#43;
    ((1-textureLerp)*normalTexture4);
    
float3 normal = (((0.5*normalTexture) &#43; 
    (0.5*normalTextureDetail))*2) - 1;

normal.xyz = normal.xzy;
normal = normalize(normal);
    
float3 cubeTexCoords = reflect(input.worldPos-EyePos,normal);
    
float3 cubeTex = texCUBE(CubeTextureSampler,cubeTexCoords).rgb;
    
<span class="kwrd">return</span> float4((cubeTex*0.8)&#43;(diffuseColor*0.2),1); </pre>
<p>What we did here is add two separate, lerping texture coordinates together. The 1 and 2 have been scaled by 0.1, making the waves much larger. The 3 and 4 lookups are scaled by 2 so they are much smaller, and move much faster in the opposite direction. This
 makes it look like the ocean has an overall current and some smaller waves simulating wind. The pixels are then combined before being converted to normals. Go ahead and run it. You should see your nice, new ocean!</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image010_2.jpg"><img title="clip_image010" border="0" alt="clip_image010" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9954238/clip_image010_thumb.jpg" width="428" height="321"></a></p>
<h3>Conclusion</h3>
<p>And there you have it: a nice, infinite ocean! Since the majority of the work is done in the pixel shader, it will go on to the very end of the depth buffer and tile infinitely. Also, this is best when you are only looking out at it. It becomes somewhat
 apparent to the user if you are looking at the level on the ocean and only the sky, not the level, reflects properly. You may also notice that the ocean looks a bit cartoony in our example, but the good news is that this is merely an effect of the skybox being
 done in a soft pastel style. A more realistic skybox means a more realistic ocean.</p>
<p>I'm looking forward to seeing how people use this effect! If you use it, please
<a href="mailto:louisingenthron@fvproductions.org">send me an email</a> with a screenshot.</p>
<h3>About The Author</h3>
<p>Louis Ingenthron is a Game Developer in Orlando, FL. He works on commercial Console and PC titles, but runs his own Indie Games company,
<a href="http://fvproductions.org/">FV Productions</a>, on the side. He is best known for his open source XNA rhythm game Unsigned and specializes in real-time Graphics programming. He has been working with XNA since the 2.0 Beta and with .NET C# for just as
 long. He is also familiar with several other development languages, such as C, C&#43;&#43;, and Java. Occasionally, he can even be found doing web development and Flash. Louis also writes for MSDN's Coding4Fun website, contributing articles on a monthly basis.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:aaaa00bc9a6a41a4a0699e7600ca3a30">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Making-an-Ocean-with-XNA</comments>
      <itunes:summary>
In this article, Louis Ingenthron will show you how to create a simple endless ocean for an XNA C# game.
Introduction
Every game needs boundaries, such as a window separating the player from space or a brick wall. When I first played Splinter Cell: Double Agent&#39;s Cozumel Cruise level, I spent a good 5 minutes just looking at the ocean that kept the player in bounds. It
 was a beautiful sunset with waves moving across the ocean endlessly outward... and it was neat.
When I was tasked with creating a great ocean for a Caribbean pirate game, I knew it had to look great, like Splinter Cell&#39;s. Too many games, especially indie games, just put a cheap texture or two on a blue quad. But in my opinion, having a great looking
 boundary like an ocean can really tie your environment together and add a layer of polish.
Now, just to clarify: we aren&#39;t going for the ocean in Crysis here. We want something that looks good and seems to be endless, so most of our work will be in the DirectX 9 Shaders. We will be using C# and XNA to build a project around it (XNA is fantastic
 for rapid development and tech demos, as well as its full Indie Games Distribution system).
Getting Started
Let&#39;s take a look at the base project. You should be able to compile and run it on the spot. When you get in, you will be able to turn the camera with the mouse and move with WASD (or use the first gamepad with standard FPS controls if you converted to run
 on Xbox360), but all that&#39;s there is the skybox at an infinite distance away. I won&#39;t go into rendering skyboxes in this article because there are
many
articles 
about it 
already. But you should be familiar with the concept of Cube Maps, which are basically six square textures representing the six faces of a cube.

So, let&#39;s get right into the code. We&#39;ll start with a big blue plane. Open up Ocean.cs. You will notice that we already have some code in here. We have some vertices set up in the Load() function and a vertex declaration created (Again, in t</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Making-an-Ocean-with-XNA</link>
      <pubDate>Wed, 27 Jan 2010 16:00:45 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Making-an-Ocean-with-XNA</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9954238_100.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9954238_220.jpg" height="165" width="220"/>      
      <dc:creator>Louis Ingenthron </dc:creator>
      <itunes:author>Louis Ingenthron </itunes:author>
      <slash:comments>5</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Making-an-Ocean-with-XNA/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>XNA</category>
      <category>HSL</category>
    </item>
  <item>
      <title>Look Behind SurfaceScapes</title>
      <description><![CDATA[You may remember the&nbsp;<a shape="rect" href="http://blogs.msdn.com/surface/archive/2009/10/19/dungeons-dragons-done-right-on-microsoft-surface.aspx" shape="rect">Dungeons and Dragons demo video</a> that was out in October using Microsoft Surface. Eric Havir on the Surface Blog has an interview with the student led project along with a status of the project. Read the Q&amp;A <a shape="rect" href="http://blogs.msdn.com/surface/archive/2009/12/08/bringing-d-d-to-microsoft-surface.aspx" shape="rect">here</a>.  <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:35dda3f1fe2f4cc9a31b9e1000ffbfaf">]]></description>
      <comments>http://channel9.msdn.com/Blogs/LarryLarsen/Look-Behind-SurfaceScapes</comments>
      <itunes:summary>You may remember the&amp;nbsp;Dungeons and Dragons demo video that was out in October using Microsoft Surface. Eric Havir on the Surface Blog has an interview with the student led project along with a status of the project. Read the Q&amp;amp;A here. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/LarryLarsen/Look-Behind-SurfaceScapes</link>
      <pubDate>Fri, 18 Dec 2009 16:50:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/LarryLarsen/Look-Behind-SurfaceScapes</guid>      
      <dc:creator>Larry Larsen</dc:creator>
      <itunes:author>Larry Larsen</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/LarryLarsen/Look-Behind-SurfaceScapes/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Surface Computer</category>
    </item>
  <item>
      <title>Playfire: A Growing Network for Gamers</title>
      <description><![CDATA[ <p><a shape="rect" href="http://www.playfire.com/a/welcome" shape="rect">Playfire</a>, a social network for gamers, lets you track your scores and rankings on services like Xbox 360, Playstation 3, PSP, and others while also engaging in discussions with fellow gamers, viewing game-related content like photos and videos, building your own virtual game collection, and more. Originally launched early last year, the company is now boasting 250,000 members with 100,000 added in October 2009 alone, <a shape="rect" href="http://eu.techcrunch.com/2009/11/10/confirmed-gamer-social-network-playfire-secures-2-1m-series-a/" shape="rect">reports TechCrunch</a>. <em>(The site itself says they have 245,000&#43; gamers, however).</em> Playfire also recently took in additional funding which the company plans to use to expand their development team and accelerate their growth, notes the article. </p><p>Once logged in, users can track over 40,000 game titles, meet fellow gamers from around the world, join groups, take quizzes, and build a free website for their clan or guild.&nbsp;&nbsp; </p><p>If you haven’t checked out Playfire before (or it’s been awhile), you may want to take a look. The company revamped their homepage earlier this month with a fresh design that loads faster and makes accessing the various parts of the website much easier than before. </p><p><a shape="rect" href="http://www.playfire.com/a/welcome" shape="rect">Playfire</a> is free to join – there are no “premium” features you have to pay for. It’s just your typical niche social networking site. Interested gamers can sign up <a shape="rect" href="http://www.playfire.com/a/welcome" shape="rect">here</a> for an account. </p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:9e3f196066d04a3c841b9e0e0077a217">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Playfire-A-Growing-Network-for-Gamers</comments>
      <itunes:summary> Playfire, a social network for gamers, lets you track your scores and rankings on services like Xbox 360, Playstation 3, PSP, and others while also engaging in discussions with fellow gamers, viewing game-related content like photos and videos, building your own virtual game collection, and more. Originally launched early last year, the company is now boasting 250,000 members with 100,000 added in October 2009 alone, reports TechCrunch. (The site itself says they have 245,000&amp;#43; gamers, however). Playfire also recently took in additional funding which the company plans to use to expand their development team and accelerate their growth, notes the article. Once logged in, users can track over 40,000 game titles, meet fellow gamers from around the world, join groups, take quizzes, and build a free website for their clan or guild.&amp;nbsp;&amp;nbsp; If you haven’t checked out Playfire before (or it’s been awhile), you may want to take a look. The company revamped their homepage earlier this month with a fresh design that loads faster and makes accessing the various parts of the website much easier than before. Playfire is free to join – there are no “premium” features you have to pay for. It’s just your typical niche social networking site. Interested gamers can sign up here for an account. </itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Playfire-A-Growing-Network-for-Gamers</link>
      <pubDate>Sat, 05 Dec 2009 20:32:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Playfire-A-Growing-Network-for-Gamers</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_8d6b5fa1-4f21-4538-b6ca-24584feee928.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_ba380d0b-9f03-47e4-a15a-129be8d285da.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Playfire-A-Growing-Network-for-Gamers/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Social Networks</category>
      <category>Xbox</category>
      <category>Xbox 360</category>
      <category>Social Networking</category>
      <category>social network</category>
    </item>
  <item>
      <title>Creating a Pinball Game in Silverlight: Using the Physics Helper Library + Farseer Physics</title>
      <description><![CDATA[
<p>In this tutorial, we'll create a Silverlight pinball game using <u>Behaviors</u><b>,
</b>a new addition to Expression Blend 3 &amp; Silverlight that allows you to create interactivity with little or no coding.
</p>
<p>Below you'll find a video and step-by-step walkthrough. </p>

<h3>Videos:</h3>
<ul>
<li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-1-of-10/">Part 1</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-2-of-10/">Part 2</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-3-of-10/">Part 3</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-4-of-10/">Part 4</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-5-of-10/">Part 5</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-6-of-10/">Part 6</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-7a-of-10/">Part 7a</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-7b-of-10/">Part 7b</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-8-of-10/">Part 8</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-9-of-10/">Part 9</a>
</li><li><a href="http://channel9.msdn.com/posts/Clint/Silverlight-Pinball-with-Farseer-Physics-Part-10-of-10/">Part 10</a></li></ul>
<h3>Setup and Prerequisites</h3>
<p>First you have to setup Physics Helper controls into Expression Blend. Follow these steps:</p>
<ol>
<li>Download the Physics Helper ZIP file from <a href="http://physicshelper.codeplex.com/Release/ProjectReleases.aspx">
http://physicshelper.codeplex.com/Release/ProjectReleases.aspx</a> </li><li>Extract the ZIP file contents and dump them into a folder. </li><li>Run <b>install.bat</b>. (Note: this copies a few required assemblies to a folder in Blend 3.<b>)</b>
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image001.jpg">
</li></ol>
<h3><a title="_Toc237838539" name="_Toc237838539"></a>Getting Started &amp; Making the Ball</h3>
<p>Next, you create the controller and the pinball. Here's how.</p>
<ol>
<li>Open Expression Blend 3 and create a new “Silverlight 3 Application &#43; Website” named PinballGame.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image002.jpg" width="400" height="324">
</li><li>Change your default layout container to a Canvas. You can do this in the Objects and Timeline panel by right-clicking LayoutRoot and selecting Change Layout Type/Canvas. Canvas layout containers are better for games because they allow for positioning of
 elements at absolute (x,y) coordinates. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image003.jpg" width="290" height="266">
</li><li>Give the application a bigger default size. Select the UserControl element in the Objects and Timeline panel. Then, in the Properties panel, change the Width to 800 and the Height to 600.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image004.png" width="269" height="190">
</li><li>Add a <b>Physics Controller Behavior</b> to our main game Canvas. From the Asset Panel, find the PhysicsController Behavior and drag it to the Objects and Timeline Panel. Then, drop it on the LayoutRoot Canvas.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image005.jpg" width="233" height="253">
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image006.jpg" width="233" height="122">
</li><li>Change a few of the PhysicsController's properties, to make it easier to use. In the Objects and Timeline Panel, select the PhysicsControllerBehavior assigned to LayoutRoot. Then, set the highlighted properties as follows in the Properties Window:
<br>
1.)&nbsp; Decrease the vertical gravity to 250 <br>
2.)&nbsp; Increase the iterations to 200. This will help with collision detection in a fast-action game.
<br>
3.)&nbsp; Set MousePickEnabled to true. This will allow us to manipulate objects with the mouse during development and testing.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image007.png" width="261" height="218">
</li><li>Create a &quot;playing field&quot; for the pinball. To do this, draw out a Rectangle onto the artboard, just off the bottom of the user control bounds. Set the properties of the Rectangle as follows:
<br>
<br>
<b>Name</b>: rectPlatform <br>
<b>Fill</b>: select a color of your choosing (light blue is selected below). <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image008.jpg" width="364" height="317">
</li><li>To make “rectPlatform” a physics element, we need to add a PhysicsObjectBehavior to it. Find the PhysicsObjectBehavior in the Assets panel and drag/drop it onto rectPlatform on the Artboard.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image009.png" width="343" height="369">
</li><li>In the Objects and Timeline Panel, select the PhysicsObjectBehavior belonging to rectPlatform. Then in the Properties Panel, set the IsStatic property to True so that the platform will stay in place.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image010.png" width="264" height="173">
</li><li>Next we'll create the ball. Draw out an Ellipse near the very top of the UserControl and set the following properties:
<br>
<b><br>
Name: </b>ellBall<b> <br>
Height</b>: 50 <br>
<b>Width</b>: 50 <br>
<b>Fill</b>: A color of your choosing. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image011.jpg" width="378" height="326">
</li><li>To make the ball a Physics Object, we need to add a PhysicsObjectBehavior to it. From the Asset Library, drag and drop a PhysicsObjectBehavior onto ellBall.
</li><li>Run the project by clicking F5. The ball should fall and hit the platform. Use the mouse to manipulate the ball.
</li></ol>
<h3><a title="_Toc237838540" name="_Toc237838540"></a>Making the Flippers</h3>
<p>In a pinball game, the Flippers are controlled by the player and are used to move the ball up the playfield. Standard pinball games have one right and one left flipper, but many games have three or more flippers located in various locations on the playfield.
 We'll create two user controls to represent the flippers – a right flipper and a left flipper – that way we can easily add as many flippers as we want to our main playfield.</p>
<ol>
<li>In the Projects Panel, right-click the PinballGame (Silverlight) project and select Add New Item. Select UserControl and name the control LeftFlipper.xaml.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image012.jpg" width="222" height="241">
</li><li>In the Objects and Timeline Panel, right-click LayoutRoot and select Change Layout Type/Canvas. This is required for the Physics Helper to work with nested User Controls.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image013.jpg" width="256" height="281">
</li><li>In the Objects and Timeline Panel, select the UserControl element and set its Width and Height to 200 x 200 pixels in the Properties Panel.
</li><li>Draw out a Rectangle that is about 200 x 50 pixels big, centered in the user control. Round the corners of the Rectangle.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image014.png" width="235" height="185">
</li><li>From the main Blend menu, select Object/Path/Convert to Path. This will create a new Path element from the Rectangle primitive. Then select the Direct Selection tool from the Toolbox, which will allow you to manipulate the individual points on the Path.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image015.png" width="37" height="84">
</li><li>Select the top, left two points on the Path and move them down so that you end up with a more “flipper like” shape:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image016.png" width="224" height="171">
</li><li>In the Toolbox, select the Selection arrow and rotate the flipper 45 degrees so that it looks similar to this (be sure the flipper is still within the bounds of the user control):
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image017.jpg" width="196" height="186">
</li><li>Right-click the flipper Path and select Group Into/Canvas. Name the Canvas <b>
cnvLeftFlipper</b> and resize it so that it surrounds the entire flipper Path. Note that you could “embellish” the cnvLeftFlipper with additional elements if you wish.
</li><li>Next we'll create a Joint so that the Flipper can rotate on an axis. We'll need something to anchor the joint to, so first let's add a small Static object to hold the Joint in place. Draw out a Rectangle at the upper left of the flipper and name the Rectangle
<b>rectHolder</b>. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image018.jpg" width="196" height="197">
</li><li>To add a Joint, we will need a UI element to visually represent where we want the joint created. You can use any element you want for this, but an Ellipse works pretty well. Draw out an Ellipse on top of the rectHolder.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image019.jpg" width="196" height="197">
</li><li>Now we can add all of the required Physics Behaviors to the User Control.
<ol>
<li>From the Asset Library, drag a PhysicsObjectBehavior to the rectHolder Rectangle. Set its IsStatic property to True. Since we don't really want to see the rectHolder in our UI, just send it to the back of the elements (Right-click, then select Order/Send
 to Back). </li><li>Drag a PhysicsObjectBehavior to the cnvLeftFlipper Canvas. Set the RestitutionCoefficent property to “0.1”. (This makes the flipper a bit more “bouncy” on collisions)
</li><li>Drag a PhysicsJointBehavior to the Ellipse. Set the Body1 property to “cnvLeftFlipper” and the Body2 property to “rectHolder”. Set the CollisionGroup to “1” and the AngleLimitLower and AngleLimitUpper to 0 and 50 respectively. Also enable the AngleSpring:
<br>
</li><li>Drag a PhysicsApplyTorqueBehavior to cnvLeftFlipper. We want to apply Torque when the user presses the Left arrow key, so we'll create a Trigger for this. Select the Behavior and in the Properties Panel, click the New Trigger button.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image021.png" width="267" height="191">&nbsp;
<br>
<br>
Select the PhysicsKeyTrigger type from the popup. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image022.jpg" width="197" height="296">
<br>
Set the Key property for the Trigger to “Left” and the TorqueValue to -100000 <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image023.png" width="264" height="187">
</li></ol>
</li><li>Build the Project so that the LeftFlipper user control is available. </li><li>Open MainPage.xaml and drag an instance of LeftFlipper from the Asset Library onto the Artboard. Position it near the bottom of the user control and slightly to the Left.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image024.jpg" width="373" height="321">
</li><li>Run the project and try the flipper with the Left arrow key. </li><li>In this step, we'll create a copy of “LeftFlipper” to make&nbsp; a “RightFlipper”. In the Projects Panel, right-click LeftFlipper.xaml and select Copy. Then right-click the PinBallGame Project and select Paste.
<br>
You now have a new User Control named “Copy of LeftFlipper.xaml”. Rename this to RightFlipper.xaml. Then in the code-behind file, make sure the Class and Constructor are also renamed to “RightFlipper”.
<br>
Change to XAML view for RightFlipper.xaml and change the x:Class attribute so that it inherits from RightFlipper:&nbsp;
<br>
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>&lt;</span><span>UserControl</span> <br><span>xmlns</span><span>=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span> <br><span>xmlns:x</span><span>=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span> <br><span>xmlns:d</span><span>=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span> <br><span>xmlns:mc</span><span>=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span> <br><span>mc:Ignorable</span><span>=&quot;d&quot;</span> <br><span>xmlns:i</span>=&amp;<span>amp</span>;<span>quotclr-namespace:System</span>.<span>Windows</span>.<span>Interactivity</span>;<span>assembly</span>=<span>System</span>.<span>Windows</span>.<span>Interactivity</span><span>&quot; <br>    xmlns:pb=&quot;</span><span>clr-namespace:Spritehand</span>.<span>PhysicsBehaviors</span>;<span>assembly</span>=<span>Spritehand</span>.<span>PhysicsBehaviors</span><span>&quot; <br>x:Class=&quot;</span><span>PinballGame</span>.<span>RightFlipper</span><span>&quot; <br>d:DesignWidth=&quot;</span><span>640</span><span>&quot; d:DesignHeight=&quot;</span><span>480</span><span>&quot; Height=&quot;</span><span>200</span><span>&quot; Width=&quot;</span><span>200</span>&quot;<span>&gt;</span></pre>
<br>
</div>
Open RightFlipper.xaml and find the pathLeftFlipper element. Rename this to pathRightFlipper. Then, rename “cnvLeftFlipper” to “cnvRightFlipper”. Rename “rectHolder” to “rectRightHolder” and position the rectHolder and joint ellipse so that they are in the
 correct location for the flipper: <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image026.png" width="163" height="159">
<br>
Modify the PhysicsJointBehavior for the joint in the Objects and Timeline Panel. Change BodyOne to “cnvRightFlipper”, BodyTwo to “rectRightHolder” and change the Angle limits so they are appropriate for the opposite flipper:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image027.png" width="264" height="219">
<br>
Select the PhysicsApplyTorqueBehavior for cnvRightFlipper in the Objects and Timeline Panel. Change the Key property for the trigger to “Right” so that it will initiate on the Right Arrow key down. Also change the TorqueValue so that it will apply torque clockwise:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image028.png" width="265" height="190">
<br>
</li><li>Add an instance of RightFlipper onto the MainPage.xaml and position it to the right of LeftFlipper.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image029.jpg" width="372" height="325">
</li><li>Test the project by clicking F5. You can now click left and right arrows keys to manipulate the paddles.
</li></ol>
<h3><a title="_Toc237838541" name="_Toc237838541"></a>Creating the Playfield &#43; Scrolling</h3>
<p>Now let's create more of a playfield for our Pinball game and add a Camera control so that the game will scroll and always follow the pinball. Feel free to tweak the design as you wish.</p>
<ol>
<li>Open MainPage.xaml in Expression Blend and zoom out by using Ctrl plus minus (Ctrl -).
</li><li>Draw out a Path using the Pen tool for the right border. Note that you can extend above the upper bounds of the User Control. Group this into a Canvas named “cnvLeftBorder” (right click the Path and select Group Into/Canvas).
</li><li>Drag a PhysicsObjectBehavior from the Asset Library onto cnvLeftBorder and set the IsStatic property to True. Also set the CollisionGroup property to “1” so that collisions will not occur between the border and the Flippers.
</li><li>Repeat Steps 2 and 3 above for the right border, naming that cnvRightBorder. You should have something similar to the following:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image030.jpg" width="281" height="267">
</li><li>Continue adding border controls and applying physics behaviors until you are happy with your playfield. Make the playfield completely closed in so that the ball cannot escape (except by the bottom trap of course!)
</li><li>You can also add more LeftFlipper and RightFlipper controls so that the player can more easily move the ball up the playfield. Here is one example playfield design:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image031.jpg" width="238" height="336">
</li><li>To enable scrolling, we can add a Camera Controller to the ball, causing the camera to follow the ball around the screen. Drag a PhysicsCameraBehavior from the Asset Library onto the ellBall element.
</li></ol>
<h3><a title="_Toc237838542" name="_Toc237838542"></a>Creating a Kicking Target</h3>
<p>Pinball games have lots of different types of targets – some are simple sensors which give points on contact, others are little toys that gobble up the ball for a few seconds. In this step, we'll create a Kicking Target, which gives points when hit by the
 ball but also kicks the ball back in the opposite direction.</p>
<ol>
<li>Create a new User Control named KickingTarget. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image032.jpg" width="203" height="220">
</li><li>Change the LayoutRoot container to a Canvas by right-clicking and selecting Change Layout Type/Canvas.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image033.jpg" width="255" height="234">
</li><li>Select the [UserControl] in the Objects and Timeline Panel and set its Width and Height to 100 x 100.
</li><li>Draw out an Ellipse that is 90x90 pixels, and positioned at Left, Top 5,5 (so that it is centered in the control).
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image034.png" width="484" height="141">
</li><li>Draw out a second Ellipse that is 70x70 pixels and positioned and Left, Top 15, 15.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image035.png" width="131" height="130">
</li><li>Group the two Ellipses into a Canvas by selecting them both in the Objects and Timeline Panel and selecting Group Into/Canvas. Name the Canvas “cnvKicker”.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image036.png" width="281" height="204">
</li><li>Drag a PhysicsObjectBehavior from the Asset Library onto cnvKicker. Set the IsStatic and RestitutionCoefficient properties as shown below. Setting the RestitutionCoefficient above a value of 1 will make the object “kick” things back.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image037.png" width="265" height="174">
</li><li>Build the project so that the new user control is available. Then open MainPage.xaml and add a few instance of “KickingTarget” to the page.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image038.jpg" width="208" height="296">
</li><li>Run the project and try out the Kicking Targets. </li></ol>
<h3><a title="_Toc237838543" name="_Toc237838543"></a>Optimizing Performance</h3>
<p>Our pinball game is looking up, but the performance could be a lot better. The startup time for the game is taking quite awhile because the Physics Helper Library is determining the outline of all of the shapes. Also, the frame rate is too low.</p>
<p>By default, Silverlight has a target frame rate of 60 frames per second. This is great for a lot of casual games, but Pinball requires a bit more speed. Additionally, Silverlight 3 introduces GPU Acceleration which can greatly increase the performance of
 our game by offloading graphics operations to the Video Card.</p>
<ol>
<li>Open the Default.html page in the website project. This page hosts the Silverlight control and exposes the plugin parameters. Add the following parameters to the plug in to increase the default frame rate and enable GPU Acceleration for our game.
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>&lt;</span><span>object</span> <span>data</span><span>=&quot;data:application/x-silverlight,&quot;</span> <span>type</span><span>=&quot;application/x-silverlight-2&quot;</span> <span>width</span><span>=&quot;800&quot;</span> <span>height</span><span>=&quot;600&quot;</span><span>&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;source&quot;</span> <span>value</span><span>=&quot;ClientBin/PinballGame.xap&quot;</span><span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;onerror&quot;</span> <span>value</span><span>=&quot;onSilverlightError&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;background&quot;</span> <span>value</span><span>=&quot;#010141&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;minRuntimeVersion&quot;</span> <span>value</span><span>=&quot;3.0.40624.0&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;MaxFrameRate&quot;</span> <span>value</span><span>=&quot;160&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;EnableGPUAcceleration&quot;</span> <span>value</span><span>=&quot;true&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;EnableCacheVisualization&quot;</span> <span>value</span><span>=&quot;false&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>param</span> <span>name</span><span>=&quot;autoUpgrade&quot;</span> <span>value</span><span>=&quot;true&quot;</span> <span>/&gt;</span> <br><span>&lt;</span><span>a</span> <span>href</span><span>=&quot;http://go.microsoft.com/fwlink/?LinkID=149156&amp;ampv=3.0.40624.0&quot;</span> <span>style</span><span>=&quot;text-decoration: none;&quot;</span><span>&gt;</span> <br><span>&lt;</span><span>img</span> <span>src</span><span>=&quot;http://go.microsoft.com/fwlink/?LinkId=108181&quot;</span> <span>alt</span><span>=&quot;Get Microsoft Silverlight&quot;</span> <span>style</span><span>=&quot;border-style: none&quot;</span><span>/&gt;</span> <br><span>&lt;/</span><span>a</span><span>&gt;</span> <br><span>&lt;/</span><span>object</span><span>&gt;</span></pre>
<br>
</div>
</li><li>Apply the CacheMode attribute to <b><i>all elements</i></b> in the game that are static. Since our pinball game's elements are not animated, we can apply the CacheMode to each of them. (If the objects contained animations within them, then the Cache would
 be invalidated during animation).
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>&lt;</span><span>Rectangle</span> <span>x:Name</span><span>=&quot;rectPlatform&quot;</span> <span>CacheMode</span><span>=&quot;BitmapCache&quot;</span> <span>Fill</span><span>=&quot;#FF8AD0C9&quot;</span> <span>Height</span><span>=&quot;70&quot;</span> <span>Width</span><span>=&quot;800&quot;</span> <span>Canvas</span>.<span>Left</span><span>=&quot;-14&quot;</span> <span>Canvas</span>.<span>Top</span><span>=&quot;2172&quot;</span> <span>Opacity</span><span>=&quot;0&quot;</span><span>&gt;</span> <br><span>&lt;</span><span>i:Interaction.Behaviors</span><span>&gt;</span> <br><span>&lt;</span><span>pb:PhysicsObjectBehavior</span> <span>IsStatic</span><span>=&quot;True&quot;</span><span>/&gt;</span> <br><span>&lt;/</span><span>i:Interaction.Behaviors</span><span>&gt;</span> <br><span>&lt;/</span><span>Rectangle</span><span>&gt;</span></pre>
<br>
</div>
</li><li>Now we'll speed up the startup time by adding in a pre-calculated Point Cache. The Physics Helper Library echoes out the calculated points at runtime. Open the project in Visual Studio, and run with debugging on. In the Output Window, Find the ReadBoundaryCache
 method that was echoed out and Copy the entire method. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image041.jpg" width="523" height="218">
</li><li>Note that the copied code can contain multiple rows of the same points. You can trim out any rows that are duplicated, for example cnvRightFlipper_1 is a copy of cnvRightFlipper, so you can remove that from the list of points.
</li><li>In order to load the list of boundary outlines into the Physics Controller, we need to get a reference to the controller through code. Open up MainPage.xaml.cs and add the highlighted code:
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>public</span> <span>partial</span> <span>class</span> MainPage : UserControl <br>{ <br>    PhysicsControllerMain _physicsController; <br>    <span>public</span> MainPage() <br>    { <br>        <span>// Required to initialize variables </span><br>        InitializeComponent(); <br>        <span>this</span>.Loaded &#43;= <span>new</span> RoutedEventHandler(MainPage_Loaded); <br>    } <br>    <span>void</span> MainPage_Loaded(<span>object</span> sender, RoutedEventArgs e) <br>    { <br>        _physicsController = LayoutRoot.GetValue( PhysicsControllerMain.PhysicsControllerProperty) <span>as</span> PhysicsControllerMain; <br>        BoundaryCache.ReadBoundaryCache(_physicsController); <br>    } <br>}</pre>
<br>
</div>
</li><li>Run the project and test the performance. Note that items that have a tint applied to them (Red, Blue, etc.) are NOT being cached and GPU accelerated.
</li></ol>
<h3><a title="_Toc237838544" name="_Toc237838544"></a>Scoring</h3>
<p>In this section, we'll embellish our game with a Score.</p>
<ol>
<li>We'll create a Canvas that overlays our main Canvas to contain a High Score TextBlock. This is so that the Score TextBlock will not scroll with the rest of the Playfield. Open MainPage.xaml and the select LayoutRoot in the Objects and Timeline Panel. Right-click
 LayoutRoot and select Group Into/Canvas. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image043.jpg" width="227" height="200">
</li><li>Add a new StackPanel into this outside Canvas that contains two TextBlock aligned Horizontally. The first TextBlock should contain the Text “Score:” and the second TextBlock should contain the Text “0”. Set the Font Size to a larger value, around 12 pt.
 Position the TextBlock at the Top, Left portion of the Canvas. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image044.jpg" width="367" height="273">
</li><li>Next we'll handle the Collision event for the Physics Controller so we can add to the score. Open MainPage.xaml.cs and add in a Property wrapper for the current&nbsp; score:
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>public</span> <span>int</span> Score <br>{ <br>    get <br>    { <br>        <span>return</span> Convert.ToInt32(txtScore.Text); <br>    } <br>    set <br>    { <br>        txtScore.Text = <span>value</span>.ToString(); <br>    } <br>}</pre>
<br>
</div>
</li><li>Handle the Collision event for the Physics Controller and increment the Score.
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>void</span> MainPage_Loaded(<span>object</span> sender, RoutedEventArgs e) <br>{ <br>    _physicsController = LayoutRoot.GetValue(PhysicsControllerMain.PhysicsControllerProperty) <span>as</span> PhysicsControllerMain; <br>    BoundaryCache.ReadBoundaryCache(_physicsController); <br>        _physicsController.Collision &#43;= <span>new</span> PhysicsControllerMain.CollisionHandler(_physicsController_Collision); <br>} <br><br><span>void</span> _physicsController_Collision(<span>string</span> sprite1, <span>string</span> sprite2) <br>{ <br>    <span>if</span> (sprite1 == &quot;ellBall<span>&quot; &amp;&amp; sprite2.StartsWith(&quot;ellKicker&quot;</span>)) <br>        Score &#43;= 10; <br>}</pre>
<br>
</div>
</li></ol>
<h3><a title="_Toc237838545" name="_Toc237838545"></a>Tracking Lives</h3>
<p>When the ball collides with the “rectPlatform” obstacle at the bottom, the ball has been lost and we should launch a new ball.
</p>
<ol>
<li>Add a new ChildWindow to the project named “LostTheBall.xaml”. <br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image047.jpg" width="269" height="292">
</li><li>Set the “Cancel” button's Visibility to Collapsed. </li><li>Add a TextBlock and set its Text to a message for the user stating the ball was lost.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image048.jpg" width="320" height="239">
</li><li>Add code in MainPage.xaml.cs to display the dialog and reset the ball. <br>
LostTheBall _lostTheBall;
<div id="codeSnippetWrapper">
<pre id="codeSnippet"><span>void</span> _physicsController_Collision(<span>string</span> sprite1, <span>string</span> sprite2) <br>{ <br>    <span>if</span> (sprite1 == <span>&quot;ellBall&quot;</span> &amp;&amp; sprite2.StartsWith(<span>&quot;cnvKicker&quot;</span>)) <br>    { <br>        Score &#43;= 10; <br>    } <br><br>    <span>if</span> (_lostTheBall == <span>null</span> &amp;&amp;ampsprite1 == <span>&quot;ellBall&quot;</span> &amp;&amp; sprite2 == <span>&quot;rectPlatform&quot;</span>) <br>    { <br>        _lostTheBall = <span>new</span> LostTheBall(); <br>        _lostTheBall.Closed &#43;= <span>new</span> EventHandler(dialog_Closed); <br>        _lostTheBall.Show(); <br>    } <br>} <br><br><span>void</span> dialog_Closed(<span>object</span> sender, EventArgs e) <br>{ <br>    _lostTheBall = <span>null</span>; <br>    PhysicsSprite ball = _physicsController.PhysicsObjects[<span>&quot;ellBall&quot;</span>]; <br>    ball.BodyObject.Position = <span>new</span> Vector2(460, 430); <br>    }</pre>
<br>
</div>
</li></ol>
<h3><a title="_Toc237838546" name="_Toc237838546"></a>Adding Sound Effects</h3>
<p>We can easily add buffered sound effects using the PhysicsSoundBehavior.</p>
<ol>
<li>In Visual Studio, Import two sound files into the project, score.wma and click.wma. Set their Build Action to Content.
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image050.jpg" width="220" height="315">
</li><li>Open MainPage.xaml in Expression Blend. Drag a PhysicsSoundBehavior to the LayoutRoot Canvas. Set the TriggerType to PhysicsCollisionTrigger and set the following properties:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image051.png" width="268" height="288">
</li><li>Drag another PhysicsSoundBehavior to the LayoutRoot Canvas. Set the TriggerType to PhysicsCollisionTrigger and set the following properties:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image052.png" width="265" height="263">
</li><li>Drag another PhysicsSoundBehavior to the LayoutRoot Canvas. Set the TriggerType to PhysicsCollisionTrigger and set the following properties:
<br>
<img border="0" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/9896181/image053.png" width="267" height="263">
</li><li>Run the project. </li></ol>
<h3>About the Author</h3>
<p>Andy Beaulieu is a software developer and trainer who is well versed in many Microsoft technologies including Silverlight, ASP.NET, ADO.NET and WindowsForms.
<a href="http://www.andybeaulieu.com/">Visit Andy's Blog</a> for more fun and games with Silverlight.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:82fcceec17384a9fb98c9e7600caa7c2">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Creating-a-Pinball-Game-in-Silverlight-Using-the-Physics-Helper-Library--Farseer-Physics</comments>
      <itunes:summary>
In this tutorial, we&#39;ll create a Silverlight pinball game using Behaviors,
a new addition to Expression Blend 3 &amp;amp; Silverlight that allows you to create interactivity with little or no coding.

Below you&#39;ll find a video and step-by-step walkthrough. 

Videos:

Part 1
Part 2
Part 3
Part 4
Part 5
Part 6
Part 7a
Part 7b
Part 8
Part 9
Part 10
Setup and Prerequisites
First you have to setup Physics Helper controls into Expression Blend. Follow these steps:

Download the Physics Helper ZIP file from 
http://physicshelper.codeplex.com/Release/ProjectReleases.aspx Extract the ZIP file contents and dump them into a folder. Run install.bat. (Note: this copies a few required assemblies to a folder in Blend 3.)



Getting Started &amp;amp; Making the Ball
Next, you create the controller and the pinball. Here&#39;s how.

Open Expression Blend 3 and create a new “Silverlight 3 Application &amp;#43; Website” named PinballGame.


Change your default layout container to a Canvas. You can do this in the Objects and Timeline panel by right-clicking LayoutRoot and selecting Change Layout Type/Canvas. Canvas layout containers are better for games because they allow for positioning of
 elements at absolute (x,y) coordinates. 

Give the application a bigger default size. Select the UserControl element in the Objects and Timeline panel. Then, in the Properties panel, change the Width to 800 and the Height to 600.


Add a Physics Controller Behavior to our main game Canvas. From the Asset Panel, find the PhysicsController Behavior and drag it to the Objects and Timeline Panel. Then, drop it on the LayoutRoot Canvas.




Change a few of the PhysicsController&#39;s properties, to make it easier to use. In the Objects and Timeline Panel, select the PhysicsControllerBehavior assigned to LayoutRoot. Then, set the highlighted properties as follows in the Properties Window:

1.)&amp;nbsp; Decrease the vertical gravity to 250 
2.)&amp;nbsp; Increase the iterations to 200. This will help with collision detection in a f</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Creating-a-Pinball-Game-in-Silverlight-Using-the-Physics-Helper-Library--Farseer-Physics</link>
      <pubDate>Mon, 30 Nov 2009 19:20:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Creating-a-Pinball-Game-in-Silverlight-Using-the-Physics-Helper-Library--Farseer-Physics</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9896181_100.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/9896181_220.jpg" height="165" width="220"/>      
      <dc:creator>Andy Beaulieu </dc:creator>
      <itunes:author>Andy Beaulieu </itunes:author>
      <slash:comments>11</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Creating-a-Pinball-Game-in-Silverlight-Using-the-Physics-Helper-Library--Farseer-Physics/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Silverlight</category>
    </item>
  <item>
      <title>Steam Integrates with Windows 7</title>
      <description><![CDATA[ <p>PC gamers are probably already familiar with <a shape="rect" href="http://store.steampowered.com/" shape="rect">Steam</a>, the gaming community site whose software program delivers downloadable games directly to your desktop. If you’re a Steam user and have upgraded to Windows 7, there’s a nice feature available for you from the new Windows taskbar, as <a shape="rect" href="http://www.downloadsquad.com/2009/10/28/valves-steam-now-has-windows-7-support/" shape="rect">DownloadSquad</a> just noticed – Jump Lists for Steam! </p><p>Jump lists are one of the best features in the new Windows OS. From any program pinned to the taskbar, a right-click on the program’s icon will display links to quick tasks, recently accessed files or recent actions, and so on. Of course, jump list-enabled programs have to be designed that way, but many already are – <a shape="rect" href="http://www.hanselman.com/blog/LightItUpListOfApplicationsThatUseNewWindows7Features.aspx" shape="rect">and not just those from Microsoft, either</a>. </p><p>In Steam’s case, the jump list shows recently planed games, your online status, and lists links to various parts of the Steam website like the Store or the “My Games” section. You can also pin your favorite games to the top of the list for easy access. </p><p>If you’re not seeing these options yet, make sure you have the latest version of the Steam software on your computer. New users can download the application for free from <a shape="rect" href="http://store.steampowered.com/about/" shape="rect">here</a>. </p><p><em>(Image credit: </em><a shape="rect" href="http://www.downloadsquad.com/2009/10/28/valves-steam-now-has-windows-7-support/" shape="rect"><em>DownloadSquad</em></a><em>)</em></p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:9e57f4589df74fe381e29e0e0076afee">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Steam-Integrates-with-Windows-7</comments>
      <itunes:summary> PC gamers are probably already familiar with Steam, the gaming community site whose software program delivers downloadable games directly to your desktop. If you’re a Steam user and have upgraded to Windows 7, there’s a nice feature available for you from the new Windows taskbar, as DownloadSquad just noticed – Jump Lists for Steam! Jump lists are one of the best features in the new Windows OS. From any program pinned to the taskbar, a right-click on the program’s icon will display links to quick tasks, recently accessed files or recent actions, and so on. Of course, jump list-enabled programs have to be designed that way, but many already are – and not just those from Microsoft, either. In Steam’s case, the jump list shows recently planed games, your online status, and lists links to various parts of the Steam website like the Store or the “My Games” section. You can also pin your favorite games to the top of the list for easy access. If you’re not seeing these options yet, make sure you have the latest version of the Steam software on your computer. New users can download the application for free from here. (Image credit: DownloadSquad)</itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Steam-Integrates-with-Windows-7</link>
      <pubDate>Thu, 29 Oct 2009 18:46:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Steam-Integrates-with-Windows-7</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_1125d5bd-0471-4728-aaa3-c46381429d7e.jpg" height="0" width="0"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_67735352-a958-487e-a45f-b490eb91e5f0.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Steam-Integrates-with-Windows-7/RSS</wfw:commentRss>
      <category>Gaming</category>
      <category>Windows 7</category>
    </item>
  <item>
      <title>Track the Hottest Video Games on Twitter</title>
      <description><![CDATA[ <p>How hot is the new <a shape="rect" href="http://tweetmygaming.com/game/the-beatles-rock-band/" shape="rect">Beatles’ edition of Rock Band</a>? A new site called <a shape="rect" href="http://tweetmygaming.com/" shape="rect">TweetMyGaming</a> can show you. This dedicated, real-time Twitter tracker aggregates all the tweets about video games and displays them on its main page in a live-updating feed. You can see what games others are searching for at the moment or you can use the search box to search for a particular game instead. In a sense, the experience is similar to using Twitter’s own search engine (<a shape="rect" href="http://search.twitter.com" shape="rect">search.twitter.com</a>) except that you don’t have to refresh the page to see new results. </p><p>Another cool feature of the site are the data graphs for popular games which let you track Twitter mentions over time. You can configure the charts to display the mentions for the past 24 hours, past week, month, or all-time. Click on the chart and the page will update to display the real-time feed for that game’s keyword or hashtag as well as a sidebar displaying the top links associated with that game. This links sidebar needs a little tweaking though, since a search for <a shape="rect" href="http://tweetmygaming.com/game/halo-3/" shape="rect">#halo3</a> pointed me to the “hot link” called bit.ly – Twitter’s own URL shortener! Looks like TweetMyGaming needs to learn how to parse some URLs. </p><p>The site will also point you to related games and places you can buy or rent the game you searched for. The site is powered by game news site <a shape="rect" href="http://gamerdna.com" shape="rect">GamerDNA</a>, so there are links to the game on that site as well. </p><p>You can check out TweetMyGaming for yourself at <a shape="rect" href="http://www.tweetmygaming.com" shape="rect">www.tweetmygaming.com</a>.</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Tags/gaming/RSS&WT.dl=0&WT.entryid=Entry:RSSView:11216b86157944b199439e0e00f647f8">]]></description>
      <comments>http://channel9.msdn.com/Blogs/coolstuff/Track-the-Hottest-Video-Games-on-Twitter</comments>
      <itunes:summary> How hot is the new Beatles’ edition of Rock Band? A new site called TweetMyGaming can show you. This dedicated, real-time Twitter tracker aggregates all the tweets about video games and displays them on its main page in a live-updating feed. You can see what games others are searching for at the moment or you can use the search box to search for a particular game instead. In a sense, the experience is similar to using Twitter’s own search engine (search.twitter.com) except that you don’t have to refresh the page to see new results. Another cool feature of the site are the data graphs for popular games which let you track Twitter mentions over time. You can configure the charts to display the mentions for the past 24 hours, past week, month, or all-time. Click on the chart and the page will update to display the real-time feed for that game’s keyword or hashtag as well as a sidebar displaying the top links associated with that game. This links sidebar needs a little tweaking though, since a search for #halo3 pointed me to the “hot link” called bit.ly – Twitter’s own URL shortener! Looks like TweetMyGaming needs to learn how to parse some URLs. The site will also point you to related games and places you can buy or rent the game you searched for. The site is powered by game news site GamerDNA, so there are links to the game on that site as well. You can check out TweetMyGaming for yourself at www.tweetmygaming.com.</itunes:summary>
      <link>http://channel9.msdn.com/Blogs/coolstuff/Track-the-Hottest-Video-Games-on-Twitter</link>
      <pubDate>Tue, 15 Sep 2009 16:38:00 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/Blogs/coolstuff/Track-the-Hottest-Video-Games-on-Twitter</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/100/on10_53915_100x75.jpg" height="75" width="100"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/220/on10_53915_220x165.jpg" height="165" width="220"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/320/on10_85b79fe7-bd03-45d1-9e9a-1ce4052ee583.jpg" height="437" width="512"/>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/previewImages/85/on10_b4b137ba-f343-454f-b8fb-5464f9871b84.jpg" height="64" width="85"/>      
      <dc:creator>Sarah Perez</dc:creator>
      <itunes:author>Sarah Perez</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/Blogs/coolstuff/Track-the-Hottest-Video-Games-on-Twitter/RSS</wfw:commentRss>
      <category>Games</category>
      <category>Gaming</category>
      <category>Twitter</category>
      <category>Xbox</category>
      <category>Xbox 360</category>
      <category>Video Games</category>
    </item>    
</channel>
</rss>
