.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   How to integrate bot in to the game dll ? (http://forums.bots-united.com/showthread.php?t=4187)

The Storm 05-07-2005 11:16

How to integrate bot in to the game dll ?
 
Ok I now have a new little project. I start to make a bot for http://www.sandsofwar.net/
I get the source code of Sands of War and I think it will be better to integrate the bot in to the sow.dll file. I started from HPB bot teamplate 4 (the hook dll version). I now want to know what stuff of the bot I don't need to compile it with the sow.dll file.

P.S I will work on both SoW bot and E[POD]bot so don't worry EPB fans. :)
Now just waiting for MarD to test the new version 5 of EPB.

Rick 05-07-2005 11:24

Re: How to integrate bot in to the game dll ?
 
Hah following my good advice about integrated bots eh? :) Get "Bot 10" made by botman(http://hpb-bot.bots-united.com/releases/bot10src.zip) and see what he needed to do to make it work.

Whistler 05-07-2005 13:37

Re: How to integrate bot in to the game dll ?
 
also check the TheFatal's HL bot framework, which is simpler but contains everything you need to get the bot work:
http://www.telefragged.com/thefatal/

The Storm 07-07-2005 17:06

Re: How to integrate bot in to the game dll ?
 
Ok I download bot10 by botman but now I need by some tutorial. So I get the first bot spectating in game. Now first I need by some help to get the bot to navigate weapons. So I find in bot.cpp this lines :
Code:

// weapon firing delay based on skill (min and max delay for each weapon)
float primary_fire_delay[WEAPON_TEARGASGRENADE+1][5][2] = {
  // WEAPON_NONE - NOT USED
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_CROWBAR
  {{0.0, 0.1}, {0.2, 0.3}, {0.3, 0.5}, {0.4, 0.6}, {0.6, 1.0}},
  // WEAPON_GLOCK (9mm)
  {{0.0, 0.1}, {0.1, 0.2}, {0.2, 0.3}, {0.3, 0.4}, {0.4, 0.5}},
  // WEAPON_PYTHON (357)
  {{0.0, 0.25}, {0.2, 0.5}, {0.4, 0.8}, {1.0, 1.3}, {1.5, 2.0}},
  // WEAPON_MP5 (9mmAR)
  {{0.0, 0.1}, {0.1, 0.3}, {0.3, 0.5}, {0.4, 0.6}, {0.5, 0.8}},
  // WEAPON_CHAINGUN - NOT USED
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_CROSSBOW
  {{0.0, 0.25}, {0.2, 0.4}, {0.5, 0.7}, {0.8, 1.0}, {1.0, 1.3}},
  // WEAPON_SHOTGUN
  {{0.0, 0.25}, {0.2, 0.5}, {0.4, 0.8}, {0.6, 1.2}, {0.8, 2.0}},
  // WEAPON_RPG
  {{1.0, 3.0}, {2.0, 4.0}, {3.0, 5.0}, {4.0, 6.0}, {5.0, 7.0}},
  // WEAPON_GAUSS
  {{0.0, 0.1}, {0.2, 0.3}, {0.3, 0.5}, {0.5, 0.8}, {1.0, 1.2}},
  // WEAPON_EGON
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_HORNETGUN
  {{0.0, 0.1}, {0.25, 0.4}, {0.4, 0.7}, {0.6, 1.0}, {1.0, 1.5}},
  // WEAPON_HANDGRENADE
  {{1.0, 1.4}, {1.4, 2.0}, {1.8, 2.6}, {2.0, 3.0}, {2.5, 3.8}},
  // WEAPON_TRIPMINE
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_SATCHEL
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_SNARK
  {{0.0, 0.1}, {0.1, 0.2}, {0.2, 0.5}, {0.5, 0.7}, {0.6, 1.0}},
  };

float secondary_fire_delay[WEAPON_TEARGASGRENADE+1][5][2] = {
  // WEAPON_NONE - NOT USED
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_CROWBAR - Not applicable
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_GLOCK (9mm)
  {{0.0, 0.1}, {0.0, 0.1}, {0.1, 0.2}, {0.1, 0.2}, {0.2, 0.4}},
  // WEAPON_PYTHON (357)
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_MP5 (9mmAR)
  {{0.0, 0.3}, {0.5, 0.8}, {0.7, 1.0}, {1.0, 1.6}, {1.4, 2.0}},
  // WEAPON_CHAINGUN - NOT USED
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_CROSSBOW
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_SHOTGUN
  {{0.0, 0.25}, {0.2, 0.5}, {0.4, 0.8}, {0.6, 1.2}, {0.8, 2.0}},
  // WEAPON_RPG - Not applicable
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_GAUSS
  {{0.2, 0.5}, {0.3, 0.7}, {0.5, 1.0}, {0.8, 1.5}, {1.0, 2.0}},
  // WEAPON_EGON - Not applicable
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_HORNETGUN
  {{0.0, 0.1}, {0.2, 0.3}, {0.3, 0.5}, {0.5, 0.8}, {0.7, 1.2}},
  // WEAPON_HANDGRENADE - Not applicable
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_TRIPMINE - Not applicable
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_SATCHEL
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}},
  // WEAPON_SNARK - Not applicable
  {{0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}}
  };

