.:: 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: Something about msecval
Old
  (#11)
Bert
Member
 
Status: Offline
Posts: 11
Join Date: Jan 2004
Default Re: Something about msecval - 13-01-2004

[Off-topic]
I think there are alot of tiny bots out there on the net, afterall with Botman's template code and readme, it's amazingly easy to get a basic bot in a mod.
As for my bot, I released the first version a month ago or so, but it's nothing more than a modified HPBbot. It's for the mod Science and Industry (www.planethalflife.com/si) and it's more like a "Can I pull it off" release. There's some errors in the logic (Bots really like to kill scis) and it only comes with waypoints for 1 map. And it's not fully compatible with the latest version (97b). Try it if you like, but don't expect too much http://users.pandora.be/piele/MBFbot.zip . These days I seem to be stuck in an endless redesign cycle, I simply can not decide on what's the best way to handle things, so I keep changing stuff around :/
[/Offtopic]
  
Reply With Quote
Re: Something about msecval
Old
  (#12)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: Something about msecval - 13-01-2004

Quote:
Originally Posted by Pierre-Marie Baty
botmeister, your method will force the bots to move as fast as can be, whether they carry heavy weapons or not. Have you tried hooking pfnSetClientMaxSpeed() and set each bot's max speed to this value ?
Thanks again, I'll give this one a try.


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut
  
Reply With Quote
Re: Something about msecval
Old
  (#13)
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: Something about msecval - 14-01-2004

@Bert: Okay, well, good luck, and btw when you come up with a "production release" of your bot we can make you part of Bots United perhaps (website, forum, etc.)

@botmeister: I find it curious that you never did. It's the way to do things, all CS bots hook pfnSetClientMaxSpeed() actually ! How come you never tried that ?



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: Something about msecval
Old
  (#14)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: Something about msecval - 14-01-2004

Quote:
I find it curious that you never did. It's the way to do things, all CS bots hook pfnSetClientMaxSpeed() actually ! How come you never tried that ?
I never did because I have not built much of a bot. Aside from the server management stuff, what I've done is enhanced existing bots which only goes so far.

I'm not sure how you would use the function just yet
void (*pfnSetClientMaxspeed) (const edict_t *pEdict, float fNewMaxspeed);

Can you give me a hint or two to move things along?


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut
  
Reply With Quote
Re: Something about msecval
Old
  (#15)
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: Something about msecval - 14-01-2004

in your array of bots, have a variable for each bot to store its current max speed. When pfnSetClientMaxspeed() is called upon a bot entity, send fNewMaxspeed to this variable. And when pfnRunPlayerMove() happens for the same bot, use this variable as the move_speed and strafe_speed parameter (if you want to make the bot run or strafe full speed, else divide it by two.)



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: Something about msecval
Old
  (#16)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: Something about msecval - 15-01-2004

Quote:
Originally Posted by Pierre-Marie Baty
in your array of bots, have a variable for each bot to store its current max speed. When pfnSetClientMaxspeed() is called upon a bot entity, send fNewMaxspeed to this variable. And when pfnRunPlayerMove() happens for the same bot, use this variable as the move_speed and strafe_speed parameter (if you want to make the bot run or strafe full speed, else divide it by two.)
Ok, from what I understand, pfnSetClientMaxspeed() is used to set the speed of a bot. What I'd need it for is to get the speed of a bot, since I do not know what the bots speed should be. So, are you saying that I hook onto the function, and whenever it gets called I grab whatever was passed to the function as the bots new speed?

Anyhow, what I'm doing is simply passing on everything I get from the pfnRunPlayerMove() hook which was called by the actual bot mod, so I don't understand why on some servers the bots run around real fast. I'll have another look at my code, perhaps there's a problem with passing on the same speeds all the time.


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut
  
Reply With Quote
Re: Something about msecval
Old
  (#17)
strelok
Member
 
Status: Offline
Posts: 26
Join Date: Jan 2004
Default Re: Something about msecval - 15-01-2004

[QUOTE=Are you sure your problem comes from here ?[/QUOTE]
And if I use this code:

if (pBot->msecdel <= gpGlobals->time) {
pBot->msecdel = gpGlobals->time + 1.0;
if (pBot->msecnum > 0)
pBot->msecval = 800/pBot->msecnum;
pBot->msecnum = 0;
}
else
pBot->msecnum++;
if (pBot->msecval < 1)
pBot->msecval = 1;
if (pBot->msecval > 100)
pBot->msecval = 100;

bots move slowly (I with primary weapon run faster, than they with a knife). Also do not freeze.
  
Reply With Quote
Re: Something about msecval
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: Something about msecval - 15-01-2004

@ botmeister: each time a player switches to a new weapon, his run speed changes. The function that the MOD code calls in the engine to change the client's max speed is SetClientMaxSpeed(). So yes, grab the value that is passed, and use it for your bots ; i.e. do this:
Code:
void pfnSetClientMaxspeed (const edict_t *pEdict, float fNewMaxspeed)
{
   int client_index = ENTINDEX ((edict_t *) pEdict) - 1; // get client index
 
   // is this message for a bot ? if so, remember its max speed
   if (players[client_index].is_racc_bot)
	  players[client_index].Bot.BotMove.f_max_speed = fNewMaxspeed;
 
   (*g_engfuncs.pfnSetClientMaxspeed) (pEdict, fNewMaxspeed);
}
@ Strelok: it is *normal* that the msec code has some influence on the bot's speed, but your problem doesn't come from here, because the msec code is *correct*. You should not change it. Instead, check for the bot's max speed. There is a problem in CS 1.6 where the player's max speed isn't set at round start (max_speed is initially 0 because pfnSetClientMaxSpeed() isn't called at round start like in 1.5) but it becomes set only when players switch to a new weapon. It may explain why your bots don't move as long as they don't change weapons.



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: Something about msecval
Old
  (#19)
strelok
Member
 
Status: Offline
Posts: 26
Join Date: Jan 2004
Default Re: Something about msecval - 23-01-2004

2 Pierre-Marie Baty: It not a problem cs1.6. In cs1.5 all too most, but time of freezing is longer.
  
Reply With Quote
Re: Something about msecval
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: Something about msecval - 23-01-2004

curious...
does it occur also if you set the mp_freezetime CVAR to 0 ?



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
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