Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zBot Spread Fix #951

Open
redheadgektor opened this issue Feb 26, 2024 · 5 comments
Open

zBot Spread Fix #951

redheadgektor opened this issue Feb 26, 2024 · 5 comments

Comments

@redheadgektor
Copy link

redheadgektor commented Feb 26, 2024

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
Copy link
Contributor

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

@redheadgektor
Copy link
Author

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
Copy link
Contributor

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

@redheadgektor
Copy link
Author

@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
Copy link
Contributor

RauliTop commented Feb 27, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants