![]() |
![]() |
Venom |
![]()
Post
#1
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 82 Joined: 24-July 06 Member No.: 807 ![]() |
Hello,
Well i have been playing TF2 basicly since beta, having been release and after playing it for 3 or 4 weeks solid now, I would like to start to turn towards bot development. After previously working with the older HL version of RCbot on Natural Selection and modifing that bot to support different game types, I will be moving my efforts towards bot development with TF2. Like all source games and mods, they all come with basic source bots any way. The only way to activate this in games like TF2, is to make sure that -console command is on before you launch the game, and simply type "sv_cheats 1" and then "bot_add". Due to the lack of development and customisation of these standard bots, the bots will not do anything even though they can be added to the game. So I will now be looking at RCBot2 to see if i can get bots into TF2. I will keep you posted on my efforts, i am currently downloading the Windows version of the TF2 dedicated server, having a glimps at the RCbot2 forum, people seem to be having problems with dedicated server so i hope I am able to setup and install RCbots correctly. Wish me luck Venom |
![]() ![]() |
Venom |
![]()
Post
#2
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 82 Joined: 24-July 06 Member No.: 807 ![]() |
do you have any of the source code which has been converted already? it will give me a head start.
|
Cheeseh |
![]()
Post
#3
|
![]() Admin ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 ![]() |
do you have any of the source code which has been converted already? it will give me a head start. I only started with the bot modifications and base classes I guess i can post them here, my ftp is no longer working i would have to upload it to the filebase or I can post my changes: new: bot_fortress.h CODE #ifndef __BOT_FORTRESS_H__ #define __BOT_FORTRESS_H__ typedef enum { TF_CLASS_SCOUT = 1, TF_CLASS_SNIPER = 2, TF_CLASS_SOLDIER = 3, TF_CLASS_DEMOMAN = 4, TF_CLASS_MEDIC = 5, TF_CLASS_HWGUY = 6, TF_CLASS_PYRO = 7, TF_CLASS_SPY = 8, TF_CLASS_ENGINEER = 9, TF_CLASS_CIVILIAN = 0, }TF_Class; enum { TF_TEAM_SPEC = 0, TF_TEAM_BLUE = 1, TF_TEAM_RED = 2, TF_TEAM_GREEN = 3, TF_TEAM_YELLOW = 4 }; class CBotFortress : public CBot { public: virtual void init (bool bVarInit=false); // setup buttons and data structures virtual void setup (); virtual void died ( edict_t *pKiller ); virtual void killed ( edict_t *pVictim ); virtual int getTeam () = 0; virtual void modThink () = 0; void setLookAtTask ( eLookTask lookTask ); virtual bool isEnemy ( edict_t *pEdict ); virtual void getLookAtVector (); virtual void startGame (); virtual void spawnInit (); virtual void checkStuck (); virtual bool startedGame (); bool isTF () { return true; } virtual TF_Class getClass () = 0; protected: virtual void selectTeam (); virtual void selectClass (); }; class CBotTF2 : public CBotFortress { public: void init (bool bVarInit=false); // setup buttons and data structures void setup (); void spawnInit (); void died ( edict_t *pKiller ); void killed ( edict_t *pVictim ); int getTeam (); void modThink (); void setLookAtTask ( eLookTask lookTask ); bool isEnemy ( edict_t *pEdict ); void getLookAtVector (); void startGame (); void checkStuck (); bool startedGame (); bool isTF () { return true; } TF_Class getClass (); protected: void selectTeam (); void selectClass (); }; class CBotFF : public CBotFortress { public: void init (bool bVarInit=false); // setup buttons and data structures void setup (); void spawnInit (); void died ( edict_t *pKiller ); void killed ( edict_t *pVictim ); int getTeam (); void modThink (); void setLookAtTask ( eLookTask lookTask ); bool isEnemy ( edict_t *pEdict ); void getLookAtVector (); void startGame (); void checkStuck (); bool startedGame (); bool isTF () { return true; } TF_Class getClass (); protected: void selectTeam (); void selectClass (); }; #endif new : bot_fortress.cpp CODE /* * This file is part of RCBot. * * RCBot by Paul Murphy adapted from Botman's HPB Bot 2 template. * * RCBot is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * RCBot is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RCBot; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. * */ #include "bot.h" #include "bot_fortress.h" #include "bot_buttons.h" #include "bot_globals.h" #include "bot_profile.h" #include "vstdlib/random.h" // for random functions void CBotFortress :: init (bool bVarInit) { CBot::init(bVarInit); } void CBotFortress :: setup () { CBot::setup(); } bool CBotFortress :: startedGame () { return true; } void CBotFortress :: startGame() { selectTeam(); selectClass(); } void CBotFortress :: killed ( edict_t *pVictim ) { return; } void CBotFortress :: died ( edict_t *pKiller ) { spawnInit(); if ( RandomInt(0,1) ) m_pButtons->attack(); } void CBotFortress :: spawnInit () { CBot::spawnInit(); } bool CBotFortress :: isEnemy ( edict_t *pEdict ) { if ( pEdict == m_pEdict ) return false; if ( !ENTINDEX(pEdict) || (ENTINDEX(pEdict) > CBotGlobals::maxClients()) ) return false; if ( CBotGlobals::getTeamplayOn() ) { if ( CBotGlobals::getTeam(pEdict) == getTeam() ) return false; } return true; } void CBotFortress :: modThink () { // dont use physcannon for now... switch to pistol if ( m_pPlayerInfo->GetWeaponName() && *(m_pPlayerInfo->GetWeaponName()) ) { if ( !strcmp("weapon_physcannon",m_pPlayerInfo->GetWeaponName()) ) { m_pController->SetActiveWeapon("weapon_pistol"); } else if ( !FStrEq(m_pProfile->getWeapon(),"default") && !FStrEq(m_pProfile->getWeapon(),m_pPlayerInfo->GetWeaponName())) { m_pController->SetActiveWeapon(m_pProfile->getWeapon()); } } } void CBotTF2 :: selectTeam () { } void CBotTF2 :: selectClass () { } void CBotFF :: selectTeam () { } void CBotFF :: selectClass () { } /////////////// void CBotTF2 :: modThink () { // mod specific think code here } void CBotTF2 :: init (bool bVarInit) { CBot::init(bVarInit); } void CBotTF2 :: setup () { CBot::setup(); } bool CBotTF2 :: startedGame () { return true; } void CBotTF2 :: startGame () { return; } void CBotTF2 :: killed (edict_t *pKiller) { } void CBotTF2 :: died (edict_t *pKiller) { spawnInit(); // wait for respawn } void CBotTF2 :: spawnInit () { CBot::spawnInit(); } bool CBotTF2 :: isEnemy ( edict_t *pEdict ) { if ( pEdict == m_pEdict ) return false; if ( !ENTINDEX(pEdict) || (ENTINDEX(pEdict) > CBotGlobals::maxClients()) ) return false; if ( CBotGlobals::getTeam(pEdict) == getTeam() ) return false; return true; } patch : bot_mods.cpp CODE void CBotMods :: readMods() { m_Mods.push_back(new CCounterStrikeSourceMod()); m_Mods.push_back(new CHalfLifeDeathmatchMod()); m_Mods.push_back(new CCounterStrikeSourceModDedicated()); m_Mods.push_back(new CHalfLifeDeathmatchModDedicated()); m_Mods.push_back(new CFortressForeverMod()); m_Mods.push_back(new CFortressForeverModDedicated()); m_Mods.push_back(new CTeamFortress2Mod()); m_Mods.push_back(new CTeamFortress2ModDedicated()); } patch : bot_mods.h CODE class CFortressForeverMod : public CBotMod { public: CFortressForeverMod() { setup("FortressForever","SourceMods",MOD_FF); } private: }; class CFortressForeverModDedicated : public CBotMod { public: CFortressForeverModDedicated() { setup("FortressForever","source dedicated server",MOD_FF); } private: }; class CTeamFortress2Mod : public CBotMod { public: CTeamFortress2Mod() { setup("tf","team fortress 2",MOD_TF2); } private: }; class CTeamFortress2ModDedicated : public CBotMod { public: CTeamFortress2ModDedicated() { setup("tf","source dedicated server",MOD_TF2); } private: }; patch bot_const.h CODE typedef enum { MOD_UNSUPPORTED = 0, MOD_HLDM2, MOD_CSS, MOD_FF, MOD_TF2, MOD_ANY, MOD_MAX }eModId; |
![]() ![]() |
![]() |
Lo-Fi Version | Time is now: 19th July 2025 - 12:27 AM |