So can someone explain me what each number doing and how I must modifi them ?

Whistler 08-07-2005 09:52

Re: How to integrate bot in to the game dll ?
 
these are delay times of firing weapons in the HL for different level of bots.

the weapon handling in bot number 10 is hardcoded in bot_combat.cpp, just read the source code at there

also if you want to make a good bot, I'd advise _not_ to use botman's bot number 10, just use TheFatal's minimal framework and do most of the work yourself. However if you simply want a work bot (even if it's "stupid"), bot10 is a good way with only a few changes for the mod's game rules.

The Storm 08-07-2005 11:21

Re: How to integrate bot in to the game dll ?
 
Whistler I don't want to make fully new bot. I just want to make a simply functional bot for this mod. I don't have enough time to start from the zero and code all by myself. However I don't see any text that explain each number for what is. Yes I know that this numbers are the fire delay but I need to know each number what do.

Whistler 08-07-2005 12:06

Re: How to integrate bot in to the game dll ?
 
Just read the source code :)

PHP Code:

  {{1.01.4}, {1.42.0}, {1.82.6}, {2.03.0}, {2.53.8}},
  
best skill          -------------->            worst skill 

and the delay time is RANDOM_FLOAT(1.0, 1.4).

The Storm 08-07-2005 12:50

Re: How to integrate bot in to the game dll ?
 
Thanks Whistler if I have more questions I will ask again. :P

The Storm 09-07-2005 15:45

Re: How to integrate bot in to the game dll ?
 
I need by some help. So I have problems with getting the bot to join in game.
Here my code placed in the start of BotThink()
Code:

if (not_started)
        {
                for (int index = 1; index < gpGlobals->maxClients; index++)
                {
                        CBasePlayer *pPlayer;

                        pPlayer = (CBasePlayer*)UTIL_PlayerByIndex( index );

                        if (!pPlayer)  // if invalid then continue with next index...
                                continue;

                        if (IsAlive())
                                continue;

                        if ((create_time + 0.5 <= gpGlobals->time) && (pPlayer->pev->flags & FL_FAKECLIENT))
                        {
                            pPlayer->m_iTeam = 1;// Join Team 1
                                pPlayer->m_iNextTeam = 1;
                            pPlayer->m_iClass = 1;// Select class 1
                                pPlayer->m_iNextClass = 1;
                                pPlayer->Spawn();// Spawn the bot
                                not_started = 0;
                                create_time = gpGlobals->time;

                            g_engfuncs.pfnRunPlayerMove( edict( ), pev->v_angle, f_move_speed,
                                                                                        0, 0, pev->button, 0,
                                                                                        gpGlobals->frametime * 1000 );
                                return;
                        }
                }
        }

So after all only the first bot join in game. After I type add bot again the others bots stay spectators. If you can tell me where is the my mistake.
not_started is settet to 1 when new bot connect.
Btw I'm using bot10 by botman for integrating the bot in to the sow.dll file.

Whistler 10-07-2005 09:53

Re: How to integrate bot in to the game dll ?
 
well I know nothing about that MOD, but you can read the source code of the MOD to figure out how the MOD deal with joining games.


All times are GMT +2. The time now is 01:42.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.