<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Game Dev</title>
	<atom:link href="http://sharky.bluecog.co.nz/?feed=rss2&#038;page_id=15" rel="self" type="application/rss+xml" />
	<link>http://sharky.bluecog.co.nz</link>
	<description>Home of the Air Legends game for Xbox 360 and Windows, Bionic Shark Studios, XNA game development &#38; other madness</description>
	<lastBuildDate>Sun, 22 Apr 2012 22:22:43 +0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Elbows</title>
		<link>http://sharky.bluecog.co.nz/?page_id=15&#038;cpage=1#comment-128277</link>
		<dc:creator>Elbows</dc:creator>
		<pubDate>Thu, 03 Sep 2009 13:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://sharky.bluecog.co.nz/?page_id=15#comment-128277</guid>
		<description>It surely helped me, i was looking for some kind of idea into this problem, thanks for the grant help, although it was out of the blue that i found this, it really gives me a leg up</description>
		<content:encoded><![CDATA[<p>It surely helped me, i was looking for some kind of idea into this problem, thanks for the grant help, although it was out of the blue that i found this, it really gives me a leg up</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sharky</title>
		<link>http://sharky.bluecog.co.nz/?page_id=15&#038;cpage=1#comment-90084</link>
		<dc:creator>Sharky</dc:creator>
		<pubDate>Sun, 28 Dec 2008 20:44:03 +0000</pubDate>
		<guid isPermaLink="false">http://sharky.bluecog.co.nz/?page_id=15#comment-90084</guid>
		<description>Thanks Oli.

Well in simplest terms, you&#039;d probably want to start with getting the Vector between your AI position and the target position. 

e.g. (not sure if this compiles - doing it from memory - but you&#039;ll get the idea)

//assuming you have a TargetThing object and an AIThing object, both with Position
//(vector3) properties defining their position in the world.

Vector3 targetPosition = TargetThing.Position;
Vector3 aiPosition = AIThing.Position;

//the difference between these to vectors gives you an offset vector 
//from one to the other

Vector3 offsetToTarget = targetPosition - aiPosition;
float distanceToTarget = offsetToTarget.Length();

//you probably don&#039;t want your AI to warp jump straight to that position
//so we normalize the offset vector (turns it into a vector heading the same direction,
//but with a length of exactly 1.

Vector3 moveDirectionVector = Vector3.Zero;
if (distanceToTarget &gt; 0) //Normalize would get odd result if the positions were the same.
{
    moveDirectionVector = offsetToTarget
    moveDirectionVector.Normalize();
}

//now to actually move your AIThing in that direction 
//you&#039;ll want something kind of like this.
//Note: your games Update method would likely have a gameTime parameter.
//AIThing.MaxSpeedPerSecond would be a float value defining how far something would move in a Second.
//gameTime.ElapsedGameTime.TotalSeconds is how many seconds
// (likely fraction of a second) have passed since the previous Update.  
//We use it to even out the perceived movement regardless of the 
//game&#039;s Framerate which fluctuates.

Vector3 velocity = moveDirectionVector * AIThing.MaxSpeedPerSecond * gameTime.ElapsedGameTime.TotalSeconds;

//add the velocity to your AI&#039;s position to move it.

AIThing.Position = AIThing.Position + velocity;



Hope that helps?</description>
		<content:encoded><![CDATA[<p>Thanks Oli.</p>
<p>Well in simplest terms, you&#8217;d probably want to start with getting the Vector between your AI position and the target position. </p>
<p>e.g. (not sure if this compiles &#8211; doing it from memory &#8211; but you&#8217;ll get the idea)</p>
<p>//assuming you have a TargetThing object and an AIThing object, both with Position<br />
//(vector3) properties defining their position in the world.</p>
<p>Vector3 targetPosition = TargetThing.Position;<br />
Vector3 aiPosition = AIThing.Position;</p>
<p>//the difference between these to vectors gives you an offset vector<br />
//from one to the other</p>
<p>Vector3 offsetToTarget = targetPosition &#8211; aiPosition;<br />
float distanceToTarget = offsetToTarget.Length();</p>
<p>//you probably don&#8217;t want your AI to warp jump straight to that position<br />
//so we normalize the offset vector (turns it into a vector heading the same direction,<br />
//but with a length of exactly 1.</p>
<p>Vector3 moveDirectionVector = Vector3.Zero;<br />
if (distanceToTarget > 0) //Normalize would get odd result if the positions were the same.<br />
{<br />
    moveDirectionVector = offsetToTarget<br />
    moveDirectionVector.Normalize();<br />
}</p>
<p>//now to actually move your AIThing in that direction<br />
//you&#8217;ll want something kind of like this.<br />
//Note: your games Update method would likely have a gameTime parameter.<br />
//AIThing.MaxSpeedPerSecond would be a float value defining how far something would move in a Second.<br />
//gameTime.ElapsedGameTime.TotalSeconds is how many seconds<br />
// (likely fraction of a second) have passed since the previous Update.<br />
//We use it to even out the perceived movement regardless of the<br />
//game&#8217;s Framerate which fluctuates.</p>
<p>Vector3 velocity = moveDirectionVector * AIThing.MaxSpeedPerSecond * gameTime.ElapsedGameTime.TotalSeconds;</p>
<p>//add the velocity to your AI&#8217;s position to move it.</p>
<p>AIThing.Position = AIThing.Position + velocity;</p>
<p>Hope that helps?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oli</title>
		<link>http://sharky.bluecog.co.nz/?page_id=15&#038;cpage=1#comment-90067</link>
		<dc:creator>Oli</dc:creator>
		<pubDate>Sun, 28 Dec 2008 18:47:17 +0000</pubDate>
		<guid isPermaLink="false">http://sharky.bluecog.co.nz/?page_id=15#comment-90067</guid>
		<description>Awesome game Sharky : D
Can you help me?
I wanna create AI that mmoves towards a given point 
how do I do this?</description>
		<content:encoded><![CDATA[<p>Awesome game Sharky : D<br />
Can you help me?<br />
I wanna create AI that mmoves towards a given point<br />
how do I do this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sharky</title>
		<link>http://sharky.bluecog.co.nz/?page_id=15&#038;cpage=1#comment-58755</link>
		<dc:creator>Sharky</dc:creator>
		<pubDate>Wed, 23 Jul 2008 08:25:42 +0000</pubDate>
		<guid isPermaLink="false">http://sharky.bluecog.co.nz/?page_id=15#comment-58755</guid>
		<description>Thanks heaps.</description>
		<content:encoded><![CDATA[<p>Thanks heaps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Borealis</title>
		<link>http://sharky.bluecog.co.nz/?page_id=15&#038;cpage=1#comment-58751</link>
		<dc:creator>Borealis</dc:creator>
		<pubDate>Wed, 23 Jul 2008 08:10:17 +0000</pubDate>
		<guid isPermaLink="false">http://sharky.bluecog.co.nz/?page_id=15#comment-58751</guid>
		<description>Hey Sharky,

As promised I checked out your game. I just ran it on the Xbox360.
I tried several game modes and planes. Did not experience a crash or slow down.

Hope this helps.

Bino</description>
		<content:encoded><![CDATA[<p>Hey Sharky,</p>
<p>As promised I checked out your game. I just ran it on the Xbox360.<br />
I tried several game modes and planes. Did not experience a crash or slow down.</p>
<p>Hope this helps.</p>
<p>Bino</p>
]]></content:encoded>
	</item>
</channel>
</rss>
