<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Peli's Farm - Pex, Stubs, Moles, QuickGraph, MbUnit, Reflector Addins - NSteer</title>
    <link>http://blog.dotnetwiki.org/</link>
    <description>TouchDevelop, Pex4Fun, Rise4Fun, Pex, Moles, QuickGraph, MbUnit, Reflector Addins</description>
    <language>en-us</language>
    <copyright>Jonathan 'Peli' de Halleux</copyright>
    <lastBuildDate>Sat, 09 Sep 2006 18:21:39 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>jonathan.dehalleux@gmail.com</managingEditor>
    <webMaster>jonathan.dehalleux@gmail.com</webMaster>
    <item>
      <trackback:ping>http://blog.dotnetwiki.org/Trackback.aspx?guid=6740b0e3-ba66-4a57-a0aa-67898ab1134e</trackback:ping>
      <pingback:server>http://blog.dotnetwiki.org/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dotnetwiki.org/PermaLink,guid,6740b0e3-ba66-4a57-a0aa-67898ab1134e.aspx</pingback:target>
      <dc:creator>Jonathan de Halleux</dc:creator>
      <wfw:comment>http://blog.dotnetwiki.org/CommentView,guid,6740b0e3-ba66-4a57-a0aa-67898ab1134e.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dotnetwiki.org/SyndicationService.asmx/GetEntryCommentsRss?guid=6740b0e3-ba66-4a57-a0aa-67898ab1134e</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
After 2 years in the CLR, I'm moving job (and building) to Microsoft Research. I will
be working on <a href="http://research.microsoft.com/research/pubs/view.aspx?type=Technical%20Report&amp;id=917">Parametrized
Unit Testing</a>.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://blog.dotnetwiki.org/aggbug.ashx?id=6740b0e3-ba66-4a57-a0aa-67898ab1134e" />
      </body>
      <title>Moving to Research</title>
      <guid isPermaLink="false">http://blog.dotnetwiki.org/PermaLink,guid,6740b0e3-ba66-4a57-a0aa-67898ab1134e.aspx</guid>
      <link>http://blog.dotnetwiki.org/2006/09/09/MovingToResearch.aspx</link>
      <pubDate>Sat, 09 Sep 2006 18:21:39 GMT</pubDate>
      <description>&lt;p&gt;
After 2 years in the CLR, I'm moving job (and building) to Microsoft Research. I will
be working on &lt;a href="http://research.microsoft.com/research/pubs/view.aspx?type=Technical%20Report&amp;amp;id=917"&gt;Parametrized
Unit Testing&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.dotnetwiki.org/aggbug.ashx?id=6740b0e3-ba66-4a57-a0aa-67898ab1134e" /&gt;</description>
      <comments>http://blog.dotnetwiki.org/CommentView,guid,6740b0e3-ba66-4a57-a0aa-67898ab1134e.aspx</comments>
      <category>Articles</category>
      <category>Fun with graphs</category>
      <category>MbUnit</category>
      <category>NSteer</category>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://blog.dotnetwiki.org/Trackback.aspx?guid=b4982bbf-c784-4d1d-9c29-17b93eb2fc2e</trackback:ping>
      <pingback:server>http://blog.dotnetwiki.org/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dotnetwiki.org/PermaLink,guid,b4982bbf-c784-4d1d-9c29-17b93eb2fc2e.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.dotnetwiki.org/CommentView,guid,b4982bbf-c784-4d1d-9c29-17b93eb2fc2e.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dotnetwiki.org/SyndicationService.asmx/GetEntryCommentsRss?guid=b4982bbf-c784-4d1d-9c29-17b93eb2fc2e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h3>NSteer 2: Laying down some interfaces
</h3>
        <p>
In the previous episode, we laid down the concepts and “lexical” language about autonomous
agents. We can start to design interfaces for each concept identified previously. 
Here’s a concept summary to get started:
</p>
        <h4>Concept summary
</h4>
        <ul dir="ltr">
          <li>
            <div style="MARGIN-RIGHT: 0px">Dynamic concepts
</div>
            <ul>
              <li>
                <div style="MARGIN-RIGHT: 0px">Agent, the canonical autonomous agent,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Behavior, the canonical behavior,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Body, an instance defining the kinetic dynamics of
