1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

VCAI performance improvements

* Node graph initialization optimized.
* Fixed "Unathorized obstacle access".
* Pathfinding tracing disabled with ifdef.
* Misc bonus calculation optimizations.
* Removed timestamp from log lines. Date formatting eats too much CPU.
* Paths for all heroes in Client are now cached
This commit is contained in:
AlexVinS
2019-01-15 06:00:00 +03:00
parent 8fee46de7c
commit 4b5910c2f4
25 changed files with 472 additions and 347 deletions

View File

@@ -24,7 +24,7 @@ public:
virtual void applyOnDestination(
HeroPtr hero,
CDestinationNodeInfo & destination,
CDestinationNodeInfo & destination,
const PathNodeInfo & source,
AIPathNode * dstMode,
const AIPathNode * srcNode) const
@@ -76,6 +76,9 @@ private:
boost::multi_array<AIPathNode, 5> nodes;
const CGHeroInstance * hero;
STRONG_INLINE
void resetTile(const int3 & tile, EPathfindingLayer layer, CGPathNode::EAccessibility accessibility);
public:
/// more than 1 chain layer allows us to have more than 1 path to each tile so we can chose more optimal one.
static const int NUM_CHAINS = 3;
@@ -89,8 +92,9 @@ public:
AINodeStorage(const int3 & sizes);
~AINodeStorage();
void initialize(const PathfinderOptions & options, const CGameState * gs, const CGHeroInstance * hero) override;
virtual CGPathNode * getInitialNode() override;
virtual void resetTile(const int3 & tile, EPathfindingLayer layer, CGPathNode::EAccessibility accessibility) override;
virtual std::vector<CGPathNode *> calculateNeighbours(
const PathNodeInfo & source,