Add your own alternative version
Stats
528.4K views 21.2K downloads 215 bookmarked
Posted
22 Jun 2005

Comments and Discussions




You're absolutely right  this time the main design will be totally agnostic of Windows.Forms (but it will be used in one of the "Platform" plugin that provides the engine with system events and APIs).
And feel free to assault to your heart's content! Maybe you'll come up with some nice classes to add to the new project once it's on codeplex.





Im working towards a class file where I can go:
reeParticle p1 = new reeParticle();
p1.Image = thisBitmap;
p1.startLoc(50, 50);
p1.endLoc(50, 100);
p1.Speed = 50;
p1.colorAt(0.3) = Color.Red;
p1.colorAt(0.6) = Color.Blue;
p1.colorAt(1.0) = Color.Yellow;
p1.sizeAt(0.5)= 0.5;
p1.sizeAt(1.0)= 1;
p1.Init();
Or some such.
Going to be interesting
= Reelix =





Is the work on this great engine still continued?





Yes and no. There's been a whole lot of development on the engine, but it's grown wild because I'm always finding new and better patterns for things. I've had to keep the old ones around since I have products depending on them. I don't want to release something in that state  it's a mess for someone who's not already intimely familiar with it.
I've just started working on a v2.0 which takes only the best of v1.x, and improves on the architecture even more. The first alpha version will probably be targeted at the Unity runtime (unity3d.com), and thus run both in browsers and as standalones on Windows/OSX/Wii (and possibly iPhone). Later, I will add support for SlimDX, and maybe XNA to get a wider range of delivery mechanisms.
Alpha ETA: sometime this spring!





Thanks for the fast answer.
That's definitely a: yes for me





hi,
i followed your tutorial01.txt built a project,but when i debug it .it throw a problem:
Exception has been thrown by the target of an invocation.
the location is program.cs >
endogine.Init(main, null, null);
this place.
i use vs.net2005. whats the problem?
from vevi





I like Endogine but i have one question: how to clear screen? (delete all sprites, texts, etc)





If you have references to all the Spritederived instances, just Dispose() them, otherwise you can iterate through the root sprite's (normally Stage.DefaultParent) children and Dispose() those, and they will dispose all their children recursively.
If you're going to use the engine seriously, I can provide a link to the latest version. There have been massive additions (and some breaking changes) to it since the last update here, but I haven't had time to rewrite the article or create tutorials for it.





will be very good if you will give me link to latest version





It's available now at
http://flowlabs.net/Download/Endogine080709.rar
I've had to remove some resources and projects because of copyright issues (eg BASS libraries), so you might get a few error messages when opening the solution, but you should be able to just ignore them.
Unfortunately, I won't have time to give any support ATM, so I'm afraid you're on your own  don't throw away your old projects just yet






The OpenGL renderer is experimental, you should exclude that projects from the solution. The Irrlicht renderer, which provides DX/OGL/Software modes, actually works pretty OK, but I had to add some features to the Irrlicht engine so it's not one of the standard dlls (and there's still work to do on it).
You can download my Irrlicht dlls here:
http://flowlabs.net/Download/Irrlicht.rar





thanks for the help it's hard to find engine like this (usualy they all commercial)
modified on Thursday, July 10, 2008 8:27 AM





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







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.

