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:
jeefo 2023-05-02 09:42:43 +03:00 committed by GitHub
commit e7712a551a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 3114 additions and 1722 deletions

View file

@ -538,75 +538,6 @@ String BotSupport::getCurrentDateTime () {
return String (timebuf);
}
String BotSupport::buildPath (int32_t file, bool isMemoryLoad) {
using FilePath = Twin <String, String>;
static HashMap <int32_t, FilePath> paths = {
{ BotFile::Vistable, FilePath ("train", "vis")},
{ BotFile::Practice, FilePath ("train", "prc")},
{ BotFile::Pathmatrix, FilePath ("train", "pmx")},
{ BotFile::LogFile, FilePath ("logs", "txt")},
{ BotFile::Graph, FilePath ("graph", "graph")},
{ BotFile::PodbotPWF, FilePath ("pwf", "pwf")},
{ BotFile::EbotEWP, FilePath ("ewp", "ewp")},
};
static StringArray path;
path.clear ();
// if not memory file we're don't need game dir
if (!isMemoryLoad) {
path.emplace (game.getRunningModName ());
}
// allways append addons/product
path.emplace ("addons");
path.emplace (product.folder);
// the datadir
path.emplace ("data");
// append real filepath
path.emplace (paths[file].first);
// if file is logfile use correct logfile name with date
if (file == BotFile::LogFile) {
time_t ticks = time (&ticks);
tm timeinfo {};
plat.loctime (&timeinfo, &ticks);
auto timebuf = strings.chars ();
strftime (timebuf, StringBuffer::StaticBufferSize, "L%d%m%Y", &timeinfo);
path.emplace (strings.format ("%s_%s.%s", product.folder, timebuf, paths[file].second));
}
else {
String mapName = game.getMapName ();
path.emplace (strings.format ("%s.%s", mapName.lowercase (), paths[file].second));
}
// finally use correct path separarators for us
return String::join (path, plat.win ? "\\" : "/");
}
// converts storage option to stroage filename
int32_t BotSupport::storageToBotFile (StorageOption options) {
if (options & StorageOption::Graph) {
return BotFile::Graph;
}
else if (options & StorageOption::Matrix) {
return BotFile::Pathmatrix;
}
else if (options & StorageOption::Vistable) {
return BotFile::Vistable;
}
else if (options & StorageOption::Practice) {
return BotFile::Practice;
}
return BotFile::Graph;
}
int32_t BotSupport::sendTo (int socket, const void *message, size_t length, int flags, const sockaddr *dest, int destLength) {
const auto send = [&] (const Twin <const uint8_t *, size_t> &msg) -> int32_t {
return Socket::sendto (socket, msg.first, msg.second, flags, dest, destLength);