build: reworked build and package to simplify process

build: reworked build and package to simplify process
build: windows dll is now compiled by clang, msvc build added to extras package
fix: clear all the implicit conversions in the code (also fixed some bugs)
fix: crash on  never xash3d-fwgs engine
fix: fixed bad bot behaviors on aarch64
fix: crash on some maps due to missing previous node
fix: finally removed memset(this) within bot creatin
This commit is contained in:
jeefo 2023-04-02 12:17:12 +03:00 committed by GitHub
commit 53df621dfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1004 additions and 949 deletions

View file

@ -349,7 +349,7 @@ CR_DECLARE_SCOPED_ENUM (Reload,
)
// collision probes
CR_DECLARE_SCOPED_ENUM (CollisionProbe,
CR_DECLARE_SCOPED_ENUM (CollisionProbe, uint32,
Jump = cr::bit (0), // probe jump when colliding
Duck = cr::bit (1), // probe duck when colliding
Strafe = cr::bit (2) // probe strafing when colliding
@ -367,7 +367,7 @@ CR_DECLARE_SCOPED_ENUM (BotMsg,
)
// sensing states
CR_DECLARE_SCOPED_ENUM (Sense,
CR_DECLARE_SCOPED_ENUM_TYPE (Sense, uint32,
SeeingEnemy = cr::bit (0), // seeing an enemy
HearingEnemy = cr::bit (1), // hearing an enemy
SuspectEnemy = cr::bit (2), // suspect enemy behind obstacle
@ -378,7 +378,7 @@ CR_DECLARE_SCOPED_ENUM (Sense,
)
// positions to aim at
CR_DECLARE_SCOPED_ENUM (AimFlags,
CR_DECLARE_SCOPED_ENUM_TYPE (AimFlags, uint32,
Nav = cr::bit (0), // aim at nav point
Camp = cr::bit (1), // aim at camp vector
PredictPath = cr::bit (2), // aim at predicted path
@ -590,12 +590,12 @@ struct Client {
// define chatting collection structure
struct ChatCollection {
int chatProbability;
float chatDelay;
float timeNextChat;
int entityIndex;
String sayText;
StringArray lastUsedSentences;
int chatProbability {};
float chatDelay {};
float timeNextChat {};
int entityIndex {};
String sayText {};
StringArray lastUsedSentences {};
};
// include bot graph stuff
@ -622,7 +622,7 @@ private:
int m_oldButtons {}; // our old buttons
int m_reloadState {}; // current reload state
int m_voicePitch; // bot voice pitch
int m_voicePitch {}; // bot voice pitch
int m_loosedBombNodeIndex {}; // nearest to loosed bomb node
int m_plantedBombNodeIndex {}; // nearest to planted bomb node
int m_currentNodeIndex {}; // current node index
@ -635,19 +635,18 @@ private:
int m_tryOpenDoor {}; // attempt's to open the door
int m_liftState {}; // state of lift handling
int m_radioSelect {}; // radio entry
float m_headedTime {};
float m_prevTime {}; // time previously checked movement speed
float m_heavyTimestamp; // is it time to execute heavy-weight functions
float m_heavyTimestamp {}; // is it time to execute heavy-weight functions
float m_prevSpeed {}; // speed some frames before
float m_timeDoorOpen {}; // time to next door open check
float m_lastChatTime {}; // time bot last chatted
float m_timeLogoSpray {}; // time bot last spray logo
float m_knifeAttackTime {}; // time to rush with knife (at the beginning of the round)
float m_duckDefuseCheckTime {}; // time to check for ducking for defuse
float m_frameInterval; // bot's frame interval
float m_lastCommandTime; // time bot last thinked
float m_frameInterval {}; // bot's frame interval
float m_lastCommandTime {}; // time bot last thinked
float m_reloadCheckTime {}; // time to check reloading
float m_zoomCheckTime {}; // time to check zoom again
float m_shieldCheckTime {}; // time to check shiled drawing again
@ -685,15 +684,15 @@ private:
float m_minSpeed {}; // minimum speed in normal mode
float m_oldCombatDesire {}; // holds old desire for filtering
float m_itemCheckTime {}; // time next search for items needs to be done
float m_joinServerTime; // time when bot joined the game
float m_playServerTime; // time bot spent in the game
float m_joinServerTime {}; // time when bot joined the game
float m_playServerTime {}; // time bot spent in the game
float m_changeViewTime {}; // timestamp to change look at while at freezetime
float m_breakableTime {}; // breakeble acquired time
bool m_moveToGoal {}; // bot currently moving to goal??
bool m_isStuck {}; // bot is stuck
bool m_isReloading {}; // bot is reloading a gun
bool m_forceRadio; // should bot use radio anyway?
bool m_forceRadio {}; // should bot use radio anyway?
bool m_defendedBomb {}; // defend action issued
bool m_defendHostage {}; // defend action issued
bool m_duckDefuse {}; // should or not bot duck to defuse bomb
@ -708,14 +707,14 @@ private:
bool m_moveToC4 {}; // ct is moving to bomb
bool m_grenadeRequested {}; // bot requested change to grenade
Pickup m_pickupType; // type of entity which needs to be used/picked up
PathWalk m_pathWalk; // pointer to current node from path
Dodge m_combatStrafeDir; // direction to strafe
Fight m_fightStyle; // combat style to use
CollisionState m_collisionState; // collision State
FindPath m_pathType; // which pathfinder to use
Pickup m_pickupType {}; // type of entity which needs to be used/picked up
PathWalk m_pathWalk {}; // pointer to current node from path
Dodge m_combatStrafeDir {}; // direction to strafe
Fight m_fightStyle {}; // combat style to use
CollisionState m_collisionState {}; // collision State
FindPath m_pathType {}; // which pathfinder to use
uint8 m_enemyParts {}; // visibility flags
TraceResult m_lastTrace[TraceChannel::Num]; // last trace result
TraceResult m_lastTrace[TraceChannel::Num] {}; // last trace result
edict_t *m_pickupItem {}; // pointer to entity of item to use/pickup
edict_t *m_itemIgnore {}; // pointer to entity to ignore for pickup
@ -725,31 +724,31 @@ private:
edict_t *m_targetEntity {}; // the entity that the bot is trying to reach
edict_t *m_avoidGrenade {}; // pointer to grenade entity to avoid
Vector m_liftTravelPos; // lift travel position
Vector m_moveAngles; // bot move angles
Vector m_idealAngles; // angle wanted
Vector m_randomizedIdealAngles; // angle wanted with noise
Vector m_angularDeviation; // angular deviation from current to ideal angles
Vector m_aimSpeed; // aim speed calculated
Vector m_aimLastError; // last calculated aim error
Vector m_prevOrigin; // origin some frames before
Vector m_lookAt; // vector bot should look at
Vector m_throw; // origin of node to throw grenades
Vector m_enemyOrigin; // target origin chosen for shooting
Vector m_grenade; // calculated vector for grenades
Vector m_entity; // origin of entities like buttons etc.
Vector m_camp; // aiming vector when camping.
Vector m_desiredVelocity; // desired velocity for jump nodes
Vector m_breakableOrigin; // origin of breakable
Vector m_liftTravelPos {}; // lift travel position
Vector m_moveAngles {}; // bot move angles
Vector m_idealAngles {}; // angle wanted
Vector m_randomizedIdealAngles {}; // angle wanted with noise
Vector m_angularDeviation {}; // angular deviation from current to ideal angles
Vector m_aimSpeed {}; // aim speed calculated
Vector m_aimLastError {}; // last calculated aim error
Vector m_prevOrigin {}; // origin some frames before
Vector m_lookAt {}; // vector bot should look at
Vector m_throw {}; // origin of node to throw grenades
Vector m_enemyOrigin {}; // target origin chosen for shooting
Vector m_grenade {}; // calculated vector for grenades
Vector m_entity {}; // origin of entities like buttons etc.
Vector m_camp {}; // aiming vector when camping.
Vector m_desiredVelocity {}; // desired velocity for jump nodes
Vector m_breakableOrigin {}; // origin of breakable
Array <edict_t *> m_ignoredBreakable; // list of ignored breakables
Array <edict_t *> m_hostages; // pointer to used hostage entities
Array <Route> m_routes; // pointer
Array <int32> m_goalHistory; // history of selected goals
Array <edict_t *> m_ignoredBreakable {}; // list of ignored breakables
Array <edict_t *> m_hostages {}; // pointer to used hostage entities
Array <Route> m_routes {}; // pointer
Array <int32> m_goalHistory {}; // history of selected goals
BinaryHeap <RouteTwin> m_routeQue;
BinaryHeap <RouteTwin> m_routeQue {};
Path *m_path {}; // pointer to the current path node
String m_chatBuffer; // space for strings (say text...)
String m_chatBuffer {}; // space for strings (say text...)
FrustumPlane m_frustum[FrustumSide::Num] {};
private:
@ -879,8 +878,8 @@ private:
void focusEnemy ();
void selectBestWeapon ();
void selectSecondary ();
void selectWeaponByName (const char *name);
void selectWeaponById (int num);
void selectWeaponByName (StringRef name);
void selectWeaponByIndex (int index);
void completeTask ();
void tasks ();
@ -938,17 +937,17 @@ private:
}
public:
entvars_t *pev;
entvars_t *pev {};
int m_index; // saved bot index
int m_wantedTeam; // player team bot wants select
int m_wantedSkin; // player model bot wants to select
int m_difficulty; // bots hard level
int m_moneyAmount; // amount of money in bot's bank
int m_index {}; // saved bot index
int m_wantedTeam {}; // player team bot wants select
int m_wantedSkin {}; // player model bot wants to select
int m_difficulty {}; // bots hard level
int m_moneyAmount {}; // amount of money in bot's bank
float m_spawnTime {}; // time this bot spawned
float m_timeTeamOrder {}; // time of last radio command
float m_slowFrameTimestamp; // time to per-second think
float m_slowFrameTimestamp {}; // time to per-second think
float m_nextBuyTime {}; // next buy time
float m_checkDarkTime {}; // check for darkness time
float m_preventFlashing {}; // bot turned away from flashbang
@ -957,11 +956,11 @@ public:
float m_blindSidemoveSpeed {}; // mad side move speeds when bot is blind
float m_fallDownTime {}; // time bot started to fall
float m_duckForJump {}; // is bot needed to duck for double jump
float m_baseAgressionLevel; // base aggression level (on initializing)
float m_baseFearLevel; // base fear level (on initializing)
float m_agressionLevel; // dynamic aggression level (in game)
float m_fearLevel; // dynamic fear level (in game)
float m_nextEmotionUpdate; // next time to sanitize emotions
float m_baseAgressionLevel {}; // base aggression level (on initializing)
float m_baseFearLevel {}; // base fear level (on initializing)
float m_agressionLevel {}; // dynamic aggression level (in game)
float m_fearLevel {}; // dynamic fear level (in game)
float m_nextEmotionUpdate {}; // next time to sanitize emotions
float m_updateTime {}; // skip some frames in bot thinking
float m_updateInterval {}; // interval between frames
float m_goalValue {}; // ranking value for this node
@ -980,21 +979,21 @@ public:
float m_shootTime {}; // time to shoot
float m_timeLastFired {}; // time to last firing
float m_difficultyChange {}; // time when auto-difficulty was last applied to this bot
float m_kpdRatio; // kill per death ratio
float m_healthValue; // clamped bot health
float m_stayTime; // stay time before reconnect
float m_kpdRatio {}; // kill per death ratio
float m_healthValue {}; // clamped bot health
float m_stayTime {}; // stay time before reconnect
int m_blindNodeIndex {}; // node index to cover when blind
int m_flashLevel {}; // flashlight level
int m_basePing; // base ping for bot
int m_basePing {}; // base ping for bot
int m_numEnemiesLeft {}; // number of enemies alive left on map
int m_numFriendsLeft {}; // number of friend alive left on map
int m_retryJoin; // retry count for chosing team/class
int m_startAction; // team/class selection state
int m_retryJoin {}; // retry count for chosing team/class
int m_startAction {}; // team/class selection state
int m_voteKickIndex {}; // index of player to vote against
int m_lastVoteKick {}; // last index
int m_voteMap {}; // number of map to vote for
int m_logotypeIndex; // index for logotype
int m_logotypeIndex {}; // index for logotype
int m_buyState {}; // current count in buying
int m_blindButton {}; // buttons bot press, when blind
int m_radioOrder {}; // actual command
@ -1002,14 +1001,14 @@ public:
int m_chosenGoalIndex {}; // used for experience, same as above
int m_lastDamageType {}; // stores last damage
int m_team {}; // bot team
int m_currentWeapon; // one current weapon for each bot
int m_weaponType; // current weapon type
int m_currentWeapon {}; // one current weapon for each bot
int m_weaponType {}; // current weapon type
int m_ammoInClip[kMaxWeapons] {}; // ammo in clip for each weapons
int m_ammo[MAX_AMMO_SLOTS] {}; // total ammo amounts
bool m_isVIP {}; // bot is vip?
bool m_notKilled; // has the player been killed or has he just respawned
bool m_notStarted; // team/class not chosen yet
bool m_notKilled {}; // has the player been killed or has he just respawned
bool m_notStarted {}; // team/class not chosen yet
bool m_ignoreBuyDelay {}; // when reaching buyzone in the middle of the round don't do pauses
bool m_inBombZone {}; // bot in the bomb zone or not
bool m_inBuyZone {}; // bot currently in buy zone
@ -1033,17 +1032,17 @@ public:
edict_t *m_lastVictim {}; // pointer to killed entity
edict_t *m_trackingEdict {}; // pointer to last tracked player when camping/hiding
Vector m_pathOrigin; // origin of node
Vector m_destOrigin; // origin of move destination
Vector m_position; // position to move to in move to position task
Vector m_doubleJumpOrigin; // origin of double jump
Vector m_lastEnemyOrigin; // vector to last enemy origin
Vector m_pathOrigin {}; // origin of node
Vector m_destOrigin {}; // origin of move destination
Vector m_position {}; // position to move to in move to position task
Vector m_doubleJumpOrigin {}; // origin of double jump
Vector m_lastEnemyOrigin {}; // vector to last enemy origin
ChatCollection m_sayTextBuffer; // holds the index & the actual message of the last unprocessed text message of a player
BurstMode m_weaponBurstMode; // bot using burst mode? (famas/glock18, but also silencer mode)
Personality m_personality; // bots type
Array <BotTask> m_tasks;
Deque <int32> m_msgQueue;
ChatCollection m_sayTextBuffer {}; // holds the index & the actual message of the last unprocessed text message of a player
BurstMode m_weaponBurstMode {}; // bot using burst mode? (famas/glock18, but also silencer mode)
Personality m_personality {}; // bots type
Array <BotTask> m_tasks {};
Deque <int32> m_msgQueue {};
public:
Bot (edict_t *bot, int difficulty, int personality, int team, int skin);
@ -1101,6 +1100,7 @@ public:
bool canSkipNextTrace (TraceChannel channel);
int getAmmo ();
int getAmmo (int id);
int getNearestToPlantedBomb ();
float getFrameInterval ();
@ -1111,6 +1111,8 @@ public:
int getAmmoInClip () const {
return m_ammoInClip[m_currentWeapon];
}
bool isLowOnAmmo (const int index, const float factor) const;
Vector getCenter () const {
return (pev->absmax + pev->absmin) * 0.5;