.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Releases, Installers, Docs & Coding (http://forums.bots-united.com/forumdisplay.php?f=48)
-   -   podbot grenade throwing bug (http://forums.bots-united.com/showthread.php?t=1527)

Whistler 28-04-2004 10:12

podbot grenade throwing bug
 
I've found this bug is still not fixed...

in the VecCheckToss() function:
Code:

    if (vecMidPoint.z < vecSpot2.z) // VERY BIG FAT BUG !
    {
          // to not enough space, fail
          return g_vecZero;
    }
 
    // How high should the grenade travel to reach the apex
    float distance1 = (vecMidPoint.z - vecSpot1.z);
    float distance2 = (vecMidPoint.z - vecSpot2.z);
 
    // How long will it take for the grenade to travel this distance
    float time1 = sqrt( distance1 / (0.5 * flGravity) );
    float time2 = sqrt( distance2 / (0.5 * flGravity) );

...Count Floyd only checks the vecSpot2.z here, which is wrong. We should check vecSpot1.z as well. Otherwise the following sqrt() will just eat a lot of negative values. I don't know what result this will cause (it doesn't crash in MSVC 6, but crashes in Borland Compiler and freezes in Visual Studio .NET beta during the following traceline).

Pierre-Marie Baty 28-04-2004 10:54

Re: podbot grenade throwing bug
 
Good one Whistler :)
You'll tell me I should have checked the YaPB source... and you'd be right :D

@$3.1415rin 28-04-2004 17:19

Re: podbot grenade throwing bug
 
it's not CF not checking that one, but valve, right ?

the negative root produces an NaN I think, so the following calculations will be invalid.

PS: just looked it up and it's already fixed there. so maybe I did it, or a later SDK version from valve had fixed the bug.

[NvT]_KaszpiR_ 24-05-2004 10:03

Re: podbot grenade throwing bug
 
hmm sthill noticing in RC 2.1 bots are throwing nades stangely (not mch, and usually wih suicidal effect)

g4s 28-05-2004 01:14

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by [NvT]_KaszpiR_
hmm sthill noticing in RC 2.1 bots are throwing nades stangely (not mch, and usually wih suicidal effect)

yes, and thats really funny indeed.
I saw two guys walking in a same line and stuck at a point. when they see an enemy, they pull out nades at the same time, turned around and threw towards the wall. and then nades came back to them...

sPlOrYgOn 28-05-2004 01:16

Re: podbot grenade throwing bug
 
yea we need better grenade throwing algorithms :D

Huntkillaz 28-05-2004 03:14

Re: podbot grenade throwing bug
 
here's my 2cents on g throwing based on playing the cs wc3 mod as orc:


1) if enemy is near u (easy to implement)

if the enemy is near u ie in visible range up clos or a bit off here's what u do


a) up close ....when up close ..face to face u gotta watch them ..

if enemy seems to move left take it's current distance and add distnce wise what u think will be the time when the gren explodes it should land at enemy's feet...when it blows

same for the right....

if enemy is coming towards u throw it at ur feet and start moving away from it...any direction that where u was standing is best :)

if enemy is going away from u ....u'll have to calculate the distance backwards but the nade has to be thrown at an angle to achieve this since it'll move in an arc.

b) far..bascially just aim at them or thier predicted position have to use similar startegy as when enemy is going away from u...

2) don't know where the enemy is.....i was thinking if it was possible that we could probably use the danger pos...to help..basically the most dangerous areas with alot of player n enemy collsions can be used as target positions for nades .....and camp spots also using walls for rebounds

----edit---
and u can talk to two mask (bot n metamod coding forum he has some posts) on grenade detection for the victim about what he's done....if he'll want to tell ;)

sPlOrYgOn 28-05-2004 03:39

Re: podbot grenade throwing bug
 
yes thats basicly how everyone throws nades..
the problem is with calculating how high to aim to make it reach the guy and it seem that when that is calculated it is way off.. so off that they end up throwing a nade in the wrong direction...

Huntkillaz 28-05-2004 03:45

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by sPlOrYgOn
yes thats basicly how everyone throws nades..
the problem is with calculating how high to aim to make it reach the guy and it seem that when that is calculated it is way off.. so off that they end up throwing a nade in the wrong direction...

then the bug is a timing issue....but if what i had just said that they use the pos of the enemy at a specific time frame then the nade would be not way off but close by...i think that there's something funny going on at the either thier calculating the pos

sPlOrYgOn 28-05-2004 03:48

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by Huntkillaz
then the bug is a timing issue....but if what i had just said that they use the pos of the enemy at a specific time frame then the nade would be not way off but close by...i think that there's something funny going on at the either thier calculating the pos

nope not a time issue..
it's an aiming issue..
more like a calculating aiming height issue or something like that..

[NvT]_KaszpiR_ 28-05-2004 09:40

Re: podbot grenade throwing bug
 
i experienced usually this:
bot wants to throw grenade
he stops and gets the nade to hand
then he spins on the place he is and finally trows grenade on the floor (or any stupid direction)
and usually nade lands exackly under his legs

