<?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>Michael Kofman</title>
	<atom:link href="http://michaelkofman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://michaelkofman.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 18 Apr 2011 00:52:13 +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>Full Sail Final Project Presentations from January 2009</title>
		<link>http://michaelkofman.com/full-sail-final-project-presentations-from-january-2009/</link>
		<comments>http://michaelkofman.com/full-sail-final-project-presentations-from-january-2009/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 00:50:33 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=257</guid>
		<description><![CDATA[Presenting Roadent Rampage, for more information on the project click here or shoot me an email here.

]]></description>
			<content:encoded><![CDATA[<p>Presenting Roadent Rampage, for more information on the project click <a href="http://michaelkofman.com/roadent-rampage/">here</a> or shoot me an email <a href="mailto:michael@straystudios.com">here</a>.</p>
<p><iframe src="http://player.vimeo.com/video/22386095" width="500" height="275" frameborder="0"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/full-sail-final-project-presentations-from-january-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GDC 2010 &#8211; Day 1</title>
		<link>http://michaelkofman.com/gdc-2010-day-1/</link>
		<comments>http://michaelkofman.com/gdc-2010-day-1/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 13:35:35 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Game Industry]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=184</guid>
		<description><![CDATA[This year&#8217;s Game Developer&#8217;s Conference felt a little strange to me. For one the conference has been skewed from Monday through Friday to Tuesday through Saturday. Second, Mascone West has been decommissioned due to some other conference going on during the same time. Third this was going to be my first ever #AISummit.
For me the [...]]]></description>
			<content:encoded><![CDATA[<p>This year&#8217;s Game Developer&#8217;s Conference felt a little strange to me. For one the conference has been skewed from Monday through Friday to Tuesday through Saturday. Second, Mascone West has been decommissioned due to some other conference going on during the same time. Third this was going to be my first ever <a href="http://search.twitter.com/search?q=AISummit">#AISummit</a>.<span id="more-184"></span></p>
<p>For me the conference really began at Day 0 when I had the opportunity to meet with lots of folks from the AI Guild including the opportunity to finally meet Alex Champandard from <a href="http://www.aigamedev.com/">AIGameDev.com</a> who literally felt like a celebrity at the event. Speaking of AIGameDev, I got to speak with two very cool contributors from the Sanbox project, Ken Short and Radur (I hope I&#8217;m spelling this right since I never got a business card *hint hint*). I met with two long time friends and people who I feel like I already owe a lot to; Dave Mark, and Neil Kirby. While I&#8217;ve followed Dave around the states throughout 2009 as well as joined him on some Team Fortress 2 skirmishes, it was a real pleasure to shake hands with Neil Kirby once again. With that being said, Neil introduced me to this year&#8217;s Eric Dybsand scholarship recipient Gabriel Deyerle who I felt like I instantly became friends with, and speaking of scholarship recipients I met Victoria Smith for the second time who was the third recipient of the scholarship in 2009. Only missing Andrew Armstrong, Neil was nice enough to take a picture which I hope to post into here once he gets around to uploading it onto flickr. And speaking of flickr do check out the AI Game Programmer&#8217;s Guild group at <a href="http://www.flickr.com/groups/agpg/">http://www.flickr.com/groups/agpg/</a>. To wrap up Day Zero I met with three other speakers of the AISummit, Borut Pfeifer, Chris Jurney and the great Emily Short.</p>
<p>Day One officially began as I made my from the Union Square Hotel and made sure to get an early seat while watching Dave and Chris go through some last minute set up work.</p>
<p><strong>10am-11am</strong><br />
The first session began with three case studies on recent AI trends. Tara Teich (Double Fine Productions) spoke about the challanges in Brutal Legends when it came to integrating 50+ unit types of various sizes, proportions, attacks combinations with the main avatar, and the design decisions of the AI Avatar character. This reminded me a bit of my own game from full sail when creating Amoeba Sports. Creating a believable AI opponent that resembles that of the human player&#8217;s avatar is a very daunting task. Tara explained that for the AI Avatar they kept his behavioral priority to something like the following:</p>
<ol>
<li>Retreat if low Health</li>
<li>Capture Resources</li>
<li>Defend the Base</li>
<li>Join a battle in progress</li>
<li>Hang out with the largest army and look cool</li>
</ol>
<p>Tara also mentioned their flat state machine that utilized &#8220;Utility&#8221; functions for transitions.</p>
<p>Alex Champandard gave a talk on Killzone II AI with how they integrated bots into almost everything they did. Killzone II bots&#8217; greatest challenge being the ability to adapt to various maps, and class combinations. This was handle using the standard logic separation between strategy, squad based, and individual AI systems. Alex stressed the heavy use of annotation and referenced several papers on the subject. Something worth noting though is that the annotations never dictated behaviour but instead acted as hints to the AI, such as chock point areas, or good sniper locations. Generally this kept the AI very competitive but did not resolve, what Alex called the third plateau, the ability for the AI to adapt to human tactics that were not accounted for or the evolving beyond expert systems, data mining, and creative AI. For this I followed up with Alex after the session and personally I feel not enough is being done. The only real solutions available are forms of learning and pattern recognition, neither is currently being used in commercial games.</p>
<p>Finally Chris Jurney spoke about Dawn of War II and the challenges faced with transitioning from a game like Company of Heroes that was very impersonal based combat to DoW2 which had quite a bit of melee. Chris summarized the solution to this problem through what he referred to as search based melee. Essentially casting a radius around various units that represented their melee distance, and performing an A* pathfinding to where the their unit radius must be exactly touching the enemies unit radius in order to perform a melee attack. Combined with an additional rule to avoid overlap on a given target created very convincing battle simulations and made the animation bit a lot easier to handle.</p>
<p><strong>11:15am &#8211; 12:15am</strong><br />
Behaviour Trees by Alex Champandard, Michael Dawe, and David Hernandez Cerpa began the talk by exclaiming the sheer popularity and flexibility of BTs in video games. For those who aren&#8217;t familiar with Behaviour Trees I recommend doing some light reading on AIGameDev.com, but for all intensive purposes they are Hierarchical Finite State Machines that don&#8217;t really operate in the sense of states, and use very light and compact nodes to transition behaviours. David opened up by talking about the various node types (Priority, Sequential, Stochastic) and continued with defining slightly more advanced topics such as Event-Driven behaviours (the ability to enable behaviours through events), and Dynamic Behaviours (mostly referring to enticers). Enticers are behaviour trees that attach themselves to actors and detach themselves when finished. These BTs are useful for level behaviour support, and downloadable content. Alex continued by talking about common Design Patterns within BTs, such as scaling up using a HFSM mindset. For this he recommended to not approach behaviour stringing in a linear fashion, but instead chunk BT hierarchies into a blackboard architecture and than create more abstract behaviours that utilize them such as SneakToCover(), PeakAtThreat(), RunToCover(). This of course is hinting at the problem that Alex has been trying to solve and that is the creation of generalized AI. The most important take away from Alex&#8217;s bit was to keep BTs decoupled from the problem at hand. Be careful of &#8220;state like&#8221; behaviours. Lastly, Michael spoke about integrating scripting into BTs, which is quite a common thing to do. BTs are about flexibility and rapid iterations and scripting is usually the ideal solution to the problem. For LUA Michael spoke about a common interface that integrates with the C++ code. They would make sure that no trig was performed in any of the scripts. A tool was created to allow for the designers to rapidly iterate through behaviours, where he himself only created 7 out of the 50+ that were in the game. Lua was optimized by removing floating point math, and prevent mid-frame garbage collection. He typically would spend 10% of his time debugging existing scripts from the designers, and 10% on functionality requests (trig) that were done in C++ and executed using dll functions. He also stressed that BTs need to be periodically reviewed.</p>
<p><strong>1:45pm-2:45pm</strong><br />
The next session was a panel discussion on AI Middleware. I&#8217;ll thankfully keep this one brief as it was pretty synonymous that we should continue to be wary of AI Middleware granted the rent at the end of day by the host John Funge was really interesting. Key points of note were:</p>
<ul>
<li>We want tools over black boxes</li>
<li>Integration support by the middle ware company is often moot, due to the precieved benefits</li>
<li>Evaluating middleware is often difficult due to their inability to simulate production environments during testing</li>
</ul>
<p>The only success story came from Steve Gargolinski from Blue Fang Games who intergrated Havok Behaviours into their Wii title.</p>
<p>&#8211; intermission &#8211;<br />
Well I&#8217;m already getting very tired as I am already at 1300 words and really need to sleep. I&#8217;ll do my best to continue while it may not actually happen until my plane ride home on Saturday evening. After all GDC tends to get busier, and its an event that is difficult to cover in great detail</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/gdc-2010-day-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Inspiration, Motivation, and Fools Gold</title>
		<link>http://michaelkofman.com/inspiration-motivation-and-fools-gold/</link>
		<comments>http://michaelkofman.com/inspiration-motivation-and-fools-gold/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 00:58:08 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=148</guid>
		<description><![CDATA[I am fairly fond of the title for this post as it does two things. It&#8217;s an open invitation to spam crawlers and this is the first blog post in some time with more than a code snippet or two.
In short, it has been almost a year since I&#8217;ve graduated Full Sail University and since [...]]]></description>
			<content:encoded><![CDATA[<p>I am fairly fond of the title for this post as it does two things. It&#8217;s an open invitation to spam crawlers and this is the first blog post in some time with more than a code snippet or two.</p>
<p>In short, it has been almost a year since I&#8217;ve graduated Full Sail University and since then I have had a number of experiences that made me on numerous occasions question the validity of my life-choices. <span id="more-148"></span>This stems from the idea of immediate sacrifice and delayed gratification towards a brighter and happier future. This for most is an accepted part of life and being successful. While ultimately we all strive for happiness and each time we sacrifice and give we hope it to be a means to an end. Of course as we grow older we slowly but surely realize the real cynical nature of human life.</p>
<p>I&#8217;ve asked myself on occasion; what makes me happy? Is it having a high paycheck? Is it the process of creating video games? Is it sitting at a bar? While I&#8217;ve questioned my motives, I always arrive at the same answer sooner or later. I realize that I simply wish to be challenged and learn. At the core that is what drives me! That is what motivates and inspires me. Still I&#8217;ve never been able to make the jump to a full time Indie, or a commit towards academia.</p>
<p>In the near future I hope to reevaluate why I have failed to follow my real agenda. Attain courage, and achieve some closure.</p>
<p>This is essentially a slightly longer twitter post. Thanks for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/inspiration-motivation-and-fools-gold/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wordpress Pagination</title>
		<link>http://michaelkofman.com/wordpress-pagination/</link>
		<comments>http://michaelkofman.com/wordpress-pagination/#comments</comments>
		<pubDate>Tue, 26 May 2009 00:52:19 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Guides]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/mk2009/?p=128</guid>
		<description><![CDATA[Today while striving to wrap up Michael Kofman 2009 I found myself spending longer than I would have liked trying to get a &#8220;wordpress page&#8221; to loop through all of my blog posts with enabled pagination. The intention was to become familiar with the wordpress framework, install a few plugins and be on my marry [...]]]></description>
			<content:encoded><![CDATA[<p>Today while striving to wrap up Michael Kofman 2009 I found myself spending longer than I would have liked trying to get a &#8220;wordpress page&#8221; to loop through all of my blog posts with enabled <a href="http://www.tonymarston.net/php-mysql/pagination.html#a3">pagination</a>. The intention was to become familiar with the wordpress framework, install a few plugins and be on my marry way.  Sadly things didn&#8217;t quite go so smoothly. So to make this a lot less painful for future readers here is a short list of steps and plug ins used as well as a final code snippet. After I&#8217;ll discuss some of the alternate methods I found, share my work cited and hopefully put some value into the community.<br />
<span id="more-128"></span></p>
<h4>Wordpress Page Templates</h4>
<p>My first question was how to create a new page in wordpress and apply to it my own layout and stylesheets. This was incredibly easy and intuitive.</p>
<ol>
<li>Create a new .php page that will serve as a template for your new wordpress page.</li>
<li>Page templates are easily recognized by the wordpress CMS via a magical comment.</li>
</ol>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name: Your Template Name Here
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<ol start="3">
<li>Navigate to /wp-admin/ and depending on the version of your dashboard click add page. </li>
<li>Here you can give your page any title you want. And somewhere on the page you should see an option to apply a template to the page (again this varies with wordpress versions so Google or check documentation). If you uploaded your new .php template to the proper location you should conveniently see &#8220;Your Template Name Here&#8221; as an option.</li>
</ol>
<h4>Installing a Pagination Plugin</h4>
<p>I decided to use <a href="http://www.lesterchan.net/wordpress/readme/wp-pagenavi.html">WP-PageNavi</a> although there are several alternatives I&#8217;ve found.</p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/wp-page-numbers/">WP Page Numbers</a></li>
<li><a href="http://wordpress.org/extend/plugins/different-posts-per-page/">Different Posts Per Page</a></li>
</ul>
<p>To download and install follow these instructions:</p>
<blockquote  cite="http://www.hongkiat.com/blog/adding-nice-wordpress-pagination/"><p>
   1. Download WP-PageNavi<br />
   2. Upload folder “pagenavi” under wp-contents/plugins<br />
   3. Activate the plugin<br />
   4. Add the following code into your current theme’s php file.</p>
<p>          <?php if(function_exists(’wp_pagenavi’)) { wp_pagenavi(); } ?></p>
<p>   5. Configure the settings under WP-Admin -> Options -> PageNavi<br />
   6. Click “Update Options” and you are done.
</p></blockquote>
<h4>The Lonely Loop</h4>
<p>The reason I titled this lonely loop is because most wordpress documentation will refer to the post entries as &#8220;<a href="http://codex.wordpress.org/The_Loop">THE LOOP</a>&#8220;. The final code snippet that finally got things rolling for me was as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #000088;">$my_query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'showposts=5&amp;paged=$page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$my_query</span><span style="color: #339933;">;</span>
&nbsp;
		query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;showposts=5&amp;paged=<span style="color: #006699; font-weight: bold;">$page</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  			&lt;div class=&quot;post&quot; id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
                    &lt;div class=&quot;date&quot;&gt;
                    	&lt;div class=&quot;day&quot;&gt;&lt;center&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/center&gt; &lt;/div&gt;
                    	&lt;div class=&quot;month&quot;&gt;&lt;center&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/center&gt; &lt;/div&gt;
                    	&lt;div class=&quot;year&quot;&gt;&lt;center&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/center&gt; &lt;/div&gt;
                    &lt;/div&gt;
&nbsp;
                    &lt;h2&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title_attribute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h2&gt;
&nbsp;
                    <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read the rest of this entry &amp;raquo;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
                    &lt;p&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No Comments &amp;#187;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1 Comment &amp;#187;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'% Comments &amp;#187;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
                &lt;/div&gt;
                &lt;br class=&quot;clear&quot; /&gt;
                &lt;br class=&quot;clear&quot; /&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
       &lt;div&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_posts_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Older Entries'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
       &lt;div&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> previous_posts_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Newer Entries'</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_pagenavi'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> wp_pagenavi<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h4>Obstacles Overcome</h4>
<p>One of the first challenges I faced was realizing that the default loop provided in index.php did not properly render posts but instead interpreted function calls like the_title() with regard to the title of the page (template) opposed to individual posts. I later found according to slightly misleading documentation that a new query object is required. I proceeded to create one called $my_query. Where I would prefix function calls as such.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$my_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p> and</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$my_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>This seemed to work, but the next problem was getting pagination to work in synch with this new query. The problem was that WP-PageNavi only listens to $wp_query. I had wondered around for some time trying to resolve this particular delima short of writing ajax and the pagination functionality by hand or maybe trying a different plug in. Thank fully after jumping from link to link I finally stumbled onto the following code block.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'paged'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;showposts=5&amp;paged=<span style="color: #006699; font-weight: bold;">$page</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h2&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h2&gt;
&lt;span class=&quot;entry-date&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F d, Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This finally got the ball rolling. I had only correct a few errors that sparked from the constant experimentation like a random reseting of the query at the end of the while loop. Conveniently above the pagination caused the current page to always read 1.</p>
<p>Hope this will be helpful to someone in the future. Here is an unordered list of sources.<br />
http://codex.wordpress.org/Template_Tags/query_posts<br />
http://codex.wordpress.org/The_Loop<br />
http://codex.wordpress.org/Function_Reference/WP_Query<br />
http://codex.wordpress.org/IRC<br />
http://almosteffortless.com/2006/12/21/wordpress-pagination-on-a-page/<br />
http://jarodtaylor.com/blog/wordpress-ultimate-archive-index-with-pagination/<br />
http://www.w3cgallery.com/w3c-css/wordpress-pagination-in-pagephp-or-display-subpages-as-paging-under-parent-page<br />
http://wordpress.org/support/topic/256899<br />
http://www.lesterchan.net/wordpress/readme/wp-pagenavi.html</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/wordpress-pagination/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting Started with wxWidgets</title>
		<link>http://michaelkofman.com/getting-started-with-wxwidgets/</link>
		<comments>http://michaelkofman.com/getting-started-with-wxwidgets/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 11:44:11 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=117</guid>
		<description><![CDATA[I wanted to explore what wxWidgets was all about after learning that tool programmers in the game industry commonly use it in their development environment. Getting started with wxWidgets on a windows platform is fairly straight forward.
Download the latest stable release http://www.wxwidgets.org/downloads/
Go ahead and grab wxMSW &#8211; installer for Windows. Make sure your visual studio [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to explore what wxWidgets was all about after learning that tool programmers in the game industry commonly use it in their development environment. Getting started with wxWidgets on a windows platform is fairly straight forward.</p>
<p>Download the latest stable release http://www.wxwidgets.org/downloads/<br />
Go ahead and grab wxMSW &#8211; installer for Windows. Make sure your visual studio is closed so that the environment variable gets set up correctly.</p>
<p>Next your going to need to compile the library. So go ahead and navigate to installDir\build\msw.<br />
Open up wx.dsw and convert it to your native Visual Studio format. Close visual studio back down and open up each vcproj in the current directory through notepad or notepad++. Search and replace each of the following:<br />
       &#8211; RuntimeLibrary=&#8221;3&#8243; with RuntimeLibrary=&#8221;1&#8243;<br />
       &#8211; RuntimeLibrary=&#8221;2&#8243; with RuntimeLibrary=&#8221;0&#8243;</p>
<p>Once your done. Open up the solution again, and right click the solution in the solution explorer. Select Batch Build. Select only the release and debug for each project. Once complete your ready to create your first wxWidget application with the added work of including all the directories and .lib in your project settings.</p>
<p>Here are two good links to help you get through this:<br />
http://wiki.wxwidgets.org/Compiling_WxWidgets_on_Windows<br />
http://wiki.wxwidgets.org/MSVC_.NET_Setup_Guide#Project_Properties</p>
<p>If it doesn&#8217;t work out right, go ahead and triple check everything!</p>
<p>What I learned from all this was that while wxWidgets are great for multiplatform development they are probably not a solution for developing game GUIs. I&#8217;d love to hear what others think on this subject, meanwhile I&#8217;ll move on to setting up my own GUI framework after a few hours of sleep.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/getting-started-with-wxwidgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Sandbox</title>
		<link>http://michaelkofman.com/new-sandbox/</link>
		<comments>http://michaelkofman.com/new-sandbox/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 05:00:28 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=115</guid>
		<description><![CDATA[During a casual conversation someone brings up the idea of writing their own game engine. This is usually met rather stern remarks about complexity, lines of code, and a unworthy endeavor. Well for the most part I would say that is a true statement, and let me just say that is not what I&#8217;m trying [...]]]></description>
			<content:encoded><![CDATA[<p>During a casual conversation someone brings up the idea of writing their own game engine. This is usually met rather stern remarks about complexity, lines of code, and a unworthy endeavor. Well for the most part I would say that is a true statement, and let me just say that is not what I&#8217;m trying to do. Well I&#8217;m trying not to think about it that way. My goal over the course of this week is to assemble together several sub systems I&#8217;ve done before, and some that I haven&#8217;t into a comprehensive sandbox. Then split it into several plug and play DLLs that I can use in future projects.</p>
<p>What I have so far:</p>
<ul>
<li>Math Library</li>
<li>Event Handler</li>
<li>Win32 Framework</li>
<li>Resource Manager</li>
<li>DirectX Initialization and Callbacks</li>
</ul>
<p>What I&#8217;m tackling this week:</p>
<ul>
<li>GUI Framework</li>
<li>wxWidgets Integration</li>
<li>Network Framework</li>
<li>Console Debugger</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/new-sandbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Full Sail Experience</title>
		<link>http://michaelkofman.com/my-full-sail-experience/</link>
		<comments>http://michaelkofman.com/my-full-sail-experience/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 23:26:59 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[FullSail]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Game Industry]]></category>
		<category><![CDATA[FullSail University]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=111</guid>
		<description><![CDATA[What drove me to take the plunge?
After high school I was very frustrated by the core classes that defined the first two years of a regular University. I was becoming even more frustrated by the partying, and lack of vision most of my friends and peers were only concerned about. I don’t remember what conversation [...]]]></description>
			<content:encoded><![CDATA[<p>What drove me to take the plunge?</p>
<p class="MsoNormal">After high school I was very frustrated by the core classes that defined the first two years of a regular University. I was becoming even more frustrated by the partying, and lack of vision most of my friends and peers were only concerned about. I don’t remember what conversation made me remember Full Sail but it was a school I had known about since middle school and I truly felt my passion was in game development. I decided that I want two things out of my career. First interesting and challenging work that would keep me ever interested. Second I wanted to work at a fun place that allowed for creativity. So long story made a little shorter, Full Sail University is one of two schools at the time that might hope to provide for the sort of education that really teaches you the internal workings of making a game. I took the plunge. I packed up everything I owned into my car at the time 1998 Nissan Maxima, and drove it from Philadelphia to Winter Park FL. Thankfully my apartment was ready; I choose to stay at Winter Park Pointe apartments because they were the closest and cheapest in the area. I also decided to not have a roommate after a few disappointing attempts. So for the next few months I slept on nothing but a mattress.</p>
<p class="MsoNormal">The first three months are crucial at Full Sail; they help separate those who can and cannot handle the program. Odd schedules that have classes end at 1am and start again at 9am the next day. It was interesting trying to adapt to it, and many of us became nocturnal. The next month the schedule changed again. Oh yes, a semester is only a month long and classes are 40 hours a week. The pacing was perfect for me and I really dug all the knowledge. I was excited to be there, and I was just amazed at the different types of people I was surrounded by and all of whom held a strong interest in video games. I bought a PS3, and started playing games a lot more than ever before in my life. At some point along the way I think I lost sight of my goal and what was at stake. After the first three months I felt like I had C++ down solid.</p>
<p class="MsoNormal">The rest of the year we spent learning MFC, Win32, C#, DirectX, and Design Patterns. Along the way we also had a few general education classes needed for accreditation, but they too were all geared towards Game Development. This included an English course that had us write a full game design document. Math in Linear Algebra, Calculus, and Physics all laid out the foundation for what was to come.</p>
<p class="MsoNormal">The first game making experience was defined by two classes; Software Game Development and Software Game Production. I feel like both experiences deserve a post mortem but the lessons learned cannot be learned from reading this.</p>
<p class="MsoNormal">After the half way point it felt like we did something really great. We made a game! A great one at that. I, Casey Flach, and Charlie Prouse put together a 3D top down shooter in a roughly five weeks. Who knew that making a game doesn’t take months but weeks? Well we were hungry for more knowledge and the next few months more than helped satisfy that appetite. We took classes in Artificial Intelligence, Networking, Machine Architecture, OpenGL, Optimization, and Engine Development.</p>
<p class="MsoNormal">And we finally made it … final project… to be continued….</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/my-full-sail-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Unity3D</title>
		<link>http://michaelkofman.com/working-with-unity3d/</link>
		<comments>http://michaelkofman.com/working-with-unity3d/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 19:20:21 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Unity 3D]]></category>
		<category><![CDATA[Zeitgeist Games]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=107</guid>
		<description><![CDATA[Unity 3D has been a really great experience at my new job at Zeitgeist Games. Although I&#8217;m under NDA and can&#8217;t talk about what I&#8217;ve really been working on, I decided it would be a good idea to share with you a learning demo I put together that demonstrates the capabilities of Unity3D in a [...]]]></description>
			<content:encoded><![CDATA[<p>Unity 3D has been a really great experience at my new job at Zeitgeist Games. Although I&#8217;m under NDA and can&#8217;t talk about what I&#8217;ve really been working on, I decided it would be a good idea to share with you a learning demo I put together that demonstrates the capabilities of Unity3D in a browser.</p>
<p>Take a look and I hope you like this <a href="http://michaelkofman.com/UnitParticleExperiment.html" target="_self">Unity3D Particle Demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/working-with-unity3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exoporting from Maya</title>
		<link>http://michaelkofman.com/exoporting-from-maya/</link>
		<comments>http://michaelkofman.com/exoporting-from-maya/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 11:17:08 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Guides]]></category>
		<category><![CDATA[Exporter]]></category>
		<category><![CDATA[Maya]]></category>
		<category><![CDATA[Michael Kofman]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=89</guid>
		<description><![CDATA[Game developers, big and small, are often tasked with content generation. We write tools that range from scripters, effects editors, to the infamous level editors. While level editors serve an important role in the game development cycle, sometimes time and limited man power don&#8217;t allow for the creation of a fully featured environment.
In this tutorial [...]]]></description>
			<content:encoded><![CDATA[<p>Game developers, big and small, are often tasked with content generation. We write tools that range from scripters, effects editors, to the infamous level editors. While level editors serve an important role in the game development cycle, sometimes time and limited man power don&#8217;t allow for the creation of a fully featured environment.</p>
<p>In this tutorial we&#8217;ll go straight to the source with the creation of our Maya exporter. We will not be covering Mel, or building our own GUI. Instead we&#8217;ll be adopting from the <span style="font-size: 10pt; font-family: Lucida Console;">MPxFileTranslator</span>, a maya file exporter. We&#8217;ll be saving out our code into an XML file format that can then be used as input for character models, or even levels.</p>
<p><span id="more-89"></span></p>
<p>Understanding Maya&#8217;s naming convention is key to feeling comfortable and eventually predicting variable names when exploring further feature sets of the Maya API.</p>
<p>Nearly all Maya prefixes begin with the letter <span style="color: #244061;"><strong>M</strong></span>; which of course stands for Maya and defines a Maya wrapper class. Next we have <span style="color: #244061;"><strong>MFn</strong></span>; which stands for Maya Function set. For example <span style="font-size: 10pt; font-family: Lucida Console;">MFnMesh</span>, contains specific functions and variables that appropriately define a mesh (<em>a mesh is a collection of vertices, normals and uv coordinates in 3D space</em>) object in Maya. The MFn prefix is not limited to only visible objects in Maya. For instance, <span style="font-size: 10pt; font-family: Lucida Console;">MFnDependencyNode</span> is a conceptual object that is used to define a node inside the Maya graph architecture (we&#8217;ll cover the Maya architecture shortly, so don&#8217;t stress it).</p>
<p>Another important prefix in Maya is the <span style="color: #244061;"><strong>MIt</strong></span> prefix that stands for Maya iterator. An iterator is not a difficult concept for those who are familiar with the STL library. It points towards some position in a data set (in this case a tree) and allows us for easy traversal, going to the next object ( <span style="font-size: 10pt; font-family: Lucida Console;">itr.next()</span> ) and looping until done ( <span style="font-size: 10pt; font-family: Lucida Console;">while(!itr.isDone())</span> ).</p>
<p>The last and final prefix to take note of is the <span style="color: #244061;"><strong>MPx</strong></span>. It stands for Maya Proxy object (see proxy). Quite simply it provides us with an interface towards integrating into Maya itself. Common uses of MPx are the <span style="font-size: 10pt; font-family: Lucida Console;">MPxFileTranslator</span> which we will be focusing on in this tutorial and the <span style="font-size: 10pt; font-family: Lucida Console;">MPxCommand</span> which allows the user to create his or her own custom Maya commands. For more information please reference the Maya Documentation.</p>
<p>Now that we are past the formalities, we can begin to talk about how Maya organizes it&#8217;s data, so that we can begin to extract from it. Essentially everything in Maya is stored inside a Directed Acyclic Graph or DAG (this one keyword will be very important so please take note of it now).  For those familiar with web design this is equivalent to the HTML DOM object, for those not familiar I will refer to the data structure of a <em>graph</em>. The major difference in definition of a graph data structure and the DAG is that child nodes cannot be their own parents. See picture below.</p>
<p><a href="http://michaelkofman.com/mk2009/wp-content/uploads/2008/08/dagandnotadag.jpg" class="lightview" rel="gallery[89]" title="dagandnotadag"><img class="aligncenter size-medium wp-image-90" title="dagandnotadag" src="http://michaelkofman.com/wp-content/uploads/2008/08/dagandnotadag-300x174.jpg" alt="" width="300" height="174" /></a></p>
<p><strong>Step 1 – creating a proxy<br />
</strong></p>
<p>Create a new class and derive from <span style="font-size: 10pt; font-family: Lucida Console;">MPxFileTranslator</span>.</p>
<p style="margin-left: 36pt"><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">class CFileTranslator : public MPxFileTranslator<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Lucida Console;"> You will need to overload the following functions<br />
</span></p>
<p><span style="font-size:10pt"><span style="font-family: Lucida Console;"> </span><span style="font-family: Consolas; color: #0070c0;">static void * creator(void);<br />
</span></span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MStatus writer(const MFileObject&amp; file, const MString&amp; optionString, FileAccessMode mode);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> bool haveWriteMethod(void)const { return true; }<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MString defaultExtension() const { return &#8220;xml&#8221;;}<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MString filter() const { return &#8220;*.xml&#8221;;}<br />
</span></p>
<p><strong>Step 2 – creating a an exporter class<br />
</strong></p>
<p>Our Maya exporter will execute after pushing file -&gt; export all or file -&gt; export selection. Our entry point is than inside the <span style="font-size: 10pt; font-family: Lucida Console;">writer()</span> function that we have overloaded. In order to check for selection we can perform the simple if check for <span style="font-size: 10pt; font-family: Lucida Console;">mode == kExportActiveAccessMode</span> else we export all. Since this is more of a feature than base functionality I won&#8217;t cover exporting by selection in any great detail but its implementation is not very different from exporting all.</p>
<p>We now have the simple design decision to write all our code inside the <span style="font-size: 10pt; font-family: Lucida Console;">CFileTranslator</span> class we created earlier or simply create a new class that will be specific towards our needs. We will want this new class to contain a few basic functions. Such as <span style="font-size: 10pt; font-family: Lucida Console;">ClearAndReset()</span>, <span style="font-size: 10pt; font-family: Lucida Console;">ExportVertexData()</span> and <span style="font-size: 10pt; font-family: Lucida Console;">WriteToFile()</span>. We will call these in that sequence from within the <span style="font-size: 10pt; font-family: Lucida Console;">CFileTranslator</span>&#8217;s <span style="font-size: 10pt; font-family: Lucida Console;">writer()</span> function.</p>
<p><strong>Step 3 – data structures and data members<br />
</strong></p>
<p>Next we&#8217;ll create some basic data structures that we&#8217;ll fill out during exporting. One thing to note is that we&#8217;ll be using Maya&#8217;s intrinsic data types such as MFloatPoint which is essentially Maya&#8217;s version of a 3-tulupe vector that contains floats for the x, y, and z coordinates.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">typedef struct _tVertex<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFloatPoint point;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFloatVector normal;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> float uv[2];<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }UniqueVertex;<br />
</span></p>
<p>Here we created a new datatype that will contain the vertex position (<span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">point</span>), the vertex normal (<span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">normal</span>) and the UV texture coordinates (<span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">uv[2]</span>). As we export our data we&#8217;re looking to optimize Maya&#8217;s vertex list by creating avoid duplicate vertices and creating a unique vertex list. We&#8217;ll than create our own triangle list that store indices into this our array of unique vertices. For a better idea on how index buffers work, reference Chad Vernon&#8217;s website at (<a href="http://www.chadvernon.com/blog/tutorials/directx9/vertex-and-index-buffers/">http://www.chadvernon.com/blog/tutorials/directx9/vertex-and-index-buffers/</a>). So the last important data structure we&#8217;ll need to generate is our triangle.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">typedef struct _tTriangle<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">{<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> unsigned int verts[3];<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">}Triangle;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> std::vector&lt;UniqueVertex&gt;    m_UniqueVertList;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> std::vector&lt;Triangle&gt;    m_TriangleList;<br />
</span></p>
<p>Wrapping the above into a mesh structure would allow us to export more than one mesh at a time. These are further improvements that you may consider making to the base exporter.</p>
<p><strong>Step 4 – the loop<br />
</strong></p>
<p>The idea is quite simple, but the work may become a little tedious. Our goal is to go through go through Maya&#8217;s DAG , find all the Meshes and export them. The tedious part is that we&#8217;ll be doing a very similar traversal for just about each part of the export process since the DAG contains everything from Mesh objects to lights and transforms.</p>
<p>Thankfully the iteration process is quite straightforward. We begin by creating a MItDag. We specify that we&#8217;ll be traversing in <em>depth first</em> order, and we&#8217;ll be looking for <em>Meshes</em>. The code should look something like this.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">MItDag dagIt(MItDag::kDepthFirst, MFn::kMesh);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> </span>Next we loop through each element, each time checking if the Mesh is an intermediate object, which simply means it&#8217;s something left over in Maya history but is not the current model we continue. Else we begin exporting by calling <span style="font-size: 10pt; font-family: Lucida Console;">GetMesh()</span>, our own function that will fill out our data structures from earlier.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">for (;!dagIt.isDone(); dagIt.next())<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MDagPath currPath;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> dagIt.getPath(currPath);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFnMesh currMesh(currPath);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> if (currMesh.isIntermediateObject())<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> continue;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> GetMesh(currMesh);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p><strong>Step 5 – Creating a unique vertex list from Maya&#8217;s data<br />
</strong></p>
<p><strong> </strong>We&#8217;re now inside the GetMesh() function at which point our prime objective is to fill out our m_UniqueVertList and m_TriangleList for our mesh. This is also a good time to go ahead and pull out things like the mesh transform, or any custom attributes if you so wish. Again we will not focus on these features and move onto the actual data.</p>
<p>We begin by creating a MDagPath object which essentially will contain the directory, or path if you will, of the mesh we are attempting to export.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">MDagPath path;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> currMesh.getPath(path);<br />
</span></p>
<p>Next we&#8217;ll create a new itterator to traverse the polygons of our mesh (aka triangles). We&#8217;ll also create a few arrays that we&#8217;ll populate with Maya&#8217;s vertex positions, vertex normals, and UV coordinates.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">MItMeshPolygon polyItr(path);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFloatPointArray _tPoints;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> currMesh.getPoints(_tPoints);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFloatVectorArray _tNormals;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> currMesh.getNormals(_tNormals);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFloatArray _tVArrays;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> MFloatArray _tUArrays;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> currMesh.getUVs(_tVArrays,_tUArrays);<br />
</span></p>
<p>Something to take note of now, is that the index of the vertex positions, normals, and UVs will all be unique. Although the index of the U and V coordinates is a 1:1, and will use the same value.</p>
<p>If you have kept up with this tutorial so far, congratulations, we&#8217;re now in the final stretch and I will simply go ahead and post up the code for generating the unique vertex list and triangle list per mesh. Remember that this code snippet is my own and your coding style may or may not adhere to it. The important part is that you understand the process involved.</p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;">for (; !polyItr.isDone(); polyItr.next())<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> Triangle tmpTriangle;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> for (int vertIndex = 0; vertIndex &lt; 3; ++vertIndex)<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> UniqueVertex tmpVertex;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> tmpVertex.point = _tPoints[polyItr.vertexIndex(vertIndex)];<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> tmpVertex.normal = _tNormals[polyItr.normalIndex(vertIndex)];<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> int uvIndex = -1;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> if(polyItr.getUVIndex(vertIndex, uvIndex))<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> tmpVertex.uv[0] = _tVArrays[uvIndex];<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> tmpVertex.uv[1] = _tUArrays[uvIndex];<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> else<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> continue; // this is a bad place to be!<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> bool exists = false;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> int i = 0;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> int size = m_UniqueVertList.size();<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> for (; i &lt; size; ++i)<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> if(m_UniqueVertList[i].point == tmpVertex.point &amp;&amp; m_UniqueVertList[i].normal == tmpVertex.normal &amp;&amp;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> m_UniqueVertList[i].uv[0] == tmpVertex.uv[0] &amp;&amp; m_UniqueVertList[i].uv[1] == tmpVertex.uv[1] )<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> exists = true;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> break;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> if (exists)<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> {<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> tmpTriangle.verts[vertIndex] = i;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> continue;<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> tmpTriangle.verts[vertIndex] = m_UniqueVertList.size();<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> m_UniqueVertList.push_back(tmpVertex);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> m_TriangleList.push_back(tmpTriangle);<br />
</span></p>
<p><span style="font-size: 10pt; font-family: Consolas; color: #0070c0;"> }<br />
</span></p>
<p>Since I didn&#8217;t cover everything involved with creating a Maya exporter and assumed some familiarity, or rather ability to use the Maya Documentation, please feel free to post comments and ask questions. I&#8217;ll be glad to make clarifications, but at the moment I need to get back to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/exoporting-from-maya/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Final Project Begins, It&#8217;s Go Time!</title>
		<link>http://michaelkofman.com/final-project-begins-its-go-time/</link>
		<comments>http://michaelkofman.com/final-project-begins-its-go-time/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 09:12:12 +0000</pubDate>
		<dc:creator>Michael Kofman</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Final Project]]></category>
		<category><![CDATA[FullSail]]></category>

		<guid isPermaLink="false">http://michaelkofman.com/?p=86</guid>
		<description><![CDATA[I&#8217;m excited, no thrilled, I&#8217;m so anxious I can&#8217;t find the words to describe how I feel right now. Its the first day of school again. Oh the antcipation. You know when you go to sleep right away, in hopes of making tomorrow come faster, only to wake up hours before thinking and dreaming about [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m excited, no thrilled, I&#8217;m so anxious I can&#8217;t find the words to describe how I feel right now. Its the first day of school again. Oh the antcipation. You know when you go to sleep right away, in hopes of making tomorrow come faster, only to wake up hours before thinking and dreaming about nothing else.</p>
<p>We finally made it to Final Project! The next five months will be the most important months for me at FullSail. They will define all that I&#8217;ve learned, they will define all that I&#8217;m capable of. These last months will be the last stepping stones towards breaking into my dream job. There&#8217;s nothing more to say but this.</p>
<p>No matter what happens, no matter what goes wrong, no matter what challanges lie ahead. Our final project will be amazing, I know it. And with the months to come, I think I&#8217;ll convince you!</p>
]]></content:encoded>
			<wfw:commentRss>http://michaelkofman.com/final-project-begins-its-go-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

