# Tuesday, June 28, 2005
CruiseControl 0.9.2 has now MbUnit stylesheets... Congratulation to the CruiseControl team and Andrew to get this done. :)
posted on Tuesday, June 28, 2005 8:02:06 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
# Tuesday, June 14, 2005
posted on Tuesday, June 14, 2005 8:00:40 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
# Sunday, June 12, 2005

I've uploaded the first demo on the project site. Have fun...

http://projectdistributor.net/Projects/Project.aspx?projectId=124

posted on Sunday, June 12, 2005 10:43:12 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]

I have created a project on http://projectdistributor.net for NSteer and will soon upload a drop to the server. If you are interrested by this project, suscribe to the RSS:

 

posted on Sunday, June 12, 2005 11:17:38 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
# Friday, June 10, 2005

NSteer 2: Laying down some interfaces

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:

Concept summary

  • Dynamic concepts
    • Agent, the canonical autonomous agent,
    • Behavior, the canonical behavior,
    • Body, an instance defining the kinetic dynamics of the agent,
    • Vision, what the agent sees,
    • Integrators integrate the motion dynamics,
    • Saturators, saturate scalars and vectors,
  • Visualization concepts
    • Visualizable: can be visible/hidden, can be rendered,
    • Sprite: a graphical element with a background and a border
    • 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.
    • A scene is the graphical layer abstraction.
    • A world provides dimensions and projection methods,
  • Service concepts
    • Agent service, maintains a list of active actions,
    • World service, accesses world instance
    • Integrator service, manages agent movement integration and force resolution,
    • Behavior service, manages local and global behaviors,

On top of those concepts, remember that we are going to work with the System.Components model-container-services interfaces: IComponent, IContainer.

Dynamic concepts

An agent has a body, a behavior, a vision and can be visualized.
public interface IAgent : IComponent, IVisualizable
{
    IBody Body { get;}
    IBehavior Behavior { get;}
    IVision Vision { get;}
}
A behavior computes the steering force and is also considered as an artifact.
public interface IBehavior : IArtifact
{
    PointF ComputeSteering();
}
A body implements the kinetics of the agent and is as well an artifact.
public interface IBody : IArtifact
{
    float Mass { get;}
    PointF Position { get;}
    float Direction { get;}
    Referential Anchor { get;}
    PointF Velocity { get;}
    PointF Acceleration { get;}
    IPointSaturator VelocitySaturator { get; set;}
    IPointSaturator AccelerationSaturator { get; set;}
    void Update(
        PointF acceleration,
        PointF velocity,
        PointF position);
}

There are some comments to do about this interface.
1. IPointSaturator is the interface defining PointF saturator. In fact, it is very important to make sure that the agents have a maximum speed!
2. Referential is the local referential attached to the agent.
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.

A vision determines if an agent can see another, it has a maximum range (and is an artifact)
public interface IVision : IArtifact
{
    float MaxRange { get;}
    bool CanSee(IAgent agent);
}
An integrator integrates the motion dynamics,
public interface IIntegrator
{
    void Integrate(IBody body, PointF steering);
}
A saturator will rescale a vector or a scalar depending on the body state.

It also provides a way to determine the maximum vector norm (norm-2) depending on the “attack” angle.

public interface IScalarSaturator
{
    float Saturate(IBody body, float value);
}
public interface IPointSaturator
{
    PointF Saturate(IBody body, PointF vector);
    float GetMaxNormFromAngle(float value);
}

Visualization concepts


A scene provides the methods to render lines, circles, etc…
public interface IScene : IComponent
{
    void Prepare();
    void Flush();
    void DrawLine(Pen pen, PointF start, PointF end);
    ...  
    void PushTranslateTransform(float dx, float dy);
    ...
    void PopTransform();
}

A visualizable element can be visible/hidden and rendered,
public interface IVisualizable
{
    bool Visible { get;set;}
    void Render(IScene scene);
}
A sprite is a graphical element with a background and a border
public interface ISprite : IVisualizable, IDisposable
{
    string Name { get;}
    Font Font { get;set;}
    Color BackgroundColor { get;set;}
    Color StrokeColor { get;set;}
    float StrokeWidth { get;set;}
}

I’ve added the name for debugging reasons.

An artifact is a sprite attached to an agent (e.g. smoke trail, hallow, etc…).
public interface IArtifact : ISprite, IOwned<IAgent>
{}
public interface IOwned<T>
{
    event EventHandler OwnerChanged;
    T Owner { get;set;}
}
The world contains world dimensions and projection from/to screen.
public interface IWorld
{
    Size WorldSize { get;}
    Size ScreenSize { get;}
    PointF ScreenToWorld(PointF point);
    PointF WorldToScreen(PointF point);
    PointF ToWorldRatio{get;}
   PointF ToScreenRatio {get;}
}

Service concepts

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.

