.:: 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
Correct walk speed?
Old
  (#1)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Correct walk speed? - 05-04-2004

I have noticed that simply deviding the current movespeed by 2 does NOT give you the actual walk speed used by CS. I can even hear my bots walk while they move slower , and they say in debug console that they are 'walking'.

Currently i have this:
Code:
  // walk only when NOT holding duck (is same as walking, combination makes bot super slow)
  if (f_walk_time > gpGlobals->time && !(pEdict->v.button & IN_DUCK))
	f_move_speed = f_max_speed / 2.0;
This makes bots walk slower, true, but it does not make them walk as slow as they should! DId anyone already fixed this? Or perhaps i am using 'out-dated' info?


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
  (#2)
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? - 05-04-2004

I am using something similar but I always suspected it was wrong too... glad to be certain of it at last.

What you can do is to use PMTools to print your player's velocity when you're running and when you're walking, using different weapons, and see if one is always the half of the other (and if not, what fraction of it).

In order to keep pressing the forward key when you're in the console, enter "+forward" in the console. When you want to stop going forward, enter "-forward". Same for walking. You can use this to check your player's velocity while in movement.

*edit* P.S: be sure to do this when you're on a flat ground.



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; 05-04-2004 at 23:44..
  
Reply With Quote
Re: Correct walk speed?
Old
  (#3)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 06-04-2004

I have run a little test:

Pistol/Knife:
Running speed = 250
Walking = 130

M4A1
Running speed = 230
Walking = 125

MP5
Running speed = 250
Walking = 130

There is no simple 'devide to' formula in this one. You could do with the MP5 and such , devide by 1.913 or something, but then it would not match with the M4A1

I bet there are different walk speeds for all weapons.


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
  (#4)
KickBot
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2004
Default Re: Correct walk speed? - 06-04-2004

When I tried to make a bot for cs1.5 I got into this problem also.
I did experiments with the player and came up with this:
Code:
float ABotBody::BodySpeed2RealSpeed( BODY_SPEED s, float flMaxSpeed ) const
{
	switch (s)
	{
		case BODYSPEED_STAND: 
			return 0.0f;
		case BODYSPEED_WALK:
			//Experiments on human player with CS1.5 gives these velocities:
			//Pistol			  Run:250  Walk:130
			//Knife			   Run:260  Walk:135
			//Kalash+Armor&Helmet Run:221  Walk:114   
			//so it seems the formula is linear and integer:
			//  Walk = (int)Run/2 + (int)(Run/50).
			return (float) (((int)flMaxSpeed)/2 + ((int)flMaxSpeed)/50);
		case BODYSPEED_RUN:
		default:
			return flMaxSpeed;
	}
}
(crap I use DevC++ ide indentation and had to redo it there by hand...)

It semeed like a good approximation but did not investigate much.
IIRC casting to int before the divisions was important and more accurate than using floats.
The thing is you have to always keep track of the actual max speed (passed as a parameter here flMaxSpeed). I don't remember if intercepting engine's pfnSetClientMaxspeed always worked or not. Thanks I don't have this kind of variable maxspeed problems in IOS

Hope this helps.
  
Reply With Quote
Re: Correct walk speed?
Old
  (#5)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 06-04-2004

i have tried your code, and it also lets the bots walk slow. But the strange thing is, you can still hear this player walking. I think its a bug in CS or something. THe bots 'walk hearing speed' is faster then the actual walk animation.


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
  (#6)
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

What i did is this.

I checked out which speed the game dll assigns to players when,
walking, croucing, proneing, running, walking slow

Then i used those speeds to give to the bots.

So instead of deviding the max_speeds.
I assign speeds the game.dll would do.

That way they move the same speed as clients do
And the footstep sounds will be fixed then also.
Cos the game.dll checks for client move speed and sets evironmental sounds to the player walking. running. etc etc.
  
Reply With Quote
Re: Correct walk speed?
Old
  (#7)
KickBot
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2004
Default Re: Correct walk speed? - 06-04-2004

Well the safest way would be to record all speeds for the player in a big table to have a relation [equipment] -> {speeds}, because in CS speed depends on your equipment, so you'll have to measure every combination possible...

Stefan IIRC you also have to set the proper buttons pushed or released like a player would do (IN_RUN etc...). Just hang a minute I'll see if I can resurect my bot and check the sound thing under CS 1.5...
Edit: Ok. The bots are walking and don't make walking sound and are playing the proper animation. At least with the starting equipment. Maybe my trick doesn't work for all kind of equipment or the version of CS you are running, dunno. In addition I have the following code to make sure the right walk buttons are pressed, just before sending the orders to the engine:
Code:
if (m_IdealSpeed == BODYSPEED_WALK)	 m_ActButtons &= (~IN_RUN);
else if (m_IdealSpeed == BODYSPEED_RUN) m_ActButtons |= IN_RUN;
If this still doesn't work then I can't help you more since I can't test equipment with my unfinished cs 1.5 bot sorry

Last edited by KickBot; 06-04-2004 at 14:24..
  
Reply With Quote
Re: Correct walk speed?
Old
  (#8)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 06-04-2004

In CS 1.5 normally the players would recieve their max speed from the game dll. In CS 1.6 it seems not to work that well anymore. I also found some glitches with health updates too. Anyway, i am going to try this 'IN_RUN' thingy and let you know if 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
  (#9)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 06-04-2004

i have this code:
Code:
  // walk only when NOT holding duck (is same as walking, combination makes bot super slow)
  if (f_walk_time > gpGlobals->time && !(pEdict->v.button & IN_DUCK))  
  {
   // From "KickBot"
   //	return (float) (((int)flMaxSpeed)/2 + ((int)flMaxSpeed)/50);
   //OLD: f_move_speed = f_max_speed / 2.0; // this is not correct
   
   pEdict->v.button &= (~IN_RUN);
   f_move_speed = (float) (((int)f_max_speed)/2 + ((int)f_max_speed)/50);
  }
The walk speed is slower, i don't know if its correct, but i assume that KickBots speed calculation is better then the simple "devide by 2" thingy. yet, i still hear faster footsteps by bots. Its like the animation is not set right?


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
  (#10)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Correct walk speed? - 06-04-2004

Quote:
Originally Posted by Cpl. Shrike
What i did is this.

I checked out which speed the game dll assigns to players when,
walking, croucing, proneing, running, walking slow

Then i used those speeds to give to the bots.

So instead of deviding the max_speeds.
I assign speeds the game.dll would do.

That way they move the same speed as clients do
And the footstep sounds will be fixed then also.
Cos the game.dll checks for client move speed and sets evironmental sounds to the player walking. running. etc etc.
Hmm, perhaps you also know what message is sent when the speed is changed? I'll dig into this too, but if you know it by hearth it might help. I am going to 'investigate' this a bit more with the PMTools. This is very strange!


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
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