.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Something about msecval (http://forums.bots-united.com/showthread.php?t=344)

Bert 13-01-2004 20:47

Re: Something about msecval
 
[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]

botmeister 13-01-2004 21:19

Re: Something about msecval
 
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.

Pierre-Marie Baty 13-01-2004 23:42

Re: Something about msecval
 
@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 ?

botmeister 14-01-2004 05:15

Re: Something about msecval
 
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?

Pierre-Marie Baty 14-01-2004 05:48

Re: Something about msecval
 
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.)

botmeister 15-01-2004 06:20

Re: Something about msecval
 
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.

strelok 15-01-2004 06:56

Re: Something about msecval
 
[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.

Pierre-Marie Baty 15-01-2004 11:38

Re: Something about msecval
 
@ 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.

strelok 23-01-2004 06:39

Re: Something about msecval
 
2 Pierre-Marie Baty: It not a problem cs1.6. In cs1.5 all too most, but time of freezing is longer.

Pierre-Marie Baty 23-01-2004 07:41

Re: Something about msecval
 
curious...
does it occur also if you set the mp_freezetime CVAR to 0 ?


All times are GMT +2. The time now is 04:04.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.