.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#1)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 13-02-2011

Intro: This is needed to randomize bot shoot vector, random_seed value for bot is always 0, so weapon spread offset for bot is constant!!!! (spread offset is: [x=-0.481522, -0.558304])

My solution (need to hook pfnCmdStart function):
Without metamod:
Code:
void CmdStart (const edict_t *const player, const struct usercmd_s *const command, unsigned int randomSeed)
{
	if (player->v.flags & FL_FAKECLIENT)
		randomSeed = RANDOM_LONG (0u, 0x7FFFFFFFu);

	(*g_DLLFunctionTable.pfnCmdStart) (player, command, randomSeed);
}
With metamod:
Code:
void CmdStart_Post (const edict_t *const player, const struct usercmd_s *const command, unsigned int randomSeed)
{
	if (player->v.flags & FL_FAKECLIENT)
		static_cast <unsigned int *> (player->pvPrivateData)[96]/*player->pvPrivateData->random_seed*/ = RANDOM_LONG (0u, 0x7FFFFFFFu);

	RETURN_META (MRES_IGNORED);
}
P.S. SORRY FOR BAD ENGLISH!!!
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 13-02-2011

Private data changing almost always needs different offset for windows and linux. Did You try it on both systems?
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#3)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 13-02-2011

Only win32, for linux offset is 101 (Sorry forgot about it :\)
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#4)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 13-02-2011

Correct me, but if I remeber correct the cmdStart function will not work on dedicated server?

Edit:: Silly me, you even posted the linux offset and this mean that it will work on dedicated server...
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#5)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 14-02-2011

CmdStart() is called for each client when he runs command.

