<?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>matt greer's blog</title>
	<atom:link href="http://matt-greer.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://matt-greer.com/blog</link>
	<description></description>
	<lastBuildDate>Sat, 27 Feb 2010 19:11:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Making CocosNet more contributor friendly</title>
		<link>http://matt-greer.com/blog/2010/02/making-cocosnet-more-contributor-friendly/</link>
		<comments>http://matt-greer.com/blog/2010/02/making-cocosnet-more-contributor-friendly/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 19:10:53 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cocosnet]]></category>
		<category><![CDATA[contributing]]></category>
		<category><![CDATA[readme]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=208</guid>
		<description><![CDATA[For the longest time CocosNet has been me by my lonesome. But interest in the library is picking up, and people are interested in both using CocosNet and contributing to it.]]></description>
			<content:encoded><![CDATA[<p>For the longest time CocosNet has been me by my lonesome. But interest in the library is picking up, and people are interested in both using CocosNet and contributing to it.</p>
<p>So I am making an effort to make CocosNet easier to use in your projects, and also easier to contribute to. I redid the readme, you can see it in all its markdown glory over at <a href="http://github.com/city41/cocosnet">github</a>. I also added a <a href="http://github.com/city41/CocosNet/blob/master/ContributorsGuide.txt">contributor&#8217;s guide</a> to the project.</p>
<p>Please bear with me a bit as I get a grasp on pushing a project more in the group direction as opposed to being just me. If you have any ideas, suggestions, anything, I am all ears.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2010/02/making-cocosnet-more-contributor-friendly/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CocosNet update: first app in store, and other stuff</title>
		<link>http://matt-greer.com/blog/2010/02/cocosnet-update-first-app-in-store-and-other-stuff/</link>
		<comments>http://matt-greer.com/blog/2010/02/cocosnet-update-first-app-in-store-and-other-stuff/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 18:51:20 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[artist]]></category>
		<category><![CDATA[cocosnet]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[sonic sd]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[tile]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=204</guid>
		<description><![CDATA[I got an email the other day saying someone had used CocosNet in an app that made its way into the app store. I thought that was pretty cool. It&#8217;s a simple little app, but it&#8217;s well done: Sonic SD. If you are a Doctor Who fan, you will recognize it instantly. He made use of [...]]]></description>
			<content:encoded><![CDATA[<p>I got an email the other day saying someone had used CocosNet in an app that made its way into the app store. I thought that was pretty cool. It&#8217;s a simple little app, but it&#8217;s well done: <a href="http://itunes.apple.com/us/app/sonic-sd/id348876224?mt=8">Sonic SD</a>. If you are a Doctor Who fan, you will recognize it instantly. He made use of CocosNet&#8217;s particle system for the &#8220;electric&#8221; effect, and it came out nicely.</p>
<p>What about me? My game? CocosNet? Let me tell you.</p>
<h2>CocosNet Update</h2>
<p>I recently moved from Washington state to Colorado in order to reconnect with my girlfriend who had moved here a year ago. I got a new job (which starts on Monday) and all in all things have been nuts for me with the move, job hunting, and transition. So my game got put on hold throughout all of this, and that includes CocosNet.</p>
<p>Things have settled down and I am back at it. I am moving forward with my game and CocosNet now, and will start to investigate its iPad compatibility soon, as I definitely want to release my game with iPad awareness. People have emailed me saying there are iPad related issues, so I will be looking into them,</p>
<h3>Contributions: Tile and Sprite Animation Support</h3>
<p>I just got an email as I was writing this that someone has done some work to port tile and sprite animation support over. Thanks Jonathan! I will give a proper update and credit for all this as I learn more about it.</p>
<h2>Are you an artist?</h2>
<p>Another hitch is things did not work out between me and my artist for the game. So I am back to square one on graphics. If you are interested in providing artwork for a nearly complete game, <a href="mailto:matt.e.greer@gmail.com?subject=game artist">let me know</a>, maybe we can work something out.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2010/02/cocosnet-update-first-app-in-store-and-other-stuff/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>You Get What You Create</title>
		<link>http://matt-greer.com/blog/2010/01/you-get-what-you-create/</link>
		<comments>http://matt-greer.com/blog/2010/01/you-get-what-you-create/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 21:55:19 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[mvc2]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[stackoverflow]]></category>
		<category><![CDATA[systems]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=198</guid>
		<description><![CDATA[...your system is going to become what the users make of it. And users are going to exploit the system for their needs first, and your intentions second, if at all. It's extremely difficult to design a system that ends up being used how you had intended it to...]]></description>
			<content:encoded><![CDATA[<p>Systems always devolve into whatever benefits their users the most.</p>
<h2>Marvel vs Capcom 2</h2>
<p>In Marvel vs Capcom 2, Cable is able to combo his supers into themselves. This means that once Cable has landed one of his supers, he is guaranteed to land as many more as he has remaining super meter for.</p>
<div id="attachment_200" class="wp-caption alignnone" style="width: 300px"><img class="size-full wp-image-200" title="mvc2_b02_049" src="http://matt-greer.com/blog/wp-content/uploads/2010/01/mvc2_b02_049.jpeg" alt="Cable being Cable" width="290" height="165" /><p class="wp-caption-text">Cable being Cable</p></div>
<p>This was clearly a design flaw in the game that Capcom didn&#8217;t catch before releasing. In fact in MvC2 there are countless design flaws and bugs in the game that lead to player gain. If you ever play MvC2 at any level of competitiveness, you will notice that these flaws are exploited to their maximum value, always. The way the game &#8220;should&#8221; be played, and the way it is actually played, are entirely different. The Street Fighter community values a game if once its exploits are all discovered and maximized, the game still manages to be competitive. MvC2 got lucky and these flaws largely balanced out into a decent game. Street Fighter 3 (the first one) was not so lucky, where Ibuki had a simple infinite combo that made her significantly more powerful than all other characters. SF3 games very rapidly devolve into both players playing Ibuki and going for her infinite, not interesting or stimulating. So SF3 is maligned in the Street Fighter community.</p>
<p>People exploit systems for their gain as much as possible everywhere. This is not a phenomenon only found in Street Fighter games.</p>
<h2>StackOverflow</h2>
<p>Over the past several months I have become a very active <a href="http://www.stackoverflow.com">StackOverflow</a> user. I have come to really enjoy the site. It&#8217;s extremely well implemented, and even fun to use. It&#8217;s obvious a lot of thought was put into how and when reputation is doled out, and what users can do with the reputation. The overall goal was to create a site where intelligent questions and answers are awarded, and high contributing users are recognized. For the most part they seem to have accomplished their goal.</p>
<p>However, a user&#8217;s reputation can have real world implications. Potential employers can look at your StackOverflow profile and use it to consider whether to hire you. This fact alone means people are going to push and exploit StackOverflow as much as they can, as getting reputation is important. This has resulted in some phenomenon I have observed, and even participated in:</p>
<ul>
<li><b>Lousy questions get answered and even encouraged: </b>Questions that would have received flaming and/or &#8220;go Google it!&#8221; in newsgroups and forums are often frankly answered on StackOverflow. Of course, the answerer is hoping to earn some reputation, and these lousy questions are easy to answer.</li>
<li><b>People new to the site are much less likely to get an answer to their question: </b>This isn&#8217;t necessarily a negative or problem with the site itself, but it is a reality. The issue is that people are less likely to answer a question if they are afraid their answer won&#8217;t receive rep or won&#8217;t potentially get voted as the chosen answer.</li>
<li><b>People take advantage of the community and essentially ask for their entire issue to be spoon fed to them: </b>Beginners will often ask a question, get it answered, then immediately post a second question which is obviously just the very next stumbling point in their code. And these questions get posted within seconds of each other. The user is not trying to learn or improve on their own at all, they are instead attempting to get StackOverflow to do their work for them. Again, these questions are usually happily answered.</li>
<li><b>Reputation doesn&#8217;t seem to indicate anything: </b>I have seen many extremely basic and even silly questions asked by people with very high reputation. Since reputation is very easy to get, especially if you are persistent, then it ultimately doesn&#8217;t say much. Sure if someone has 100k of reputation, they are probably a pretty good programmer. But someone with 5000? They could be anything. The reputation score doesn&#8217;t differentiate between a quality programmer who is only an occasional StackOverflow user and someone who is a lousy programmer but has managed to snatch up many 10 points of rep repeatedly. You really need to look at someone&#8217;s profile, and know what to look for, to get a good idea of what quality they really are.</li>
</ul>
<p>A good example of all of this was a recent question asked: <a href="http://stackoverflow.com/questions/1987841/is-c-the-same-as-objective-c">&#8220;Is C# the same as Objective-C?&#8221;</a> The person asking has decent reputation, yet this is clearly a rather silly question. No offense to the person asking, I&#8217;m sure they genuinely wanted to know. But as the <a href="http://stackoverflow.com/questions/1987841/is-c-the-same-as-objective-c/1987851#1987851">accepted and highest rated answer</a> pointed out, all they had to do was go to Wikipedia.</p>
<p>Jon Skeet, who has the highest reputation of all on StackOverflow, has even talked about on his blog how <a href="http://msmvps.com/blogs/jon_skeet/archive/2009/01/15/stack-overflow-reputation-and-being-a-micro-celebrity.aspx">it&#8217;s a &#8220;game&#8221;</a></p>
<blockquote><p><em>It&#8217;s a game</em>. This is the most important aspect. I love games. I&#8217;m <em>fiercely</em> competitive, and will always try to work out all the corners of a game&#8217;s system &#8211; things like it being actually somewhat useless getting accepted answers before you&#8217;ve reached the 200 limit. I don&#8217;t necessarily <em>play</em> to the corners of the game (I would rather post a useful but unpopular answer than a popular but harmful one, for serious questions) but I enjoy working them out. I would be interested to measure my levels of testosterone when typing furiously away at an answer, hoping to craft something useful before anyone else does. I&#8217;m never going to be &#8220;macho&#8221; physically, but I can certainly be an alpha geek. So long as it doesn&#8217;t go too far, I think it&#8217;s a positive thing.</p></blockquote>
<p>In the end it doesn&#8217;t really matter. I agree with Jon in that &#8220;so long as it doesn&#8217;t go too far, I think it&#8217;s a positive thing.&#8221; So far, my opinion is StackOverflow has been a net positive to the community. However there is no doubt that the site has created some unwanted trends. I&#8217;ll see how I feel about StackOverflow a year or so from now.</p>
<h2>Reddit</h2>
<p>My all time favorite website, <a href="http://www.reddit.com">reddit</a>, has fallen victim to this too. Reddit is all about users voting up and down things, either submitted links from other websites, or comments about the links. &#8220;Redditquette&#8221; states that you should only downvote a comment if it&#8217;s a troll, offensive, or off topic. The idea is that different opinions should be allowed and not stifled. For the past several years, this has worked well enough. Reddit was a small enough community to respect the rules.</p>
<p>But as of late, Reddit&#8217;s userbase has exploded (which is fantastic for the site, I&#8217;m happy for them), and thus adherence to the rules has dropped dramatically. People downvote comments if they simply disagree or don&#8217;t like them. After thousands of people have viewed comments on a link and everyone has up or down voted what they like and don&#8217;t like, you end up with a very &#8220;group think&#8221; mentality. The comments that the majority liked rise to the top, the comments the majority disliked fall to the bottom. Regardless of how appropriate a given comment may be as far as Reddit had intended comments to be.</p>
<p>This isn&#8217;t necessarily a bad thing, it just means Reddit as of late has become a totally different site. I still enjoy the site and visit it often.</p>
<h2>You get what you create</h2>
<p>The moral of the story being your system is going to become what the users make of it. And users are going to exploit the system for their needs first, and your intentions second, if at all. It&#8217;s extremely difficult to design a system that ends up being used how you had intended it to. As I am finishing up my iPhone game now, I am very seriously thinking about this and considering what it means for my game. Will people find ways to play my game I had not intended? Is that a good, bad, or irrelevant thing? If by some stroke of divine luck my game became worldwide popular and competitive, how would people play it then? Could there be a loophole in my game&#8217;s design that renders the game pointless and dumb? Just some things to ponder&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2010/01/you-get-what-you-create/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Microsoft Walkway of Releases</title>
		<link>http://matt-greer.com/blog/2009/12/the-microsoft-walkway-of-releases/</link>
		<comments>http://matt-greer.com/blog/2009/12/the-microsoft-walkway-of-releases/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 22:07:48 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=176</guid>
		<description><![CDATA[I stumbled upon this the other day on campus and really enjoyed walking through it and looking at all the different releases, so i thought I&#8217;d share. I also thought I should wait for a sunny day to take these pics, but how accurate  would that be?   The tiles span from 1977 [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon this the other day on campus and really enjoyed walking through it and looking at all the different releases, so i thought I&#8217;d share. I also thought I should wait for a sunny day to take these pics, but how accurate  would that be? <img src='http://matt-greer.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The tiles span from 1977 to 2000. I guess they figured it was getting to the point that the entire campus would need to be covered in these things if they were to keep doing this.</p>
<p><img class="alignnone size-large wp-image-178" title="img_0254" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0254-1024x768.jpg" alt="img_0254" width="717" height="538" /></p>
<p><img class="alignnone size-large wp-image-191" title="img_0267" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0267-1024x768.jpg" alt="img_0267" width="717" height="538" /></p>
<div id="attachment_180" class="wp-caption alignnone" style="width: 727px"><img class="size-large wp-image-180  " title="img_02561" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_02561-1024x768.jpg" alt="The very first release on the walkway" width="717" height="538" /><p class="wp-caption-text">The very first release on the walkway</p></div>
<div id="attachment_181" class="wp-caption alignnone" style="width: 727px"><img class="size-large wp-image-181  " title="img_0257" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0257-1024x768.jpg" alt="The older releases got bunched together into yearly tiles like this. Was it that the walkway's original intent was to be less lavish, or were these retroactively added and they only had so much space for them?" width="717" height="538" /><p class="wp-caption-text">The older releases got bunched together into yearly tiles like this. Was it that the walkway&#39;s original intent was to be less lavish, or were these retroactively added and they only had so much space for them?</p></div>
<p><img class="alignnone size-large wp-image-184" title="img_0260" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0260-1024x768.jpg" alt="img_0260" width="717" height="538" /></p>
<p><a href="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0260.jpg"></a><img class="alignnone size-large wp-image-187" title="img_0263" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0263-1024x768.jpg" alt="img_0263" width="717" height="538" /></p>
<p><a href="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0263.jpg"></a><img class="alignnone size-large wp-image-188" title="img_0264" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0264-1024x768.jpg" alt="img_0264" width="717" height="538" /></p>
<div id="attachment_186" class="wp-caption alignnone" style="width: 727px"><img class="size-large wp-image-186  " title="img_0262" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0262-1024x768.jpg" alt="I love the name of this one." width="717" height="538" /><p class="wp-caption-text">I love the name of this one.</p></div>
<div id="attachment_189" class="wp-caption alignnone" style="width: 727px"><img class="size-large wp-image-189  " title="img_0265" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0265-1024x768.jpg" alt="Everyone's favorite! (This version is the only one on the walkway)" width="717" height="538" /><p class="wp-caption-text">Everyone&#39;s favorite! (This version is the only one on the walkway)</p></div>
<p><img class="alignnone size-large wp-image-190" title="img_0266" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0266-1024x768.jpg" alt="img_0266" width="717" height="538" /></p>
<div id="attachment_185" class="wp-caption alignnone" style="width: 727px"><img class="size-large wp-image-185  " title="img_0261" src="http://matt-greer.com/blog/wp-content/uploads/2009/12/img_0261-1024x768.jpg" alt="Ah Bob, how we miss thee." width="717" height="538" /><p class="wp-caption-text">Ah Bob, how we miss thee.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/12/the-microsoft-walkway-of-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CocosNet: Fields vs Properties on PointF</title>
		<link>http://matt-greer.com/blog/2009/11/cocosnet-fields-vs-properties-on-pointf/</link>
		<comments>http://matt-greer.com/blog/2009/11/cocosnet-fields-vs-properties-on-pointf/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 23:22:59 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cocosnet]]></category>
		<category><![CDATA[fields vs properties]]></category>
		<category><![CDATA[pointf]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=160</guid>
		<description><![CDATA[Currently CocosNet has hijacked System.Drawing.PointF to become a vector class. It's common to need a vector type object that can do things such as finding angles, dot products, lengths, reflections, and CocosNet is no different here. Cocos2D accomplished this with CGPoint, which was also a hijacking along the same lines. I defined a set of <a href="http://github.com/city41/CocosNet/blob/master/CocosNet/CocosNetLib/ExtensionMethods.cs">extension methods</a> that give PointF everything it needs to be a first class vector class, and overall it works very well. I am very hesitant to change it, and I think ultimately I never will.]]></description>
			<content:encoded><![CDATA[<p>Currently CocosNet has hijacked <code>System.Drawing.PointF</code> to become a vector class. It&#8217;s common to need a vector type object that can do things such as finding angles, dot products, lengths, reflections, and CocosNet is no different here. Cocos2D accomplished this with <code>CGPoint</code>, which was also a hijacking along the same lines. I defined a set of <a href="http://github.com/city41/CocosNet/blob/master/CocosNet/CocosNetLib/ExtensionMethods.cs">extension methods</a> that give PointF everything it needs to be a first class vector class, and overall it works very well. I am very hesitant to change it, and I think ultimately I never will.</p>
<h2>Performance Comparisons</h2>
<p><code>PointF</code> has some potential performance issues. It uses properties for accessing x and y, and this is just plain slower than fields. I whipped up a <a href="http://matt-greer.com/blog/wp-content/uploads/2009/11/benchmark.cs">little benchmark</a> to test this. I used a simple struct with x and y fields and performed operations that required accessing x and y many times against this struct and PointF. The numbers indicate the average number of milliseconds it took to perform the operations with X and Y (ran on a first gen iPhone):</p>
<table border="0">
<tbody>
<tr>
<th>Iterations</th>
<th>PointF</th>
<th>Vertex struct</th>
<th>Difference</th>
</tr>
<tr>
<td>1,000</td>
<td>0.08590</td>
<td>0.07960</td>
<td>7.4%</td>
</tr>
<tr>
<td>5,000</td>
<td>0.13280</td>
<td>0.10034</td>
<td>24.5%</td>
</tr>
<tr>
<td>25,000</td>
<td>0.37196</td>
<td>0.19775</td>
<td>47%</td>
</tr>
<tr>
<td>125,000</td>
<td>1.55883</td>
<td>0.70856</td>
<td>54.6%</td>
</tr>
<tr>
<td>625,000</td>
<td>7.44762</td>
<td>3.21161</td>
<td>57%</td>
</tr>
</tbody>
</table>
<p>So as the number of times you use a property go up, the amount of time you spend inside the call to the property goes up a good deal compared to just grabbing a field. I also ran the benchmark on the simulator on my iMac and was able to push it a lot further, iteration wise. My highest iteration count on the sim (arbitrarily) landed here:</p>
<table border="0">
<tbody>
<tr>
<td>1,953,125,000</td>
<td>317.077</td>
<td>130.615</td>
<td>59%</td>
</tr>
</tbody>
</table>
<p>Do these numbers matter? I mean PointF is <i>over 2 times slower</i> than an equivalent struct! Wow! Not so fast. This benchmark is doing 100 gets/sets per iteration. This benchmark is also essentially doing <i>nothing</i> else. Your code would have to be doing gets/sets against a <code>PointF</code> like m&#8217;f'ing crazy before you&#8217;d see any real difference. The ratio of gets/sets in typical code to actual things that matter is pitifully small. Chances are very good you just aren&#8217;t manipulating vectors enough for this to ever matter.</p>
<p>On the most demanding <a href="http://matt-greer.com/blog/cocosnet-particle-systems/">particle system</a> sample in CocosNet, it is doing 87,000 gets/sets to X and Y per frame. The game I am currently writing will also require a good deal of vector manipulation per frame on top of that. I do think in my case, I could ditch <code>PointF</code> and earn a 1 to maybe 3 fps framerate boost (just a guess). And in the end when I am cleaning things up and getting ready to ship, that might be worth it. Until then, I won&#8217;t even consider it. And even if I do decide to ditch <code>PointF</code>, it wouldn&#8217;t be at the expense of CocosNet, I&#8217;d use a pair of floats deep inside my tightest code and the particle systems and still make <code>PointF</code> the official way to deal with vectors across CocosNet. Using a common class that people are familiar with and that can be passed into other APIs without any conversion required, has enough advantages to warrant keeping it this way.</p>
<h2>Public Fields Are Bad</h2>
<p>I am very against public fields in classes. I think they should basically never be used. CocosNet has a set of types that are simple structs with a collection of public fields in them. This is required because these types are sent over to OpenGL, which will access these types as a big ol&#8217;, raw slab of memory. I really cringe when I am working on code and I run into a public field. In C#, you can create a property with an automatic backing field, so there&#8217;s no excuse anymore.</p>
<p>A common argument is &#8220;giving all your fields a property is not encapsulation!&#8221;, except, that it is. If your fields need to be manipulated by external callers, then they are part of the public interface to the class, and thus they need a property to handle this. The property has given you a nice insurance plan for the future. If your class internals need to change, properties ensure the interface is far less likely to be forced to, making you and your consumers happy. Public fields are signing a contract you will probably regret. A property that represented a simple field can become an abstract property easily, not so with fields. Not to mention a public field is just hanging out there, you can never know who (and when) is writing/reading it. This can cause subtle, hard to track down bugs. Properties are your friend, all modern OO languages have some kind of equivalent to them for a reason.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/11/cocosnet-fields-vs-properties-on-pointf/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Unit testing MonoTouch with MonoDevelop and NUnit</title>
		<link>http://matt-greer.com/blog/2009/11/unit-testing-monotouch-with-monodevelop-and-nunit/</link>
		<comments>http://matt-greer.com/blog/2009/11/unit-testing-monotouch-with-monodevelop-and-nunit/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 23:58:23 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[monodevelop]]></category>
		<category><![CDATA[monotouch]]></category>
		<category><![CDATA[nunit]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=154</guid>
		<description><![CDATA[NUnit doesn't quite work for MonoTouch projects out of the box, but getting it to work is easy.]]></description>
			<content:encoded><![CDATA[<p>MonoDevelop has NUnit integration built right into it. Which is quite nice, you can build and run tests with a rather nice interface without ever leaving the IDE.</p>
<p>This doesn&#8217;t quite work for MonoTouch projects as is, but getting it to work is easy. Add an NUnit project to your MonoTouch based solution. Have this project reference your MonoTouch projects as you normally would, create some tests, and let &#8216;em rip. You will find that it will complain about</p>
<blockquote><p>A dependency of a referenced assembly may be missing, or you may be referencing an assembly created with a newer CLR version.</p></blockquote>
<p>This is an accurate error message. The NUnit project is setup to run for standard Mono apps, not MonoTouch. So it has no idea where monotouch.dll, or any other MonoTouch assemblies you may be using, are.</p>
<h2>To fix this</h2>
<p> just add references to the MonoTouch system assemblies to your NUnit project. They are located at <code>/Developer/MonoTouch/usr/lib/mono/&lt;version&gt;</code>. Once added, the NUnit project will be happy and run as expected. That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/11/unit-testing-monotouch-with-monodevelop-and-nunit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CocosNet Particle Systems</title>
		<link>http://matt-greer.com/blog/2009/10/cocosnet-particle-systems/</link>
		<comments>http://matt-greer.com/blog/2009/10/cocosnet-particle-systems/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 06:17:24 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cocosnet]]></category>
		<category><![CDATA[particle systems]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=104</guid>
		<description><![CDATA[I've implemented <code>PointParticleSystem</code> in CocosNet, and most of the example systems that are used to illustrate it: Fireworks, fire, sun, galaxy, flower, meteor, spiral, snow and rain. This implementation is pretty much a direct port straight across with the only changes being those dictated by the language transition.]]></description>
			<content:encoded><![CDATA[<p>This morning I made a slightly premature <a href="http://twitter.com/city41/status/5179437321">tweet</a> that indicated I have CocosNet particle systems beating Cocos2D particle systems in some regards. That&#8217;s actually not true. I apologize for the, uh, outburst <img src='http://matt-greer.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I will definitely check things out more thoroughly as CocosNet progresses in the future. I&#8217;ve spent the evening carefully comparing the two, and when I make both environments identical, test wise, Cocos2D is still faster. But &#8230; not by much! CocosNet is already very much usable, performance-wise.</p>
<p>I&#8217;ve implemented <code>PointParticleSystem</code> in CocosNet, and most of the example systems that are used to illustrate it: Fireworks, fire, sun, galaxy, flower, meteor, spiral, snow and rain. This implementation is pretty much a direct port straight across with the only changes being those dictated by the language transition.</p>
<p><object width="425" height="344" data="http://www.youtube.com/v/c1gmTCXTNis&amp;hl=en&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/c1gmTCXTNis&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /></object></p>
<p>With this implementation in place, I got decent performance (running in release mode on a first gen iPhone):</p>
<p><!-- td { padding: 10px; border: 1px solid black; } table { margin: 30px; } --></p>
<table border="0">
<tbody>
<tr>
<th></th>
<td>Cocos2D</td>
<td>CocosNet</td>
<td>% Change</td>
</tr>
<tr>
<td>Fireworks</td>
<td>37fps</td>
<td>20</td>
<td>-45.95%</td>
</tr>
<tr>
<td>Fire</td>
<td>51</td>
<td>45</td>
<td>-11.76%</td>
</tr>
<tr>
<td>Sun</td>
<td>60</td>
<td>42</td>
<td>-30%</td>
</tr>
<tr>
<td>Galaxy</td>
<td>60</td>
<td>60</td>
<td>0%</td>
</tr>
<tr>
<td>Flower</td>
<td>60</td>
<td>50</td>
<td>-16.67%</td>
</tr>
<tr>
<td>Meteor</td>
<td>60</td>
<td>60</td>
<td>0%</td>
</tr>
<tr>
<td>Spiral</td>
<td>60</td>
<td>42</td>
<td>-30%</td>
</tr>
<tr>
<td>Snow</td>
<td>60</td>
<td>30</td>
<td>-50%</td>
</tr>
<tr>
<td>Rain</td>
<td>60</td>
<td>60</td>
<td>0%</td>
</tr>
</tbody>
</table>
<p>I&#8217;ve written a set of extension methods that make <code>System.Drawing.PointF</code> behave more like a vector, with methods like Length, Dot, Normalize, Add, Subtract and Multiply. I inlined these calls within the crucial method that is called 200-1500 times per frame (depending on the number of particles in the particle system). This saw a nice 2-7fps improvement across the board.</p>
<h2>Ditch Properties?</h2>
<p>Cocos2D uses direct x and y fields via CGPoint, where PointF uses properties which are effectively method calls. How optimized are getters and setters? I have no idea. But I get or set X and Y 58 times per particle per frame. That&#8217;s as many as <em>87,000</em> times per frame. Ultimately, I have a feeling my use of PointF will be ditched. I think I will want a &#8220;leaner&#8221; vector struct that if nothing else, gives me direct access to X and Y instead of using properties. But we&#8217;ll see. Switching away from PointF is too expensive to do right now, I&#8217;ll keep this blog updated on progress here though.</p>
<h2>Struct versus Class</h2>
<p>Should the particles be stored in a struct object or a class? It doesn&#8217;t seem to matter. I got ever so slightly better performance storing them in a reference type. This is because I need to continually push dead particles to the back of the list, which seems to be a bit faster copying around a couple references than entire objects.</p>
<h2>Using &#8220;Quake&#8221; InvSqrt</h2>
<p>Every particle has to get its position normalized every frame. This is extremely expensive, as it requires performing a square root. So each frame of animation we are talking as many as 1500 square roots! Up until this point, I&#8217;ve been using <code>Math.Sqrt</code>, which is an obvious choice. Cocos2D uses <code>sqrtf</code> from math.h, which I would assume is roughly equivalent in implementation.</p>
<p>Quake made famous an <a href="http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/">implementation of inverse square root</a> that is very fast and pretty accurate. Using this method, I was able to implement a faster version of Normalize with no obvious degradation in the particle system&#8217;s accuracy. At this point I&#8217;ve moved beyond Cocos2D, but doing so netted me some nice improvements:</p>
<table border="0">
<tbody>
<tr>
<th></th>
<td>Cocos2D</td>
<td>CocosNet</td>
<td>% Change</td>
</tr>
<tr>
<td>Fireworks</td>
<td>37fps</td>
<td>30</td>
<td bgcolor="#aaddaa">-18.92%</td>
</tr>
<tr>
<td>Fire</td>
<td>51</td>
<td>47</td>
<td bgcolor="#ccffcc">-7.84%</td>
</tr>
<tr>
<td>Sun</td>
<td>60</td>
<td>56</td>
<td bgcolor="#99bb99">-6.67%</td>
</tr>
<tr>
<td>Galaxy</td>
<td>60</td>
<td>60</td>
<td>0%</td>
</tr>
<tr>
<td>Flower</td>
<td>60</td>
<td>50</td>
<td>-16.67%</td>
</tr>
<tr>
<td>Meteor</td>
<td>60</td>
<td>60</td>
<td>0</td>
</tr>
<tr>
<td>Spiral</td>
<td>60</td>
<td>42</td>
<td>-30%</td>
</tr>
<tr>
<td>Snow</td>
<td>60</td>
<td>36</td>
<td bgcolor="#ccffcc">-40%</td>
</tr>
<tr>
<td>Rain</td>
<td>60</td>
<td>60</td>
<td>0%</td>
</tr>
</tbody>
</table>
<p>So perhaps I&#8217;m currently a bit behind Cocos2D in performance. However there is still more to be done, and CocosNet is still extremely young. I will revisit this down the road, in the mean time I plan to continue porting other parts of Cocos and not to mention start really getting to work on a game that will use CocosNet.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/10/cocosnet-particle-systems/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Trying to like Twitter</title>
		<link>http://matt-greer.com/blog/2009/10/trying-to-like-twitter/</link>
		<comments>http://matt-greer.com/blog/2009/10/trying-to-like-twitter/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 17:51:41 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[information]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[trends]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=101</guid>
		<description><![CDATA[Twitter is like eating buffalo wings. An awful lot of work for a little smidge of meat.]]></description>
			<content:encoded><![CDATA[<p>Twitter is like eating buffalo wings. An awful lot of work for a little smidge of meat.</p>
<p>I fundamentally don&#8217;t like Twitter. It&#8217;s noisy and egotistical, a really bad combination. Waking up in the morning and facing 200 new tweets, where 2 or 3 are useful, is not my idea of fun or efficiency. The all too common appearance of the whale being carried off by birds doesn&#8217;t help. Yet at the same time, it&#8217;s one of the best avenues out there for discovering trends, hearing new information fast and early, and can be a good launching point for spreading your own news. Twitter lets me hear of new happenings in the software/technology world far faster than any other avenue and with less bias.</p>
<p>I&#8217;ve reactivated my Twitter account after a long hiatus. Mostly for the egotistical reason of trying to get the word out on a <a href="http://github.com/city41/cocosnet">new project</a> I&#8217;ve started. I have found it to be just as bad as ever. But this time I am determined to make it a useful ally.</p>
<p>I&#8217;ve come to realize a slot in my &#8220;following&#8221; list is precious. You shouldn&#8217;t be there unless you are regularly tweeting stuff I find to be interesting or useful. I shouldn&#8217;t hear about your constant, trivial, daily life unless your a friend of mine. And even that&#8217;s pushing it. I&#8217;ve decided to proactively manage my followers. Are you tweeting and retweeting complete crap? Off you go, I don&#8217;t care how useful you may be in theory. Did you just start following me? I&#8217;m not returning the favor until I feel you are worth it.</p>
<p>I need to pay attention to retweets too. They can be an easy way to find &#8220;meaty&#8221; tweeters. I almost wish Twitter could have some kind of rating system that makes it easier to find quality tweeters. Sort of like Twitter+Reddit. Or if people could categorize their tweets, and then I could only subscribe to specific categories from each tweeter. That goes against what Twitter wants to be though, and so I understand it will probably never happen.</p>
<p>Am I being an ass? Maye a little bit. It&#8217;s not like Twitter intended their service to have an excellent signal/noise ratio. It&#8217;s just a platform that the users can take anywhere they want. If people want Twitter to be completely fun then that&#8217;s perfectly valid. But for me Twitter needs to be beneficial as the &#8220;fun&#8221; side it is pretty much redundant to me. I generally find Facebook is a much better way to have fun and connect with friends through small status updates.</p>
<p>I will also try and return the favor and keep my tweets meaningful. It&#8217;s so easy to just tweet something. That&#8217;s the platform&#8217;s saving grace and its death knell at the same time.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/10/trying-to-like-twitter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sub millisecond precision with NSTimer and MonoTouch</title>
		<link>http://matt-greer.com/blog/2009/10/sub-millisecond-precision-with-nstimer-and-monotouch/</link>
		<comments>http://matt-greer.com/blog/2009/10/sub-millisecond-precision-with-nstimer-and-monotouch/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 20:31:27 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[monotouch]]></category>
		<category><![CDATA[nstimer]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=89</guid>
		<description><![CDATA[MonoTouch did a nice job of wrapping up NSTimer and lets you create them by specifying a TimeSpan for the timer's interval. That's all well and good, but TimeSpan's highest precision is a millisecond.]]></description>
			<content:encoded><![CDATA[<p>NSTimer on the iPhone is a nice little timer, it&#8217;s capable of sub millisecond precision. This is essential for games that want to run at 60fps, as in that case each frame will need to take up 16 and 2/3s milliseconds. If a whole millisecond is the best you can do, you end up with a framerate of either 58fps or 62fps, depending on which way you round.</p>
<p>MonoTouch did a nice job of wrapping up NSTimer and lets you create them by specifying a TimeSpan for the timer&#8217;s interval. That&#8217;s all well and good, but TimeSpan&#8217;s highest precision is a millisecond. Yes TimeSpan&#8217;s work with ticks too, which are 100 nanoseconds each, but I&#8217;m going to conveniently ignore that fact for the sake of doing a tiny bit of MonoTouch exploration.</p>
<p>You can create an NSTimer in MonoTouch with sub millisecond precision by ditching TimeSpans altogether and going straight in with a double indicating how long in seconds an interval will be. This is how NSTimer natively works. You want to use this method:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">NSTimer.<span style="color: #0000FF;">CreateTimer</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">double</span> seconds, NSObject target, Selector selector, <span style="color: #FF0000;">object</span> userData, <span style="color: #FF0000;">bool</span> repeating<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>You need a MonoTouch object that can masquerade as an Objective-C object to be the target. Chances are none of your existing classes can fit this bill. This is easy to do with a tiny class just for the purpose:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #FF0000;">class</span> MyNSActionDispatcher <span style="color: #008000;">:</span> NSObject <span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">string</span> SelectorName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;doAction&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #0600FF;">private</span> NSAction _action<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> MyNSActionDispatcher<span style="color: #000000;">&#40;</span>NSAction action<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>action <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;action&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
        _action <span style="color: #008000;">=</span> action<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #000000;">&#91;</span>Export<span style="color: #000000;">&#40;</span>SelectorName<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> DoAction<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        _action<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> Selector Selector <span style="color: #000000;">&#123;</span>
        get <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">return</span> <span style="color: #008000;">new</span> Selector<span style="color: #000000;">&#40;</span>SelectorName<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><code>NSAction</code> is just a delegate defined by MonoTouch, you don&#8217;t even have to use it here. The <code>Selector</code> object is what allows MonoTouch to map from an Objective-C selector to a C# method. <code>Export</code> means the method is declaring &#8220;hey this method should pretend to be an Objective-C selector. If the Objective-C runtime sends a &#8216;doAction&#8217; message, then let me handle it!&#8221;</p>
<p>This all came together to form <a href="http://github.com/city41/CocosNet/">CocosNet</a>&#8217;s main gameloop timer running at exactly 60fps, just like Cocos2D&#8217;s game loop does:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> _animationTimer <span style="color: #008000;">=</span> NSTimer.<span style="color: #0000FF;">CreateTimer</span><span style="color: #000000;">&#40;</span>AnimationInterval, <span style="color: #008000;">new</span> MyNSActionDispatcher<span style="color: #000000;">&#40;</span>MainLoop<span style="color: #000000;">&#41;</span>, MyNSActionDispatcher.<span style="color: #0000FF;">Selector</span>, <span style="color: #0600FF;">null</span>, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
NSRunLoop.<span style="color: #0000FF;">Main</span>.<span style="color: #0000FF;">AddTimer</span><span style="color: #000000;">&#40;</span>_animationTimer, <span style="color: #666666;">&quot;NSDefaultRunLoopMode&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<h2>Using ticks instead</h2>
<p>Now let&#8217;s stop ignoring the other way of creating a TimeSpan, using ticks. A tick is 100 nanoseconds, meaning there are 10 million ticks in a second. That&#8217;s more than enough precision. So ultimately, I actually went with this to create the timer, ditching my need for the helper class altogether:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">_animationTimer <span style="color: #008000;">=</span> NSTimer.<span style="color: #0000FF;">CreateRepeatingTimer</span><span style="color: #000000;">&#40;</span>TimeSpan.<span style="color: #0000FF;">FromTicks</span><span style="color: #000000;">&#40;</span>Convert.<span style="color: #0000FF;">ToInt64</span><span style="color: #000000;">&#40;</span>AnimationInterval <span style="color: #008000;">*</span> 10000000l<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, MainLoop<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Which also works quite well.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/10/sub-millisecond-precision-with-nstimer-and-monotouch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MonoTouch and Cocos2D in C#</title>
		<link>http://matt-greer.com/blog/2009/10/monotouch-and-cocos2d-in-c/</link>
		<comments>http://matt-greer.com/blog/2009/10/monotouch-and-cocos2d-in-c/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 07:11:59 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cocos2d]]></category>
		<category><![CDATA[cocosnet]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[monotouch]]></category>

		<guid isPermaLink="false">http://matt-greer.com/blog/?p=87</guid>
		<description><![CDATA[I have taken it upon myself to <a href="http://github.com/city41/CocosNet">port</a> the nice 2D game engine <a href="http://cocos2d-iphone.org">Cocos2D</a> to .NET. To be more precise, the new implementation of .NET that runs on the iPhone, <a href="http://www.monotouch.net">MonoTouch</a>. So far everything is going quite well!]]></description>
			<content:encoded><![CDATA[<p>I have taken it upon myself to <a href="http://github.com/city41/CocosNet">port</a> the nice 2D game engine <a href="http://cocos2d-iphone.org">Cocos2D</a> to .NET. To be more precise, the new implementation of .NET that runs on the iPhone, <a href="http://www.monotouch.net">MonoTouch</a>. So far everything is going quite well!</p>
<p>MonoTouch takes a small .NET profile based on Silverlight and brings it to the iPhone. This is possible through Mono&#8217;s ability to do AOT (ahead of time) compiling, to forego the need of the JIT (which is a no no on the iPhone). This also means your apps will utilize a garbage collector; Mono&#8217;s Boehm garbage collector is statically linked to your app, and running in what I understand to be &#8220;precise mode&#8221;. I&#8217;m not an expert (at all) on GC&#8217;s.</p>
<p>MonoTouch to me doesn&#8217;t seem all <em>that</em> useful for standard view driven apps. MonoTouch is still using CocoaTouch, it has not ported some kind of bastard WPF or WinForms over to the platform. Which is good, using the native libraries is definitely the way to go to create apps that feel just like their native brothers. So MonoTouch doesn&#8217;t really buy you much, if anything, in regards to learning CocoaTouch if you are a .NET kinda person. If I was going to make standard view based apps, I&#8217;d probably just stick with Objective-C and save my 400 bucks. I mean Objective-C is a pretty lame language in many regards, but it&#8217;s also quite nice in others and really isn&#8217;t all that bad.</p>
<p>However, in the case of games, MonoTouch makes a lot of sense to me. My goal is to have Cocos2D generally available to all .NET platforms: iPhone, Mac, Windows, Linux, Xbox and Windows Mobile. Then have a nice common platform to write a game once and run it everywhere. Heh. Ok so it won&#8217;t be that simple, but it will be a huge step forward. There will be lots of other hurdles such as the Xbox&#8217;s lack of OpenGL, every non phone platform&#8217;s lack of a touch screen, platform specific gotchas, the fact that iPhone games won&#8217;t necessarily make great PC games, etc etc.</p>
<h2>Mono* Impressions</h2>
<p>This is my first exposure to the world of Mono. So far I&#8217;m impressed. MonoTouch apps appear to run on the iPhone quite well. I am already seeing some garbage collector related framerate jerkiness, but that&#8217;s nothing I&#8217;ve not encountered before. So far CocosNet can go toe to toe with Cocos2D just fine.</p>
<p>There are some minor gotchas you have to watch out for in that Mono in the simulator is basically just a standard Mono app (ie, with the full fledged JIT compiler running), whereas on the phone itself it&#8217;s a very different beast. There are times you have to check the <code>Runtime.Arch</code> property and do one thing for the sim and something else for the phone. That kinda stinks, but so far it&#8217;s been rather minor.</p>
<p>In cases when you need a Cocoa method that MonoTouch has not yet bound, you have to dive into the low level world of <code>objc_msgSend</code>, which is kind of ironic. It&#8217;s like MT lifts you up far away from the world of Objective-C, or it slams you right down into the center of it.</p>
<p>Novell&#8217;s documentation has proven to be pretty good, and got me up and running on pinvoking my objc_msgSend calls and the like just fine.</p>
<p>Much of the Mono/MonoTouch team hangs out on irc.gnome.org and they&#8217;ve proven very helpful. Which is really cool.</p>
<p>Finally, MonoDevelop is Mono&#8217;s IDE and it&#8217;s very Visual Studio-ish. Which I think is great. It provides much the same look and feel, key commands, and workflows as VS. But is <b>much</b> lighter, simpler, and to the point. Sounds like a good combination to me. It&#8217;s still pretty raw at times, and can crash or certain operations can lead to an unhandled exception. But all in all I am finding it to be a quality IDE that will really shine when it&#8217;s totally ready.</p>
<p>So far my MonoTouch experience so far has been quite positive. For the first couple of weeks I avoided paying the licensing fee by just using the simulator. But today I broke down and bought the real deal, because I know MonoTouch is going to delever what I need.</p>
]]></content:encoded>
			<wfw:commentRss>http://matt-greer.com/blog/2009/10/monotouch-and-cocos2d-in-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
