Add your own alternative version
Stats
523.4K views 21.1K downloads 215 bookmarked
Posted
22 Jun 2005

Comments and Discussions



Hi Jonas,
I am developing a project, where in I am suppose to display jpeg images from MJPEG stream recieved from IP camera.
Current Status:
Out of that continuous JPEG stream JPEG images are extracted successfully. Right now the JPEG images are being displayed on the picture box. e.g. pictureBox1.Image = image.
Problem:
But CPU utilization is quite high. [for 5+ mega pixel image CPU utilization is 65%]
Hopeful way:
Using Direct X, I think CPU utilization can be reduced upto 5%.
Question:
Is there any way I can use Direct X which takes jpeg bytes and then renders them on the control.
Any help would be appreciated.
Thanks,
Sraddhan
PS: Anybody reading this thread is also welcomed to answer.





Hi,
using DirectX to show the decoded images will probably help a little bit, but you won't get nowhere near 5%, as the decoding process is probably what takes most of the CPU cycles. It might be possible to use some of the later GPUs with video decoding support to decrease CPU workload, but I haven't studied the issue myself so I can't really say.
HTH,
Jonas





I wanted to send a thanks for your contribution. I used your AStar routine as the basis of a rewrite to encapsulate the implementation a bit more. It's about 90% as far as features (needs some more events defined) but from testing so far functionally it appears pretty clean. I'd love to hear your thoughts.
Below is:
AStarSearcher
AStarNode
AStarSearchResult
and an Init routine for the search nodes
/******************************
AStarSearcher
******************************/
public class AStarSearcher<br />
{<br />
private Vector3 _minBoundary;<br />
private Vector3 _maxBoundary;<br />
<br />
private bool _paused = false;<br />
private bool _sorted = false;<br />
<br />
private List<AStarNode> _nodeList = new List<AStarNode>();<br />
private List<AStarNode> _tempNodes = new List<AStarNode>();<br />
<br />
public event EventHandler<AStarNodeEventArgs> OnNodeAdded;<br />
public event EventHandler<AStarNodeEventArgs> OnNodeRemoved;<br />
<br />
public AStarSearcher(Vector3 MinBoundary, Vector3 MaxBoundary)<br />
{<br />
_minBoundary = MinBoundary;<br />
_maxBoundary = MaxBoundary;<br />
InitializeNodes();<br />
}<br />
<br />
<br />
public void InitializeNodes()<br />
{<br />
_nodeList = new List<AStarNode>();<br />
InitializeTempNodes();<br />
}<br />
<br />
public void InitializeTempNodes()<br />
{<br />
for (int i = 0; i < _tempNodes.Count; i++)<br />
{<br />
RemoveTempNode(_tempNodes[0]);<br />
}<br />
_tempNodes = new List<AStarNode>();<br />
}<br />
<br />
public void AddNode(Vector3 Position)<br />
{<br />
AStarNode node = new AStarNode(this, Position);<br />
AddNode(node);<br />
}<br />
<br />
public void AddNode(AStarNode Node)<br />
{<br />
if(!IsInBounds(Node.Position))<br />
{<br />
throw new Exception("Node out of bounds");<br />
}<br />
_nodeList.Add(Node);<br />
_sorted = false;<br />
NodeAdded(Node);<br />
}<br />
<br />
public void AddTempNode(AStarNode Node)<br />
{<br />
if (!IsInBounds(Node.Position))<br />
{<br />
throw new Exception("Temp node out of bounds");<br />
}<br />
_tempNodes.Add(Node);<br />
NodeAdded(Node);<br />
}<br />
<br />
public void RemoveNode(AStarNode Node)<br />
{<br />
if (!_nodeList.Contains(Node))<br />
{<br />
return;<br />
}<br />
_nodeList.Remove(Node);<br />
NodeRemoved(Node);<br />
}<br />
<br />
public void RemoveTempNode(AStarNode Node)<br />
{<br />
if (!_tempNodes.Contains(Node))<br />
{<br />
return;<br />
}<br />
_tempNodes.Remove(Node);<br />
NodeRemoved(Node);<br />
}<br />
<br />
public List<AStarNode> GetSearchNodes()<br />
{<br />
List<AStarNode> result = new List<AStarNode>();<br />
result.AddRange(_nodeList);<br />
result.AddRange(_tempNodes);<br />
return result;<br />
}<br />
<br />
public void SortNodes()<br />
{<br />
if (!_sorted)<br />
{<br />
_nodeList.Sort(AStarNode.ByPosition);<br />
_sorted = true;<br />
}<br />
}<br />
<br />
public void UpdateCost(AStarNode Node, List<AStarNode> Goals)<br />
{<br />
double costToStart = 0;<br />
if (Node.Parent != null)<br />
{<br />
double distance = Node.Position.Distance(Node.Parent.Position);<br />
costToStart = Node.Parent.CostToStart + Node.Parent.Cost + (distance * distance);<br />
}<br />
Node.CostToStart = costToStart;<br />
Node.CostToGoal = GetAverageDistance(Node, Goals);<br />
Node.TotalCost = Node.CostToStart + Node.CostToGoal + Node.Cost;<br />
}<br />
<br />
public double GetAverageDistance(AStarNode Node, List<AStarNode> Available)<br />
{<br />
if (Available.Count == 0)<br />
{<br />
return 0;<br />
}<br />
double result = 0;<br />
foreach (AStarNode node in Available)<br />
{<br />
result += Node.Position.Distance(node.Position);<br />
}<br />
return result / Available.Count;<br />
}<br />
<br />
public AStarNode FindClosestNode(AStarNode Node, List<AStarNode> Available)<br />
{<br />
if (Available.Count == 0)<br />
{<br />
return Node;<br />
}<br />
double min = Node.Position.Distance(Available[0].Position);<br />
int index = 0;<br />
for (int i = 1; i < Available.Count; i++)<br />
{<br />
double d = Node.Position.Distance(Available[i].Position);<br />
if (d < min)<br />
{<br />
min = d;<br />
index = i;<br />
}<br />
}<br />
return Available[index];<br />
}<br />
<br />
public AStarSearchResult FindShortestPath(Vector3 Start, Vector3 Goal)<br />
{<br />
List<Vector3> goals = new List<Vector3>();<br />
goals.Add(Goal);<br />
return FindShortestPath(Start, goals);<br />
}<br />
<br />
public AStarSearchResult FindShortestPath(Vector3 Start, List<Vector3> Goals)<br />
{<br />
if(Goals.Count == 0)<br />
{<br />
return new AStarSearchResult();<br />
}<br />
InitializeTempNodes();<br />
List<AStarNode> openNodes = new List<AStarNode>();<br />
List<AStarNode> closedNodes = new List<AStarNode>();<br />
List<Vector3> solution = new List<Vector3>();<br />
List<AStarNode> goalNodes = ConvertGoalsToNodes(Goals);<br />
AStarNode startNode = ConvertToStartNode(Start);<br />
openNodes.Add(startNode);<br />
AStarNode current = startNode;<br />
<br />
UpdateCost(startNode, goalNodes);<br />
while (openNodes.Count > 0)<br />
{<br />
current = RemoveCheapestNode(openNodes);<br />
if (current == null)<br />
{<br />
return new AStarSearchResult();<br />
}<br />
if (goalNodes.Contains(current))<br />
{<br />
while (current != null)<br />
{<br />
solution.Insert(0, current.Position);<br />
current = current.Parent;<br />
}<br />
AStarSearchResult result = new AStarSearchResult(solution);<br />
return result;<br />
}<br />
List<AStarNode> relatedNodes = current.RelatedNodes;<br />
foreach (AStarNode relatedNode in relatedNodes)<br />
{<br />
if (!relatedNode.Available)<br />
{<br />
continue;<br />
}<br />
if (openNodes.Contains(relatedNode)  closedNodes.Contains(relatedNode))<br />
{<br />
continue;<br />
}<br />
relatedNode.Parent = current;<br />
UpdateCost(relatedNode, goalNodes);<br />
openNodes.Add(relatedNode);<br />
}<br />
closedNodes.Add(current);<br />
}<br />
return new AStarSearchResult();<br />
}<br />
<br />
public AStarNode GetClosestNode(AStarNode Node)<br />
{<br />
SortNodes();<br />
foreach (AStarNode node in _nodeList)<br />
{<br />
if (Node.Position.X < node.Position.X && Node.Position.Y < node.Position.Y)<br />
{<br />
return node;<br />
}<br />
}<br />
return _nodeList[_nodeList.Count  1];<br />
}<br />
<br />
public void BindToClosestNode(AStarNode Node)<br />
{<br />
AStarNode closest = GetClosestNode(Node);<br />
Node.AddRelatedNode(closest);<br />
Comparison<AStarNode> byDistance = delegate(AStarNode One, AStarNode Two)<br />
{<br />
double distOne = Node.Position.Distance(One.Position);<br />
double distTwo = Node.Position.Distance(Two.Position);<br />
return distOne.CompareTo(distTwo);<br />
};<br />
closest.RelatedNodes.Sort(byDistance);<br />
Node.AddRelatedNode(closest.RelatedNodes[0]);<br />
Node.AddRelatedNode(closest.RelatedNodes[1]);<br />
}<br />
<br />
public AStarNode ConvertToStartNode(Vector3 Start)<br />
{<br />
foreach (AStarNode node in GetSearchNodes())<br />
{<br />
if (node.Position == Start)<br />
{<br />
return node;<br />
}<br />
}<br />
AStarNode startNode = new AStarNode(this, Start);<br />
BindToClosestNode(startNode);<br />
AddTempNode(startNode);<br />
return startNode;<br />
}<br />
<br />
public List<AStarNode> ConvertGoalsToNodes(List<Vector3> Goals)<br />
{<br />
List<AStarNode> goalNodes = new List<AStarNode>();<br />
foreach (Vector3 goal in Goals)<br />
{<br />
bool found = false;<br />
foreach (AStarNode node in GetSearchNodes())<br />
{<br />
if (node.Position == goal)<br />
{<br />
goalNodes.Add(node);<br />
found = true;<br />
break;<br />
}<br />
}<br />
if (!found)<br />
{<br />
AStarNode goalNode = new AStarNode(this, goal);<br />
BindToClosestNode(goalNode);<br />
goalNodes.Add(goalNode);<br />
AddTempNode(goalNode);<br />
}<br />
}<br />
return goalNodes;<br />
}<br />
<br />
public AStarNode RemoveCheapestNode(List<AStarNode> Nodes)<br />
{<br />
if (Nodes.Count == 0)<br />
{<br />
return null;<br />
}<br />
double min = Nodes[0].TotalCost;<br />
int index = 0;<br />
for (int i = 1; i < Nodes.Count; i++)<br />
{<br />
if (Nodes[i].TotalCost < min)<br />
{<br />
min = Nodes[i].TotalCost;<br />
index = i;<br />
}<br />
}<br />
AStarNode result = Nodes[index];<br />
Nodes.RemoveAt(index);<br />
return result;<br />
}<br />
<br />
public bool IsAvailable(AStarNode Node)<br />
{<br />
if (!IsInBounds(Node.Position))<br />
{<br />
return false;<br />
}<br />
if (!Node.Available)<br />
{<br />
return false;<br />
}<br />
return true;<br />
}<br />
<br />
public bool IsInBounds(Vector3 Position)<br />
{<br />
return<br />
Position.X > _minBoundary.X &&<br />
Position.Y > _minBoundary.Y &&<br />
Position.X < _maxBoundary.X &&<br />
Position.Y < _maxBoundary.Y;<br />
}<br />
<br />
private void NodeAdded(AStarNode Node)<br />
{<br />
if (OnNodeAdded != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(Node);<br />
OnNodeAdded(this, args);<br />
}<br />
}<br />
<br />
private void NodeRemoved(AStarNode Node)<br />
{<br />
if (OnNodeRemoved != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(Node);<br />
OnNodeRemoved(this, args);<br />
}<br />
}<br />
}
/*****************************************
AStar Node
*****************************************/
public class AStarNode : IComparable<AStarNode><br />
{<br />
private AStarSearcher _owner = null;<br />
private AStarNode _parent = null;<br />
private List<AStarNode> _relatedNodes = new List<AStarNode>();<br />
private Vector3 _position;<br />
private bool _available = true;<br />
private double _cost = 0;<br />
private double _totalCost = 0;<br />
private double _costToStart = 0;<br />
private double _costToGoal = 0;<br />
<br />
public event EventHandler<AStarNodeEventArgs> OnParentChanged;<br />
public event EventHandler<AStarNodeEventArgs> OnPositionChanged;<br />
public event EventHandler<AStarNodeEventArgs> OnAvailableChanged;<br />
public event EventHandler<AStarNodeEventArgs> OnCostChanged;<br />
public event EventHandler<AStarNodeEventArgs> OnTotalCostChanged;<br />
public event EventHandler<AStarNodeEventArgs> OnCostToStartChanged;<br />
public event EventHandler<AStarNodeEventArgs> OnCostToGoalChanged;<br />
public event EventHandler<AStarRelatedNodesEventArgs> OnRelated;<br />
public event EventHandler<AStarRelatedNodesEventArgs> OnUnRelated;<br />
<br />
public AStarNode(AStarSearcher Owner)<br />
{<br />
Initialize(Owner, new Vector3(0, 0, 0));<br />
}<br />
<br />
public AStarNode(AStarSearcher Owner, Vector3 Position)<br />
{<br />
Initialize(Owner, Position);<br />
}<br />
<br />
private void Initialize(AStarSearcher Owner, Vector3 Position)<br />
{<br />
_owner = Owner;<br />
_position = Position;<br />
_owner.OnNodeRemoved += new EventHandler<AStarNodeEventArgs>(_owner_OnNodeRemoved);<br />
}<br />
<br />
void _owner_OnNodeRemoved(object sender, AStarNodeEventArgs e)<br />
{<br />
if (!_relatedNodes.Contains(e.Node))<br />
{<br />
return;<br />
}<br />
_relatedNodes.Remove(e.Node);<br />
}<br />
<br />
public void Dispose()<br />
{<br />
_parent = null;<br />
}<br />
<br />
public AStarNode Parent<br />
{<br />
get<br />
{<br />
return _parent;<br />
}<br />
set<br />
{<br />
if (_parent == value)<br />
{<br />
return;<br />
}<br />
_parent = value;<br />
if (_parent == null)<br />
{<br />
CostToStart = 0;<br />
return;<br />
}<br />
ParentChanged();<br />
}<br />
}<br />
<br />
public List<AStarNode> RelatedNodes<br />
{<br />
get<br />
{<br />
return _relatedNodes;<br />
}<br />
}<br />
<br />
public Vector3 Position<br />
{<br />
get<br />
{<br />
return _position;<br />
}<br />
set<br />
{<br />
if(_position == value)<br />
{<br />
return;<br />
}<br />
_position = value;<br />
PositionChanged();<br />
}<br />
}<br />
<br />
public bool Available<br />
{<br />
get<br />
{<br />
return _available;<br />
}<br />
set<br />
{<br />
if (_available == value)<br />
{<br />
return;<br />
}<br />
_available = value;<br />
AvailableChanged();<br />
}<br />
}<br />
<br />
public double Cost<br />
{<br />
get<br />
{<br />
return _cost;<br />
}<br />
set<br />
{<br />
if (_cost == value)<br />
{<br />
return;<br />
}<br />
_cost = value;<br />
CostChanged();<br />
}<br />
}<br />
<br />
public double TotalCost<br />
{<br />
get<br />
{<br />
return _totalCost;<br />
}<br />
set<br />
{<br />
if (_totalCost == value)<br />
{<br />
return;<br />
}<br />
_totalCost = value;<br />
TotalCostChanged();<br />
}<br />
}<br />
<br />
public double CostToStart<br />
{<br />
get<br />
{<br />
return _costToStart;<br />
}<br />
set<br />
{<br />
if (_costToStart == value)<br />
{<br />
return;<br />
}<br />
_costToStart = value;<br />
CostToStartChanged();<br />
}<br />
}<br />
<br />
public double CostToGoal<br />
{<br />
get<br />
{<br />
return _costToGoal;<br />
}<br />
set<br />
{<br />
if (_costToGoal == value)<br />
{<br />
return;<br />
}<br />
_costToGoal = value;<br />
CostToGoalChanged();<br />
}<br />
}<br />
<br />
public void Reset()<br />
{<br />
Cost = 1;<br />
TotalCost = 0;<br />
CostToStart = 0;<br />
CostToGoal = 0;<br />
Parent = null;<br />
}<br />
<br />
private void ParentChanged()<br />
{<br />
if (OnParentChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnParentChanged(this, args);<br />
}<br />
}<br />
<br />
private void PositionChanged()<br />
{<br />
if (OnPositionChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnPositionChanged(this, args);<br />
}<br />
}<br />
<br />
private void AvailableChanged()<br />
{<br />
if (OnAvailableChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnAvailableChanged(this, args);<br />
}<br />
}<br />
<br />
private void CostChanged()<br />
{<br />
if (OnCostChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnCostChanged(this, args);<br />
}<br />
}<br />
<br />
private void TotalCostChanged()<br />
{<br />
if (OnTotalCostChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnTotalCostChanged(this, args);<br />
}<br />
}<br />
<br />
private void CostToStartChanged()<br />
{<br />
if (OnCostToStartChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnCostToStartChanged(this, args);<br />
}<br />
}<br />
<br />
private void CostToGoalChanged()<br />
{<br />
if (OnCostToGoalChanged != null)<br />
{<br />
AStarNodeEventArgs args = new AStarNodeEventArgs(this);<br />
OnCostToGoalChanged(this, args);<br />
}<br />
}<br />
private void Related(AStarNode Other)<br />
{<br />
if (OnRelated != null)<br />
{<br />
AStarRelatedNodesEventArgs args = new AStarRelatedNodesEventArgs(true, this, Other);<br />
OnRelated(this, args);<br />
}<br />
}<br />
<br />
private void UnRelated(AStarNode Other)<br />
{<br />
if (OnUnRelated != null)<br />
{<br />
AStarRelatedNodesEventArgs args = new AStarRelatedNodesEventArgs(false, this, Other);<br />
OnUnRelated(this, args);<br />
}<br />
}<br />
<br />
public void AddRelatedNode(AStarNode RelatedNode)<br />
{<br />
if (RelatedNode == this)<br />
{<br />
return;<br />
}<br />
if (_relatedNodes.Contains(RelatedNode))<br />
{<br />
return;<br />
}<br />
_relatedNodes.Add(RelatedNode);<br />
RelatedNode.AddRelatedNode(this);<br />
Related(RelatedNode);<br />
}<br />
<br />
public void RemoveRelatedNode(AStarNode RelatedNode)<br />
{<br />
if (!_relatedNodes.Contains(RelatedNode))<br />
{<br />
return;<br />
}<br />
_relatedNodes.Remove(RelatedNode);<br />
RelatedNode.RemoveRelatedNode(RelatedNode);<br />
UnRelated(RelatedNode);<br />
}<br />
<br />
public static Comparison<AStarNode> ByTotalCost<br />
{<br />
get<br />
{<br />
return delegate(AStarNode one, AStarNode two)<br />
{<br />
return one.TotalCost.CompareTo(two.TotalCost);<br />
};<br />
}<br />
}<br />
<br />
public static Comparison<AStarNode> ByPosition<br />
{<br />
get<br />
{<br />
return delegate(AStarNode one, AStarNode two)<br />
{<br />
int x = one.Position.X.CompareTo(two.Position.X);<br />
if (x != 0)<br />
{<br />
return x;<br />
}<br />
return one.Position.Y.CompareTo(two.Position.Y);<br />
<br />
};<br />
}<br />
}<br />
<br />
#region IComparable<AStarNode> Members<br />
<br />
public int CompareTo(AStarNode other)<br />
{<br />
return this.Position.CompareTo(other.Position);<br />
}<br />
<br />
#endregion<br />
}
/***********************************
AStar Search Results
***********************************/
public class AStarSearchResult<br />
{<br />
private List<Vector3> _solution;<br />
private bool _foundSolution;<br />
<br />
public AStarSearchResult()<br />
{<br />
_foundSolution = false;<br />
_solution = new List<Vector3>();<br />
}<br />
<br />
public AStarSearchResult(List<Vector3> Solution)<br />
{<br />
if (Solution.Count == 0)<br />
{<br />
_foundSolution = false;<br />
return;<br />
}<br />
_foundSolution = true;<br />
_solution = Solution;<br />
}<br />
<br />
public bool FoundSolution<br />
{<br />
get<br />
{<br />
return _foundSolution;<br />
}<br />
}<br />
<br />
public List<Vector3> Solution<br />
{<br />
get<br />
{<br />
return _solution;<br />
}<br />
}<br />
}
/***************************************
AStart Provider initialization routine
This routine is for square tiles but the nature of the
searcher is such that is can support other board
types
Also, if the state of the nodes can be linked to the
state of the board via events or an observer etc
you should only need to init once so subsequent searches
benefit from the one time cost to build
***************************************/
public void InitAStarSearcher(AStarSearcher PathProvider, GameBoard GameBoard)<br />
{<br />
PathProvider.InitializeNodes();<br />
AStarNode[,] primaryNodes = new AStarNode[GameBoard.TilesAcross, GameBoard.TilesDown];<br />
AStarNode[,] secondaryNodes = new AStarNode[GameBoard.TilesAcross  1, GameBoard.TilesDown  1];<br />
for (int x = 0; x < GameBoard.TilesAcross; x++)<br />
{<br />
for (int y = 0; y < GameBoard.TilesDown; y++)<br />
{<br />
double left = GameBoard.Tiles[x, y].Left + (_width / 2);<br />
double top = GameBoard.Tiles[x, y].Top + (_height / 2);<br />
AStarNode primaryNode = new AStarNode(PathProvider, new Vector3(left, top, 0));<br />
primaryNode.Available = GameBoard.Tiles[x, y].Terrain.LandPassable;<br />
primaryNodes[x, y] = primaryNode;<br />
PathProvider.AddNode(primaryNode);<br />
if (x > 0 && y > 0)<br />
{<br />
AStarNode secondaryNode = new AStarNode(PathProvider, new Vector3(GameBoard.Tiles[x, y].Left, GameBoard.Tiles[x, y].Top, 0));<br />
secondaryNode.Available =<br />
GameBoard.Tiles[x, y].Terrain.LandPassable &&<br />
GameBoard.Tiles[x  1, y].Terrain.LandPassable &&<br />
GameBoard.Tiles[x  1, y  1].Terrain.LandPassable &&<br />
GameBoard.Tiles[x, y  1].Terrain.LandPassable;<br />
secondaryNodes[x  1, y  1] = secondaryNode;<br />
PathProvider.AddNode(secondaryNode);<br />
<br />
primaryNodes[x, y].AddRelatedNode(primaryNodes[x, y  1]);<br />
primaryNodes[x, y].AddRelatedNode(primaryNodes[x  1, y]);<br />
primaryNodes[x  1, y  1].AddRelatedNode(primaryNodes[x  1, y]);<br />
primaryNodes[x  1, y  1].AddRelatedNode(primaryNodes[x, y  1]);<br />
primaryNodes[x, y  1].AddRelatedNode(primaryNodes[x  1, y  1]);<br />
primaryNodes[x  1, y].AddRelatedNode(primaryNodes[x  1, y  1]);<br />
secondaryNodes[x  1, y  1].AddRelatedNode(primaryNodes[x, y]);<br />
secondaryNodes[x  1, y  1].AddRelatedNode(primaryNodes[x  1, y]);<br />
secondaryNodes[x  1, y  1].AddRelatedNode(primaryNodes[x  1, y  1]);<br />
secondaryNodes[x  1, y  1].AddRelatedNode(primaryNodes[x, y  1]);<br />
<br />
if(x > 1)<br />
{<br />
secondaryNodes[x  1, y  1].AddRelatedNode(secondaryNodes[x  2, y  1]);<br />
}<br />
if(y > 1)<br />
{<br />
secondaryNodes[x  1, y  1].AddRelatedNode(secondaryNodes[x  1, y  2]);<br />
}<br />
}<br />
}<br />
}<br />
}
/******************************************
Example of search request
******************************************/
Point start = new Point(50, 50);<br />
Point goal1 = new Point(405, 400);<br />
Point goal2 = new Point(300, 400);<br />
List<Vector3> goals = new List<Vector3>();<br />
goals.Add(new Vector3(goal1.X, goal1.Y, 0));<br />
goals.Add(new Vector3(goal2.X, goal2.Y, 0));<br />
<br />
AStarSearchResult result = _pathProvider.FindShortestPath(<br />
new Vector3(start.X, start.Y, 0),<br />
goals);