the agent,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Vision, what the agent sees,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Integrators integrate the motion dynamics,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Saturators, saturate scalars and vectors,
</div>
              </li>
            </ul>
          </li>
          <li>
            <div style="MARGIN-RIGHT: 0px">Visualization concepts
</div>
            <ul>
              <li>
                <div style="MARGIN-RIGHT: 0px">Visualizable: can be visible/hidden, can be rendered,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Sprite: a graphical element with a background and a
border
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Artifact, a dynamic or visual artifact that can be
attached to an agent (e.g. smoke trail, hallow, etc…). An artifact is owned by agent.
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">A scene is the graphical layer abstraction.
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">A world provides dimensions and projection methods,
</div>
              </li>
            </ul>
          </li>
          <li>
            <div style="MARGIN-RIGHT: 0px">Service concepts
</div>
            <ul>
              <li>
                <div style="MARGIN-RIGHT: 0px">Agent service, maintains a list of active actions,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">World service, accesses world instance 
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Integrator service, manages agent movement integration
and force resolution,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">Behavior service, manages local and global behaviors,
</div>
              </li>
              <li>
                <div style="MARGIN-RIGHT: 0px">…
</div>
              </li>
            </ul>
          </li>
        </ul>
        <p>
On top of those concepts, remember that we are going to work with the System.Components
model-container-services interfaces: <font face="Courier New">IComponent, IContainer</font>.<br /></p>
        <h4>Dynamic concepts
</h4>
        <h5>An agent has a body, a behavior, a vision and can be visualized.
</h5>
        <pre>public interface IAgent : IComponent, IVisualizable<br />
{<br />
    IBody Body { get;}<br />
    IBehavior Behavior { get;}<br />
    IVision Vision { get;}<br />
}</pre>
        <h5>A behavior computes the steering force and is also considered as an artifact.
</h5>
        <pre>public interface IBehavior : IArtifact<br />
{<br />
    PointF ComputeSteering();<br />
}</pre>
        <h5>A body implements the kinetics of the agent and is as well an artifact.
</h5>
        <pre>public interface IBody : IArtifact<br />
{<br />
    float Mass { get;}</pre>
        <pre>    PointF Position { get;}<br />
    float Direction { get;}<br />
    Referential Anchor { get;}</pre>
        <pre>    PointF Velocity { get;}<br />
    PointF Acceleration { get;}</pre>
        <pre>    IPointSaturator VelocitySaturator { get; set;}<br />
    IPointSaturator AccelerationSaturator { get; set;}</pre>
        <pre>    void Update(<br />
        PointF acceleration, 
<br />
        PointF velocity, 
<br />
        PointF position);<br />
}</pre>
        <p>
There are some comments to do about this interface. 
<br />
1. IPointSaturator is the interface defining PointF saturator. In fact, it is
very important to make sure that the agents have a maximum speed! 
<br />
2. Referential is the local referential attached to the agent. 
<br />
3. There is one major lack in this interface, the inertia, the rotation velocity
and acceleration. For the sake of simplicity, I decided to leave those aside for now.
</p>
        <h5>A vision determines if an agent can see another, it has a maximum range (and is
an artifact)
</h5>
        <pre>public interface IVision : IArtifact<br />
{<br />
    float MaxRange { get;}<br />
    bool CanSee(IAgent agent);<br />
}</pre>
        <h5>An integrator integrates the motion dynamics,
</h5>
        <pre>public interface IIntegrator<br />
{<br />
    void Integrate(IBody body, PointF steering);<br />
}</pre>
        <h5>A saturator will rescale a vector or a scalar depending on the body state.
</h5>
        <p>
It also provides a way to determine the maximum vector norm (norm-2) depending on
the “attack” angle.
</p>
        <pre>public interface IScalarSaturator<br />
{<br />
    float Saturate(IBody body, float value);<br />
} 
<br />
public interface IPointSaturator<br />
{<br />
    PointF Saturate(IBody body, PointF vector);<br />
    float GetMaxNormFromAngle(float value);<br />
}</pre>
        <h4>Visualization concepts
</h4>
        <h5>
          <br />
