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

<channel>
	<title>Sharp World &#187; Video games</title>
	<atom:link href="http://sharpmix.net/blog/category/video-games/feed/" rel="self" type="application/rss+xml" />
	<link>http://sharpmix.net/blog</link>
	<description>It&#039;s about C# and video games !</description>
	<lastBuildDate>Fri, 18 Sep 2009 15:43:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Asteroid</title>
		<link>http://sharpmix.net/blog/2009/09/17/asteroid-game/</link>
		<comments>http://sharpmix.net/blog/2009/09/17/asteroid-game/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 14:46:25 +0000</pubDate>
		<dc:creator>Abdallah Fdal</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[asteroid]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://s219861678.onlinehome.fr/blog/?p=127</guid>
		<description><![CDATA[For making an asteroid game,
I found it hard at first but it&#8217;s quite easy.

One of Newton&#8217;s law : In the absence of a net external force, a body either is at rest or moves with constant velocity.
We are evolving in space so the last phrase part is our algorithm.
But you might have encountered some problems [...]]]></description>
			<content:encoded><![CDATA[<p>For making an asteroid game,</p>
<p>I found it hard at first but it&#8217;s quite easy.</p>
<p><a href="http://sharpmix.net/blog/wp-content/uploads/2009/09/Asteroid.jpg"><img src="http://sharpmix.net/blog/wp-content/uploads/2009/09/Asteroid-300x225.jpg" alt="Asteroid" title="Asteroid" width="300" height="225" class="aligncenter size-medium wp-image-337" /></a></p>
<p><a href="http://en.wikipedia.org/wiki/Newton%27s_laws_of_motion">One of Newton&#8217;s law</a> : <em>In the absence of a net external force, a body either is at rest or moves with constant velocity.</em></p>
<p>We are evolving in space so the last phrase part is our algorithm.</p>
<p>But you might have encountered some problems if you are very new to games programming, like how do I make all these things move ?</p>
<p>It&#8217;s simple,</p>
<ul>
<li>When you change the direction of your ship, you need to keep a reference of the angle your ship is pointing at.</li>
<li>With this angle, using trigonometry you will get a vector which is what you need.</li>
</ul>
<p>And math magics will do the rest !</p>
<p>There are a couple of other issues you need to handle like,</p>
<ul>
<li>Limiting velocity of your ship or soon it will go very fast,</li>
<li>Wrap your angle,</li>
<li>Screen dimensions,</li>
<li>etc &#8230;</li>
</ul>
<p>You will soon find out that the core of games is quite short, but the polishing is very long.</p>
<p>Here is the source for controlling the ship : <a href='http://sharpmix.net/blog/wp-content/uploads/2009/09/Asteroid.zip'>Asteroid</a></p>
<p>In the next article, I will show you how to implement weapons, monsters and rocks &#8230; that in turn involves a couple of other things &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sharpmix.net/blog/2009/09/17/asteroid-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first game project.</title>
		<link>http://sharpmix.net/blog/2009/06/28/my-first-game-project/</link>
		<comments>http://sharpmix.net/blog/2009/06/28/my-first-game-project/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 20:30:39 +0000</pubDate>
		<dc:creator>Abdallah Fdal</dc:creator>
				<category><![CDATA[Video games]]></category>
		<category><![CDATA[game]]></category>

		<guid isPermaLink="false">http://managedworld.wordpress.com/?p=101</guid>
		<description><![CDATA[I have been playing video games for now about 20 years, but always been interested in creating one.
Years have passed since and now I am quite comfortable with C# so, I decided to test XNA.
XNA if you don&#8217;t know already, is the equivalent of .Net Framework, but for creating games.
As games have a different implementation [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing video games for now about 20 years, but always been interested in creating one.</p>
<p>Years have passed since and now I am quite comfortable with C# so, I decided to test <a href="http://creators.xna.com/en-US/">XNA</a>.</p>
<p>XNA if you don&#8217;t know already, is the equivalent of .Net Framework, but for creating games.</p>
<p>As games have a different implementation logic than business applications, the kit addresses issues you might encounter when creating games, such as drawing sprites, using a gamepad, overlaying etc &#8230; well, all of what makes a game development different from a typical desktop application.</p>
<p>I&#8217;ve always been a fan of tons of games (I am not going onto a list for now), though my preference goes to action games, from fighting games to FPS.</p>
<p>Obviously there are some things I cannot afford (yet) alone, there would be too much work and the result wouldn&#8217;t be that great.</p>
<p>So a 2D or 3D game ?</p>
<p>There is in the XNA a 2D platformer starter kit but surprisingly, 3D is not that hard.</p>
<p>Well I have decided to create a 3D game as the first game.</p>
<p>The main problem in this is, as for every new domain you get interested into, you need to take a peek at all the other (mandatory) things around. For games it&#8217;s going to be graphics, sounds and of course some programming. This is where 3D is handy as there are many tools to help you shape your graphic ideas.</p>
<p>For the sound I think I can handle it. (I am doing music for a couple of years now)</p>
<p>Well for the rest, -&gt; Internet (as usual)</p>
<p>Now for a first project, I don&#8217;t expect it to rock much, but with time, I found it&#8217;s a good idea to dare big things, to not suffer of under-specifications after, even though it sounds like being a massive work.</p>
<p>I am coming to it to now,</p>
<p>Have always been a fan of <a href="http://en.wikipedia.org/wiki/Wipeout_(video_game)">Wipeout</a>, so, ahem &#8230; I wanted to create a game like it. <em>Yeah &#8230;</em></p>
<p><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/2-suns-with-clouds.png"><img class="aligncenter size-full wp-image-102" title="Game Project 2 suns with clouds" src="http://sharpmix.net/blog/wp-content/uploads/2009/06/2-suns-with-clouds.png" alt="Game Project 2 suns with clouds" width="600" height="271" /></a></p>
<p>The first landscape depicts a small planetoid where the life process didn&#8217;t bloom as on Earth but surprisingly there is water. That planetoid is part of a solar system that has 2 suns.</p>
<p>For the landscape I just found out the astonishing <a href="http://www.planetside.co.uk/">Terragen</a> which rendering engine mimics nothing more than the real implementation (in the real world).</p>
<p>You can create landscapes life-like at the cost of heavy CPU usage, multi-threading is supported but my great <a href="http://processorfinder.intel.com/details.aspx?sSpec=SLAQG">Core 2 Duo T9300</a> isn&#8217;t of much help, even though (it used to be) a high-end CPU for laptops.</p>
<p>Also, using <a href="http://www.starrynight.com/">Starry Night</a>, I have found that the sky consists of <a href="http://en.wikipedia.org/wiki/DirectDraw_Surface">DDS</a> textures, which is interesting.</p>
<p><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/Game-Project-starrynight.jpg"></a><a href="http://sharpmix.net/blog/wp-content/uploads/2009/09/game-starry.png"><img class="aligncenter size-full wp-image-287" title="game starry" src="http://sharpmix.net/blog/wp-content/uploads/2009/09/game-starry.png" alt="game starry" width="500" height="500" /></a></p>
<p style="text-align:center;">
<p>The next (but probably uglier) option would be to create an engine that is fed by a star catalog &#8230;</p>
<p>I have gathered some 3D models of crafts,</p>
<p>Now I need to code all this to try form something &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://sharpmix.net/blog/2009/06/28/my-first-game-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detect the type of your monitor</title>
		<link>http://sharpmix.net/blog/2009/06/12/detect-monitor-type-getmonitortechnologytype/</link>
		<comments>http://sharpmix.net/blog/2009/06/12/detect-monitor-type-getmonitortechnologytype/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 16:54:23 +0000</pubDate>
		<dc:creator>Abdallah Fdal</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CRT]]></category>
		<category><![CDATA[DDC/CI]]></category>
		<category><![CDATA[detect monitor type]]></category>
		<category><![CDATA[EDID]]></category>
		<category><![CDATA[GetMonitorTechnologyType]]></category>
		<category><![CDATA[LCD]]></category>
		<category><![CDATA[MAME]]></category>
		<category><![CDATA[PowerStrip]]></category>
		<category><![CDATA[scanlines]]></category>
		<category><![CDATA[softMCCS]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[WinI2C/DDC]]></category>

		<guid isPermaLink="false">http://managedworld.wordpress.com/?p=38</guid>
		<description><![CDATA[UPDATE : Here is the monitor management application !
MonitorConfigurationAPI
Requirements : Vista and a display monitor with Vista drivers.
Usage : Click &#8216;Probe&#8217; button then wait a few seconds !
Issues

Color temperature doesn&#8217;t produce expected results
During detection, some monitors may change their settings

If you don&#8217;t have a Vista-specific driver, you shouldn&#8217;t install an old XP driver otherwise it [...]]]></description>
			<content:encoded><![CDATA[<h3>UPDATE : Here is the monitor management application !</h3>
<p><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/MonitorConfigurationAPI.zip">MonitorConfigurationAPI</a></p>
<p>Requirements : Vista and a display monitor with Vista drivers.</p>
<p>Usage : Click &#8216;Probe&#8217; button then wait a few seconds !</p>
<p>Issues</p>
<ul>
<li>Color temperature doesn&#8217;t produce expected results</li>
<li>During detection, some monitors may change their settings</li>
</ul>
<p><strong>If you don&#8217;t have a Vista-specific driver, you shouldn&#8217;t install an old XP driver otherwise it will break a couple of things on your system like monitor management for instance. You may think that you can roll-back to the previous driver, but it&#8217;ll be broken anyway ! I have seen some results with monitor that don&#8217;t have  Vista drivers with the <em>Generic PnP Monitor</em> that is installed by default, though.</strong></p>
<hr />For my <a href="http://en.wikipedia.org/wiki/MAME">MAME </a>GUI project,</p>
<p>I needed to detect what is the type of the monitor plugged onto the PC. This then, would allow me to provide custom <a href="http://en.wikipedia.org/wiki/Scanline">scanlines</a> PNGs, dependent of the technology used.</p>
<p style="text-align:center;">
<p style="text-align:center;"><a href="http://en.wikipedia.org/wiki/Cathode_ray_tube">CRT</a> ?</p>
<p style="text-align:center;"><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/crt.png"><img class="aligncenter size-full wp-image-39" title="CRT" src="http://sharpmix.net/blog/wp-content/uploads/2009/06/crt.png" alt="CRT" width="320" height="239" /></a></p>
<p style="text-align:center;">or <a href="http://en.wikipedia.org/wiki/Lcd">LCD</a> ?</p>
<p style="text-align:center;"><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/lcd.png"><img class="aligncenter size-full wp-image-40" title="LCD" src="http://sharpmix.net/blog/wp-content/uploads/2009/06/lcd.png" alt="LCD" width="320" height="239" /></a></p>
<p style="text-align:center;">
<p style="text-align:left;">
<p style="text-align:left;">Knowing that LCD does blurry stretching when not set at its native resolution, it is critical to know what display we are going to play on, in order to provide The (best possible) visual experience.</p>
<p>Proper arcade games emulation is somewhat sensitive to your display settings, hence, it&#8217;s always best to try provide nearest if not exact, display settings (resolution &amp; refresh rate).</p>
<p>This all came out when I decided to try MAME, seriously (this time) on my LCD screen.<br />
I got the following conclusion : it is possible to have a very good display experience even on LCDs, compared to using <a href="http://entechtaiwan.com/util/ps.shtm">PowerStrip</a> with my CRT.</p>
<p>While I have a great <a href="http://support.dell.com/support/edocs/monitors/p1130/en/g_ug/specs.htm">P1130</a> which is nothing more than a repainted <a href="http://www.erenumerique.fr/comparatif_de_8_ecrans_crt_21_et_22_pouces-art-156-2.html">G520</a> from Sony and is very good, if not one of the best CRTs to play your arcade games on, I like to play MAME quickly on my desktop PC (which in fact is a laptop) who is connected to the LCD screen. This is because since I got a new PC, the old Precision 360 workstation has been converted to a gaming-only PC. Too lazy to stand up and play just like in a real arcade game &#8230;</p>
<p>I thought : <em>&#8220;This should be simple to get, I only need to know what is the type of screen, nothing more. (So it&#8217;s gonna be easy, yeah ?)&#8221;</em></p>
<p>But life was different,</p>
<p>In fact this post is kind of, the tip of the iceberg I&#8217;ve been sitting on and didn&#8217;t even know there was an iceberg under my feets until recently &#8230; So I decided to write this post, because now I got it working and other people can benefit from it.</p>
<p>I knew that display monitors have a protocol so the PC can speak with them, <a href="http://en.wikipedia.org/wiki/Display_Data_Channel">DDC/CI</a>.</p>
<p>But here the problems comes,</p>
<ul>
<li>The protocol is using nothing more than <a href="http://en.wikipedia.org/wiki/I2c">I²C</a></li>
<li>This is something low-level, not addressable with C# directly</li>
</ul>
<p>And the list grows with time, why such simple request be so complicated to code ?</p>
<p>Now here are the possible solutions,</p>
<ul>
<li>Get <a href="http://en.wikipedia.org/wiki/EDID">EDID</a> string from Windows registry<br />
(Nice try but the string is in its raw form, decode it ? the specifications are not free &#8230;)</li>
<li>Use a software like <a href="http://www.entechtaiwan.com/lib/softmccs.shtm">softMCCS,</a> or better, an SDK like <a href="http://www.nicomsoft.com/wini2cddc/">WinI2C/DDC</a>,<br />
(Nice try again but these analysis softwares are stand-alone application, and while WinI2C is exactly what is needed, it&#8217;s pricey and not to consider because of the target project : Another <strong>free </strong>MAME GUI (already claiming it&#8217;s the best).</li>
</ul>
<p>While I&#8217;ve spent some time on WinI2C, the time-bombed samples always crashed for me, though the compiled demo ran &#8230; so I haven&#8217;t even been able to use it !</p>
<p>Now I don&#8217;t really need it because i have the same thing I coded myself but this wouldn&#8217;t happen without help right from Microsoft :-) considering you have Vista or better.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms775230(VS.85).aspx">Monitor Configuration</a><br />
<em><br />
You can use the monitor configuration functions to get information from a monitor and to change a monitor&#8217;s settings. You can use these functions to :</em></p>
<p><em>* Change a monitor&#8217;s geometry settings, such as the width and height of the display.<br />
* Change image settings, such as brightness and contrast.<br />
* Reset a monitor&#8217;s settings to their factory defaults.<br />
* Degauss the monitor.</em></p>
<p><em>Internally, the monitor configuration functions use the Display Data Channel Command Interface (DDC/CI) to send commands to the monitor.<br />
Now while this kicks ass, again, it&#8217;s for C++ &#8230;</em></p>
<p>Okay it does 99% of the job, all you have to do is call the functions you need, in fact it is even handier for my project as I am even able to change the colors of the monitor (if supported), great for monochrome emulation !</p>
<p>Now the only thing we need is a C# wrapper. (But some of it ran into trouble)</p>
<p>&#8230;</p>
<p>It got stuck when trying to get the physical monitors from the monitor, the pointer pointing to 0 was indeed correct (a pointer of pointer ?). While I hate pointers I find them working great when they are tamed.</p>
<p>But you still have to do a lot of things even with this API to get your Graal.</p>
<p><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/api.png"><img class="aligncenter size-full wp-image-41" title="Monitor Detect API" src="http://sharpmix.net/blog/wp-content/uploads/2009/06/api.png" alt="Monitor Detect API" width="496" height="300" /></a></p>
<p>In the next part I will unveil a complete monitor configuration wrapper for C# :-)</p>
<p><a href="http://sharpmix.net/blog/wp-content/uploads/2009/06/cd.png"><img class="aligncenter size-full wp-image-42" title="Monitor Detect Class Diagram" src="http://sharpmix.net/blog/wp-content/uploads/2009/06/cd.png" alt="Monitor Detect Class Diagram" width="650" height="505" /></a><br />
This is longer than expected as I decided to fully document it, and it&#8217;s tedious !<br />
(I am already considering another project that creates P/Invoke declarations fully documented from MSDN site but here comes dirty HTML and Regular Expressions &#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://sharpmix.net/blog/2009/06/12/detect-monitor-type-getmonitortechnologytype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