Example for RunPlayerMove function, which calls SV_RunCmd(), which call engine.pfnCmdStart() function:
Decompiled:
Code:
//----- (01D84280) --------------------------------------------------------
int __cdecl PF_RunPlayerMove_I(int a1/* edict_t *fakeClient */, int a2/* float *moveAngles */, int a3/* float forwardMoveSpeed */, int a4/* float sideMoveSpeed */, int a5/* float upMoveSpeed */, __int16 a6/* unsigned short buttons */, char a7/* unsigned char impulse */, char a8/* unsigned char msecValue */)
{
  int result; // eax@1
  int v9; // ebx@1
  int v10; // ebp@1
  unsigned int v11; // eax@1
  int v12; // edx@1
  char v13; // [sp+18h] [bp-34h]@1
  char v14; // [sp+1Ah] [bp-32h]@1
  int v15; // [sp+1Ch] [bp-30h]@1
  int v16; // [sp+20h] [bp-2Ch]@1
  int v17; // [sp+24h] [bp-28h]@1
  int v18; // [sp+28h] [bp-24h]@1
  int v19; // [sp+2Ch] [bp-20h]@1
  int v20; // [sp+30h] [bp-1Ch]@1
  char v21; // [sp+34h] [bp-18h]@1
  __int16 v22; // [sp+36h] [bp-16h]@1
  char v23; // [sp+38h] [bp-14h]@1

  v9 = host_client;
  v10 = sv_player;
  v11 = NUM_FOR_EDICT(a1);
  sv_player = a1;
  host_client = svs.clients + 20488 * v11 - 20488;	// host_client = &svs.clients[NUM_FOR_EDICT(fakeClient) - 1];
  *(double *)(host_client + 9656)/* host_client->time */ = host_frametime + sv.time - (double)(unsigned __int8)a8 / 1000.0;
  Q_memset(v9, &v13, 0, 0x34u/* sizeof (usercmd_t) */);
  v21/* command.lightlevel */ = 0;
  pmove = &g_svmove.player_index;
  v12 = *(_DWORD *)(a2 + 4);
  result = *(_DWORD *)(a2 + 8);
  v15 = *(_DWORD *)a2;	// command.viewangles.x = moveAngles.x;
  v16 = v12;	// command.viewangles.y = moveAngles.y;
  v17 = result;	// command.viewangles.z = moveAngles.z;
  v18 = a3;	// command.forwardmove = forwardMoveSpeed;
  v19 = a4;	// command.sidemove = sideMoveSpeed;
  v20 = a5;	// command.upmove = upMoveSpeed;
  v22 = a6;	// command.buttons = buttons;
  v23 = a7;	// command.impulse = impulse;
  v14 = a8;	// command.msec = msecValue;
  SV_PreRunCmd();
  SV_RunCmd(v9, (int)&v13/* &command.lerp_msec */, 0/* randomSeed */);
  sv_player = v10;
  memcpy((void *)(host_client + 9552)/* host_client->lastcmd */, &v13, 0x34u/* sizeof (usercmd_t) */);
  host_client = v9;
  return result;
}
Restored:
Code:
//----- (01D84280) --------------------------------------------------------
void PF_RunPlayerMove_I (edict_t *fakeClient, const float *moveAngles, float forwardMoveSpeed, float sideMoveSpeed, float upMoveSpeed, unsigned short buttons, unsigned char impulse, unsigned char msecValue)
{
	usercmd_t command;

	// Store off the globals.. they're gonna get whacked
	client_t *const temp_host_client (host_client);
	edict_t *const temp_sv_player (sv_player);

	sv_player = fakeClient;

	host_client = &svs.clients[NUM_FOR_EDICT (fakeClient) - 1];

	host_client->time = host_frametime + sv.time - msecValue / 1000.0;

	Q_memset (&command, 0, sizeof (usercmd_t));

	command.lightlevel = 0;
	pmove = &g_svmove.player_index;
	command.viewangles.x = moveAngles.x;
	command.viewangles.y = moveAngles.y;
	command.viewangles.z = moveAngles.z;
	command.forwardmove = forwardMoveSpeed;
	command.sidemove = sideMoveSpeed;
	command.upmove = upMoveSpeed;
	command.buttons = buttons;
	command.impulse = impulse;
	command.msec = msecValue;

	SV_PreRunCmd ();
	SV_RunCmd (&command, 0/* randomSeed */);

	// save off the last good usercmd
	memcpy (&host_client->lastcmd, &command, sizeof (usercmd_t));

	// Restore the globals..
	sv_player = temp_sv_player;
	host_client = temp_host_client;
}
SV_RunCmd() function (only decompiled):
Code:
//----- (01DC0CC0) --------------------------------------------------------
void __usercall SV_RunCmd(int a1<ebx>, int a2/* usercmd_t command */, int a3/* unsigned int random_seed */)
{
  int v3; // edx@3
  float v4; // ST64_4@4
  float v5; // ST1C_4@12
  int v6; // eax@18
  int v7; // eax@19
  int v8; // ST54_4@25
  bool v9; // [sp+Ch] [bp-CCh]@15
  int v10; // [sp+4Ch] [bp-8Ch]@23
  int v11; // [sp+50h] [bp-88h]@23
  int v12; // [sp+54h] [bp-84h]@23
  char v13; // [sp+5Ch] [bp-7Ch]@1
  int v14; // [sp+5Eh] [bp-7Ah]@3
  char v15; // [sp+7Ch] [bp-5Ch]@4
  int v16; // [sp+90h] [bp-48h]@25
  int i; // [sp+94h] [bp-44h]@23
  int v18; // [sp+98h] [bp-40h]@25
  char v19; // [sp+9Ch] [bp-3Ch]@25
  float v20; // [sp+D4h] [bp-4h]@7

  memcpy(&v13, (const void *)a2, 0x34u);
  if ( *(double *)(host_client + 9624) <= realtime )
  {
    v3 = host_client;
    *(_DWORD *)(host_client + 9624) = 0;
    *(_DWORD *)(v3 + 9628) = 0;
    if ( (double)(unsigned __int8)v14 <= 50.0 )
    {
      if ( !*(_DWORD *)(host_client + 9544) )
        SV_SetupMove(host_client);
      gEntityInterface.pfnCmdStart(sv_player, a2, a3);
      v20 = (double)*(_BYTE *)(a2 + 2) * 0.001;
      *(double *)(host_client + 9656) = v20 + *(double *)(host_client + 9656);
      *(double *)(host_client + 9616) = (double)*(_BYTE *)(a2 + 2) / 1000.0 + *(double *)(host_client + 9616);
      if ( *(_BYTE *)(a2 + 32) )
      {
        *(_DWORD *)(sv_player + 516) = *(_BYTE *)(a2 + 32);
        if ( *(_BYTE *)(a2 + 32) == 204 )
          SV_ForceFullClientsUpdate(a1);
      }
      *(_DWORD *)(sv_player + 184) = 0;
      *(_DWORD *)(sv_player + 188) = 0;
      *(_DWORD *)(sv_player + 192) = 0;
      *(_DWORD *)(sv_player + 512) = *(_WORD *)(a2 + 30);
      SV_CheckMovingGround(sv_player, v20);
      *(_DWORD *)(pmove + 80) = *(_DWORD *)(sv_player + 244);
      *(_DWORD *)(pmove + 84) = *(_DWORD *)(sv_player + 248);
      *(_DWORD *)(pmove + 88) = *(_DWORD *)(sv_player + 252);
      if ( !*(_DWORD *)(sv_player + 288) )
      {
        *(_DWORD *)(sv_player + 244) = *(_DWORD *)(a2 + 4);
        *(_DWORD *)(sv_player + 248) = *(_DWORD *)(a2 + 8);
        *(_DWORD *)(sv_player + 252) = *(_DWORD *)(a2 + 12);
      }
      v5 = *(double *)(host_client + 9656);
      SV_PlayerRunPreThink(sv_player, v5);
      SV_PlayerRunThink(sv_player, v20, *(double *)(host_client + 9656));
      if ( Length((float *)(sv_player + 172)) > 0.0 )
      {
        *(_DWORD *)(sv_player + 184) = *(_DWORD *)(sv_player + 172);
        *(_DWORD *)(sv_player + 188) = *(_DWORD *)(sv_player + 176);
        *(_DWORD *)(sv_player + 192) = *(_DWORD *)(sv_player + 180);
      }
      *(_DWORD *)(pmove + 4) = 1;
      *(_DWORD *)(pmove + 8) = *(_DWORD *)svs.maxclients > 1;
      *(float *)(pmove + 12) = 1000.0 * *(double *)(host_client + 9656);
      *(_DWORD *)(pmove + 188) = (*(_DWORD *)(sv_player + 548) & 0x4000) != 0;
      *(_DWORD *)(pmove + 500) = LODWORD(flt_1E8B214);
      *(_DWORD *)(pmove + 504) = *(_DWORD *)(sv_player + 656);
      *(float *)(pmove + 140) = (double)*(signed int *)(sv_player + 684);
      *(_DWORD *)(pmove + 144) = *(_DWORD *)(sv_player + 672);
      *(_DWORD *)(pmove + 148) = *(_DWORD *)(sv_player + 676);
      *(_DWORD *)(pmove + 152) = *(_DWORD *)(sv_player + 688);
      *(_DWORD *)(pmove + 156) = *(_DWORD *)(sv_player + 692);
      *(float *)(pmove + 172) = (double)*(signed int *)(sv_player + 680);
      *(_DWORD *)(pmove + 200) = *(_DWORD *)(sv_player + 700);
      Q_strncpy(pmove + 324592, host_client + 20220, 255);
      *(_BYTE *)(pmove + 324847) = 0;
      *(_DWORD *)(pmove + 92) = *(_DWORD *)(sv_player + 160);
      *(_DWORD *)(pmove + 96) = *(_DWORD *)(sv_player + 164);
      *(_DWORD *)(pmove + 100) = *(_DWORD *)(sv_player + 168);
      *(_DWORD *)(pmove + 104) = *(_DWORD *)(sv_player + 196);
      *(_DWORD *)(pmove + 108) = *(_DWORD *)(sv_player + 200);
      *(_DWORD *)(pmove + 112) = *(_DWORD *)(sv_player + 204);
      *(_DWORD *)(pmove + 68) = *(_DWORD *)(sv_player + 244);
      *(_DWORD *)(pmove + 72) = *(_DWORD *)(sv_player + 248);
      *(_DWORD *)(pmove + 76) = *(_DWORD *)(sv_player + 252);
      *(_DWORD *)(pmove + 116) = *(_DWORD *)(sv_player + 172);
      *(_DWORD *)(pmove + 120) = *(_DWORD *)(sv_player + 176);
      *(_DWORD *)(pmove + 124) = *(_DWORD *)(sv_player + 180);
      *(_DWORD *)(pmove + 128) = *(_DWORD *)(sv_player + 500);
      *(_DWORD *)(pmove + 132) = *(_DWORD *)(sv_player + 504);
      *(_DWORD *)(pmove + 136) = *(_DWORD *)(sv_player + 508);
      *(_DWORD *)(pmove + 160) = *(_DWORD *)(sv_player + 232);
      *(_DWORD *)(pmove + 164) = *(_DWORD *)(sv_player + 236);
      *(_DWORD *)(pmove + 168) = *(_DWORD *)(sv_player + 240);
      *(_DWORD *)(pmove + 212) = *(_DWORD *)(sv_player + 496);
      *(_DWORD *)(pmove + 180) = *(_DWORD *)(sv_player + 408);
      *(_DWORD *)(pmove + 192) = *(_DWORD *)(sv_player + 412);
      *(_DWORD *)(pmove + 196) = *(_DWORD *)(sv_player + 416);
      *(_DWORD *)(pmove + 216) = 0;
      *(_DWORD *)(pmove + 204) = *(_DWORD *)(sv_player + 564);
      memcpy((void *)(pmove + 283736), &v13, 0x34u);
      v9 = *(float *)(sv_player + 480) <= 0.0;
      *(_DWORD *)(pmove + 208) = v9;
      *(_DWORD *)(pmove + 220) = *(_DWORD *)(sv_player + 392);
      *(_DWORD *)(pmove + 184) = *(_DWORD *)(sv_player + 548);
      *(_DWORD *)pmove = NUM_FOR_EDICT(sv_player) - 1;
      *(_DWORD *)(pmove + 508) = *(_DWORD *)(sv_player + 708);
      *(_DWORD *)(pmove + 512) = *(_DWORD *)(sv_player + 712);
      *(_DWORD *)(pmove + 516) = *(_DWORD *)(sv_player + 716);
      *(_DWORD *)(pmove + 520) = *(_DWORD *)(sv_player + 720);
      *(_DWORD *)(pmove + 524) = *(_DWORD *)(sv_player + 724);
      *(_DWORD *)(pmove + 528) = *(_DWORD *)(sv_player + 728);
      *(_DWORD *)(pmove + 532) = *(_DWORD *)(sv_player + 732);
      *(_DWORD *)(pmove + 536) = *(_DWORD *)(sv_player + 736);
      *(_DWORD *)(pmove + 540) = *(_DWORD *)(sv_player + 740);
      *(_DWORD *)(pmove + 544) = *(_DWORD *)(sv_player + 744);
      *(_DWORD *)(pmove + 548) = *(_DWORD *)(sv_player + 748);
      *(_DWORD *)(pmove + 552) = *(_DWORD *)(sv_player + 752);
      *(_DWORD *)(pmove + 556) = *(_DWORD *)(sv_player + 756);
      *(_DWORD *)(pmove + 560) = *(_DWORD *)(sv_player + 760);
      *(_DWORD *)(pmove + 564) = *(_DWORD *)(sv_player + 764);
      *(_DWORD *)(pmove + 568) = *(_DWORD *)(sv_player + 768);
      *(_DWORD *)(pmove + 572) = *(_DWORD *)(sv_player + 772);
      *(_DWORD *)(pmove + 576) = *(_DWORD *)(sv_player + 776);
      *(_DWORD *)(pmove + 580) = *(_DWORD *)(sv_player + 780);
      *(_DWORD *)(pmove + 584) = *(_DWORD *)(sv_player + 784);
      *(_DWORD *)(pmove + 56) = *(_DWORD *)(sv_player + 136);
      *(_DWORD *)(pmove + 60) = *(_DWORD *)(sv_player + 140);
      *(_DWORD *)(pmove + 64) = *(_DWORD *)(sv_player + 144);
      SV_AddLinksToPM((int)&sv_areanodes, pmove + 56);
      *(_DWORD *)(pmove + 16) = LODWORD(v20);
      *(_DWORD *)(pmove + 325040) = 1;
      *(_DWORD *)(pmove + 325044) = PM_SV_PlaySound;
      *(_DWORD *)(pmove + 325048) = PM_SV_TraceTexture;
      *(_DWORD *)(pmove + 325052) = PM_SV_PlaybackEventFull;
      gEntityInterface.pfnPM_Move(pmove, 1);
      *(_DWORD *)(sv_player + 496) = *(_DWORD *)(pmove + 212);
      *(_DWORD *)(sv_player + 408) = *(_DWORD *)(pmove + 180);
      *(_DWORD *)(sv_player + 564) = *(_DWORD *)(pmove + 204);
      *(_DWORD *)(sv_player + 576) = *(_DWORD *)(pmove + 228);
      *(_DWORD *)(sv_player + 580) = *(_DWORD *)(pmove + 232);
      *(_DWORD *)(sv_player + 548) = *(_DWORD *)(pmove + 184);
      *(_DWORD *)(sv_player + 416) = *(_DWORD *)(pmove + 196);
      *(_DWORD *)(sv_player + 392) = *(_DWORD *)(pmove + 220);
      *(_DWORD *)(sv_player + 656) = *(_DWORD *)(pmove + 504);
      *(_DWORD *)(sv_player + 688) = *(_DWORD *)(pmove + 152);
      *(_DWORD *)(sv_player + 500) = *(_DWORD *)(pmove + 128);
      *(_DWORD *)(sv_player + 504) = *(_DWORD *)(pmove + 132);
      *(_DWORD *)(sv_player + 508) = *(_DWORD *)(pmove + 136);
      *(_DWORD *)(sv_player + 196) = *(_DWORD *)(pmove + 104);
      *(_DWORD *)(sv_player + 200) = *(_DWORD *)(pmove + 108);
      *(_DWORD *)(sv_player + 204) = *(_DWORD *)(pmove + 112);
      *(_DWORD *)(sv_player + 232) = *(_DWORD *)(pmove + 160);
      *(_DWORD *)(sv_player + 236) = *(_DWORD *)(pmove + 164);
      *(_DWORD *)(sv_player + 240) = *(_DWORD *)(pmove + 168);
      if ( *(_DWORD *)(pmove + 224) == -1 )
      {
        v7 = *(_DWORD *)(sv_player + 548);
        BYTE1(v7) &= 0xFDu;
        *(_DWORD *)(sv_player + 548) = v7;
      }
      else
      {
        v6 = *(_DWORD *)(sv_player + 548);
        BYTE1(v6) |= 2u;
        *(_DWORD *)(sv_player + 548) = v6;
        *(_DWORD *)(sv_player + 540) = EDICT_NUM(*(_DWORD *)(pmove
                                                                 + 224 * *(_DWORD *)(pmove + 224)
                                                                 + 672));
      }
      *(_DWORD *)(sv_player + 136) = *(_DWORD *)(pmove + 56);
      *(_DWORD *)(sv_player + 140) = *(_DWORD *)(pmove + 60);
      *(_DWORD *)(sv_player + 144) = *(_DWORD *)(pmove + 64);
      *(_DWORD *)(sv_player + 160) = *(_DWORD *)(pmove + 92);
      *(_DWORD *)(sv_player + 164) = *(_DWORD *)(pmove + 96);
      *(_DWORD *)(sv_player + 168) = *(_DWORD *)(pmove + 100);
      *(_DWORD *)(sv_player + 172) = *(_DWORD *)(pmove + 116);
      *(_DWORD *)(sv_player + 176) = *(_DWORD *)(pmove + 120);
      *(_DWORD *)(sv_player + 180) = *(_DWORD *)(pmove + 124);
      if ( !*(_DWORD *)(sv_player + 288) )
      {
        *(_DWORD *)(sv_player + 244) = *(_DWORD *)(pmove + 68);
        *(_DWORD *)(sv_player + 248) = *(_DWORD *)(pmove + 72);
        *(_DWORD *)(sv_player + 252) = *(_DWORD *)(pmove + 76);
        *(_DWORD *)(sv_player + 208) = *(_DWORD *)(pmove + 68);
        *(_DWORD *)(sv_player + 212) = *(_DWORD *)(pmove + 72);
        *(_DWORD *)(sv_player + 216) = *(_DWORD *)(pmove + 76);
        *(float *)(sv_player + 208) = -*(float *)(pmove + 68) / 3.0;
      }
      *(_DWORD *)(sv_player + 672) = *(_DWORD *)(pmove + 144);
      *(_DWORD *)(sv_player + 684) = (signed __int64)*(float *)(pmove + 140);
      *(_DWORD *)(sv_player + 676) = *(_DWORD *)(pmove + 148);
      *(_DWORD *)(sv_player + 692) = *(_DWORD *)(pmove + 156);
      *(_DWORD *)(sv_player + 680) = (signed __int64)*(float *)(pmove + 172);
      *(_DWORD *)(sv_player + 700) = *(_WORD *)(pmove + 283766);
      *(_DWORD *)(sv_player + 708) = *(_DWORD *)(pmove + 508);
      *(_DWORD *)(sv_player + 712) = *(_DWORD *)(pmove + 512);
      *(_DWORD *)(sv_player + 716) = *(_DWORD *)(pmove + 516);
      *(_DWORD *)(sv_player + 720) = *(_DWORD *)(pmove + 520);
      *(_DWORD *)(sv_player + 724) = *(_DWORD *)(pmove + 524);
      *(_DWORD *)(sv_player + 728) = *(_DWORD *)(pmove + 528);
      *(_DWORD *)(sv_player + 732) = *(_DWORD *)(pmove + 532);
      *(_DWORD *)(sv_player + 736) = *(_DWORD *)(pmove + 536);
      *(_DWORD *)(sv_player + 740) = *(_DWORD *)(pmove + 540);
      *(_DWORD *)(sv_player + 744) = *(_DWORD *)(pmove + 544);
      *(_DWORD *)(sv_player + 748) = *(_DWORD *)(pmove + 548);
      *(_DWORD *)(sv_player + 752) = *(_DWORD *)(pmove + 552);
      *(_DWORD *)(sv_player + 756) = *(_DWORD *)(pmove + 556);
      *(_DWORD *)(sv_player + 760) = *(_DWORD *)(pmove + 560);
      *(_DWORD *)(sv_player + 764) = *(_DWORD *)(pmove + 564);
      *(_DWORD *)(sv_player + 768) = *(_DWORD *)(pmove + 568);
      *(_DWORD *)(sv_player + 772) = *(_DWORD *)(pmove + 572);
      *(_DWORD *)(sv_player + 776) = *(_DWORD *)(pmove + 576);
      *(_DWORD *)(sv_player + 780) = *(_DWORD *)(pmove + 580);
      *(_DWORD *)(sv_player + 784) = *(_DWORD *)(pmove + 584);
      SetMinMaxSize(
        sv_player,
        (int)&dword_1E7E79C[3 * *(_DWORD *)(pmove + 188)],
        (int)&dword_1E7E7CC[3 * *(_DWORD *)(pmove + 188)]);
      if ( *(_DWORD *)(*(_DWORD *)(host_client + 19356) + 396) )
      {
        SV_LinkEdict(a1, sv_player, 1);
        v10 = *(_DWORD *)(sv_player + 160);
        v11 = *(_DWORD *)(sv_player + 164);
        v12 = *(_DWORD *)(sv_player + 168);
        for ( i = 0; i < *(_DWORD *)(pmove + 283788); ++i )
        {
          v16 = *(_DWORD *)(pmove + 224 * *(_DWORD *)(pmove + 68 * i + 283840) + 672);
          v18 = EDICT_NUM(v16);
          v8 = pmove + 68 * i + 283792;
          SV_ConvertPMTrace((int)&v19, pmove + 68 * i + 283792, v18);
          *(_DWORD *)(sv_player + 160) = *(_DWORD *)(v8 + 52);
          *(_DWORD *)(sv_player + 164) = *(_DWORD *)(v8 + 56);
          *(_DWORD *)(sv_player + 168) = *(_DWORD *)(v8 + 60);
          SV_Impact(v18, sv_player, (int)&v19);
        }
        *(_DWORD *)(sv_player + 160) = v10;
        *(_DWORD *)(sv_player + 164) = v11;
        *(_DWORD *)(sv_player + 168) = v12;
      }
      gGlobalVariables.time = *(double *)(host_client + 9656);
      gGlobalVariables.frametime = v20;
      gEntityInterface.pfnPlayerPostThink(sv_player);
      gEntityInterface.pfnCmdEnd(sv_player);
      if ( !*(_DWORD *)(host_client + 9544) )
        SV_RestoreMove(host_client);
    }
    else
    {
      v4 = (double)*(_BYTE *)(a2 + 2);
      LOBYTE(v14) = (signed __int64)(v4 / 2.0);
      SV_RunCmd(&v13, a3);
      LOBYTE(v14) = (signed __int64)(v4 / 2.0);
      v15 = 0;
      SV_RunCmd(&v13, a3);
    }
  }
  else
  {
    *(double *)(host_client + 9616) = (double)*(_BYTE *)(a2 + 2) / 1000.0 + *(double *)(host_client + 9616);
  }
}
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#6)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 15-02-2011