Been a while since I stopped in here to check on things. I see you had expected to have something out early '07 and here it is late '07. Still keeping the project alive here?





One of my goals for the next release here was to have implemented some major architectural changes, such as getting rid of the Castlib/Member notions. However, since we're using it as the multimedia engine in 5 different commercial products, if I want to rewrite those portions, I'll either have to branch Endogine or adjust all those products for the new architecture. A difficult decision.
But it *has* come a very long way since the last CodeProject release, and a new version makes sense even with those flaws. Now, I just need to find the time to revise and rewrite the old demo project code...





Great work! I have been testing for a while..
Because of the intensive use of textures it would be fine that you use the compression textures feature of Directx if it is possible.
Also a bit more of documentation would be great )
Regards!





Thanks! Yes, that would be helpful. I'm looking at rewriting the texture management system  originally it was made to work somewhat like Macromedia Director's resource mgmt system, but it's not very good. I have already implemented an architecture that works very well for color palettes, fonts, string resources etc, and when I switch to that for textures I will also extend the funtionality.





Many modules can be useful, not just applicable in games but also other image or animation related applications.
VALUE LIFE; STAY AWAY FROM CODING.





Endogine has been thoroughly refactored the last few months, thanks to it being used as a cornerstone in a suite of commercial products.
There are still a number of patterns that need to change before I can call it 1.0, which may take a few months, but I hope to release a decent intermediate version the next few weeks.
After 1.0 I'll be looking more in detail at what needs to be done for Endogine to play nice as a widget system with Irrlicht, since my next project at work will be a 3D game. XNA integration is not currently on my roadmap, since I'm not yet sure how well the XNA framework technically and legally goes with the things I'm doing. I hope things will clear up with the release of Game Studio Pro.