and boom :D


they should trow nades faster, and i was thinking if it is possible to write simple algorithm so that bot would predict at least one or 2 nade bumps from the wall or ceiling

KWo 28-05-2004 11:15

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by [NvT]_KaszpiR_
they should trow nades faster, and i was thinking if it is possible to write simple algorithm so that bot would predict at least one or 2 nade bumps from the wall or ceiling

You are a coder - so You can help in this. Do it! :D

Huntkillaz 29-05-2004 05:04

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by [NvT]_KaszpiR_
i experienced usually this:
bot wants to throw grenade
he stops and gets the nade to hand
then he spins on the place he is and finally trows grenade on the floor (or any stupid direction)
and usually nade lands exackly under his legs

and boom :D


they should trow nades faster, and i was thinking if it is possible to write simple algorithm so that bot would predict at least one or 2 nade bumps from the wall or ceiling

i always thought it was kinda easy to implement since projectile motion is covered in physics and maths alot...i mean make em do it in a snapshot time and not changing...it should work better i guess....i'll have a look at the code....though i only know a bit of java :(

sPlOrYgOn 29-05-2004 05:14

Re: podbot grenade throwing bug
 
I'm just in 10th grade :(
haven't taken physics yet...
but I'm in Math Analysis/Trignometry...
and I think I remotely remember being taught how objects fall and the formulas and all that...
but it's all gone outta my head right now :D

Huntkillaz 29-05-2004 05:22

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by sPlOrYgOn
I'm just in 10th grade :(
haven't taken physics yet...
but I'm in Math Analysis/Trignometry...
and I think I remotely remember being taught how objects fall and the formulas and all that...
but it's all gone outta my head right now :D

dude i wasn't implying that u guys do it...i was just saying that i thought this would be one of the easy things to nail by a l33t coder

for someone who's in 10th grade ur doing great :)

ps: whats 10th grade as age wise...we don't use grades in nz :o

sPlOrYgOn 29-05-2004 05:26

Re: podbot grenade throwing bug
 
I'm 16 years old

[edit]
anyone actually know the formulas or anything?
some help coding or providing math help would be appreciated =)
[/edit]

Huntkillaz 29-05-2004 05:42

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by sPlOrYgOn
I'm 16 years old

[edit]
anyone actually know the formulas or anything?
some help coding or providing math help would be appreciated =)
[/edit]

fire up google and search projectile motion

http://www.physics.purdue.edu/~jhglbrg/beginner.html ....a review of some sites

http://library.thinkquest.org/2779/Even_more.html
http://id.mind.net/~zona/mstm/physics/mechanics/curvedMotion/projectileMotion/generalSolution/generalSolution.html


..i'll look up my physics book for some stuff.....it's been a 2 yrs since i've touched physics...

sPlOrYgOn 29-05-2004 07:13

Re: podbot grenade throwing bug
 
strange...
pb2.6mm currently uses the same throwing code as the pb2.6 that CF released...
did this throwing bug exist since 2.5?
or did CF play around with this code before he released it?

Huntkillaz 30-05-2004 03:55

Re: podbot grenade throwing bug
 
Quote:

Originally Posted by sPlOrYgOn
strange...
pb2.6mm currently uses the same throwing code as the pb2.6 that CF released...
did this throwing bug exist since 2.5?
or did CF play around with this code before he released it?

he did change stuff b4 the release of 2.6 8o

Quote:


Version 2.6
+ FIXED: DS SERVER CVAR
+ FIXED: Borg Mode and added extra Borg Cam
+ FIXED: Misc Bugs when attacking
+ FIXED: Bots switching to next Weapon when only Ammo in current Clip
+ FIXED: Duck/Jumping Bug
+ FIXED: About 3 MB of Memory/Resource Leaks :)
+ Rewrote func type handling, especially buttons
+ Aiming now affected by Enemy Velocity & Bot Turns
+ Bots continue their Tasks if no direct Path to Enemy
+ CT Bots low on health (or 50% Probability) guard a dropped C4
+ Rewrote Startup Routines which previously caused the stupid jumping
+ Smarter Grenade Usage
+ Correct FOV for each Weapon & Sniping Mode
+ New Zoom Switching allows better sniping weapon usage
+ Changes in the Behaviour Code - Bots try to go for Cover faster
+ Misc changes to the statistics system - depending on Emotions Bots may camp instead of moving to dangerous positions
+ Bots don't move in Intermission
+ Bots leave their camping/hiding position if they get hurt by unusual damage like drowning or gas

sPlOrYgOn 30-05-2004 04:09

Re: podbot grenade throwing bug
 
yea... smarter... right... :D

Abu Amok 01-06-2004 20:49

Re: podbot grenade throwing bug
 
hi!

in my opinion studying ballistics to solve the grenade throwing bug is a
somewhat "academic" approach..

As this isn't about reinventing the wheel I' d rather propose a more practical attempt: Check out how the others are doing...

