<?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>LegacyWorlds Beta 6 &#187; trajectory</title>
	<atom:link href="http://blog.legacyworlds.com/index.php/tag/trajectory/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.legacyworlds.com</link>
	<description>Updates on the new version&#039;s design and progress</description>
	<lastBuildDate>Sat, 26 Mar 2011 10:18:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Travel and distances (5/5): putting it all together</title>
		<link>http://blog.legacyworlds.com/index.php/2008-12-11/travel-and-distances-5/</link>
		<comments>http://blog.legacyworlds.com/index.php/2008-12-11/travel-and-distances-5/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 10:00:36 +0000</pubDate>
		<dc:creator>TSeeker</dc:creator>
				<category><![CDATA[Game design]]></category>
		<category><![CDATA[distance]]></category>
		<category><![CDATA[Hyperspace]]></category>
		<category><![CDATA[normal space]]></category>
		<category><![CDATA[space travel]]></category>
		<category><![CDATA[Structure of the universe]]></category>
		<category><![CDATA[trajectory]]></category>

		<guid isPermaLink="false">http://blog.legacyworlds.com/?p=90</guid>
		<description><![CDATA[The previous posts in the series explained the basic elements of distance and trajectory computations in the Legacy Worlds Beta 6 universe; this final post about travel and distances puts these elements together, explaining how and when they apply. Indeed, while players will get the final say about their fleets&#8217; trajectories, some details remain to [...]]]></description>
			<content:encoded><![CDATA[<p>The previous posts in the series explained the basic elements of distance and trajectory computations in the Legacy Worlds Beta 6 universe; this final post about travel and distances puts these elements together, explaining how and when they apply.</p>
<p>Indeed, while players will get the final say about their fleets&#8217; trajectories, some details remain to be explained. In addition, many other elements of the game use the travel rules (e.g. mining operations or trade); in these cases, the various computations are applied behind the scenes, without any intervention from the player.</p>
<p><span id="more-90"></span></p>
<p><strong>Path optimisation</strong></p>
<p>In the previous post we described optimal indirect routes as well as sub-optimal indirect routes; however, these routes only apply to interstellar travel. When trying to compute an optimal route between two areas, the game will also consider the trajectory&#8217;s endpoints. For example, when traveling from a stellar system to another, it may sometimes be worth staying in Hyperspace to avoid a particulary dense Oort cloud.</p>
<p><strong>Travel time</strong></p>
<p>While we have described trajectories in terms of abstract &#8220;distance units&#8221;, the actual time it takes a fleet to travel along a trajectory also depends on other factors.</p>
<ul>
<li>The slowest ship in a fleet determines the fleet&#8217;s actual speed.</li>
<li>The speed of a ship depends on both its engines and its size; quite obviously, a capital ship outfitted with fighter engines will not be able to accelerate as fast as a fighter.</li>
<li>Some ships may be outfitted with specific modules that can cause them to fly through nebulae or near black holes at optimal speeds.</li>
</ul>
<p><strong>Fleet trajectories</strong></p>
<p>While the game&#8217;s interface will provide the player with automated trajectory selection tools, it will be possible to create arbitrary trajectories &#8211; deciding which sections to travel and whether they should be traveled in Hyperspace or normal space. While this is unnecessary under most circumstances, it is sometimes useful to create a more complex path, for example while planning an attack.</p>
<p><strong>Supergate travel</strong></p>
<p>Supergate travel was not described in this series of post; that is because it obeys specific rules which are not really a part of distance and trajectory computations. We will post more details about supergate travel in another post.</p>
<p><strong>Automated uses of path computations</strong></p>
<p>In addition to fleets, many elements in Beta 6 will need to use path computations: probes, remote mining operations, trading, population migration&#8230; In these cases it would be annoying to ask the player about the trajectory to use. Trajectories used by these elements will therefore be computed using the best known route.</p>
<p><strong>Next time on the LWB6 blog &#8230;</strong></p>
<p>This concludes our series about travel and distances. While it was quite boring and sometimes a bit technical, I think it was necessary to describe these various notions.</p>
<p>The next post will be about the stock market system, which can be used to increase an empire&#8217;s benefits while introducing a chance of economic depression.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.legacyworlds.com/index.php/2008-12-11/travel-and-distances-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Travel and distances (4/5): interstellar travel</title>
		<link>http://blog.legacyworlds.com/index.php/2008-12-07/travel-and-distances-4/</link>
		<comments>http://blog.legacyworlds.com/index.php/2008-12-07/travel-and-distances-4/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 10:00:05 +0000</pubDate>
		<dc:creator>TSeeker</dc:creator>
				<category><![CDATA[Game design]]></category>
		<category><![CDATA[black holes]]></category>
		<category><![CDATA[distance]]></category>
		<category><![CDATA[Hyperspace]]></category>
		<category><![CDATA[interstellar travel]]></category>
		<category><![CDATA[normal space]]></category>
		<category><![CDATA[space travel]]></category>
		<category><![CDATA[Structure of the universe]]></category>
		<category><![CDATA[trajectory]]></category>

		<guid isPermaLink="false">http://blog.legacyworlds.com/?p=79</guid>
		<description><![CDATA[The previous posts in this series discussed generalities, stellar systems and special objects such as nebulae. The last element that needs to be considered to describe travel in the Legacy Worlds universe is actual interstellar travel. Because of the structure of the universe in the new version, it is impossible to describe interstellar travel as [...]]]></description>
			<content:encoded><![CDATA[<p>The previous posts in this series discussed generalities, stellar systems and special objects such as nebulae. The last element that needs to be considered to describe travel in the Legacy Worlds universe is actual interstellar travel.</p>
<p>Because of the structure of the universe in the new version, it is impossible to describe interstellar travel as simply as it was in Beta 5. It is impossible to fly through some of the map&#8217;s areas, while Beta 5 made sure that it was always possible to get from one point to another without passing through something that wasn&#8217;t reachable. In addition, the new version will allow players to use waypoints when determining a fleet&#8217;s trajectory; because that is possible, it is only logical that the game can propose optimal trajectories to the player. Finally, a lot of computations depend on the distance between two points &#8211; these computations should always use the best possible route.</p>
<p><span id="more-79"></span></p>
<p>As implied by the introduction above, there are at least two different modes which can be used when computing interstellar travel routes: direct paths (flying in a straight line) and indirect, optimal paths. However, players in Beta 6 will not always know the whole map of a layer; it would therefore be illogical for their fleets to use the optimal paths when they do not know these paths. This fact adds a third trajectory computation mode, which is the &#8220;best known route&#8221;. We will examine all 3 modes.</p>
<p><strong>Direct paths</strong></p>
<p>While direct paths seem easy (they are, after all, a straight line between two points) at first glance, it gets much more complicated than that due to the fact that the trajectory has to be split in order to know the distance traveled at each location. This computation is made necessary by the fact that different areas of the map have different multipliers (for example nebulae or areas near a black hole).</p>
<p>The graph below illustrates the problem:</p>
<p><a href="http://blog.legacyworlds.com/wp-content/uploads/2008/11/direct-path-example.png" rel="lightbox[79]" title="Direct path example"><img class="aligncenter size-medium wp-image-82" title="Direct path example" src="http://blog.legacyworlds.com/wp-content/uploads/2008/11/direct-path-example.png" alt="" width="188" height="232" /></a></p>
<p>On this graph, we can clearly see that the direct path between the two areas noted by a black spot intersects different areas (the cyan areas); however, it is also clear that the distance traveled in each area is different.</p>
<p>In order to solve this, we start by computing the raw Euclidean distance between the two points and multiplying it by 1000; this is the total length of the path. We then use a parametric representation of the line to compute transitions from an area to the next:</p>
<blockquote>
<pre>x( distance ) = X1 + distance * ( X2 - X1 ) / total_distance
y( distance ) = Y1 + distance * ( Y2 - Y1 ) / total_distance</pre>
</blockquote>
<p>The results are then rounded to integer values; while this causes a few errors (some paths end up being asymmetrical when they shouldn&#8217;t), the error is always 1 distance unit, which can safely be ignored at this scale.</p>
<p>In the case of the trajectory presented on the graph above, the resulting path is:</p>
<p>Applying this algorithm to our example results in the following list of transitions and distances:</p>
<ul>
<li> At (-1;2) : 625 distance units</li>
<li> At (-1;1) : 208 distance units</li>
<li> At (0;1) : 1042 distance units</li>
<li> At (0;0) : 625 distance units</li>
<li> At (1;0) : 625 distance units</li>
<li> At (1;-1) : 1041 distance units</li>
<li> At (2;-1) : 209 distance units</li>
<li> At (2;-2) : 625 distance units</li>
</ul>
<p><strong>Indirect paths</strong></p>
<p>In some cases, it is impossible to go from a point to another directly because of a black hole sitting in the middle of the trajectory. In other cases, the direct paths would take the ships through very slow areas of the map and there is a much more efficient trajectory that goes around these areas. However, the best path is not always known. Two different algorithms will be used for these two types of indirect trajectories.</p>
<p>The classic <a class="external text" title="http://en.wikipedia.org/wiki/Djikstra's_algorithm" rel="nofollow" href="http://en.wikipedia.org/wiki/Djikstra%27s_algorithm">Djikstra algorithm</a> will be used to compute optimal paths; since it is very slow, the optimal trajectories will be pre-computed when the layer is created, and partially re-computed in case the space-time drilling ability is used (which shouldn&#8217;t happen too often, hopefully). Using the pre-computed results, it is easy to determine whether a player has all of the data required to compute the optimal trajectory or if a sub-optimal indirect path has to be used.</p>
<p>Sub-optimal indirect paths are impossible to pre-compute, as it would require computing the set of indirect paths for each possible combination of known/unknown map areas. Therefore, the <a class="external text" title="http://en.wikipedia.org/wiki/A*_search_algorithm" rel="nofollow" href="http://en.wikipedia.org/wiki/A*_search_algorithm">A* algorithm</a> (classically used for pathfinding in real-time strategy games) will be used on a per-request basis.</p>
<p>The examples below show the difference between direct and optimal indirect paths. The image on the left is the direct path, which requires 41,565 distance units; the image on the right is the indirect path, &#8220;measuring&#8221; only 15,889 distance units.</p>
<p style="text-align: center;"><a href="http://blog.legacyworlds.com/wp-content/uploads/2008/11/direct.png" rel="lightbox[79]" title="Direct path"><img class="wp-image-83" title="Direct path" src="http://blog.legacyworlds.com/wp-content/uploads/2008/11/direct.png" alt="" width="175" height="175" /></a><a href="http://blog.legacyworlds.com/wp-content/uploads/2008/11/indirect.png" rel="lightbox[79]" title="Indirect, optimal path"><img class="wp-image-84" title="Indirect, optimal path" src="http://blog.legacyworlds.com/wp-content/uploads/2008/11/indirect.png" alt="" width="175" height="175" /></a></p>
<p style="text-align: left;"><strong>Next time, on the LWB6 blog&#8230;</strong></p>
<p style="text-align: left;">Now that we&#8217;ve seen the different parts needed for distance and trajectory computation, the only thing left is to explain how these different parts will be put together to actually compute distances and trajectories as required.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.legacyworlds.com/index.php/2008-12-07/travel-and-distances-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

