- Introduced Unit Testing capabilities to the PathFinder trait and algorithm.
Introduced also a small Unit test project to prove it. - Separated caching capabilities from PathFinder class to increase cohesion and maintainability. Refactored the pathfinding algorithm by extracting methods based on responsibilities like calculating costs and reordering functions. These changes should provide a in average a small increase in pathfinding performance and maintainability. - Optimized the pathfinder algorithm to reuse calculations like the MovementCost and heuristics. - Introduced base classes, IPathSearch and IPriorityQueue interfaces, and restructured code to ease readability and testability - Renamed the PathFinder related classes to more appropriate names. Made the traits rely on the interface IPathfinder instead of concrete PathFinder implementation. - Massive performance improvements - Solved error with harvesters' Heuristic - Updated the heuristic to ease redability and adjustability. D can be adjusted to offer best paths by decreasing and more performance by increasing it - Refactored the CellLayer<CellInfo> creation in its own Singleton class - Extracted the graph abstraction onto an IGraph interface, making the Pathfinder agnostic to the definition of world and terrain. This abstraction can help in the future to be able to cache graphs for similar classes and their costs, speeding up the pathfinder and being able to feed the A* algorithm with different types of graphs like Hierarchical graphs
This commit is contained in:
@@ -33,25 +33,21 @@ namespace OpenRA
|
||||
T Trait<T>();
|
||||
IEnumerable<T> TraitsImplementing<T>();
|
||||
|
||||
T TraitInfo<T>();
|
||||
|
||||
IEnumerable<IRenderable> Render(WorldRenderer wr);
|
||||
}
|
||||
|
||||
public class Actor : IScriptBindable, IScriptNotifyBind, ILuaTableBinding, ILuaEqualityBinding, ILuaToStringBinding, IEquatable<Actor>, IActor
|
||||
{
|
||||
public ActorInfo Info { get; private set; }
|
||||
public readonly ActorInfo Info;
|
||||
ActorInfo IActor.Info { get { return this.Info; } }
|
||||
|
||||
public readonly World World;
|
||||
IWorld IActor.World { get { return World; } }
|
||||
|
||||
IWorld IActor.World
|
||||
{
|
||||
get { return World; }
|
||||
}
|
||||
public readonly uint ActorID;
|
||||
uint IActor.ActorID { get { return this.ActorID; } }
|
||||
|
||||
public uint ActorID { get; private set; }
|
||||
|
||||
[Sync]
|
||||
public Player Owner { get; set; }
|
||||
[Sync] public Player Owner { get; set; }
|
||||
|
||||
public bool IsInWorld { get; internal set; }
|
||||
public bool Destroyed { get; private set; }
|
||||
@@ -224,11 +220,6 @@ namespace OpenRA
|
||||
return World.TraitDict.WithInterface<T>(this);
|
||||
}
|
||||
|
||||
public T TraitInfo<T>()
|
||||
{
|
||||
return Info.Traits.Get<T>();
|
||||
}
|
||||
|
||||
public bool HasTrait<T>()
|
||||
{
|
||||
return World.TraitDict.Contains<T>(this);
|
||||
|
||||
Reference in New Issue
Block a user