.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Why bots need this? (http://forums.bots-united.com/showthread.php?t=3787)

KWo 28-03-2005 10:44

Why bots need this?
 
Since I'm not a bot coder and I know almost nothing about C++ and HL SDK, I can't answer to T(+)rget what can be a reason to using some special management in code for bots.
A lot of times I saw some bots or players as ghosts on the server (also noticed by other people at this and other forums) when there is AMX or AMX MOD X. I've asked him why it's not working correctly (not resetted at player's respawn) some function set_user_rendering. T(+)rget told me it is resetted in FUN module and he was surprised a bit if it doesn't work correctly for bots. But he asked me about something I can't answer. Maybe someone of You guys can give more light to explain the problem.

Quote:

Originally Posted by T(+)rget
Code:

// Don't ask, bots need this for reinitialising :/
void ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer) {
        CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
        if(pPlayer->IsBot()) {
  pPlayer->bot = true;
  pPlayer->PutInServer();
        }

        RETURN_META(MRES_IGNORED);
}

I had problems with VexdUM when I killed bots with my damage natives, if I didn't code the above then the round wouldn't end because the server didn't notice the bot die.

I don't understand the full reason behind this, might be better to ask 1 of the bot authors they should be able to elabrate upon it some more.

It sounds like a similar problem/bug which you've noticed.

If you have AMX 0.9.9b installed I can send you a test Fun version to try.

-Targ


Cheeseh 28-03-2005 15:09

Re: Why bots need this?
 
I never had to use that code before for my own bot, and I haven't seen it used in other bots...

What MOD is it for?
What Bot is using it?

I'm guessing that the bot doesn't fully support the mod or simply hasn't got the correct code for them to join the server properly. The code above just makes the bot join the game, where the bot should have done that code itself in it's creation function.

KWo 28-03-2005 15:29

Re: Why bots need this?
 
The mod it's AMX and the bot it's AMXBOT (T(+)rget's one) and it should work for CS. More info here:
http://forums.bots-united.com/showthread.php?t=3102

T(+)rget 28-03-2005 23:32

Re: Why bots need this?
 
Well like I mentioned to KWo the bot needed reinitialising:
Code:

static cell AMX_NATIVE_CALL create_bot(AMX *amx, cell *params) {
    int iLen;
    char* botname = GET_AMXSTRING(amx, params[1], 0, iLen);
    edict_t* pEdict = CREATE_FAKE_CLIENT(botname);

    if(!pEdict) {
        AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
        return 0;
    }

    pEdict->v.flags |= FL_FAKECLIENT;
    CPlayer *pPlayer = GET_PLAYER_POINTER(pEdict);
    pPlayer->id = ENTINDEX(pEdict);
    pPlayer->pEdict = pEdict;
    CALL_GAME_ENTITY(PLID, "player", VARS(pPlayer->pEdict));
    char *sInfoBuffer = GET_INFOKEYBUFFER(pPlayer->pEdict);
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "rate", "3500");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "cl_updaterate", "20");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "cl_lw", "1");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "cl_lc", "1");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "cl_dlmax", "128");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "_vgui_menus", "0");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "_ah", "0");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "dm", "0");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "tracker", "0");
    SET_CLIENT_KEYVALUE(pPlayer->id, sInfoBuffer, "friends", "0");
    char szRejectReason[128];
    MDLL_ClientConnect(pPlayer->pEdict, botname, "127.0.0.1", szRejectReason);
    MDLL_ClientPutInServer(pPlayer->pEdict);
    RUNPLAYERMOVE(pPlayer->pEdict, pPlayer->pEdict->v.v_angle, 0.0, 0.0, 0, 0, 0, 76);

    return 1;
}

Don't think there is any problems with the above? Only occurs whilst using the damage natives I created ie outside influence.

-Targ

Pierre-Marie Baty 29-03-2005 02:28

Re: Why bots need this?
 
This may be caused because you lack client-side code for your bot. Your bot needs to know how to handle the VGUI network message the server sends it (like for example for choosing team and class). CS has a bug where it is possible to force a player to "play" even though the team and class have not been selected correctly, however as soon as this player dies, problems arise which resemble the one you mentioned (if I remember well).


All times are GMT +2. The time now is 00:43.

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