A scene provides the methods to render lines, circles, etc…
</h5>
        <pre>public interface IScene : IComponent<br />
{<br />
    void Prepare();<br />
    void Flush();</pre>
        <pre>    void DrawLine(Pen pen, PointF start, PointF end);<br />
    ...   </pre>
        <pre>    void PushTranslateTransform(float dx, float dy);<br />
    ...<br />
    void PopTransform();<br />
}</pre>
        <h5>
          <br />
A visualizable element can be visible/hidden and rendered,
</h5>
        <pre>public interface IVisualizable<br />
{<br />
    bool Visible { get;set;}<br />
    void Render(IScene scene);<br />
}</pre>
        <h5>A sprite is a graphical element with a background and a border
</h5>
        <pre>public interface ISprite : IVisualizable, IDisposable<br />
{<br />
    string Name { get;}<br />
    Font Font { get;set;}<br />
    Color BackgroundColor { get;set;}<br />
    Color StrokeColor { get;set;}<br />
    float StrokeWidth { get;set;}<br />
}</pre>
        <p>
I’ve added the name for debugging reasons.
</p>
        <h5>An artifact is a sprite attached to an agent (e.g. smoke trail, hallow, etc…).
</h5>
        <pre>public interface IArtifact : ISprite, IOwned&lt;IAgent&gt;<br />
{}<br />
public interface IOwned&lt;T&gt;<br />
{<br />
    event EventHandler OwnerChanged;<br />
    T Owner { get;set;}<br />
}</pre>
        <h5>The world contains world dimensions and projection from/to screen.
</h5>
        <pre>public interface IWorld<br />
{<br />
    Size WorldSize { get;}<br />
    Size ScreenSize { get;}<br />
    PointF ScreenToWorld(PointF point);<br />
    PointF WorldToScreen(PointF point);<br />
    PointF ToWorldRatio{get;}<br />
   PointF ToScreenRatio {get;}<br />
}</pre>
        <h4>Service concepts
</h4>
        <p>
I’ll skip the service concepts for now. They basically provide access to the different
instances of neighborhood, obstacle manager, agent list, etc... For now, it’s to time
have a break and a well-deserved cool beer. 
<br /></p>
        <img width="0" height="0" src="http://blog.dotnetwiki.org/aggbug.ashx?id=b4982bbf-c784-4d1d-9c29-17b93eb2fc2e" />
      </body>
      <title>NSteer 2 Laying Down Some Interfaces In The Previous Episode We Laid Down The Concepts And Lexical Language Abo</title>
      <guid isPermaLink="false">http://blog.dotnetwiki.org/PermaLink,guid,b4982bbf-c784-4d1d-9c29-17b93eb2fc2e.aspx</guid>
      <link>http://blog.dotnetwiki.org/2005/06/11/NSteer2LayingDownSomeInterfacesInThePreviousEpisodeWeLaidDownTheConceptsAndLexicalLanguageAbo.aspx</link>
      <pubDate>Sat, 11 Jun 2005 00:03:26 GMT</pubDate>
      <description>&lt;h3&gt;NSteer 2: Laying down some interfaces
&lt;/h3&gt;
&lt;p&gt;
In the previous episode, we laid down the concepts and “lexical” language about autonomous
agents. We can start to design interfaces for each concept identified previously.&amp;nbsp;
Here’s a concept summary to get started:
&lt;/p&gt;
&lt;h4&gt;Concept summary
&lt;/h4&gt;
&lt;ul dir=ltr&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Dynamic concepts
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Agent, the canonical autonomous agent,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Behavior, the canonical behavior,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Body, an instance defining the kinetic dynamics of
the agent,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Vision, what the agent sees,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Integrators integrate the motion dynamics,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Saturators, saturate scalars and vectors,
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Visualization concepts
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Visualizable: can be visible/hidden, can be rendered,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Sprite: a graphical element with a background and a
border
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Artifact, a dynamic or visual artifact that can be
attached to an agent (e.g. smoke trail, hallow, etc…). An artifact is owned by agent.
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;A scene is the graphical layer abstraction.
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;A world provides dimensions and projection methods,
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Service concepts
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Agent service, maintains a list of active actions,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;World service, accesses world instance 
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Integrator service, manages agent movement integration
and force resolution,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;Behavior service, manages local and global behaviors,
&lt;/div&gt;
&lt;li&gt;
&lt;div style="MARGIN-RIGHT: 0px"&gt;…
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
On top of those concepts, remember that we are going to work with the System.Components
model-container-services interfaces: &lt;font face="Courier New"&gt;IComponent, IContainer&lt;/font&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;h4&gt;Dynamic concepts
&lt;/h4&gt;
&lt;h5&gt;An agent has a body, a behavior, a vision and can be visualized.
&lt;/h5&gt;
&lt;pre&gt;public interface IAgent : IComponent, IVisualizable&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IBody Body { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IBehavior Behavior { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IVision Vision { get;}&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;A behavior computes the steering force and is also considered as an artifact.
&lt;/h5&gt;
&lt;pre&gt;public interface IBehavior : IArtifact&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF ComputeSteering();&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;A body implements the kinetics of the agent and is as well an artifact.
&lt;/h5&gt;
&lt;pre&gt;public interface IBody : IArtifact&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; float Mass { get;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF Position { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; float Direction { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Referential Anchor { get;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF Velocity { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF Acceleration { get;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPointSaturator VelocitySaturator { get; set;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; IPointSaturator AccelerationSaturator { get; set;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Update(&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF acceleration, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF velocity, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF position);&lt;br&gt;
}&lt;/pre&gt;
&lt;p&gt;
There are some comments to do about this interface. 
&lt;br&gt;
1.&amp;nbsp;IPointSaturator is the interface defining PointF saturator. In fact, it is
very important to make sure that the agents have a maximum speed! 
&lt;br&gt;
2.&amp;nbsp;Referential is the local referential attached to the agent. 
&lt;br&gt;
3.&amp;nbsp;There is one major lack in this interface, the inertia, the rotation velocity
and acceleration. For the sake of simplicity, I decided to leave those aside for now.
&lt;/p&gt;
&lt;h5&gt;A vision determines if an agent can see another, it has a maximum range (and is
an artifact)
&lt;/h5&gt;
&lt;pre&gt;public interface IVision : IArtifact&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; float MaxRange { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bool CanSee(IAgent agent);&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;An integrator integrates the motion dynamics,
&lt;/h5&gt;
&lt;pre&gt;public interface IIntegrator&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; void Integrate(IBody body, PointF steering);&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;A saturator will rescale a vector or a scalar depending on the body state.
&lt;/h5&gt;
&lt;p&gt;
It also provides a way to determine the maximum vector norm (norm-2) depending on
the “attack” angle.
&lt;/p&gt;
&lt;pre&gt;public interface IScalarSaturator&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; float Saturate(IBody body, float value);&lt;br&gt;
} 
&lt;br&gt;
public interface IPointSaturator&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF Saturate(IBody body, PointF vector);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; float GetMaxNormFromAngle(float value);&lt;br&gt;
}&lt;/pre&gt;
&lt;h4&gt;Visualization concepts
&lt;/h4&gt;
&lt;h5&gt;
&lt;br&gt;
A scene provides the methods to render lines, circles, etc…
&lt;/h5&gt;
&lt;pre&gt;public interface IScene : IComponent&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; void Prepare();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; void Flush();&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void DrawLine(Pen pen, PointF start, PointF end);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&amp;nbsp;&amp;nbsp; &lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void PushTranslateTransform(float dx, float dy);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; void PopTransform();&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;
&lt;br&gt;
A visualizable element can be visible/hidden and rendered,
&lt;/h5&gt;
&lt;pre&gt;public interface IVisualizable&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bool Visible { get;set;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; void Render(IScene scene);&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;A sprite is a graphical element with a background and a border
&lt;/h5&gt;
&lt;pre&gt;public interface ISprite : IVisualizable, IDisposable&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; string Name { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Font Font { get;set;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Color BackgroundColor { get;set;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Color StrokeColor { get;set;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; float StrokeWidth { get;set;}&lt;br&gt;
}&lt;/pre&gt;
&lt;p&gt;
I’ve added the name for debugging reasons.
&lt;/p&gt;
&lt;h5&gt;An artifact is a sprite attached to an agent (e.g. smoke trail, hallow, etc…).
&lt;/h5&gt;
&lt;pre&gt;public interface IArtifact : ISprite, IOwned&amp;lt;IAgent&amp;gt;&lt;br&gt;
{}&lt;br&gt;
public interface IOwned&amp;lt;T&amp;gt;&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; event EventHandler OwnerChanged;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; T Owner { get;set;}&lt;br&gt;
}&lt;/pre&gt;
&lt;h5&gt;The world contains world dimensions and projection from/to screen.
&lt;/h5&gt;
&lt;pre&gt;public interface IWorld&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Size WorldSize { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Size ScreenSize { get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF ScreenToWorld(PointF point);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF WorldToScreen(PointF point);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PointF ToWorldRatio{get;}&lt;br&gt;
&amp;nbsp;&amp;nbsp; PointF ToScreenRatio {get;}&lt;br&gt;
}&lt;/pre&gt;
&lt;h4&gt;Service concepts
&lt;/h4&gt;
&lt;p&gt;
I’ll skip the service concepts for now. They basically provide access to the different
instances of neighborhood, obstacle manager, agent list, etc... For now, it’s to time
have a break and a well-deserved cool beer. 
&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.dotnetwiki.org/aggbug.ashx?id=b4982bbf-c784-4d1d-9c29-17b93eb2fc2e" /&gt;</description>
      <comments>http://blog.dotnetwiki.org/CommentView,guid,b4982bbf-c784-4d1d-9c29-17b93eb2fc2e.aspx</comments>
      <category>NSteer</category>
    </item>
    <item>
      <trackback:ping>http://blog.dotnetwiki.org/Trackback.aspx?guid=5b20ca3b-2372-4bd4-8fe3-004603f05287</trackback:ping>
      <pingback:server>http://blog.dotnetwiki.org/pingback.aspx</pingback:server>
      <pingback:target>http://blog.dotnetwiki.org/PermaLink,guid,5b20ca3b-2372-4bd4-8fe3-004603f05287.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://blog.dotnetwiki.org/CommentView,guid,5b20ca3b-2372-4bd4-8fe3-004603f05287.aspx</wfw:comment>
      <wfw:commentRss>http://blog.dotnetwiki.org/SyndicationService.asmx/GetEntryCommentsRss?guid=5b20ca3b-2372-4bd4-8fe3-004603f05287</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blog.dotnetwiki.org/archive/2004/09/16/961.aspx">A while ago</a>,
I mentioned I was planning to build an autonomous agent framework on .NET (this was
in fact a long time ago). It’s time to wake this project up with a shiny description:
</p>
        <QUOTE>
          <b>NSteer</b> is a framework for simulating of autonomous agents for .NET. 
<p>
Until we get down to the code, here is a little snapshot to get you hooked:
</p><p></p><center><img src="/images/29/nsteersnap.png" /> 
</center><p></p><p></p><h4>A bit of history: boids, flocks, herds, etc…
</h4><p>
In 1986, <a href="http://www.red3d.com/cwr/boids/">Craig Reynolds</a> wrote a little
application that simulated bird group behaviors. The term <a href="http://www.red3d.com/cwr/boids/">Boids</a> was
born. The beauty of his approach was that the “bird” behavior was not
created from some complicated mathematical equation, it all boiled down to 3 simple
rules that each agent would follow:
</p><ol><li>
Separation: avoid neighbors, 
</li><li>
Cohesion: go towards the group center, 
</li><li>
Alignment: align with group velocity.</li></ol><p>
Since then there has been a lot action in this field and you can see applications
of this approach in a lot of the blockbuster hits. Check out Craig’s web site
for an impressive list of links to papers (I love this <a href="http://www.red3d.com/cwr/papers/1999/gdc99steer.html">one</a>),
samples, frameworks and movies…. It was about time to bring .NET into the play.
</p><h4>Laying down concepts
</h4><p>
Let’s start by identifying the concepts in our problem that we can later translate
into interfaces:
</p><ul><li>
An <b>Agent</b> describes an independent entity that lives in a <b style="mso-bidi-font-weight: normal">World</b>.
An <b>Agent</b> has a <b>Vision</b>, a <b>Body</b> and a <b>Behavior</b></li><li>
A <b>Body</b> defines the cinematic properties of the agent (position, acceleration,
etc…) 
</li><li>
A <b>Vision</b> defines the region where the Agent can “see” obstacles
or neighbors 
</li><li>
The <b>Behavior</b> of the <b>Agent</b> will yield a steering force that will move
the Agent. This is the “brain” of the agent. 
</li><li><b>Agents</b> are confined in a <b>World.</b></li><li>
A <b>Simulator</b> that uses an <b>Integrator</b> to integrate the dynamics of the
system.</li></ul><p>
We will also need ways to access the list of Agents, Obstacles, etc… To do so,
I chose to use the Service – Component – Container pattern where different
services give access to the agents, obstacles, etc...
</p><p>
In .Net, this pattern is already part of the framework. The <code>IComponent</code>, <code>IContainer</code> interfaces
are defined in <code>System.ComponentModel</code> and there already exists base class
such as <code>Container</code>, <code>Component</code>, <code>ServiceContainer</code> to
get started.
</p><p>
For a start, we will define the following services:
</p><ul><li><b>AgentService</b>, gives access to the Agents, 
</li><li><b>WorldService, </b>gives access to the world dimension and properties, 
</li><li><b>ObstacleService, </b>gives access to the obstacles in the world, 
</li><li><b>NeighorhoodService, </b>let agent query about neighboring agents</li></ul><p>
At last, we need some concepts for visualization:
</p><ul><li>
A <b>Sprite</b> is a 2D drawing with background color, foreground color, etc…
It can be hidden or made visible. 
</li><li>
A <b>Scene</b> is an abstraction of GDI+,(just in case I had the courage to implement
the framework using DirectX or XAML).</li></ul><p>
There might be a couple more going down the road, but this looks like a good starting
point. I’ll see on the next post how we lay down the interface and maybe get
ready for testing.
</p><img width="0" height="0" src="http://blog.dotnetwiki.org/aggbug.ashx?id=5b20ca3b-2372-4bd4-8fe3-004603f05287" /></QUOTE>
      </body>
      <title>NSteer 1: Getting the architecture in place</title>
      <guid isPermaLink="false">http://blog.dotnetwiki.org/PermaLink,guid,5b20ca3b-2372-4bd4-8fe3-004603f05287.aspx</guid>
      <link>http://blog.dotnetwiki.org/2005/05/26/NSteer1GettingTheArchitectureInPlace.aspx</link>
      <pubDate>Thu, 26 May 2005 03:35:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blog.dotnetwiki.org/archive/2004/09/16/961.aspx"&gt;A while ago&lt;/a&gt;,
I mentioned I was planning to build an autonomous agent framework on .NET (this was
in fact a long time ago). It&amp;#8217;s time to wake this project up with a shiny description:
&lt;/p&gt;
&lt;QUOTE&gt;
&lt;b&gt;NSteer&lt;/b&gt; is a framework for simulating of autonomous agents for .NET. 
&lt;p&gt;
Until we get down to the code, here is a little snapshot to get you hooked:
&lt;/p&gt;
&lt;p&gt;
&lt;center&gt;&lt;img src="/images/29/nsteersnap.png"&gt;&amp;nbsp;
&lt;/center&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;h4&gt;A bit of history: boids, flocks, herds, etc&amp;#8230;
&lt;/h4&gt;
&lt;p&gt;
In 1986, &lt;a href="http://www.red3d.com/cwr/boids/"&gt;Craig Reynolds&lt;/a&gt; wrote a little
application that simulated bird group behaviors. The term &lt;a href="http://www.red3d.com/cwr/boids/"&gt;Boids&lt;/a&gt; was
born. The beauty of his approach was that the &amp;#8220;bird&amp;#8221; behavior was not
created from some complicated mathematical equation, it all boiled down to 3 simple
rules that each agent would follow:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Separation: avoid neighbors, 
&lt;li&gt;
Cohesion: go towards the group center, 
&lt;li&gt;
Alignment: align with group velocity.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Since then there has been a lot action in this field and you can see applications
of this approach in a lot of the blockbuster hits. Check out Craig&amp;#8217;s web site
for an impressive list of links to papers (I love this &lt;a href="http://www.red3d.com/cwr/papers/1999/gdc99steer.html"&gt;one&lt;/a&gt;),
samples, frameworks and movies&amp;#8230;. It was about time to bring .NET into the play.
&lt;/p&gt;
&lt;h4&gt;Laying down concepts
&lt;/h4&gt;
&lt;p&gt;
Let&amp;#8217;s start by identifying the concepts in our problem that we can later translate
into interfaces:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
An &lt;b&gt;Agent&lt;/b&gt; describes an independent entity that lives in a &lt;b style="mso-bidi-font-weight: normal"&gt;World&lt;/b&gt;.
An &lt;b&gt;Agent&lt;/b&gt; has a &lt;b&gt;Vision&lt;/b&gt;, a &lt;b&gt;Body&lt;/b&gt; and a &lt;b&gt;Behavior&lt;/b&gt; 
&lt;li&gt;
A &lt;b&gt;Body&lt;/b&gt; defines the cinematic properties of the agent (position, acceleration,
etc&amp;#8230;) 
&lt;li&gt;
A &lt;b&gt;Vision&lt;/b&gt; defines the region where the Agent can &amp;#8220;see&amp;#8221; obstacles
or neighbors 
&lt;li&gt;
The &lt;b&gt;Behavior&lt;/b&gt; of the &lt;b&gt;Agent&lt;/b&gt; will yield a steering force that will move
the Agent. This is the &amp;#8220;brain&amp;#8221; of the agent. 
&lt;li&gt;
&lt;b&gt;Agents&lt;/b&gt; are confined in a &lt;b&gt;World.&lt;/b&gt; 
&lt;li&gt;
A &lt;b&gt;Simulator&lt;/b&gt; that uses an &lt;b&gt;Integrator&lt;/b&gt; to integrate the dynamics of the
system.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
We will also need ways to access the list of Agents, Obstacles, etc&amp;#8230; To do so,
I chose to use the Service &amp;#8211; Component &amp;#8211; Container pattern where different
services give access to the agents, obstacles, etc...
&lt;/p&gt;
&lt;p&gt;
In .Net, this pattern is already part of the framework. The &lt;code&gt;IComponent&lt;/code&gt;, &lt;code&gt;IContainer&lt;/code&gt; interfaces
are defined in &lt;code&gt;System.ComponentModel&lt;/code&gt; and there already exists base class
such as &lt;code&gt;Container&lt;/code&gt;, &lt;code&gt;Component&lt;/code&gt;, &lt;code&gt;ServiceContainer&lt;/code&gt; to
get started.
&lt;/p&gt;
&lt;p&gt;
For a start, we will define the following services:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;b&gt;AgentService&lt;/b&gt;, gives access to the Agents, 
&lt;li&gt;
&lt;b&gt;WorldService, &lt;/b&gt;gives access to the world dimension and properties, 
&lt;li&gt;
&lt;b&gt;ObstacleService, &lt;/b&gt;gives access to the obstacles in the world, 
&lt;li&gt;
&lt;b&gt;NeighorhoodService, &lt;/b&gt;let agent query about neighboring agents&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
At last, we need some concepts for visualization:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
A &lt;b&gt;Sprite&lt;/b&gt; is a 2D drawing with background color, foreground color, etc&amp;#8230;
It can be hidden or made visible. 
&lt;li&gt;
A &lt;b&gt;Scene&lt;/b&gt; is an abstraction of GDI+,(just in case I had the courage to implement
the framework using DirectX or XAML).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
There might be a couple more going down the road, but this looks like a good starting
point. I&amp;#8217;ll see on the next post how we lay down the interface and maybe get
ready for testing.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.dotnetwiki.org/aggbug.ashx?id=5b20ca3b-2372-4bd4-8fe3-004603f05287" /&gt;</description>
      <comments>http://blog.dotnetwiki.org/CommentView,guid,5b20ca3b-2372-4bd4-8fe3-004603f05287.aspx</comments>
      <category>Articles</category>
      <category>NSteer</category>
    </item>
  </channel>
</rss>