Joebot does throw grenades quite frequent and well aimed and at some point in the code there's a hint like "substrakt 15 to avoid the grenade hitting the ceiling" or so.

So why not get "inspiration" by someone who solved the problem? (And probably follows this thread leaning back in his comfortable chair with this biiig grin 8) in his face?)

Pierre-Marie Baty 02-06-2004 01:29

Re: podbot grenade throwing bug
 
Aspirin, stop grinning immediately, or I'll break in your house by night and convert all JoeBot XP to ANSI C and delete the original! :D

Huntkillaz 05-06-2004 01:41

Re: podbot grenade throwing bug
 
so is the joebot author wanting to give us a hand???

@$3.1415rin 05-06-2004 12:03

Re: podbot grenade throwing bug
 
dunno if there's much to say about it, just look at the code. checvectoss and checkvecthrow are just from the SDK I think.
In CSBotCS look at CheckGrenadeThrowing(), ( lol, another function where I should add some comments when I have time )
in CBotBase, take a look at the CBotBase :: HandleGOrder() function

( I know Pierre, i'm cheating :) but still grinning anyway :P )

sPlOrYgOn 05-06-2004 12:36

Re: podbot grenade throwing bug
 
thanks!
I'll look at it right now :D

[NvT]_KaszpiR_ 09-06-2004 17:43

Re: podbot grenade throwing bug
 
i guess more advanced will be where grenade will land after boucing off the wall etc

@$3.1415rin 09-06-2004 20:30

Re: podbot grenade throwing bug
 
yes, that would be cool, but the more bounces you calculate, the more possibilities you have to calculate. you won't be able to calc all those possibilities in realtime any more from a certain point on. Of course one could think about optimizations, but checkvectoss works fine most of the time, so this complicated stuff wouldnt be notices by any bot user I guess

Whistler 13-07-2004 13:53

Re: podbot grenade throwing bug
 
from bot_combat.cpp VecCheckToss() function:
Code:

  // get a rough idea of how high it can be thrown
  vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
  TRACE_LINE (vecMidPoint, vecMidPoint + Vector (0, 0, 500), ignore_monsters, pEdict, &tr);
  if (tr.flFraction != 1.0)
  {
      vecMidPoint = tr.vecEndPos;
      vecMidPoint.z = tr.pHit->v.absmin.z;
      vecMidPoint.z--;
  }

...but if tr.pHit is the worldspawn entity, the tr.pHit->v.absmin.z will just be zero. so this may be wrong code.
Perhaps you need to change this part of code back to the original HLSDK one (looks like CF has modified the two VecCheckxxxx() functions)

Pierre-Marie Baty 13-07-2004 14:57

Re: podbot grenade throwing bug
 
yea, this code looks somewhat mistaken to me.

I would think of
Code:

  // get a rough idea of how high it can be thrown
  vecMidPoint = vecSpot1 + (VecSpot2 - VecSpot1) * 0.5;
  TRACE_HULL (vecMidPoint, vecMidPoint + Vector (0, 0, 500), ignore_monsters, head_hull, pEdict, &tr);
  vecMidPoint = tr.vecEndPos;
  vecMidPoint.z--;

as the right code.

TRACE_HULL because a TraceLine would pass through the sky meshes whereas the grenade would bounce on it

And checking for flFraction is a bug since IF the grenade can actually reach 500 ft high (which is not that high in fact), then vecMidPoint would be left lined up with vecSpot1 and vecSpot2, which is NOT something we want, definitely.

sPlOrYgOn 02-10-2004 05:00

Re: podbot grenade throwing bug
 
I think I've found a good way for nade throwing :D
NOTE: PHP tags because code tags are currently broken..
Code:

  // get a rough idea of how high it can be thrown
  vecMidPoint = vecSpot1 + (vecSpot2 - vecSpot1) * 0.5;
  TRACE_HULL (vecMidPoint, vecMidPoint + Vector (0, 0, 500), ignore_monsters, head_hull, pEdict, &tr);
  if (tr.flFraction != 1.0)
  {
      vecMidPoint = vecMidPoint + (tr.vecEndPos - vecMidPoint) * 0.75;
  }


[NvT]_KaszpiR_ 18-10-2004 11:45

Re: podbot grenade throwing bug
 
yea, bots now throws nades quite well,
they get also adjusted aim when enemy suddenly changes the position

now just add option so that bots would trow nades faster (they think too long and thus they usually die by headshot :D because of standing in the place)

@$3.1415rin 27-12-2004 23:46

Re: podbot grenade throwing bug
 
just working on grenade code, therefore just another comment here why joebot throws grenades so nicely ... it's basically because of those lines here, if you havnt found out for yourself already :

in CBotBase:HandleGOrder
Code:

while(pent = UTIL_FindEntityByClassname(pent,"grenade")){
[....]
v_nvelocity = VecCheckToss(&pent->v,pent->v.origin,GOrder.VAim,g_fGravityAdj);
[....]
pent->v.velocity = v_nvelocity;



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

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