.:: 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
Re: Correct walk speed?
Old
  (#11)
Cpl. Shrike
ShrikeBot Coder/Moderator
 
Cpl. Shrike's Avatar
 
Status: Offline
Posts: 550
Join Date: Mar 2004
Location: The Netherlands
Default Re: Correct walk speed? - 06-04-2004

I don't know that from the top of my head.
I'll post the messages later today.
  
Reply With Quote
Re: Correct walk speed?
Old
  (#12)
Cpl. Shrike
ShrikeBot Coder/Moderator
 
Cpl. Shrike's Avatar
 
Status: Offline
Posts: 550
Join Date: Mar 2004
Location: The Netherlands
Default Re: Correct walk speed? - 06-04-2004

Code:
  void pfnSetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed)
  {
  	int client_index;
  	if (debug_engine) { fp=fopen("HPB_bot.txt","a");
  	fprintf(fp,"pfnSetClientMaxspeed: edict=%x speed=%f\n",pEdict,fNewMaxspeed); fclose(fp); }
  
  	for (client_index = 1; client_index < MAX_CLIENTS; client_index++)
  	{
  		if (clients[client_index].is_used)
  		clients[client_index].max_speed = fNewMaxspeed;
  	}
  	(*g_engfuncs.pfnSetClientMaxspeed)(pEdict, fNewMaxspeed);
  }
This is what im using for TOD and DOD.
Although TOD is spamming the system continiosly with the pfnSetClientMaxspeed, DOD only sends it when the clients speed changes.
In dod the speed also depends what gun and if the gun is deployed.
In that case there are more speeds to recorded for each class and gun. crouching etc etc.

=================
edit.

I recorded only the main speeds like when a client crouches.
It may varie a little but when the speed is below a certain level.
The game dll knows it's slow enuf to stop footstep sounds.
Or when the speed is low enuf the game knows it can't move because it is like zoomed or deployed.
However im not sure fo CS code. (as i don't code for cs)

Last edited by Cpl. Shrike; 06-04-2004 at 22:07..
  
Reply With Quote
Re: Correct walk speed?
Old
  (#13)
Terran
Member
 
Terran's Avatar
 
Status: Offline
Posts: 431
Join Date: Jan 2004
Default Re: Correct walk speed? - 06-04-2004

There is a CVAR named cl_movespeedkey which influences the speed while you walk. It defaults to 0.520 which might be a faktor to the normal speed.
  
Reply With Quote
Re: Correct walk speed?
Old
  (#14)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Correct walk speed? - 06-04-2004

@Stefan: never forget your bot is a SERVER-SIDE bot ! Hence you can completely drop off the hooking for Health, Battery, WeapPickup messages and such, because you have direct access to them whenever you want in pEdict->v.health, pEdict->v.armorvalue and pEdict->v.weapons respectively !

In CS 1.6, the max speed is available in pEdict->v.maxspeed
In CS 1.5, the max speed was sent to the clients through a pfnSetClientMaxSpeed() call.

Hence the fix is to always look in pEdict->v.maxspeed, and use pfnSetClientMaxSpeed() like this:
Code:
void SetClientMaxspeed (const edict_t *pEdict, float fNewMaxspeed)
{
   // this function tells the client whose player entity is pointed to by pEdict to update its
   // maximal running speed to fNewMaxspeed. I don't really get why this function is necessary,
   // since the entvars of an entity already feature a "maxspeed" variable, which must be
   // trackable in the network pack. There are a lot of weirdosities like this one in the Half-
   // Life engine.
 
   // is this client a bot ?
   if (players[ENTINDEX ((edict_t *) pEdict) - 1].is_racc_bot)
	  ((edict_t *) pEdict)->v.maxspeed = fNewMaxspeed; // update its max speed (CS 1.5 doesn't)
 
#ifdef METAMOD
   RETURN_META (MRES_IGNORED);
#else
   (*g_engfuncs.pfnSetClientMaxSpeed) (pEdict, fNewMaxspeed);
#endif
}



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Correct walk speed?
Old
  (#15)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 07-04-2004

omg. You are right. I always forget that when coding for CS 1.6. I got so used to hooking and such, i forgot its now the other way around. I checked my code and saw that i do not use direct accessing when running RB for CS 1.6. I will fix them immidiatly and then hope it works i'll let ya know.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Correct walk speed?
Old
  (#16)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 07-04-2004

yeeeeeeeeeeeeeeeeeehaw, fixed! This is l33t. THanks guys!


ow, did i already mentioned it worked?


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Correct walk speed?
Old
  (#17)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Correct walk speed? - 08-04-2004

Quote:
if (players[ENTINDEX ((edict_t *) pEdict) - 1].is_racc_bot)
I don't think this is necessary; you can use this for all players (whether it's a bot or not) without problems

Last edited by Whistler; 08-04-2004 at 05:48..
  
Reply With Quote
Re: Correct walk speed?
Old
  (#18)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Correct walk speed? - 08-04-2004

Good point indeed Whistler !



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Correct walk speed?
Old
  (#19)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Correct walk speed? - 19-04-2004

I've found this in Q1 engine code:
Code:
 	if (in_speed.state & 1)
 		speed = cl_movespeedkey.value;
 	else
 		speed = 1;
...and about the cl_movespeedkey thing:

Code:
 cvar_t	cl_movespeedkey = {"cl_movespeedkey","2.0"};
Note: the shift key in Quake1 is speed UP (not speed down) which is different from HL.

In CS the default value of cl_movespeedkey CVAR is usually 0.52, but the plain HL is 0.3. For each MOD you can type "cl_movespeedkey" in the console and you'll get the value. Note you can't use CVAR_GET_FLOAT("cl_movespeedkey") in the bot code because this CVAR is client-side.
  
Reply With Quote
Re: Correct walk speed?
Old
  (#20)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Correct walk speed? - 19-04-2004

aha, so that would mean:
Code:
if (pEdict->v.button & IN_RUN)
move_speed = pEdict->v.maxspeed * CVAR_GET_FLOAT ("cl_movespeedkey");
am I right ?

*edit* I'm dumb as f*ck sometimes, I didn't read Whistler's post until the end. DOH! Okay so that would need a #define for each MOD the bot supports, or perhaps a bot config file setting then. Gwaaah.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 19-04-2004 at 16:14..
  
Reply With Quote
Reply


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

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