Great news!
Thanks for all your hard work!





In StageBase I have a LoaderLock exception at
object o = cons.Invoke(new object[]{renderControl}); //eh
Thanks for your help...
Tinolayco





As stated in the readme (and the first link if you google "LoaderLock exception" :P), go to Debug.Exceptions and uncheck the MDA under "Managed Debug Exceptions". This is a bug that appears when using .NET 2.0 and MDX 1.1 together; the exception doesn't mean anything interesting.





hi. is there some "hello endogine" program? I mean the simpliest app using Endogine... would come handy when trying to start an appliaction using it. I know there are the test games and such, but the whole Test application is not exactly the simpliest thing ever. I'd say the best would be something along the lines of this  http://www.flatredball.com/content/FRBTemplateV42.zip
And btw. why do you use one poor CodeProject site for such a big project? It deserves it's own web





..oh and please also include some scripting example (boo and/or whatever else) thankyouverymuch





Hi there, and sorry for the late reply.
I'm currently looking at improving the patterns for using Endogine, so that it gets easier to set up new projects (and easier to port to mono). It's a tricky matter to make it really simple but versatile, and it's probably going to take a while longer... And oh, there's also XNA to consider, I'll have to see if I should adapt it to its standards.
In the meantime, you could take a look at how MusicGame is structured; it's a lot less messy than the Tests project at least.
I'll probably release a new version soon, but the largest change there is the (vastly) improved .psd codec.