I'm just curious, how you did get the "restored" source code?
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#7)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 16-02-2011

I just use IDA pro + hex rays decompiler, quake1 sources, HL2 sources (which leaked), my small brain to compare all of that

P.S. Look here
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#8)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 19-02-2011

Ok, thats explains it.

Anyway lets go a bit on topic, the random_seed value you randomize - is the way with RANDOM_LONG() the best? I think that there should be some specific algorithm for that and that in the begining when you are not moving, aimed and shoot, the bullet should go in the center of your weapon peep-sight or I got it wrong again somewhere?
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#9)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 20-02-2011

Sorry, but with my knowledge of English language I do not want a long explanation about how there shots randomization in CS.
I want to tell only one that value of a variable random_seed simply increases by unit with each frame - for the real client.
Checks about that is whether the player runs, sits or still something occur in mp.dll in a function CSomeWeapon:: PrimaryAttack.

P.S. In previous post I'll gave to you link where you can find answer to you question. (look at wpn_deagle.cpp for example)
P.S.S. function CBaseEntity::FireBullets3 takes all the information about the shot (damage, distance, penetrating power, spread, random_seed, ...) and on the basis of all it calculates the final vector where player will shoot. This function (a bit modified) you can found in HL2SRC.
  
Reply With Quote
Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable)
Old
  (#10)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Make BOT more client-like (Changing CBasePlayer::random_seed variable) - 17-03-2012

Quote:
Originally Posted by Immortal_BLG View Post
I just use IDA pro + hex rays decompiler, quake1 sources, HL2 sources (which leaked), my small brain to compare all of that

P.S. Look here
There is no download link. Or I'm blinded?
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com