having a look at this perf stuff...
This commit is contained in:
@@ -477,5 +477,10 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
quit = true;
|
quit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Debug(string s)
|
||||||
|
{
|
||||||
|
chat.AddLine(Color.White, "Debug", s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Orders
|
|||||||
|
|
||||||
string ChooseCursor(World world, MouseInput mi)
|
string ChooseCursor(World world, MouseInput mi)
|
||||||
{
|
{
|
||||||
using (new PerfSample("cursor"))
|
//using (new PerfSample("cursor"))
|
||||||
{
|
{
|
||||||
var p = Game.controller.MousePosition;
|
var p = Game.controller.MousePosition;
|
||||||
var c = Order(world, p.ToInt2(), mi)
|
var c = Order(world, p.ToInt2(), mi)
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
using (new PerfSample("find_unit_path"))
|
using (new PerfSample("find_unit_path"))
|
||||||
{
|
{
|
||||||
|
Game.Debug("FindUnitPath {0} -> {1}".F(from, target));
|
||||||
|
|
||||||
var pb = FindBidiPath(
|
var pb = FindBidiPath(
|
||||||
PathSearch.FromPoint(world, target, from, umt, false).WithCustomBlocker(AvoidUnitsNear(from, 4)),
|
PathSearch.FromPoint(world, target, from, umt, false).WithCustomBlocker(AvoidUnitsNear(from, 4)),
|
||||||
PathSearch.FromPoint(world, from, target, umt, false).WithCustomBlocker(AvoidUnitsNear(from, 4)));
|
PathSearch.FromPoint(world, from, target, umt, false).WithCustomBlocker(AvoidUnitsNear(from, 4)));
|
||||||
@@ -61,7 +63,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public List<int2> FindUnitPathToRange( int2 src, int2 target, UnitMovementType umt, int range )
|
public List<int2> FindUnitPathToRange( int2 src, int2 target, UnitMovementType umt, int range )
|
||||||
{
|
{
|
||||||
using( new PerfSample( "find_unit_path_multiple_src" ) )
|
//using( new PerfSample( "find_unit_path_multiple_src" ) )
|
||||||
{
|
{
|
||||||
var tilesInRange = world.FindTilesInCircle(target, range)
|
var tilesInRange = world.FindTilesInCircle(target, range)
|
||||||
.Where( t => world.IsPathableCell( t, umt ) );
|
.Where( t => world.IsPathableCell( t, umt ) );
|
||||||
@@ -82,7 +84,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public List<int2> FindPath( PathSearch search )
|
public List<int2> FindPath( PathSearch search )
|
||||||
{
|
{
|
||||||
using (new PerfSample("find_path_inner"))
|
//using (new PerfSample("find_path_inner"))
|
||||||
{
|
{
|
||||||
while (!search.queue.Empty)
|
while (!search.queue.Empty)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ using OpenRA.FileFormats;
|
|||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Support;
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
@@ -112,19 +113,22 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Explore(World w, int2 center, int range)
|
public void Explore(World w, int2 center, int range)
|
||||||
{
|
{
|
||||||
if (range == 0)
|
using (new PerfSample("explore"))
|
||||||
return;
|
|
||||||
|
|
||||||
var box = MakeRect(center, range);
|
|
||||||
bounds = bounds.HasValue ?
|
|
||||||
Rectangle.Union(bounds.Value, box) : box;
|
|
||||||
|
|
||||||
foreach (var t in w.FindTilesInCircle(center, range))
|
|
||||||
{
|
{
|
||||||
explored[t.X, t.Y] = true;
|
if (range == 0)
|
||||||
gapField[t.X, t.Y] = 0;
|
return;
|
||||||
|
|
||||||
|
var box = MakeRect(center, range);
|
||||||
|
bounds = bounds.HasValue ?
|
||||||
|
Rectangle.Union(bounds.Value, box) : box;
|
||||||
|
|
||||||
|
foreach (var t in w.FindTilesInCircle(center, range))
|
||||||
|
{
|
||||||
|
explored[t.X, t.Y] = true;
|
||||||
|
gapField[t.X, t.Y] = 0;
|
||||||
|
}
|
||||||
|
dirty = true;
|
||||||
}
|
}
|
||||||
dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Explore(Actor a)
|
public void Explore(Actor a)
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ namespace OpenRA.Support
|
|||||||
{
|
{
|
||||||
static class PerfHistory
|
static class PerfHistory
|
||||||
{
|
{
|
||||||
static readonly Color[] colors = { Color.Red, Color.Green, Color.Blue, Color.Yellow, Color.Orange, Color.Fuchsia, Color.Lime, Color.LightBlue, Color.White, Color.Black };
|
static readonly Color[] colors = { Color.Red, Color.Green,
|
||||||
|
Color.Blue, Color.Yellow,
|
||||||
|
Color.Orange, Color.Fuchsia,
|
||||||
|
Color.Lime, Color.LightBlue,
|
||||||
|
Color.White, Color.Teal };
|
||||||
static int nextColor;
|
static int nextColor;
|
||||||
|
|
||||||
public static Cache<string, PerfItem> items = new Cache<string, PerfItem>(
|
public static Cache<string, PerfItem> items = new Cache<string, PerfItem>(
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ namespace OpenRA.Traits.Activities
|
|||||||
this.getPath = (self, mobile) =>
|
this.getPath = (self, mobile) =>
|
||||||
self.World.PathFinder.FindPath(
|
self.World.PathFinder.FindPath(
|
||||||
PathSearch.FromPoint( self.World, self.Location, destination, mobile.GetMovementType(), false )
|
PathSearch.FromPoint( self.World, self.Location, destination, mobile.GetMovementType(), false )
|
||||||
.WithCustomBlocker( self.World.PathFinder.AvoidUnitsNear( self.Location, 4 )).WithIgnoredBuilding( ignoreBuilding ));
|
.WithCustomBlocker( self.World.PathFinder.AvoidUnitsNear( self.Location, 4 ))
|
||||||
|
.WithIgnoredBuilding( ignoreBuilding ));
|
||||||
|
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.nearEnough = 0;
|
this.nearEnough = 0;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public int SyncHash()
|
public int SyncHash()
|
||||||
{
|
{
|
||||||
using (new PerfSample("synchash"))
|
//using (new PerfSample("synchash"))
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
foreach (var a in Actors)
|
foreach (var a in Actors)
|
||||||
|
|||||||
Reference in New Issue
Block a user