When I try to compile MusicGame, I only get one error:
No overload for method 'GetAvailableRenderers' takes '0' arguments ... MusicGame\MusicGameApp\Program.cs 22 45 MusicGameApp
Because of the line:
string[] aAvailableStrategies = StageBase.GetAvailableRenderers();
When the definition of the method is:
public static string[] GetAvailableRenderers(string directory);
, in the public class StageBase.

Solution:
... .GetAvailableRenderers(null);

Consecuenses:
The software crashes. When I debug:
Could not load file or assembly 'Boo.Lang.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67' or one of its dependencies. El sistema no puede hallar el archivo especificado.
On the code:
_interpreter = new InteractiveInterpreter();
, of the constructor of the class ScripterBoo of the namespace Endogine.Scripting

What else can I do? Also I change the null with the directory where the *.dll are, but I get other errors in debugging (because of the application crash at the start)





Sorry about that; I missed checking that project after the last update. Interrim solution:
Boo.Lang.Parser can be found in your Endogine project folder, in Endogine.Scripting\Boo. Copy to the Debug and/or Release folder of the MusicGame project.





Thanks, but what about the compilation error? what parameter should I use?





The parameter is the path where the program should look for available rendering dlls. Passing null means it searches in CurrentDirectory (bin\Debug or bin\Release depending on your settings), so you should be OK, just make sure you have the Endogine.Renderer.Direct3D is in the right dir!





Thanks, it found the directory but still appears errors on debugging (index 0 is not defined, something like that), I really appreciate if you check the entire "Music Game" solution with your new versions and upload it corrected.
Thank you again.






Endogine is not for 3D geometry, it just uses the 3D card to accelerate 2D graphics, so this project won't be of much help to you. Have a look at http://www.jadengine.com/ or http://irrlicht.sourceforge.net/ instead.
For transparency, you can either use alpha blending, or additive / subtractive blending depending on what kind of result you want.
I think the easiest way might be to experiment with irrEdit (which can be found at the Irrlicht link above).
HTH





Thank you!! this engine need to help me )
Regards





I have this error when I'm building Endogine:
D:\DotNet\Biblioteki\3D\Endogine\Endogine\Endogine.Audio.Munoz\StreamingPlayer.cs(109,41) : error CS0433: Type "Microsoft.DirectX.DirectSound.Device" exist in both "c:\WINDOWS\assembly\GAC\Microsoft.DirectX.DirectSound\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.DirectSound.dll" and "c:\WINDOWS\assembly\GAC_32\Microsoft.DirectX\2.0.0.0__31bf3856ad364e35\Microsoft.DirectX.dll"
Mateusz www.Kierepka.pl





If the MDX 2.0 dll is present in the GAC, you'll have to disable it there too (rename the file or unregister it from the GAC). I'll add that to the readme.
Note: I don't recomment ever using MDX 2.0, as it will never proceed beyond beta (XNA will be the real MDX 1.1 successor).







General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

