s1lentq / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
554 stars 198 forks source link

zBot Spread Fix #951

Open redheadgektor opened 4 months ago

redheadgektor commented 4 months ago

A problem has been found, bots do not have a bullet spread, because the engine emulating usercmd does not assign random_seed. random_seed is always zero

https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/game_shared/bot/bot.cpp#L286 https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/dlls/client.cpp#L5005

FIX: Replace function

void EXT_FUNC CmdStart(const edict_t *pEdict, const struct usercmd_s *cmd, unsigned int random_seed)
{
    entvars_t *pev = const_cast<entvars_t *>(&pEdict->v);
    CBasePlayer *pPlayer = CBasePlayer::Instance(pev);

    if (!pPlayer)
        return;

    if (pPlayer->pev->groupinfo)
        UTIL_SetGroupTrace(pPlayer->pev->groupinfo, GROUP_OP_AND);

    //bots random_seed
    if (!pPlayer->IsNetClient())
    {
        pPlayer->random_seed = (int)((gpGlobals->time - pPlayer->edict()->v.starttime) * 1000.0f);
    }
    else
    {
        pPlayer->random_seed = random_seed;
    }
}
Vaqtincha commented 4 months ago

not a bug but a feature. don't do that!

redheadgektor commented 4 months ago

not a bug but a feature. don't do that!

I modified bot states for more realism actions like humans: bhop, long jumps, use buttons for open doors and try recoil controlling while long bursts

Vaqtincha commented 4 months ago

@redheadgektor The more functionality you add, the worse they will play. They won't become human no matter how hard you try.

redheadgektor commented 4 months ago

@Vaqtincha Naturally, but now at least they can fight back against the players + if they hear the noise of the enemy, they try to shoot through the wall and throw grenades in a non-random place. I also added the ability to manually place campsites (useful for zombie servers)

RauliTop commented 4 months ago

not a bug but a feature. don't do that!

I modified bot states for more realism actions like humans: bhop, long jumps, use buttons for open doors and try recoil controlling while long bursts

but now at least they can fight back against the players + if they hear the noise of the enemy, they try to shoot through the wall and throw grenades in a non-random place. I also added the ability to manually place campsites (useful for zombie servers)

@redheadgektor and where are all these new features?