.:: 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)

strelok 13-01-2004 08:02

Something about msecval
 
Why, when I use this code (by Count Floyd):

if (pBot->msecdel <= gpGlobals->time)
{
pBot->msecdel = gpGlobals->time + 0.5;
if (pBot->msecnum > 0)
pBot->msecval = 450.0/pBot->msecnum;
pBot->msecnum = 0;
}
else
pBot->msecnum++;
if (pBot->msecval < 1) // don't allow msec to be less than 1...
pBot->msecval = 1;

if (pBot->msecval > 100) // ...or greater than 100
pBot->msecval = 100;

my bots freeze (in the beginning of a round) for some seconds?

Pierre-Marie Baty 13-01-2004 08:40

Re: Something about msecval
 
This code is Rich "TheFatal" Whitehouse's method to estimate the duration of the next frame, in order to predict how long the pfnRunPlayerMove call for the movement of the bots should last. It looks correct, I find it strange that it could cause you trouble. Are you sure your problem comes from here ?

Anyway, there are several other methods to estimate the frame duration. The simplest one is to use the time difference between previous_time and gpGlobals->time in StartFrame(). But it is best to filter this value with time, and that's the purpose of msecnum and msecdel.

koraX 13-01-2004 09:16

Re: Something about msecval
 
PMB is right, This piece of code should not cause errors. I'm using it too.

botmeister 13-01-2004 10:09

Re: Something about msecval
 
Well, I've had poor results with this code, but I don't think it is the code that's the problem.

For example, I have two dedicated servers, both ar erunning realbot WIP#6 (and previously RB:AI ver 1.0). One server has the bots running around just slightly faster than they should, the other server has the bots running WAY faster than they should (2 or 3 x faster).

When I tried adding my own prototype bot into a game, I got the same problem - a bot that moved around way too fast depending on the server.

What i ended up doing, is setting the max speed of the bot entity to sv_maxspeed and that fixed the problem. I've added this "fix" to my bot manager (to be released soon), but a real solution to the problem should be found.

I posted this problem in botmans forum but no one had anything to offer at the time.

Pierre-Marie Baty 13-01-2004 17:36

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

Bert 13-01-2004 18:19

Re: Something about msecval
 
I hook pfnSetClientMaxSpeed() and my bots move at the correct speed. I also use The Fatal's msec code, and I haven't noticed any problems with it.

Cheeseh 13-01-2004 18:54

Re: Something about msecval
 
Isn't this not the problem in CS where the bots angles overflow when they spawn? You should know all about that PM :D

edit: may aswell explain some:

If you are using botmans template, if the bots try to move more than 10 degrees (I think, maybe its 20) they stop and try to turn. If they're angles have overflown this might jumble up the bots interpretation and are not turning properly, meaning they will never turn the 10 degrees (or whatever) and will not move.

Use BotFixIdealAngles() function when a bot spawns.

.. or is It IdealYaw()...

Something like that... I don't use those functions anymore :D

Pierre-Marie Baty 13-01-2004 19:05

Re: Something about msecval
 
<offtopic>
how come there are a lot of bot developers in here and we never heard of their bots ? o_O
@Bert: You have an URL for your bot ? :)
</offtopic>

Pierre-Marie Baty 13-01-2004 19:08

Re: Something about msecval
 
@Cheeseh: Strelok is using Count Floyd's code, and CF obviously fixed this angle problems for quite a time already :)

Cheeseh 13-01-2004 19:12

Re: Something about msecval
 
Alright, well maybe they are just stopping to buy stuff eh? :p I haven't looked at CF's code, if you can debug, break when their move speed is 0 and see whats making it 0.


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

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