backport: nodes flooder (analyzer) from cs-ebot
analyze: allow to disable goal marking analyze: add cvars descriptions and bounds nav: added optional post path smoothing for astar algorithm nav: now bots will use Dijkstra algo instead of floyd-warshall if memory usage too high (controlled via yb_path_floyd_memory_limit cvar) (fixes #434) nav: vistable are now calculated every frame to prevent game-freeze during loading the game (fixes #434) graph: pracrice reworked to hash table so memory footprint is as low as possible (at cost 5-10% performance loss on practice) (fixes #434) control: bots commands now is case-insensitive bot: major refactoring of bot's code nav: issue warnings about path fail only with debug practice: check for visibility when updating danger index analyzer: suspend any analyzing on change level control: add kickall_ct/kickall_t nav: increase blocked distance in stuck check
This commit is contained in:
parent
bb2e93a539
commit
e7712a551a
31 changed files with 3114 additions and 1722 deletions
79
inc/analyze.h
Normal file
79
inc/analyze.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2023 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
// next code is based on cs-ebot implemntation, devised by EfeDursun125
|
||||
class GraphAnalyze : public Singleton <GraphAnalyze> {
|
||||
public:
|
||||
GraphAnalyze () = default;
|
||||
~GraphAnalyze () = default;
|
||||
|
||||
private:
|
||||
float m_updateInterval {}; // time to update analyzer
|
||||
|
||||
bool m_basicsCreated {}; // basics waypoints were created?
|
||||
bool m_isCrouch {}; // is node to be created as crouch ?
|
||||
bool m_isAnalyzing {}; // we're in analyzing ?
|
||||
bool m_isAnalyzed {}; // current waypoint is analyzed
|
||||
bool m_expandedNodes[kMaxNodes] {}; // all nodes expanded ?
|
||||
bool m_optimizedNodes[kMaxNodes] {}; // all nodes expanded ?
|
||||
|
||||
public:
|
||||
// start analyzation process
|
||||
void start ();
|
||||
|
||||
// update analyzation process
|
||||
void update ();
|
||||
|
||||
// suspend aanalyzing
|
||||
void suspend ();
|
||||
|
||||
private:
|
||||
// flood with nodes
|
||||
void flood (const Vector &pos, const Vector &next, float range);
|
||||
|
||||
// set update interval (keeps game from freezing)
|
||||
void setUpdateInterval ();
|
||||
|
||||
// mark waypoints as goals
|
||||
void markGoals ();
|
||||
|
||||
// terminate analyzation and save data
|
||||
void finish ();
|
||||
|
||||
// optimize nodes a little
|
||||
void optimize ();
|
||||
|
||||
// cleanup bad nodes
|
||||
void cleanup ();
|
||||
|
||||
public:
|
||||
|
||||
// node should be created as crouch
|
||||
bool isCrouch () const {
|
||||
return m_isCrouch;
|
||||
}
|
||||
|
||||
// is currently anaylyzing ?
|
||||
bool isAnalyzing () const {
|
||||
return m_isAnalyzing;
|
||||
}
|
||||
|
||||
// current graph is analyzed graph ?
|
||||
bool isAnalyzed () const {
|
||||
return m_isAnalyzed;
|
||||
}
|
||||
|
||||
// mark as optimized
|
||||
void markOptimized (const int index) {
|
||||
m_optimizedNodes[index] = true;
|
||||
}
|
||||
};
|
||||
|
||||
// explose global
|
||||
CR_EXPOSE_GLOBAL_SINGLETON (GraphAnalyze, analyzer);
|
||||
Loading…
Add table
Add a link
Reference in a new issue