<?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>luminance &#187; Tiled</title>
	<atom:link href="http://www.luminance.org/tag/tiled/feed" rel="self" type="application/rss+xml" />
	<link>http://www.luminance.org</link>
	<description>Programming and Game Development - Kevin Gadd's Personal Blog</description>
	<lastBuildDate>Thu, 29 Apr 2010 17:20:57 +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>Tiled map loader for XNA</title>
		<link>http://www.luminance.org/code/2009/06/17/tiled-map-loader-for-xna</link>
		<comments>http://www.luminance.org/code/2009/06/17/tiled-map-loader-for-xna#comments</comments>
		<pubDate>Thu, 18 Jun 2009 05:02:21 +0000</pubDate>
		<dc:creator>Kael</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[loader]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[tile]]></category>
		<category><![CDATA[Tiled]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.luminance.org/?p=495</guid>
		<description><![CDATA[Update: Stephen Belanger of Nerd Culture has made some great improvements to the following code, so I encourage you to check out the post about it on his blog.
Early in the development of my game, I used the free and open-source Tiled Map Editor to create levels. It was a big time-saver since it let [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update: </strong><a href="http://www.nerdculture.org/" target="_blank">Stephen Belanger of Nerd Culture</a> has made some great improvements to the following code, so I encourage you to <a href="http://www.nerdculture.org/2009/07/14/tiled-maps-for-xna-full-support-for-the-tiled-map-xml-specification/" target="_blank">check out the post about it on his blog</a>.</p>
<p>Early in the development of my game, I used the free and open-source <a href="http://mapeditor.org/index.html">Tiled Map Editor</a> to create levels. It was a big time-saver since it let me worry about more important things instead of investing effort into being able to place tiles down on a map. Later on I decided that the traditional approach to map construction wasn&#8217;t right for my project &#8211; but I was still glad I&#8217;d used Tiled.</p>
<p>Recently I realized that there aren&#8217;t very many easy ways for newbie XNA developers to get maps into their games, so I decided it was worth packaging up my Tiled map loader and sharing it with the world. So, I&#8217;ve created a <a href="http://luminance.org/xna/Tiled.zip">simple example that shows how to load Tiled maps in your XNA game on Windows PCs and the XBox 360</a>, and included the loader with it. It&#8217;s open-source and free for your use, no strings attached. I hope you find it helpful.</p>
<p style="text-align: center;"><a href="http://www.luminance.org/wp-content/uploads/2009/06/screenshot.jpg"><img class="aligncenter size-full wp-image-499" title="screenshot" src="http://www.luminance.org/wp-content/uploads/2009/06/screenshot_small.jpg" alt="screenshot" width="540" height="420" /></a></p>
<p><a href="http://luminance.org/xna/Tiled.zip">Download source code and binaries</a></p>
<p>Note that it doesn&#8217;t have support for isometric tiles or embedded tilesets, because I had no use for either feature. Tiled&#8217;s file format is relatively simple, so if you need those features, it should be simple to add them.</p>
<p>And of course, this wouldn&#8217;t be possible without the generous contributions of the developers of Tiled, <a href="http://mapeditor.org/contact.html">Adam Turk and  Bjørn Lindeijer</a>. If you&#8217;d like to try it out, you can <a href="http://mapeditor.org/downloads.html">download it from their website</a> (note: requires Java).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.luminance.org/code/2009/06/17/tiled-map-loader-for-xna/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Maps and more sloped surfaces</title>
		<link>http://www.luminance.org/gruedorf/2008/12/02/maps-and-more-sloped-surfaces</link>
		<comments>http://www.luminance.org/gruedorf/2008/12/02/maps-and-more-sloped-surfaces#comments</comments>
		<pubDate>Tue, 02 Dec 2008 14:16:01 +0000</pubDate>
		<dc:creator>Kael</dc:creator>
				<category><![CDATA[Gruedorf]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[motion]]></category>
		<category><![CDATA[platformer]]></category>
		<category><![CDATA[polygon]]></category>
		<category><![CDATA[Tiled]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.luminance.org/?p=39</guid>
		<description><![CDATA[As a quick way of getting something that resembles content into the game, I wrote a simple loader for for Tiled&#8217;s XML map format. It was pretty straightforward, but I did discover that for whatever reason, XNA&#8217;s built in XML loader for the Content Pipeline doesn&#8217;t support XML files with a DTD attached. Also, for [...]]]></description>
			<content:encoded><![CDATA[<p>As a quick way of getting something that resembles content into the game, I wrote a simple loader for for <a title="Tiled" href="http://mapeditor.org/" target="_blank">Tiled</a>&#8217;s XML map format. It was pretty straightforward, but I did discover that for whatever reason, XNA&#8217;s built in XML loader for the Content Pipeline doesn&#8217;t support XML files with a DTD attached. Also, for some reason, it can take up to two seconds to read the map in from XML &#8211; I think there&#8217;s some sort of bug in XmlReader related to really long lines (the tiled map I&#8217;m using has a 50000-character line of base64 text in it) that&#8217;s causing it to randomly perform slower. At least it works.</p>
<p>Regardless, I put a simple map together and made some basic tiles, and got it loading into the game. Then I had to figure out how to map collision geometry to the tiles.</p>
<p>The first approach I took was using Tiled&#8217;s metadata to attach &#8217;shape&#8217; information to each tile. It worked, more or less, but I ran into weird issues with there being gaps between the edges of the tiles that the player could get stuck on or fall through, so for now, I abandoned that method. The algorithms I&#8217;m using to do motion and collision detection work best with large shapes to collide against, instead of individual tiles, since they operate on pairs of polygons or on single polygons. I think to properly collide against tiles directly, I&#8217;ll need a way to build large collision polygons from groups of tiles automatically.</p>
<p>One of the things I quickly discovered is that having lots of sloped surfaces brought out a few bugs &#8211; for example, small sloped surfaces with a very steep slope didn&#8217;t work right, with the player getting stuck on the left and right edges. The solution to this actually turned out to be pretty simple &#8211; instead of determining what the player is standing on, I switched to doing a &#8217;standing&#8217; check at multiple locations on the player&#8217;s X axis &#8211; the left side, the right side, and the middle. I use all three of those checks to compute &#8217;standing&#8217; Y positions, and take the minimum one. This seems to fix the algorithm for all of the test cases I have in this map &#8211; he moves up and down sloped surfaces just about right and can cross between surfaces without any glitches.</p>
<p>On an unrelated note, SpriteBatch is pretty damn nice. It&#8217;s fast, it&#8217;s simple, and it does exactly what you&#8217;d want it to do. A lot of people building rendering and game dev libraries tend to lean towards &#8216;heavy&#8217; tools, like a first-class Sprite object with lots of properties and methods, but the XNA guys decided to let you do everything but the rendering, and I think that was definitely the right choice.</p>
<p><a href="http://www.luminance.org/wp-content/uploads/2008/12/simple_map.png"><img class="aligncenter size-full wp-image-40" title="Simple Map" src="http://www.luminance.org/wp-content/uploads/2008/12/simple_map.png" alt="" width="500" height="291" /></a></p>
<p>Future milestones:</p>
<ul>
<li>Loading collision geometry from a file</li>
<li>Saving and loading the player&#8217;s game, along with the necessary integration for it to work right on the 360</li>
<li>Background content loading</li>
<li>Some basic AI creatures to fight</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.luminance.org/gruedorf/2008/12/02/maps-and-more-sloped-surfaces/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