posted on Friday, June 10, 2005 5:03:26 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
# Thursday, June 09, 2005

   Diagnosys: In the background, ngraphviz generates a temporary dot file for each graph that gets rendered and shreds it afterwards. If you are running Ngraphviz from a folder that does not have write support, you get something like the exception below.

   Workaround: Do not run reflector from a share!

Access to the path "\\xxxxxxxx\a26d8897-1b11-4f40-8d50-301cc6503ba2.dot" is denied.

System.UnauthorizedAccessException

  at System.IO.__Error.WinIOError(Int32 errorCode, String str)
  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share,
Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)
  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share,
Int32 bufferSize)
  at System.IO.StreamWriter.CreateFile(String path, Boolean append)
  at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
  at System.IO.StreamWriter..ctor(String path)
  at NGraphviz.Helpers.Dot.Run(GraphvizImageType imageType, String dotCode, String outputFileName)
  at QuickGraph.Algorithms.Graphviz.GraphvizAlgorithm.Write(String outputFileName)
  at Reflector.Graph.Graphs.InstructionGraphRenderer.Render(String fileName)
  at Reflector.Graph.IlGraphControl.Translate()
  at Reflector.Framework.InternetExplorerControl.OnParentChanged(EventArgs e)
  at System.Windows.Forms.Control.AssignParent(Control value)
  at System.Windows.Forms.ControlCollection.Add(Control value)
  at _134._1(IWindow )
  at _121._1(String )
  at _4.set_Visible(Boolean value)
  at Reflector.Framework.PackageBase.commandBar_Click(Object sender, EventArgs args)
  at _78.OnClick(EventArgs e)
  at _78.PerformClick()
  at _1.OnClick(EventArgs e)
  at System.Windows.Forms.MenuItemData.Execute()
  at System.Windows.Forms.Command.Invoke()
  at System.Windows.Forms.Control.WmCommand(Message& m)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.TreeView .WndProc(Message& m)
  at _2.WndProc(Message& message)
  at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

posted on Thursday, June 09, 2005 9:11:15 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [1]
# Wednesday, June 08, 2005

The SVG viewer and NGraphviz can causes some common failure that are easy to workaround, i.e. I don't plan to fix them soon ;)

1.

 Diagnosys: The first time you run the Adobe SVG viewer, a copyright dialog pops up. After that, you will hit this failure.
 Workaround: Close Reflector and rerun. The dialog is gone and everything works fine.

Object reference not set to an instance of an object.

System.NullReferenceException

  at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+
IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
  at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.DoEvents()
  at _121._1(String )
  at _4.set_Visible(Boolean value)
  at Reflector.Framework.PackageBase.commandBar_Click(Object sender, EventArgs args)
  at _78.OnClick(EventArgs e)
  at _78.PerformClick()
  at _1.OnClick(EventArgs e)
  at System.Windows.Forms.MenuItemData.Execute()
  at System.Windows.Forms.Command.Invoke()
  at System.Windows.Forms.Control.WmCommand(Message& m)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at _76.WndProc(Message& message)
  at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

2.

    Diagnosys: You don't have the necessary C++ libraries on your machine to run NGraphviz.
    Workaround: make sure msvcp71.dll and msvcr71.dll are available.

The specified module could not be found. (Exception from HRESULT: 0x8007007E)

System.IO.FileNotFoundException

  at NGraphviz.Helpers.Dot.Run(GraphvizImageType imageType, String dotCode, String outputFileName)
  at QuickGraph.Algorithms.Graphviz.GraphvizAlgorithm.Write(String outputFileName)
  at Reflector.Graph.Graphs.StatementGraphRenderer.Render(String fileName)
  at Reflector.Graph.StatementGraphControl.Translate()
  at Reflector.Framework.InternetExplorerControl.OnParentChanged(EventArgs e)
  at System.Windows.Forms.Control.AssignParent(Control value)
  at System.Windows.Forms.Control.ControlCollection.Add(Control value)
  at _134._1(IWindow )
  at _121._1(String )
  at _121._4.set_Visible(Boolean value)
  at Reflector.Framework.PackageBase.commandBar_Click(Object sender, EventArgs args)
  at _78.OnClick(EventArgs e)
  at _78.PerformClick()
  at _83._1.OnClick(EventArgs e)
  at System.Windows.Forms.MenuItem.MenuItemData.Execute()
  at System.Windows.Forms.Command.Invoke()
  at System.Windows.Forms.Command.DispatchID(Int32 id)
  at System.Windows.Forms.Control.WmCommand(Message& m)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.TreeView.WndProc(Message& m)
  at _2.WndProc(Message& message)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
posted on Wednesday, June 08, 2005 12:41:39 PM (Pacific Daylight Time, UTC-07:00)  #    Comments [0]
# Monday, June 06, 2005
Just updated to dasBlog...
posted on Monday, June 06, 2005 4:23:26 AM (Pacific Daylight Time, UTC-07:00)  #    Comments [1]