2019-08-12 14:16:28 +03:00
|
|
|
//
|
2020-06-12 18:52:38 +03:00
|
|
|
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
2023-01-22 19:12:03 +06:00
|
|
|
// Copyright © 2004-2023 YaPB Project <yapb@jeefo.net>.
|
2019-08-12 14:16:28 +03:00
|
|
|
//
|
2020-11-03 08:57:12 +03:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-08-12 14:16:28 +03:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// defines for nodes flags field (32 bits are available)
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (NodeFlag,
|
|
|
|
|
Lift = cr::bit (1), // wait for lift to be down before approaching this node
|
|
|
|
|
Crouch = cr::bit (2), // must crouch to reach this node
|
|
|
|
|
Crossing = cr::bit (3), // a target node
|
|
|
|
|
Goal = cr::bit (4), // mission goal point (bomb, hostage etc.)
|
|
|
|
|
Ladder = cr::bit (5), // node is on ladder
|
|
|
|
|
Rescue = cr::bit (6), // node is a hostage rescue point
|
|
|
|
|
Camp = cr::bit (7), // node is a camping point
|
|
|
|
|
NoHostage = cr::bit (8), // only use this node if no hostage
|
|
|
|
|
DoubleJump = cr::bit (9), // bot help's another bot (requster) to get somewhere (using djump)
|
2020-01-08 18:29:28 +03:00
|
|
|
Narrow = cr::bit (10), // node is inside some small space (corridor or such)
|
2019-08-12 14:16:28 +03:00
|
|
|
Sniper = cr::bit (28), // it's a specific sniper point
|
|
|
|
|
TerroristOnly = cr::bit (29), // it's a specific terrorist point
|
|
|
|
|
CTOnly = cr::bit (30), // it's a specific ct point
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// defines for node connection flags field (16 bits are available)
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
CR_DECLARE_SCOPED_ENUM_TYPE (PathFlag, uint16_t,
|
2019-08-12 14:16:28 +03:00
|
|
|
Jump = cr::bit (0) // must jump for this connection
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// enum pathfind search type
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (FindPath,
|
|
|
|
|
Fast = 0,
|
|
|
|
|
Optimal,
|
|
|
|
|
Safe
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// defines node connection types
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (PathConnection,
|
|
|
|
|
Outgoing = 0,
|
|
|
|
|
Incoming,
|
|
|
|
|
Bidirectional
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// a* route state
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (RouteState,
|
|
|
|
|
Open = 0,
|
|
|
|
|
Closed,
|
|
|
|
|
New
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// node edit states
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (GraphEdit,
|
|
|
|
|
On = cr::bit (1),
|
|
|
|
|
Noclip = cr::bit (2),
|
|
|
|
|
Auto = cr::bit (3)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// storage header options
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (StorageOption,
|
|
|
|
|
Practice = cr::bit (0), // this is practice (experience) file
|
|
|
|
|
Matrix = cr::bit (1), // this is floyd warshal path & distance matrix
|
|
|
|
|
Vistable = cr::bit (2), // this is vistable data
|
|
|
|
|
Graph = cr::bit (3), // this is a node graph data
|
|
|
|
|
Official = cr::bit (4), // this is additional flag for graph indicates graph are official
|
|
|
|
|
Recovered = cr::bit (5), // this is additional flag indicates graph converted from podbot and was bad
|
2020-02-08 00:03:52 +03:00
|
|
|
Exten = cr::bit (6) // this is additional flag indicates that there's extension info
|
2019-08-12 14:16:28 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// storage header versions
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (StorageVersion,
|
2022-10-03 11:20:06 +03:00
|
|
|
Graph = 2,
|
2019-08-12 14:16:28 +03:00
|
|
|
Practice = 1,
|
2023-03-23 09:57:23 +03:00
|
|
|
Vistable = 2,
|
2019-08-12 14:16:28 +03:00
|
|
|
Matrix = 1,
|
|
|
|
|
Podbot = 7
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// lift usage states
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (LiftState,
|
|
|
|
|
None = 0,
|
|
|
|
|
LookingButtonOutside,
|
|
|
|
|
WaitingFor,
|
|
|
|
|
EnteringIn,
|
|
|
|
|
WaitingForTeammates,
|
|
|
|
|
LookingButtonInside,
|
|
|
|
|
TravelingBy,
|
|
|
|
|
Leaving
|
|
|
|
|
)
|
|
|
|
|
|
2021-09-20 13:50:00 +03:00
|
|
|
// node add flags
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM (NodeAddFlag,
|
|
|
|
|
Normal = 0,
|
|
|
|
|
TOnly = 1,
|
|
|
|
|
CTOnly = 2,
|
|
|
|
|
NoHostage = 3,
|
|
|
|
|
Rescue = 4,
|
|
|
|
|
Camp = 5,
|
|
|
|
|
CampEnd = 6,
|
|
|
|
|
JumpStart = 9,
|
|
|
|
|
JumpEnd = 10,
|
|
|
|
|
Goal = 100
|
|
|
|
|
)
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// a* route
|
|
|
|
|
struct Route {
|
|
|
|
|
float g, f;
|
|
|
|
|
int parent;
|
|
|
|
|
RouteState state;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// general stprage header information structure
|
|
|
|
|
struct StorageHeader {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t magic;
|
|
|
|
|
int32_t version;
|
|
|
|
|
int32_t options;
|
|
|
|
|
int32_t length;
|
|
|
|
|
int32_t compressed;
|
|
|
|
|
int32_t uncompressed;
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
2020-02-08 00:03:52 +03:00
|
|
|
// extension header for graph information
|
|
|
|
|
struct ExtenHeader {
|
2022-09-21 14:47:36 +03:00
|
|
|
char author[32]; // original author of graph
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t mapSize; // bsp size for checksumming map consistency
|
2022-09-21 14:47:36 +03:00
|
|
|
char modified[32]; // by whom modified
|
2020-02-08 00:03:52 +03:00
|
|
|
};
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// general waypoint header information structure
|
|
|
|
|
struct PODGraphHeader {
|
|
|
|
|
char header[8];
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t fileVersion;
|
|
|
|
|
int32_t pointNumber;
|
2019-08-12 14:16:28 +03:00
|
|
|
char mapName[32];
|
|
|
|
|
char author[32];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// floyd-warshall matrices
|
|
|
|
|
struct Matrix {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int16_t dist;
|
|
|
|
|
int16_t index;
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// experience data hold in memory while playing
|
|
|
|
|
struct Practice {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int16_t damage[kGameTeamNum];
|
|
|
|
|
int16_t index[kGameTeamNum];
|
|
|
|
|
int16_t value[kGameTeamNum];
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// defines linked waypoints
|
|
|
|
|
struct PathLink {
|
|
|
|
|
Vector velocity;
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t distance;
|
|
|
|
|
uint16_t flags;
|
|
|
|
|
int16_t index;
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// defines visibility count
|
|
|
|
|
struct PathVis {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
uint16_t stand, crouch;
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// define graph path structure for yapb
|
|
|
|
|
struct Path {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t number, flags;
|
2019-08-12 14:16:28 +03:00
|
|
|
Vector origin, start, end;
|
|
|
|
|
float radius, light, display;
|
|
|
|
|
PathLink links[kMaxNodeLinks];
|
|
|
|
|
PathVis vis;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// define waypoint structure for podbot (will convert on load)
|
|
|
|
|
struct PODPath {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t number, flags;
|
2019-08-12 14:16:28 +03:00
|
|
|
Vector origin;
|
|
|
|
|
float radius, csx, csy, cex, cey;
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int16_t index[kMaxNodeLinks];
|
|
|
|
|
uint16_t conflags[kMaxNodeLinks];
|
2019-08-12 14:16:28 +03:00
|
|
|
Vector velocity[kMaxNodeLinks];
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t distance[kMaxNodeLinks];
|
2019-08-12 14:16:28 +03:00
|
|
|
PathVis vis;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// this structure links nodes returned from pathfinder
|
|
|
|
|
class PathWalk final : public DenyCopying {
|
|
|
|
|
private:
|
2023-04-02 12:17:12 +03:00
|
|
|
size_t m_cursor {};
|
|
|
|
|
size_t m_length {};
|
2020-11-23 00:06:18 +03:00
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
UniquePtr <int32_t[]> m_path {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit PathWalk () = default;
|
|
|
|
|
~PathWalk () = default;
|
|
|
|
|
|
|
|
|
|
public:
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t &next () {
|
2019-08-12 22:51:26 +03:00
|
|
|
return at (1);
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t &first () {
|
2019-08-12 22:51:26 +03:00
|
|
|
return at (0);
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t &last () {
|
2020-11-23 00:06:18 +03:00
|
|
|
return at (length () - 1);
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t &at (size_t index) {
|
2020-11-23 00:06:18 +03:00
|
|
|
return m_path[m_cursor + index];
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shift () {
|
|
|
|
|
++m_cursor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void reverse () {
|
2020-11-23 00:06:18 +03:00
|
|
|
for (size_t i = 0; i < m_length / 2; ++i) {
|
|
|
|
|
cr::swap (m_path[i], m_path[m_length - 1 - i]);
|
|
|
|
|
}
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t length () const {
|
2020-11-23 00:06:18 +03:00
|
|
|
if (m_cursor >= m_length) {
|
2019-08-12 14:16:28 +03:00
|
|
|
return 0;
|
|
|
|
|
}
|
2020-11-23 00:06:18 +03:00
|
|
|
return m_length - m_cursor;
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool hasNext () const {
|
2020-11-23 00:06:18 +03:00
|
|
|
return length () > m_cursor;
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool empty () const {
|
|
|
|
|
return !length ();
|
|
|
|
|
}
|
|
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
void add (int32_t node) {
|
2020-11-23 00:06:18 +03:00
|
|
|
m_path[m_length++] = node;
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clear () {
|
|
|
|
|
m_cursor = 0;
|
2020-11-23 00:06:18 +03:00
|
|
|
m_length = 0;
|
|
|
|
|
|
|
|
|
|
m_path[0] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void init (size_t length) {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
m_path = cr::makeUnique <int32_t []> (length);
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// graph operation class
|
|
|
|
|
class BotGraph final : public Singleton <BotGraph> {
|
|
|
|
|
public:
|
|
|
|
|
friend class Bot;
|
|
|
|
|
|
|
|
|
|
private:
|
2023-04-02 12:17:12 +03:00
|
|
|
int m_editFlags {};
|
|
|
|
|
int m_loadAttempts {};
|
|
|
|
|
int m_cacheNodeIndex {};
|
|
|
|
|
int m_lastJumpNode {};
|
|
|
|
|
int m_findWPIndex {};
|
|
|
|
|
int m_facingAtIndex {};
|
2020-11-23 00:06:18 +03:00
|
|
|
int m_highestDamage[kGameTeamNum] {};
|
2023-04-02 12:17:12 +03:00
|
|
|
int m_autoSaveCount {};
|
|
|
|
|
|
|
|
|
|
float m_timeJumpStarted {};
|
|
|
|
|
float m_autoPathDistance {};
|
|
|
|
|
float m_pathDisplayTime {};
|
|
|
|
|
float m_arrowDisplayTime {};
|
|
|
|
|
|
|
|
|
|
bool m_isOnLadder {};
|
|
|
|
|
bool m_endJumpPoint {};
|
|
|
|
|
bool m_jumpLearnNode {};
|
|
|
|
|
bool m_hasChanged {};
|
|
|
|
|
bool m_needsVisRebuild {};
|
|
|
|
|
bool m_narrowChecked {};
|
|
|
|
|
|
|
|
|
|
Vector m_learnVelocity {};
|
|
|
|
|
Vector m_learnPosition {};
|
|
|
|
|
Vector m_bombOrigin {};
|
|
|
|
|
Vector m_lastNode {};
|
|
|
|
|
|
|
|
|
|
IntArray m_terrorPoints {};
|
|
|
|
|
IntArray m_ctPoints {};
|
|
|
|
|
IntArray m_goalPoints {};
|
|
|
|
|
IntArray m_campPoints {};
|
|
|
|
|
IntArray m_sniperPoints {};
|
|
|
|
|
IntArray m_rescuePoints {};
|
|
|
|
|
IntArray m_visitedGoals {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2023-04-02 12:17:12 +03:00
|
|
|
SmallArray <Matrix> m_matrix {};
|
|
|
|
|
SmallArray <Practice> m_practice {};
|
|
|
|
|
SmallArray <Path> m_paths {};
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
SmallArray <uint8_t> m_vistable {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2023-04-11 22:32:28 +03:00
|
|
|
HashMap <int32_t, Array <int32_t>, EmptyHash <int32_t>> m_hashTable;
|
|
|
|
|
|
2023-04-02 12:17:12 +03:00
|
|
|
String m_graphAuthor {};
|
|
|
|
|
String m_graphModified {};
|
2022-09-21 14:47:36 +03:00
|
|
|
|
|
|
|
|
ExtenHeader m_extenHeader {};
|
|
|
|
|
StorageHeader m_graphHeader {};
|
|
|
|
|
|
2023-04-02 12:17:12 +03:00
|
|
|
edict_t *m_editor {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
BotGraph ();
|
|
|
|
|
~BotGraph () = default;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
int getFacingIndex ();
|
|
|
|
|
int getFarest (const Vector &origin, float maxDistance = 32.0);
|
|
|
|
|
int getNearest (const Vector &origin, float minDistance = kInfiniteDistance, int flags = -1);
|
|
|
|
|
int getNearestNoBuckets (const Vector &origin, float minDistance = kInfiniteDistance, int flags = -1);
|
2023-01-22 19:12:03 +06:00
|
|
|
int getEditorNearest ();
|
2019-08-12 14:16:28 +03:00
|
|
|
int getDangerIndex (int team, int start, int goal);
|
|
|
|
|
int getDangerValue (int team, int start, int goal);
|
|
|
|
|
int getDangerDamage (int team, int start, int goal);
|
|
|
|
|
int getPathDist (int srcIndex, int destIndex);
|
|
|
|
|
int clearConnections (int index);
|
2021-09-20 13:50:00 +03:00
|
|
|
int getBspSize ();
|
2023-04-11 22:32:28 +03:00
|
|
|
int locateBucket (const Vector &pos);
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
float calculateTravelTime (float maxSpeed, const Vector &src, const Vector &origin);
|
|
|
|
|
|
|
|
|
|
bool convertOldFormat ();
|
|
|
|
|
bool isVisible (int srcIndex, int destIndex);
|
|
|
|
|
bool isStandVisible (int srcIndex, int destIndex);
|
|
|
|
|
bool isDuckVisible (int srcIndex, int destIndex);
|
|
|
|
|
bool isConnected (int a, int b);
|
|
|
|
|
bool isConnected (int index);
|
|
|
|
|
bool isNodeReacheable (const Vector &src, const Vector &destination);
|
|
|
|
|
bool checkNodes (bool teleportPlayer);
|
|
|
|
|
bool loadPathMatrix ();
|
|
|
|
|
bool isVisited (int index);
|
|
|
|
|
|
|
|
|
|
bool saveGraphData ();
|
|
|
|
|
bool loadGraphData ();
|
2020-07-11 20:34:26 +03:00
|
|
|
bool canDownload ();
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2023-04-13 03:05:35 +03:00
|
|
|
template <typename U> bool saveStorage (StringRef name, StorageOption options, StorageVersion version, const SmallArray <U> &data, ExtenHeader *exten);
|
|
|
|
|
template <typename U> bool loadStorage (StringRef name, StorageOption options, StorageVersion version, SmallArray <U> &data, ExtenHeader *exten, int32_t *outOptions);
|
2020-06-12 18:52:38 +03:00
|
|
|
template <typename ...Args> bool raiseLoadingError (bool isGraph, MemFile &file, const char *fmt, Args &&...args);
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
void saveOldFormat ();
|
2020-09-26 18:41:53 +03:00
|
|
|
void reset ();
|
2019-08-12 14:16:28 +03:00
|
|
|
void frame ();
|
|
|
|
|
void loadPractice ();
|
|
|
|
|
void loadVisibility ();
|
|
|
|
|
void initNodesTypes ();
|
|
|
|
|
void initLightLevels ();
|
2020-01-08 18:29:28 +03:00
|
|
|
void initNarrowPlaces ();
|
2019-08-12 14:16:28 +03:00
|
|
|
void addPath (int addIndex, int pathIndex, float distance);
|
2019-08-18 21:00:00 +03:00
|
|
|
void add (int type, const Vector &pos = nullptr);
|
2019-08-12 14:16:28 +03:00
|
|
|
void erase (int target);
|
|
|
|
|
void toggleFlags (int toggleFlag);
|
|
|
|
|
void setRadius (int index, float radius);
|
|
|
|
|
void rebuildVisibility ();
|
|
|
|
|
void pathCreate (char dir);
|
|
|
|
|
void erasePath ();
|
|
|
|
|
void cachePoint (int index);
|
|
|
|
|
void calculatePathRadius (int index);
|
|
|
|
|
void savePractice ();
|
|
|
|
|
void saveVisibility ();
|
|
|
|
|
void addBasic ();
|
|
|
|
|
void eraseFromDisk ();
|
|
|
|
|
void savePathMatrix ();
|
|
|
|
|
void setSearchIndex (int index);
|
|
|
|
|
void startLearnJump ();
|
|
|
|
|
void setVisited (int index);
|
|
|
|
|
void clearVisited ();
|
|
|
|
|
void initBuckets ();
|
|
|
|
|
void addToBucket (const Vector &pos, int index);
|
|
|
|
|
void eraseFromBucket (const Vector &pos, int index);
|
2019-08-24 12:43:42 +03:00
|
|
|
void setBombOrigin (bool reset = false, const Vector &pos = nullptr);
|
2019-08-12 14:16:28 +03:00
|
|
|
void updateGlobalPractice ();
|
|
|
|
|
void unassignPath (int from, int to);
|
|
|
|
|
void setDangerValue (int team, int start, int goal, int value);
|
|
|
|
|
void setDangerDamage (int team, int start, int goal, int value);
|
|
|
|
|
void convertFromPOD (Path &path, const PODPath &pod);
|
|
|
|
|
void convertToPOD (const Path &path, PODPath &pod);
|
|
|
|
|
void convertCampDirection (Path &path);
|
2020-08-23 11:08:27 +03:00
|
|
|
void setAutoPathDistance (const float distance);
|
2020-08-31 14:52:12 +03:00
|
|
|
void showStats ();
|
2022-09-21 14:47:36 +03:00
|
|
|
void showFileInfo ();
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2023-04-11 22:32:28 +03:00
|
|
|
IntArray getNarestInRadius (float radius, const Vector &origin, int maxCount = -1);
|
|
|
|
|
const IntArray &getNodesInBucket (const Vector &pos);
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
public:
|
2020-11-23 00:06:18 +03:00
|
|
|
size_t getMaxRouteLength () const {
|
|
|
|
|
return m_paths.length () / 2;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
int getHighestDamageForTeam (int team) const {
|
|
|
|
|
return m_highestDamage[team];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setHighestDamageForTeam (int team, int value) {
|
|
|
|
|
m_highestDamage[team] = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 10:43:51 +03:00
|
|
|
StringRef getAuthor () const {
|
2022-09-21 14:47:36 +03:00
|
|
|
return m_graphAuthor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringRef getModifiedBy () const {
|
|
|
|
|
return m_graphModified;
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool hasChanged () const {
|
|
|
|
|
return m_hasChanged;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool hasEditFlag (int flag) const {
|
|
|
|
|
return !!(m_editFlags & flag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setEditFlag (int flag) {
|
|
|
|
|
m_editFlags |= flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearEditFlag (int flag) {
|
|
|
|
|
m_editFlags &= ~flag;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-24 12:43:42 +03:00
|
|
|
const Vector &getBombOrigin () const {
|
|
|
|
|
return m_bombOrigin;
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// access paths
|
|
|
|
|
Path &operator [] (int index) {
|
|
|
|
|
return m_paths[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check nodes range
|
|
|
|
|
bool exists (int index) const {
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
return index >= 0 && index < length ();
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get real nodes num
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t length () const {
|
|
|
|
|
return m_paths.length <int32_t> ();
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check if has editor
|
|
|
|
|
bool hasEditor () const {
|
|
|
|
|
return !!m_editor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set's the node editor
|
|
|
|
|
void setEditor (edict_t *ent) {
|
|
|
|
|
m_editor = ent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get the current node editor
|
|
|
|
|
edict_t *getEditor () {
|
|
|
|
|
return m_editor;
|
|
|
|
|
}
|
2023-04-11 22:32:28 +03:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Path *begin () {
|
|
|
|
|
return m_paths.begin ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Path *begin () const {
|
|
|
|
|
return m_paths.begin ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Path *end () {
|
|
|
|
|
return m_paths.end ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Path *end () const {
|
|
|
|
|
return m_paths.end ();
|
|
|
|
|
}
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
2020-06-12 18:52:38 +03:00
|
|
|
// we're need `bots`
|
|
|
|
|
#include <manager.h>
|
|
|
|
|
|
|
|
|
|
// helper for reporting load errors
|
|
|
|
|
template <typename ...Args> bool BotGraph::raiseLoadingError (bool isGraph, MemFile &file, const char *fmt, Args &&...args) {
|
|
|
|
|
auto result = strings.format (fmt, cr::forward <Args> (args)...);
|
2023-04-13 03:05:35 +03:00
|
|
|
|
|
|
|
|
// display error only for graph file
|
|
|
|
|
if (isGraph || cv_debug.bool_ ()) {
|
|
|
|
|
logger.error (result);
|
|
|
|
|
}
|
2020-06-12 18:52:38 +03:00
|
|
|
|
|
|
|
|
// if graph reset paths
|
|
|
|
|
if (isGraph) {
|
|
|
|
|
bots.kickEveryone (true);
|
|
|
|
|
|
2022-09-21 14:47:36 +03:00
|
|
|
m_graphAuthor = result;
|
2020-06-12 18:52:38 +03:00
|
|
|
m_paths.clear ();
|
|
|
|
|
}
|
|
|
|
|
file.close ();
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// explose global
|
2020-02-08 00:03:52 +03:00
|
|
|
CR_EXPOSE_GLOBAL_SINGLETON (BotGraph, graph);
|