2019-09-21 23:20:33 +03:00
//
2020-06-12 18:52:38 +03:00
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
2021-01-01 00:00:33 +03:00
// Copyright © 2004-2021 YaPB Project <yapb@jeefo.net>.
2014-07-30 14:17:46 +04:00
//
2020-11-03 08:57:12 +03:00
// SPDX-License-Identifier: MIT
2014-07-30 14:17:46 +04:00
//
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
# include <yapb.h>
2014-07-30 14:17:46 +04:00
2020-10-07 10:25:31 +03:00
ConVar cv_version ( " yb_version " , product . version . chars ( ) , Var : : ReadOnly ) ;
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
gamefuncs_t dllapi ;
2020-11-23 00:06:18 +03:00
newgamefuncs_t newapi ;
2019-07-01 21:10:00 +03:00
enginefuncs_t engfuncs ;
gamedll_funcs_t dllfuncs ;
meta_globals_t * gpMetaGlobals = nullptr ;
gamedll_funcs_t * gpGamedllFuncs = nullptr ;
mutil_funcs_t * gpMetaUtilFuncs = nullptr ;
globalvars_t * globals = nullptr ;
// metamod plugin information
plugin_info_t Plugin_info = {
META_INTERFACE_VERSION , // interface version
2020-06-12 18:52:38 +03:00
product . name . chars ( ) , // plugin name
product . version . chars ( ) , // plugin version
product . date . chars ( ) , // date of creation
product . author . chars ( ) , // plugin author
product . url . chars ( ) , // plugin URL
product . logtag . chars ( ) , // plugin logtag
2019-07-01 21:10:00 +03:00
PT_CHANGELEVEL , // when loadable
PT_ANYTIME , // when unloadable
} ;
2019-07-27 17:36:24 +03:00
namespace variadic {
2019-07-01 21:10:00 +03:00
void clientCommand ( edict_t * ent , char const * format , . . . ) {
// this function forces the client whose player entity is ent to issue a client command.
// How it works is that clients all have a argv global string in their client DLL that
// stores the command string; if ever that string is filled with characters, the client DLL
// sends it to the engine as a command to be executed. When the engine has executed that
// command, this argv string is reset to zero. Here is somehow a curious implementation of
// ClientCommand: the engine sets the command it wants the client to issue in his argv, then
// the client DLL sends it back to the engine, the engine receives it then executes the
// command therein. Don't ask me why we need all this complicated crap. Anyhow since bots have
// no client DLL, be certain never to call this function upon a bot entity, else it will just
// make the server crash. Since hordes of uncautious, not to say stupid, programmers don't
// even imagine some players on their servers could be bots, this check is performed less than
// sometimes actually by their side, that's why we strongly recommend to check it here too. In
// case it's a bot asking for a client command, we handle it like we do for bot commands
2020-10-13 12:38:24 +03:00
if ( game . isNullEntity ( ent ) ) {
if ( game . is ( GameFlags : : Metamod ) ) {
RETURN_META ( MRES_SUPERCEDE ) ;
}
return ;
}
2019-07-01 21:10:00 +03:00
va_list ap ;
2019-07-27 17:36:24 +03:00
auto buffer = strings . chars ( ) ;
2019-07-01 21:10:00 +03:00
va_start ( ap , format ) ;
2019-09-14 23:13:55 +03:00
vsnprintf ( buffer , StringBuffer : : StaticBufferSize , format , ap ) ;
2019-07-01 21:10:00 +03:00
va_end ( ap ) ;
2020-10-13 12:38:24 +03:00
if ( util . isFakeClient ( ent ) | | ( ent - > v . flags & FL_DORMANT ) ) {
2019-09-14 23:13:55 +03:00
auto bot = bots [ ent ] ;
if ( bot ) {
bot - > issueCommand ( buffer ) ;
2019-07-01 21:10:00 +03:00
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_SUPERCEDE ) ; // prevent bots to be forced to issue client commands
2016-01-03 22:03:02 +03:00
}
2019-07-01 21:10:00 +03:00
return ;
2016-01-03 22:03:02 +03:00
}
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2019-05-10 13:51:09 +03:00
}
2019-07-01 21:10:00 +03:00
engfuncs . pfnClientCommand ( ent , buffer ) ;
2019-05-10 13:51:09 +03:00
}
2019-07-01 21:10:00 +03:00
}
2014-07-30 14:17:46 +04:00
2020-06-12 18:52:38 +03:00
CR_EXPORT int GetEntityAPI ( gamefuncs_t * table , int ) {
2019-07-01 21:10:00 +03:00
// this function is called right after GiveFnptrsToDll() by the engine in the game DLL (or
// what it BELIEVES to be the game DLL), in order to copy the list of MOD functions that can
// be called by the engine, into a memory block pointed to by the functionTable pointer
// that is passed into this function (explanation comes straight from botman). This allows
// the Half-Life engine to call these MOD DLL functions when it needs to spawn an entity,
// connect or disconnect a player, call Think() functions, Touch() functions, or Use()
// functions, etc. The bot DLL passes its OWN list of these functions back to the Half-Life
// engine, and then calls the MOD DLL's version of GetEntityAPI to get the REAL gamedll
// functions this time (to use in the bot code).
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
2019-09-21 23:20:33 +03:00
plat . bzero ( table , sizeof ( gamefuncs_t ) ) ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( ! ( game . is ( GameFlags : : Metamod ) ) ) {
2020-06-12 18:52:38 +03:00
auto api_GetEntityAPI = game . lib ( ) . resolve < decltype ( & GetEntityAPI ) > ( __FUNCTION__ ) ;
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// pass other DLLs engine callbacks to function table...
2019-07-27 17:36:24 +03:00
if ( ! api_GetEntityAPI | | api_GetEntityAPI ( & dllapi , INTERFACE_VERSION ) = = 0 ) {
2020-06-12 18:52:38 +03:00
logger . fatal ( " Could not resolve symbol \" %s \" in the game dll. " , __FUNCTION__ ) ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
dllfuncs . dllapi_table = & dllapi ;
gpGamedllFuncs = & dllfuncs ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
memcpy ( table , & dllapi , sizeof ( gamefuncs_t ) ) ;
2019-07-01 21:10:00 +03:00
}
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
2019-08-29 16:24:24 +03:00
table - > pfnGameInit = [ ] ( ) {
2019-07-01 21:10:00 +03:00
// this function is a one-time call, and appears to be the second function called in the
// DLL after GiveFntprsToDll() has been called. Its purpose is to tell the MOD DLL to
// initialize the game before the engine actually hooks into it with its video frames and
// clients connecting. Note that it is a different step than the *server* initialization.
// This one is called once, and only once, when the game process boots up before the first
// server is enabled. Here is a good place to do our own game session initialization, and
// to register by the engine side the server commands we need to administrate our bots.
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// execute main config
2020-10-04 00:54:34 +03:00
conf . loadMainConfig ( true ) ;
2019-07-01 21:10:00 +03:00
conf . adjustWeaponPrices ( ) ;
2014-07-30 14:17:46 +04:00
2020-11-13 19:16:56 +03:00
// print info about dll
game . printBotVersion ( ) ;
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
dllapi . pfnGameInit ( ) ;
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnSpawn = [ ] ( edict_t * ent ) {
2019-07-01 21:10:00 +03:00
// this function asks the game DLL to spawn (i.e, give a physical existence in the virtual
// world, in other words to 'display') the entity pointed to by ent in the game. The
// Spawn() function is one of the functions any entity is supposed to have in the game DLL,
// and any MOD is supposed to implement one for each of its entities.
2014-07-30 14:17:46 +04:00
2020-09-13 02:21:15 +03:00
auto bot = bots [ ent ] ;
if ( bot ) {
bot - > spawned ( ) ;
}
2020-11-08 01:20:12 +03:00
// precache everything
game . precache ( ) ;
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_IGNORED , 0 ) ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
int result = dllapi . pfnSpawn ( ent ) ; // get result
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
if ( ent - > v . rendermode = = kRenderTransTexture ) {
ent - > v . flags & = ~ FL_WORLDBRUSH ; // clear the FL_WORLDBRUSH flag out of transparent ents
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
return result ;
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnTouch = [ ] ( edict_t * pentTouched , edict_t * pentOther ) {
2019-07-01 21:10:00 +03:00
// this function is called when two entities' bounding boxes enter in collision. For example,
// when a player walks upon a gun, the player entity bounding box collides to the gun entity
// bounding box, and the result is that this function is called. It is used by the game for
// taking the appropriate action when such an event occurs (in our example, the player who
// is walking upon the gun will "pick it up"). Entities that "touch" others are usually
// entities having a velocity, as it is assumed that static entities (entities that don't
// move) will never touch anything. Hence, in our example, the pentTouched will be the gun
// (static entity), whereas the pentOther will be the player (as it is the one moving). When
// the two entities both have velocities, for example two players colliding, this function
// is called twice, once for each entity moving.
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
if ( ! game . isNullEntity ( pentTouched ) & & pentOther ! = game . getStartEntity ( ) ) {
2019-07-27 17:36:24 +03:00
auto bot = bots [ pentTouched ] ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
if ( bot & & game . isShootableBreakable ( pentOther ) ) {
2019-08-18 21:00:00 +03:00
bot - > checkBreakable ( pentOther ) ;
2019-05-07 16:37:12 +03:00
}
2019-05-07 15:50:08 +03:00
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
dllapi . pfnTouch ( pentTouched , pentOther ) ;
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnClientConnect = [ ] ( edict_t * ent , const char * name , const char * addr , char rejectReason [ 128 ] ) {
2019-07-01 21:10:00 +03:00
// this function is called in order to tell the MOD DLL that a client attempts to connect the
// game. The entity pointer of this client is ent, the name under which he connects is
// pointed to by the pszName pointer, and its IP address string is pointed by the pszAddress
// one. Note that this does not mean this client will actually join the game ; he could as
// well be refused connection by the server later, because of latency timeout, unavailable
// game resources, or whatever reason. In which case the reason why the game DLL (read well,
// the game DLL, *NOT* the engine) refuses this player to connect will be printed in the
// rejectReason string in all letters. Understand that a client connecting process is done
// in three steps. First, the client requests a connection from the server. This is engine
// internals. When there are already too many players, the engine will refuse this client to
// connect, and the game DLL won't even notice. Second, if the engine sees no problem, the
// game DLL is asked. This is where we are. Once the game DLL acknowledges the connection,
// the client downloads the resources it needs and synchronizes its local engine with the one
// of the server. And then, the third step, which comes *AFTER* ClientConnect (), is when the
// client officially enters the game, through the ClientPutInServer () function, later below.
// Here we hook this function in order to keep track of the listen server client entity,
// because a listen server client always connects with a "loopback" address string. Also we
// tell the bot manager to check the bot population, in order to always have one free slot on
// the server for incoming clients.
// check if this client is the listen server client
if ( strcmp ( addr , " loopback " ) = = 0 ) {
game . setLocalEntity ( ent ) ; // save the edict of the listen server client...
2019-07-27 17:36:24 +03:00
// if not dedicated set the default editor for graph
2019-07-01 21:10:00 +03:00
if ( ! game . isDedicated ( ) ) {
2019-07-27 17:36:24 +03:00
graph . setEditor ( ent ) ;
2019-07-01 21:10:00 +03:00
}
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_IGNORED , 0 ) ;
}
return dllapi . pfnClientConnect ( ent , name , addr , rejectReason ) ;
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnClientDisconnect = [ ] ( edict_t * ent ) {
2019-07-01 21:10:00 +03:00
// this function is called whenever a client is VOLUNTARILY disconnected from the server,
// either because the client dropped the connection, or because the server dropped him from
// the game (latency timeout). The effect is the freeing of a client slot on the server. Note
// that clients and bots disconnected because of a level change NOT NECESSARILY call this
// function, because in case of a level change, it's a server shutdown, and not a normal
// disconnection. I find that completely stupid, but that's it. Anyway it's time to update
// the bots and players counts, and in case the client disconnecting is a bot, to back its
// brain(s) up to disk. We also try to notice when a listenserver client disconnects, so as
// to reset his entity pointer for safety. There are still a few server frames to go once a
// listen server client disconnects, and we don't want to send him any sort of message then.
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
for ( auto & bot : bots ) {
if ( bot - > pev = = & ent - > v ) {
bots . erase ( bot . get ( ) ) ; // remove the bot from bots array
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
break ;
2019-07-01 21:10:00 +03:00
}
2014-07-30 14:17:46 +04:00
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
dllapi . pfnClientDisconnect ( ent ) ;
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnClientUserInfoChanged = [ ] ( edict_t * ent , char * infobuffer ) {
2019-07-01 21:10:00 +03:00
// this function is called when a player changes model, or changes team. Occasionally it
// enforces rules on these changes (for example, some MODs don't want to allow players to
// change their player model). But most commonly, this function is in charge of handling
// team changes, recounting the teams population, etc...
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
ctrl . assignAdminRights ( ent , infobuffer ) ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
dllapi . pfnClientUserInfoChanged ( ent , infobuffer ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnClientCommand = [ ] ( edict_t * ent ) {
2019-07-01 21:10:00 +03:00
// this function is called whenever the client whose player entity is ent issues a client
// command. How it works is that clients all have a global string in their client DLL that
// stores the command string; if ever that string is filled with characters, the client DLL
// sends it to the engine as a command to be executed. When the engine has executed that
// command, that string is reset to zero. By the server side, we can access this string
// by asking the engine with the CmdArgv(), CmdArgs() and CmdArgc() functions that work just
// like executable files argument processing work in C (argc gets the number of arguments,
// command included, args returns the whole string, and argv returns the wanted argument
// only). Here is a good place to set up either bot debug commands the listen server client
// could type in his game console, or real new client commands, but we wouldn't want to do
// so as this is just a bot DLL, not a MOD. The purpose is not to add functionality to
// clients. Hence it can lack of commenting a bit, since this code is very subject to change.
if ( ctrl . handleClientCommands ( ent ) ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_SUPERCEDE ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
return ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
else if ( ctrl . handleMenuCommands ( ent ) ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_SUPERCEDE ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
return ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
// record stuff about radio and chat
bots . captureChatRadio ( engfuncs . pfnCmd_Argv ( 0 ) , engfuncs . pfnCmd_Argv ( 1 ) , ent ) ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
dllapi . pfnClientCommand ( ent ) ;
} ;
2014-07-30 14:17:46 +04:00
2020-11-08 01:20:12 +03:00
table - > pfnServerActivate = [ ] ( edict_t * edictList , int edictCount , int clientMax ) {
2019-07-01 21:10:00 +03:00
// this function is called when the server has fully loaded and is about to manifest itself
// on the network as such. Since a mapchange is actually a server shutdown followed by a
// restart, this function is also called when a new map is being loaded. Hence it's the
// perfect place for doing initialization stuff for our bots, such as reading the BSP data,
// loading the bot profiles, and drawing the world map (ie, filling the navigation hashtable).
// Once this function has been called, the server can be considered as "running".
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2014-07-30 14:17:46 +04:00
}
2020-11-08 01:20:12 +03:00
dllapi . pfnServerActivate ( edictList , edictCount , clientMax ) ;
2014-07-30 14:17:46 +04:00
2020-11-08 01:20:12 +03:00
// do a level initialization
game . levelInitialize ( edictList , edictCount ) ;
2019-07-01 21:10:00 +03:00
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnServerDeactivate = [ ] ( ) {
2019-07-01 21:10:00 +03:00
// this function is called when the server is shutting down. A particular note about map
// changes: changing the map means shutting down the server and starting a new one. Of course
// this process is transparent to the user, but either in single player when the hero reaches
// a new level and in multiplayer when it's time for a map change, be aware that what happens
// is that the server actually shuts down and restarts with a new map. Hence we can use this
// function to free and deinit anything which is map-specific, for example we free the memory
// space we m'allocated for our BSP data, since a new map means new BSP data to interpret. In
// any case, when the new map will be booting, ServerActivate() will be called, so we'll do
// the loading of new bots and the new BSP data parsing there.
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// save collected experience on shutdown
2019-07-27 17:36:24 +03:00
graph . savePractice ( ) ;
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// destroy global killer entity
bots . destroyKillerEntity ( ) ;
2017-01-03 02:11:16 +03:00
2019-07-01 21:10:00 +03:00
// set state to unprecached
game . setUnprecached ( ) ;
2017-01-03 02:11:16 +03:00
2019-07-01 21:10:00 +03:00
// enable lightstyle animations on level change
illum . enableAnimation ( true ) ;
2017-01-03 02:11:16 +03:00
2019-07-01 21:10:00 +03:00
// send message on new map
util . setNeedForWelcome ( false ) ;
2017-01-03 02:11:16 +03:00
2019-07-01 21:10:00 +03:00
// xash is not kicking fakeclients on changelevel
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Xash3D ) ) {
2019-07-01 21:10:00 +03:00
bots . kickEveryone ( true , false ) ;
2014-07-30 14:17:46 +04:00
}
2020-09-26 18:41:53 +03:00
graph . reset ( ) ;
2019-07-27 17:36:24 +03:00
// clear all the bots
bots . destroy ( ) ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2019-07-01 21:10:00 +03:00
dllapi . pfnServerDeactivate ( ) ;
2020-11-08 01:20:12 +03:00
// refill export table
2021-09-08 20:09:23 +03:00
ents . flush ( ) ;
2019-07-01 21:10:00 +03:00
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnStartFrame = [ ] ( ) {
2019-07-01 21:10:00 +03:00
// this function starts a video frame. It is called once per video frame by the game. If
// you run Half-Life at 90 fps, this function will then be called 90 times per second. By
// placing a hook on it, we have a good place to do things that should be done continuously
// during the game, for example making the bots think (yes, because no Think() function exists
// for the bots by the MOD side, remember). Also here we have control on the bot population,
// for example if a new player joins the server, we should disconnect a bot, and if the
// player population decreases, we should fill the server with other bots.
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// update lightstyle animations
illum . animateLight ( ) ;
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// update some stats for clients
util . updateClients ( ) ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
if ( graph . hasEditFlag ( GraphEdit : : On ) & & graph . hasEditor ( ) ) {
graph . frame ( ) ;
2019-07-01 21:10:00 +03:00
}
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// run stuff periodically
game . slowFrame ( ) ;
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
if ( bots . hasBotsOnline ( ) ) {
// keep track of grenades on map
bots . updateActiveGrenade ( ) ;
2016-06-23 15:30:19 +03:00
2019-07-01 21:10:00 +03:00
// keep track of intresting entities
bots . updateIntrestingEntities ( ) ;
2014-07-30 14:17:46 +04:00
}
2019-07-01 21:10:00 +03:00
// keep bot number up to date
bots . maintainQuota ( ) ;
2020-10-13 15:43:25 +03:00
// flush print queue to users
ctrl . flushPrintQueue ( ) ;
2019-08-04 18:22:01 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
dllapi . pfnStartFrame ( ) ;
2014-07-30 14:17:46 +04:00
2019-07-01 21:10:00 +03:00
// run the bot ai
2019-08-18 21:00:00 +03:00
bots . frame ( ) ;
2019-07-01 21:10:00 +03:00
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnCmdStart = [ ] ( const edict_t * player , usercmd_t * cmd , unsigned int random_seed ) {
2019-07-27 17:36:24 +03:00
auto ent = const_cast < edict_t * > ( player ) ;
2019-08-04 18:22:01 +03:00
2020-07-08 13:03:27 +03:00
// if we're handle pings for bots and clients, clear IN_SCORE button so SV_ShouldUpdatePing engine function return false, and SV_EmitPings will not overwrite our results
2020-06-12 18:52:38 +03:00
if ( game . is ( GameFlags : : HasFakePings ) & & cv_show_latency . int_ ( ) = = 2 ) {
2020-07-08 13:03:27 +03:00
if ( cmd - > buttons & IN_SCORE ) {
2019-07-27 17:36:24 +03:00
cmd - > buttons & = ~ IN_SCORE ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
// send our version of pings
util . sendPings ( ent ) ;
}
}
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
2019-07-27 17:36:24 +03:00
dllapi . pfnCmdStart ( player , cmd , random_seed ) ;
2019-07-01 21:10:00 +03:00
} ;
2014-07-30 14:17:46 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnPM_Move = [ ] ( playermove_t * playerMove , int server ) {
2019-05-10 01:33:17 +03:00
// this is the player movement code clients run to predict things when the server can't update
// them often enough (or doesn't want to). The server runs exactly the same function for
// moving players. There is normally no distinction between them, else client-side prediction
// wouldn't work properly (and it doesn't work that well, already...)
2019-07-01 21:10:00 +03:00
illum . setWorldModel ( playerMove - > physents [ 0 ] . model ) ;
2019-05-10 01:33:17 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-05-10 01:33:17 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
2019-07-01 21:10:00 +03:00
dllapi . pfnPM_Move ( playerMove , server ) ;
2019-05-10 01:33:17 +03:00
} ;
2020-06-12 18:52:38 +03:00
return HLTrue ;
2014-07-30 14:17:46 +04:00
}
2020-06-12 18:52:38 +03:00
CR_LINKAGE_C int GetEntityAPI_Post ( gamefuncs_t * table , int ) {
2020-10-04 11:12:39 +03:00
// this function is called right after GiveFnptrsToDll() by the engine in the game DLL (or
2014-07-30 14:17:46 +04:00
// what it BELIEVES to be the game DLL), in order to copy the list of MOD functions that can
// be called by the engine, into a memory block pointed to by the functionTable pointer
// that is passed into this function (explanation comes straight from botman). This allows
// the Half-Life engine to call these MOD DLL functions when it needs to spawn an entity,
// connect or disconnect a player, call Think() functions, Touch() functions, or Use()
// functions, etc. The bot DLL passes its OWN list of these functions back to the Half-Life
// engine, and then calls the MOD DLL's version of GetEntityAPI to get the REAL gamedll
// functions this time (to use in the bot code). Post version, called only by metamod.
2019-09-21 23:20:33 +03:00
plat . bzero ( table , sizeof ( gamefuncs_t ) ) ;
2014-07-30 14:17:46 +04:00
2019-07-27 17:36:24 +03:00
table - > pfnSpawn = [ ] ( edict_t * ent ) {
2019-07-01 21:10:00 +03:00
// this function asks the game DLL to spawn (i.e, give a physical existence in the virtual
// world, in other words to 'display') the entity pointed to by ent in the game. The
// Spawn() function is one of the functions any entity is supposed to have in the game DLL,
// and any MOD is supposed to implement one for each of its entities. Post version called
// only by metamod.
// solves the bots unable to see through certain types of glass bug.
if ( ent - > v . rendermode = = kRenderTransTexture ) {
ent - > v . flags & = ~ FL_WORLDBRUSH ; // clear the FL_WORLDBRUSH flag out of transparent ents
}
2019-08-29 16:24:24 +03:00
RETURN_META_VALUE ( MRES_HANDLED , 0 ) ;
2019-07-01 21:10:00 +03:00
} ;
2019-07-27 17:36:24 +03:00
table - > pfnStartFrame = [ ] ( ) {
2019-07-01 21:10:00 +03:00
// this function starts a video frame. It is called once per video frame by the game. If
// you run Half-Life at 90 fps, this function will then be called 90 times per second. By
// placing a hook on it, we have a good place to do things that should be done continuously
// during the game, for example making the bots think (yes, because no Think() function exists
// for the bots by the MOD side, remember). Post version called only by metamod.
// run the bot ai
2019-08-18 21:00:00 +03:00
bots . frame ( ) ;
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
} ;
2020-11-08 01:20:12 +03:00
table - > pfnServerActivate = [ ] ( edict_t * edictList , int edictCount , int ) {
2019-07-01 21:10:00 +03:00
// this function is called when the server has fully loaded and is about to manifest itself
// on the network as such. Since a mapchange is actually a server shutdown followed by a
// restart, this function is also called when a new map is being loaded. Hence it's the
// perfect place for doing initialization stuff for our bots, such as reading the BSP data,
// loading the bot profiles, and drawing the world map (ie, filling the navigation hashtable).
// Once this function has been called, the server can be considered as "running". Post version
// called only by metamod.
2020-11-08 01:20:12 +03:00
// do a level initialization
game . levelInitialize ( edictList , edictCount ) ;
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
} ;
2014-07-30 14:17:46 +04:00
2020-06-12 18:52:38 +03:00
return HLTrue ;
2014-07-30 14:17:46 +04:00
}
2019-08-29 16:24:24 +03:00
CR_LINKAGE_C int GetEngineFunctions ( enginefuncs_t * table , int * ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-09-21 23:20:33 +03:00
plat . bzero ( table , sizeof ( enginefuncs_t ) ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2021-09-08 20:09:23 +03:00
if ( ents . needsBypass ( ) & & ! game . is ( GameFlags : : Metamod ) ) {
2020-11-23 00:06:18 +03:00
table - > pfnCreateNamedEntity = [ ] ( int classname ) - > edict_t * {
if ( ents . isPaused ( ) ) {
ents . enable ( ) ;
ents . setPaused ( false ) ;
}
return engfuncs . pfnCreateNamedEntity ( classname ) ;
} ;
}
2019-08-29 16:24:24 +03:00
table - > pfnChangeLevel = [ ] ( char * s1 , char * s2 ) {
2019-07-01 21:10:00 +03:00
// the purpose of this function is to ask the engine to shutdown the server and restart a
// new one running the map whose name is s1. It is used ONLY IN SINGLE PLAYER MODE and is
// transparent to the user, because it saves the player state and equipment and restores it
// back in the new level. The "changelevel trigger point" in the old level is linked to the
// new level's spawn point using the s2 string, which is formatted as follows: "trigger_name
// to spawnpoint_name", without spaces (for example, "tr_1atotr_2lm" would tell the engine
// the player has reached the trigger point "tr_1a" and has to spawn in the next level on the
// spawn point named "tr_2lm".
// save collected experience on map change
2019-07-27 17:36:24 +03:00
graph . savePractice ( ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnChangeLevel ( s1 , s2 ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnLightStyle = [ ] ( int style , char * val ) {
2019-07-01 21:10:00 +03:00
// ths function update lightstyle for the bots
illum . updateLight ( style , val ) ;
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnLightStyle ( style , val ) ;
} ;
2019-08-18 21:00:00 +03:00
if ( game . is ( GameFlags : : Legacy ) ) {
2019-08-29 16:24:24 +03:00
table - > pfnFindEntityByString = [ ] ( edict_t * edictStartSearchAfter , const char * field , const char * value ) {
2019-08-18 21:00:00 +03:00
// round starts in counter-strike 1.5
if ( strcmp ( value , " info_map_parameters " ) = = 0 ) {
bots . initRound ( ) ;
}
2019-07-01 21:10:00 +03:00
2019-08-18 21:00:00 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
RETURN_META_VALUE ( MRES_IGNORED , static_cast < edict_t * > ( nullptr ) ) ;
}
return engfuncs . pfnFindEntityByString ( edictStartSearchAfter , field , value ) ;
} ;
}
2019-07-01 21:10:00 +03:00
2019-08-29 16:24:24 +03:00
table - > pfnEmitSound = [ ] ( edict_t * entity , int channel , const char * sample , float volume , float attenuation , int flags , int pitch ) {
2019-07-01 21:10:00 +03:00
// this function tells the engine that the entity pointed to by "entity", is emitting a sound
// which fileName is "sample", at level "channel" (CHAN_VOICE, etc...), with "volume" as
// loudness multiplicator (normal volume VOL_NORM is 1.0), with a pitch of "pitch" (normal
// pitch PITCH_NORM is 100.0), and that this sound has to be attenuated by distance in air
// according to the value of "attenuation" (normal attenuation ATTN_NORM is 0.8 ; ATTN_NONE
// means no attenuation with distance). Optionally flags "fFlags" can be passed, which I don't
// know the heck of the purpose. After we tell the engine to emit the sound, we have to call
// SoundAttachToThreat() to bring the sound to the ears of the bots. Since bots have no client DLL
// to handle this for them, such a job has to be done manually.
2019-08-18 21:00:00 +03:00
util . listenNoise ( entity , sample , volume ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnEmitSound ( entity , channel , sample , volume , attenuation , flags , pitch ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnMessageBegin = [ ] ( int msgDest , int msgType , const float * origin , edict_t * ed ) {
2019-07-01 21:10:00 +03:00
// this function called each time a message is about to sent.
2019-08-12 22:51:26 +03:00
msgs . start ( ed , msgType ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnMessageBegin ( msgDest , msgType , origin , ed ) ;
} ;
2019-08-29 16:24:24 +03:00
if ( ! game . is ( GameFlags : : Metamod ) ) {
table - > pfnMessageEnd = [ ] ( ) {
engfuncs . pfnMessageEnd ( ) ;
2019-07-01 21:10:00 +03:00
2019-08-29 16:24:24 +03:00
// this allows us to send messages right in handler code
msgs . stop ( ) ;
} ;
}
2019-07-01 21:10:00 +03:00
2019-08-29 16:24:24 +03:00
table - > pfnWriteByte = [ ] ( int value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteByte ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteChar = [ ] ( int value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteChar ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteShort = [ ] ( int value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteShort ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteLong = [ ] ( int value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteLong ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteAngle = [ ] ( float value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteAngle ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteCoord = [ ] ( float value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteCoord ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteString = [ ] ( const char * sz ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( sz ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteString ( sz ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnWriteEntity = [ ] ( int value ) {
2019-07-01 21:10:00 +03:00
// if this message is for a bot, call the client message function...
2019-08-12 14:16:28 +03:00
msgs . collect ( value ) ;
2019-07-01 21:10:00 +03:00
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnWriteEntity ( value ) ;
} ;
2019-08-29 16:24:24 +03:00
if ( ! game . is ( GameFlags : : Metamod ) ) {
table - > pfnRegUserMsg = [ ] ( const char * name , int size ) {
// this function registers a "user message" by the engine side. User messages are network
// messages the game DLL asks the engine to send to clients. Since many MODs have completely
// different client features (Counter-Strike has a radar and a timer, for example), network
// messages just can't be the same for every MOD. Hence here the MOD DLL tells the engine,
// "Hey, you have to know that I use a network message whose name is pszName and it is size
// packets long". The engine books it, and returns the ID number under which he recorded that
// custom message. Thus every time the MOD DLL will be wanting to send a message named pszName
// using pfnMessageBegin (), it will know what message ID number to send, and the engine will
// know what to do, only for non-metamod version
2019-08-12 14:16:28 +03:00
2019-08-29 16:24:24 +03:00
return msgs . add ( name , engfuncs . pfnRegUserMsg ( name , size ) ) ; // return privously registered message
} ;
}
2019-07-01 21:10:00 +03:00
2019-08-29 16:24:24 +03:00
table - > pfnClientPrintf = [ ] ( edict_t * ent , PRINT_TYPE printType , const char * message ) {
2019-07-01 21:10:00 +03:00
// this function prints the text message string pointed to by message by the client side of
// the client entity pointed to by ent, in a manner depending of printType (print_console,
// print_center or print_chat). Be certain never to try to feed a bot with this function,
// as it will crash your server. Why would you, anyway ? bots have no client DLL as far as
// we know, right ? But since stupidity rules this world, we do a preventive check :)
if ( util . isFakeClient ( ent ) ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_SUPERCEDE ) ;
}
return ;
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnClientPrintf ( ent , printType , message ) ;
} ;
2019-08-29 16:24:24 +03:00
table - > pfnCmd_Args = [ ] ( ) {
2019-07-01 21:10:00 +03:00
// this function returns a pointer to the whole current client command string. Since bots
// have no client DLL and we may want a bot to execute a client command, we had to implement
// a argv string in the bot DLL for holding the bots' commands, and also keep track of the
// argument count. Hence this hook not to let the engine ask an unexistent client DLL for a
// command we are holding here. Of course, real clients commands are still retrieved the
// normal way, by asking the game.
// is this a bot issuing that client command?
if ( game . isBotCmd ( ) ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_SUPERCEDE , game . botArgs ( ) ) ;
}
return game . botArgs ( ) ; // else return the whole bot client command string we know
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_IGNORED , static_cast < const char * > ( nullptr ) ) ;
}
return engfuncs . pfnCmd_Args ( ) ; // ask the client command string to the engine
} ;
2019-08-29 16:24:24 +03:00
table - > pfnCmd_Argv = [ ] ( int argc ) {
2019-07-01 21:10:00 +03:00
// this function returns a pointer to a certain argument of the current client command. Since
// bots have no client DLL and we may want a bot to execute a client command, we had to
// implement a argv string in the bot DLL for holding the bots' commands, and also keep
// track of the argument count. Hence this hook not to let the engine ask an unexistent client
// DLL for a command we are holding here. Of course, real clients commands are still retrieved
// the normal way, by asking the game.
// is this a bot issuing that client command?
if ( game . isBotCmd ( ) ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_SUPERCEDE , game . botArgv ( argc ) ) ;
}
return game . botArgv ( argc ) ; // if so, then return the wanted argument we know
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_IGNORED , static_cast < const char * > ( nullptr ) ) ;
}
return engfuncs . pfnCmd_Argv ( argc ) ; // ask the argument number "argc" to the engine
} ;
2019-08-29 16:24:24 +03:00
table - > pfnCmd_Argc = [ ] ( ) {
2019-07-01 21:10:00 +03:00
// this function returns the number of arguments the current client command string has. Since
// bots have no client DLL and we may want a bot to execute a client command, we had to
// implement a argv string in the bot DLL for holding the bots' commands, and also keep
// track of the argument count. Hence this hook not to let the engine ask an unexistent client
// DLL for a command we are holding here. Of course, real clients commands are still retrieved
// the normal way, by asking the game.
// is this a bot issuing that client command?
if ( game . isBotCmd ( ) ) {
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_SUPERCEDE , game . botArgc ( ) ) ;
}
return game . botArgc ( ) ; // if so, then return the argument count we know
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META_VALUE ( MRES_IGNORED , 0 ) ;
}
return engfuncs . pfnCmd_Argc ( ) ; // ask the engine how many arguments there are
} ;
2019-08-29 16:24:24 +03:00
table - > pfnSetClientMaxspeed = [ ] ( const edict_t * ent , float newMaxspeed ) {
2019-07-27 17:36:24 +03:00
auto bot = bots [ const_cast < edict_t * > ( ent ) ] ;
2019-07-01 21:10:00 +03:00
// check wether it's not a bot
if ( bot ! = nullptr ) {
bot - > pev - > maxspeed = newMaxspeed ;
}
2019-07-27 17:36:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
2019-07-01 21:10:00 +03:00
RETURN_META ( MRES_IGNORED ) ;
}
engfuncs . pfnSetClientMaxspeed ( ent , newMaxspeed ) ;
} ;
2014-08-01 22:28:45 +04:00
2019-08-29 16:24:24 +03:00
table - > pfnClientCommand = variadic : : clientCommand ;
2014-08-01 22:28:45 +04:00
2020-06-12 18:52:38 +03:00
return HLTrue ;
2014-08-01 22:28:45 +04:00
}
2019-08-29 16:24:24 +03:00
CR_EXPORT int GetNewDLLFunctions ( newgamefuncs_t * table , int * interfaceVersion ) {
// it appears that an extra function table has been added in the engine to gamedll interface
// since the date where the first enginefuncs table standard was frozen. These ones are
// facultative and we don't hook them, but since some MODs might be featuring it, we have to
// pass them too, else the DLL interfacing wouldn't be complete and the game possibly wouldn't
// run properly.
2014-07-30 14:17:46 +04:00
2020-11-23 00:06:18 +03:00
plat . bzero ( table , sizeof ( newgamefuncs_t ) ) ;
if ( ! ( game . is ( GameFlags : : Metamod ) ) ) {
2021-09-10 19:42:24 +03:00
auto api_GetNewDLLFunctions = game . lib ( ) . resolve < decltype ( & GetNewDLLFunctions ) > ( __FUNCTION__ ) ;
2016-09-10 19:31:38 +03:00
2020-11-23 00:06:18 +03:00
// pass other DLLs engine callbacks to function table...
2021-09-10 19:42:24 +03:00
if ( ! api_GetNewDLLFunctions | | api_GetNewDLLFunctions ( & newapi , interfaceVersion ) = = 0 ) {
2020-11-23 00:06:18 +03:00
logger . error ( " Could not resolve symbol \" %s \" in the game dll. " , __FUNCTION__ ) ;
}
dllfuncs . newapi_table = & newapi ;
memcpy ( table , & newapi , sizeof ( newgamefuncs_t ) ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
}
2020-11-23 00:06:18 +03:00
2021-09-10 19:42:24 +03:00
if ( ! game . is ( GameFlags : : Legacy ) ) {
table - > pfnOnFreeEntPrivateData = [ ] ( edict_t * ent ) {
for ( auto & bot : bots ) {
if ( bot - > m_enemy = = ent ) {
bot - > m_enemy = nullptr ;
bot - > m_lastEnemy = nullptr ;
}
2020-11-23 00:06:18 +03:00
}
2021-09-10 19:42:24 +03:00
if ( game . is ( GameFlags : : Metamod ) ) {
RETURN_META ( MRES_IGNORED ) ;
}
newapi . pfnOnFreeEntPrivateData ( ent ) ;
} ;
}
2020-06-12 18:52:38 +03:00
return HLTrue ;
2019-08-29 16:24:24 +03:00
}
CR_LINKAGE_C int GetEngineFunctions_Post ( enginefuncs_t * table , int * ) {
2019-09-21 23:20:33 +03:00
plat . bzero ( table , sizeof ( enginefuncs_t ) ) ;
2019-08-29 16:24:24 +03:00
table - > pfnMessageEnd = [ ] ( ) {
msgs . stop ( ) ; // this allows us to send messages right in handler code
RETURN_META ( MRES_IGNORED ) ;
} ;
table - > pfnRegUserMsg = [ ] ( const char * name , int ) {
// this function registers a "user message" by the engine side. User messages are network
// messages the game DLL asks the engine to send to clients. Since many MODs have completely
// different client features (Counter-Strike has a radar and a timer, for example), network
// messages just can't be the same for every MOD. Hence here the MOD DLL tells the engine,
// "Hey, you have to know that I use a network message whose name is pszName and it is size
// packets long". The engine books it, and returns the ID number under which he recorded that
// custom message. Thus every time the MOD DLL will be wanting to send a message named pszName
// using pfnMessageBegin (), it will know what message ID number to send, and the engine will
// know what to do, only for non-metamod version
// register message for our needs
msgs . add ( name , META_RESULT_ORIG_RET ( int ) ) ;
RETURN_META_VALUE ( MRES_IGNORED , 0 ) ;
} ;
2020-06-12 18:52:38 +03:00
return HLTrue ;
2014-07-30 14:17:46 +04:00
}
2019-07-27 17:36:24 +03:00
CR_EXPORT int Meta_Query ( char * , plugin_info_t * * pPlugInfo , mutil_funcs_t * pMetaUtilFuncs ) {
2014-07-30 14:17:46 +04:00
// this function is the first function ever called by metamod in the plugin DLL. Its purpose
// is for metamod to retrieve basic information about the plugin, such as its meta-interface
// version, for ensuring compatibility with the current version of the running metamod.
gpMetaUtilFuncs = pMetaUtilFuncs ;
* pPlugInfo = & Plugin_info ;
2020-06-12 18:52:38 +03:00
return HLTrue ; // tell metamod this plugin looks safe
2014-07-30 14:17:46 +04:00
}
2019-08-18 21:00:00 +03:00
CR_EXPORT int Meta_Attach ( PLUG_LOADTIME now , metamod_funcs_t * functionTable , meta_globals_t * pMGlobals , gamedll_funcs_t * pGamedllFuncs ) {
2014-07-30 14:17:46 +04:00
// this function is called when metamod attempts to load the plugin. Since it's the place
// where we can tell if the plugin will be allowed to run or not, we wait until here to make
// our initialization stuff, like registering CVARs and dedicated server commands.
2016-09-11 21:01:06 +03:00
// metamod engine & dllapi function tables
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
static metamod_funcs_t metamodFunctionTable = {
2020-06-12 18:52:38 +03:00
GetEntityAPI , // pfnGetEntityAPI ()
GetEntityAPI_Post , // pfnGetEntityAPI_Post ()
nullptr , // pfnGetEntityAPI2 ()
nullptr , // pfnGetEntityAPI2_Post ()
2020-11-23 00:06:18 +03:00
GetNewDLLFunctions , // pfnGetNewDLLFunctions ()
2016-09-11 21:01:06 +03:00
nullptr , // pfnGetNewDLLFunctions_Post ()
GetEngineFunctions , // pfnGetEngineFunctions ()
2019-08-29 16:24:24 +03:00
GetEngineFunctions_Post , // pfnGetEngineFunctions_Post ()
2016-09-11 21:01:06 +03:00
} ;
2019-08-18 21:00:00 +03:00
if ( now > Plugin_info . loadable ) {
logger . error ( " %s: plugin NOT attaching (can't load plugin right now) " , Plugin_info . name ) ;
2020-06-12 18:52:38 +03:00
return HLFalse ; // returning FALSE prevents metamod from attaching this plugin
2019-08-18 21:00:00 +03:00
}
2014-07-30 14:17:46 +04:00
// keep track of the pointers to engine function tables metamod gives us
gpMetaGlobals = pMGlobals ;
2016-09-11 21:01:06 +03:00
memcpy ( functionTable , & metamodFunctionTable , sizeof ( metamod_funcs_t ) ) ;
2014-07-30 14:17:46 +04:00
gpGamedllFuncs = pGamedllFuncs ;
2020-06-12 18:52:38 +03:00
return HLTrue ; // returning true enables metamod to attach this plugin
2014-07-30 14:17:46 +04:00
}
2019-08-18 21:00:00 +03:00
CR_EXPORT int Meta_Detach ( PLUG_LOADTIME now , PL_UNLOAD_REASON reason ) {
2014-07-30 14:17:46 +04:00
// this function is called when metamod unloads the plugin. A basic check is made in order
// to prevent unloading the plugin if its processing should not be interrupted.
2019-08-18 21:00:00 +03:00
if ( now > Plugin_info . unloadable & & reason ! = PNL_CMD_FORCED ) {
logger . error ( " %s: plugin NOT detaching (can't unload plugin right now) " , Plugin_info . name ) ;
2020-06-12 18:52:38 +03:00
return HLFalse ; // returning FALSE prevents metamod from unloading this plugin
2019-08-18 21:00:00 +03:00
}
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
bots . kickEveryone ( true ) ; // kick all bots off this server
2019-07-27 17:36:24 +03:00
// save collected experience on shutdown
graph . savePractice ( ) ;
2019-07-31 14:05:36 +03:00
util . disableSendTo ( ) ;
2014-07-30 14:17:46 +04:00
2019-09-21 23:56:01 +03:00
// make sure all stuff cleared
bots . destroy ( ) ;
2020-06-12 18:52:38 +03:00
return HLTrue ;
2014-07-30 14:17:46 +04:00
}
2019-07-27 17:36:24 +03:00
CR_EXPORT void Meta_Init ( ) {
2014-07-30 14:17:46 +04:00
// this function is called by metamod, before any other interface functions. Purpose of this
// function to give plugin a chance to determine is plugin running under metamod or not.
2019-07-27 17:36:24 +03:00
game . addGameFlag ( GameFlags : : Metamod ) ;
2016-07-01 09:32:43 +03:00
}
2019-07-27 17:36:24 +03:00
// games GiveFnptrsToDll is a bit tricky
# if defined(CR_WINDOWS)
2020-11-16 13:11:26 +03:00
# if defined(CR_CXX_MSVC) || (defined(CR_CXX_CLANG) && !defined(CR_CXX_GCC))
2019-07-27 17:36:24 +03:00
# if defined (CR_ARCH_X86)
# pragma comment(linker, " / EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1")
# endif
# pragma comment(linker, " / SECTION:.data,RW")
# endif
# if defined(CR_CXX_MSVC) && !defined(CR_ARCH_X64)
2019-08-29 16:24:24 +03:00
# define DLL_GIVEFNPTRSTODLL CR_LINKAGE_C void CR_STDCALL
2020-06-12 18:52:38 +03:00
# elif defined(CR_CXX_CLANG) || defined(CR_CXX_GCC) || defined(CR_ARCH_X64)
2019-07-31 14:05:36 +03:00
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void CR_STDCALL
2019-07-27 17:36:24 +03:00
# endif
# elif defined(CR_LINUX) || defined (CR_OSX) || defined (CR_ANDROID)
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void
# endif
2021-09-10 19:42:24 +03:00
DLL_GIVEFNPTRSTODLL GiveFnptrsToDll ( enginefuncs_t * table , globalvars_t * glob ) {
2019-07-01 21:10:00 +03:00
// this is the very first function that is called in the game DLL by the game. Its purpose
2014-07-30 14:17:46 +04:00
// is to set the functions interfacing up, by exchanging the functionTable function list
// along with a pointer to the engine's global variables structure pGlobals, with the game
// DLL. We can there decide if we want to load the normal game DLL just behind our bot DLL,
// or any other game DLL that is present, such as Will Day's metamod. Also, since there is
// a known bug on Win32 platforms that prevent hook DLLs (such as our bot DLL) to be used in
// single player games (because they don't export all the stuff they should), we may need to
// build our own array of exported symbols from the actual game DLL in order to use it as
// such if necessary. Nothing really bot-related is done in this function. The actual bot
// initialization stuff will be done later, when we'll be certain to have a multilayer game.
2019-07-01 21:10:00 +03:00
// get the engine functions from the game...
2021-09-10 19:42:24 +03:00
memcpy ( & engfuncs , table , sizeof ( enginefuncs_t ) ) ;
2020-06-12 18:52:38 +03:00
globals = glob ;
2019-05-15 19:39:45 +03:00
2019-07-01 21:10:00 +03:00
if ( game . postload ( ) ) {
2019-05-31 11:34:32 +03:00
return ;
}
2020-06-12 18:52:38 +03:00
auto api_GiveFnptrsToDll = game . lib ( ) . resolve < decltype ( & GiveFnptrsToDll ) > ( __FUNCTION__ ) ;
2019-07-27 17:36:24 +03:00
if ( ! api_GiveFnptrsToDll ) {
logger . fatal ( " Could not resolve symbol \" %s \" in the game dll. " , __FUNCTION__ ) ;
}
2021-09-10 19:42:24 +03:00
GetEngineFunctions ( table , nullptr ) ;
2.9 Update (#64)
* Fixed bots not camping in camp spots.
Fixed chatter/radio message cycling. (need feedback).
Fixed CTs unable to defuse bomb.
Fixed backward jump path generation in waypoint editor.
Fixed autoradius in waypoint editor.
Fixed autoradius menu non closeable.
Fixed bots version display on entering game.
Fixed memory leak in DLL-loader. (non metamod).
Fixed bots able to see through smoke.
Fixed team-detection on non-standard modes.
Fixed quota & autovacate management.
Fixed bunch of warnings from static analyzers.
Greatly imporoved grenade throwing.
Grealty reduced bot CPU usage.
* Fixed stack-corruption in memory-file reader.
Fixed A* pathfinder not working correctly.
Fixed 'Tried to write to uninitialized sizebuf_t error' on bot add/remove.
Minor tweaks to camping and bot enemy aiming
* Make clang happy.
* Fixed VIP-dection on some maps.
Fixed occupied waypoint checker.
Small refactoring of code with clang-format.
* Fixed clang compilation
* Fixed compilation.
* Debugging seek cover task.
Some more code cleanup.
* Fixed typos.
* Fixes to attack movement.
Revert Z component updates.
* Fixes for aiming at enemy.
Fixes for seek cover & enemy hunt tasks.
More refactoring.
* Making clang happy once again?
Tweaked grenade timers.
* Revised language comparer hasher
* Fixed build.
* Fixed build.
* Optimized headshot offsets.
Optimized aim errors and enemy searches.
Get rid of preprocessor macroses.
Added back yb_think_fps. Use with caution.
* Minor refactoring of code.
* Check if tracking entity is still alive.
Do not duck in crouch-goal waypoints.
Remove ancient hack with failed goals.
* Get rid of c++14 stuff.
Tweaked isOccupiedPoint.
* Changed pickup check radius.
* Fix compilation.
* Fixed bots ignore breakables.
Fixed A* pathfinder.
Fixed searching for optimal waypoints.
Fixed bot waypoint reachability functions.
* Get rid of new/delete calls in pathfinder.
Disallow access to yapb waypoint menu on hlds.
Minor refactoring.
* Updated linux/osx makefile
* Spaces -> Tabs in makefile.
Made G++ happy.
* Updated makefile.
* Fixed heap buffer overflow in config loader code.
* Lowered CPU usage a bit, by using "waypoint buckets" for searching closest node.
Do not traceline for doors on map, that have no doors.
Get rid stack-based containers.
* Remove win-only debug crap.
* Refactored string class.
* Fix OSX compiling.
* Minor refactoring of corelib to use cpp move-semantic.
* Use reference for active grenades searcher.
* Use system's atan2f () as it's eror rate is a bit lower.
Fixed bots continuously stays in throw smoke task.
Fixed bots reaching camp-goal jumping or stays they for some time.
Increased radius for searching targets for grenades.
Tweaked bot difficulty levels.
Improved sniper weapon handling. Trying to stand still while shooting.
Increase retreat level only if sniper weapon is low on ammo.
Fixed predict path enemy tracking timer is always true.
Allow bots to process their tasks while on freezetime, so on small maps they already aiming enemies when freezetime ends.
Fied bots endlessy trying to pickup weapons.
Reduce surpise timers when holding sniper weapons.
New aim-at-head position calculation.
Shoot delay timers are now based on bot's difficulty.
Prefer smoke grenades more than flashbangs.
Fixed kill-all bot command not killing one random bot for first time use.
Do not play with jump velocity, now using the same as in waypoints.
Tweaked shift move, so zero move speed not overriden with shift speed.
Radius waypoint searcher use waypoint bucket as well.
Increase reachability radius for dest waypoint, if it's currenlty owned by other bot.
Partially fixed bots choice to use unreachable waypoints.
* Makes OSX clang happy?
* Support for compiling on llvm-win32, makefile to be done.
Increased default reachability time.
* Fixed build.
* Move level-initialization stuff from Spawn to ServerActivate, so bot will not check init-stuff every entity spawn. This should save few CPU cycles.
* Fixed active grenades list not working after changelevel.
Reworked items pickup code, so every bot is not firing sphere search every time, but instead we maintain our own list of intresting entities, so every bot is accessing this list. This should lower CPU usage more a little.
* Precache should be done in spawn...
* Do not use engfuncs in intresting entities.
* Fixed GCC-8.2 warnings.
Minor refactoring.
* Added some safety checks to intresting entities.
Get rid of stdc++ dependency for GCC & ICC under linux.
* Remove -g from release make.
Cosmetic changes.
* Re-enabled debug overlay.
* Remove test header...
* Some static-analyzer warnings fixed.
Support for X64 build for FWGS Xash3D Engine.
* Reduced time between selecting grenade and throwing it away.
Do not try to kill bots that already dead with kill command.
Several fixes from static-analyzers.
* Update CI.
* Fixed bot's not added after the changelevel on Xash3D engine.
* Revert commit that enables movement during freezetime. Everything goes bad, when there is no freezetime....
* Bots will try to not strafe while in combat if seeing enemy only partially.
Do not use "shift" when considering stuck.
* Weapon price for Elite is 800$ since CS 1.6...
* Fixed bots at difficulty 0 can't shoot enemies.
* Cosmetic change.
* Fixed assert in ClientDisconnect when quitting game while meta unloaded yapb module.
Consider freed entities as invalid.
* Bigger distance for throwing he grenades.
* Faster version of atan2f().
* Removed accidentally left SSE header.
* Cosmetic changes to enums.
* Tweaked difficulty levels.
Bots on Android will have a difficulty level 2 by default.
Fixed LTO builds under linux.
* Do not consider Android CS as legacy.
* Get rid of system's math functions. Just for fun)
* Use SSE2 for sincos function.
* Fixed failed during load wayponts still allows to add bots, thus causing bot to crash.
Added ability to delete waypoint by number using "yb wp delete".
Enabled Link Time Optimization for Linux and OSX.
* Fixed CI Builds.
2018-10-28 19:26:36 +03:00
2019-07-31 14:05:36 +03:00
// initialize dynamic linkents
ents . initialize ( ) ;
2014-07-30 14:17:46 +04:00
// give the engine functions to the other DLL...
2021-09-10 19:42:24 +03:00
api_GiveFnptrsToDll ( table , glob ) ;
2014-07-30 14:17:46 +04:00
}
2020-11-23 00:06:18 +03:00
DLSYM_RETURN EntityLinkage : : lookup ( SharedLibrary : : Handle module , const char * function ) {
2020-11-13 19:16:56 +03:00
static const auto & gamedll = game . lib ( ) . handle ( ) ;
static const auto & self = m_self . handle ( ) ;
const auto resolve = [ & ] ( SharedLibrary : : Handle handle ) {
2020-11-23 00:06:18 +03:00
return reinterpret_cast < DLSYM_RETURN > ( m_dlsym ( static_cast < DLSYM_HANDLE > ( handle ) , function ) ) ;
2020-11-13 19:16:56 +03:00
} ;
2021-09-08 20:09:23 +03:00
if ( ents . needsBypass ( ) & & ! strcmp ( function , " CreateInterface " ) ) {
2020-11-23 00:06:18 +03:00
ents . setPaused ( true ) ;
auto ret = resolve ( module ) ;
ents . disable ( ) ;
return ret ;
}
2020-11-13 19:16:56 +03:00
// if requested module is yapb module, put in cache the looked up symbol
2020-11-23 10:48:44 +03:00
if ( self ! = module | | ( plat . win & & ( static_cast < uint16 > ( reinterpret_cast < unsigned long > ( function ) > > 16 ) & 0xffff ) = = 0 ) ) {
2020-11-13 19:16:56 +03:00
return resolve ( module ) ;
}
if ( m_exports . has ( function ) ) {
return m_exports [ function ] ;
}
auto botAddr = resolve ( self ) ;
if ( ! botAddr ) {
auto gameAddr = resolve ( gamedll ) ;
if ( gameAddr ) {
return m_exports [ function ] = gameAddr ;
}
}
else {
return m_exports [ function ] = botAddr ;
}
return nullptr ;
}
void EntityLinkage : : initialize ( ) {
2020-11-23 00:06:18 +03:00
if ( plat . arm | | game . is ( GameFlags : : Metamod ) ) {
2020-11-13 19:16:56 +03:00
return ;
}
2020-11-23 00:06:18 +03:00
m_dlsym . initialize ( " kernel32.dll " , " GetProcAddress " , DLSYM_FUNCTION ) ;
2021-09-08 20:09:23 +03:00
m_dlsym . install ( reinterpret_cast < void * > ( EntityLinkage : : lookupHandler ) , true ) ;
2020-11-23 00:06:18 +03:00
2021-09-08 20:09:23 +03:00
if ( needsBypass ( ) ) {
m_dlclose . initialize ( " kernel32.dll " , " FreeLibrary " , DLCLOSE_FUNCTION ) ;
m_dlclose . install ( reinterpret_cast < void * > ( EntityLinkage : : closeHandler ) , true ) ;
}
2020-11-13 19:16:56 +03:00
m_self . locate ( & engfuncs ) ;
}
2019-07-31 14:05:36 +03:00
// add linkents for android
# include "android.cpp"
2020-11-23 00:06:18 +03:00
// override new/delete globally, need to be included in .cpp file
# include <crlib/cr-override.h>