Bots 2 Beta Released!

.map news

Moderator: Moderators

jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The code you mentioned is from the aimat thread. What does this thread do and which thread actually calls it?
It's called from attack threads (global/bots2/states/popup.scr (strafe around corner behaviour) and strafe.scr (circle strafe behaviour)) and all it does is make the bot point to its enemy with a certain inaccuracy. As a result, when the bot fires the enemy is or is nearly hit :)
What is the local.yawoffset and local.pitch parameter and what are sensible values for them?
local.yawoffset is the difference in the bots current yaw and the yaw he should have to hit its enemy. For example, if the bot has to turn 5 degrees to the right his yawoffset would be 5, if he needs to turn 30 degrees left it would be -30.

local.pitch is the pitch the bot needs to hit its enemy, for example -30 for 30 degrees up or 10 for 10 degrees down.
They seem to depend on the self.inaccuracyfact
Well initially they depend only on the bots orientation and the direction to the enemy, but later they are changed a bit depending on the self.inaccuracyfact.
So, if i want to decrease their accuracy while they're moving, i should change the local.selfvel and if i want to decrease accuracy depending on how fast their enemy moves, i should change the local.envel.
Have i got it right so far?
Yes :)
What is the self.viewkick parameter?
It is a variable that's decreased every frame (multiplied by 0.9) and increased whenever a bot shoots (see 'fire' thread in global/bots2/bsm.scr). As a result, bot shooting gets lets accurate for sustained bursts.

Bots always aim for the head and right now they use the same accuracy for every weapon (still gotta change that :oops: )
Image
cassidy
Colour Sergeant
Posts: 89
Joined: Fri Apr 30, 2004 7:56 pm

Post by cassidy »

Will this work?

local.relvel = 0.00005 * self.botenemy.velocity * self.velocity
self.inaccuracyfact = local.selfvel + local.envel + local.relvel + local.vk

do i just put it there? (or do i have to declare the variables somewhere)

I find it hard to shoot enemies that are moving while moving myself, i think it's the hardest thing to do. And if one of the two is idle, then it won't affect anything, right?

I tried to just increase the values you told me, but it made me understand that it was not what i was looking for. The bots didn't go around making headshots out of nowhere this time, but they were quite ineffective in long distance duels.

So, it would be nice if their accuracy depended on their state as well. Eg, while they popup around a corner, their accuracy should decrease. Because it's different shooting someone on open grounds than going around a corner not knowing what's there.

This should happen the first time the bot tries that at least. Because the first time you try to take a peek of what's there, you just shoot a couple of blind bursts and get back to cover. The second time you try it, you already know what's there and you know generally where you'll be aiming, so your aiming is better.

Could you do this with some sort of counter? Just an idea, don't know if it could actually work..
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Well good suggestions, definately :) I'll try implementing your ideas in the future...

local.relvel = 0.00005 * self.botenemy.velocity * self.velocity
self.inaccuracyfact = local.selfvel + local.envel + local.relvel + local.vk

This will work in a way but remember .velocity is a vector, and self.botenemy.velocity * self.velocity calculates a dot product, which is probably not what you want.

I think you want this instead:
(vector_length self.botenemy.velocity) * (vector_length self.velocity)

which multiplies only the magnitude of the 2 velocities, without bothering about their directions :)
Image
cassidy
Colour Sergeant
Posts: 89
Joined: Fri Apr 30, 2004 7:56 pm

Post by cassidy »

note ::: Vectors are in bold

I had forgotten one could use vectors, that's even better! Their directions should be taken into account for sure.

Well, imagine that the bot is sidestepping to the left and you're mirroring its movement. It's "almost" like none of you is moving, right? By using lengths of vectors you'd be adding both the inaccuracy that's based on the bot's speed and yours, when you shouldn't take any of them into account. To remedy the situation, you can take advantage of the vectors that are given to you.

Let's say that the bot is at point B and has speed Ub (bot) while you are at point P and have speed Up (player). The main thing that matters here is your relative speed. So if we move the point of reference to point B, the bot's relative speed is now U'b=0 whereas the player's speed is now U'p=Up - Ub. So basically we accept that the bot is standing still while the player is moving with the new speed U'p. From here on, we refer to U'p as Urel (relative velocity).

Now, it's easier to shoot someone that's moving straight at you than someone that's moving parallel to your point of view. So, we could analyze the Urel to a sum of vectors, one parallel and one vertical to your point of view, where

parallel == sideways movement
vertical == towards/away movement

Code: Select all

                 I
--------------<-----B------------------------- 
                    |
                    | J
                    |
                   \|/ 

  
So Urel = Usid + Utow

where Usid=Usid*I and
Utow=Utow*J

The parallel movement should affect the accuracy more, at least it does so for human players.

How to calculate Utow and Usid: From what you've already told me, there is a variable that tells you where the bot is "looking" at, in terms of angles.
You can create a vector J that is aiming where the bot is looking at and a vector I that is vertical to J. Both vectors have length=1

The inner product of J*Urel=Utow gives you the projection of Urel on J, which is equal to the length of the "towards velocity".
In the same way you can get I*Urel=Usid (length of sideways velocity)

Remember that Urel = Usid*I+Utow*J, where Usid and Utow are just lenghts.

Accuracy should be mostly based on Usid, because as said before it's more difficult to shoot someone that's moving sideways to your point of view, than someone that's coming straight at you.

Hope you find this idea interesting ;)
User avatar
Kate
Colour Sergeant
Posts: 83
Joined: Fri May 28, 2004 12:01 pm

Post by Kate »

i tried this beta version and it didnt work properly for me.

I took the old jv_1 bot out 1st placed the new version in loaded the hunt and all the bots stood still. allies were still standing at thier spawn points and didn't move.

They shot at me when I ran towards them but with no anim. when I shot them they dropped thier gun but didnt go through a death anim.

They were taking my health when shooting me but I had no idea which was shooting?

It was like shooting fish in a barrel, never had so many kills :lol:

- Kate
Did you miss me? ..... Well get a better sight on your gun hehehe
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Very true cassidy :) I'll probably use that for newer bot versions 8-)

Kate, what is your setting for sv_privateClients? If it's not 0, make it 0 :)
Image
User avatar
Kate
Colour Sergeant
Posts: 83
Joined: Fri May 28, 2004 12:01 pm

Post by Kate »

JV,

sv_privateclients? errrm yes!! and you next question is? :lol:

I havent a clue what you're asking me :oops:

Kate
Did you miss me? ..... Well get a better sight on your gun hehehe
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Ok.

First enable 'console' in advanced options, start a map, bring down the console with the ~ key and type sv_privateClients [enter]... what does it say?

btw you could also type sv_priv and press TAB a few times :)
Image
User avatar
Kate
Colour Sergeant
Posts: 83
Joined: Fri May 28, 2004 12:01 pm

Post by Kate »

Hi JV,

I did the console as you said and it said 'sv_privateClients 0 default is 0

So I guess my private clients is ok :?

Kate
Did you miss me? ..... Well get a better sight on your gun hehehe
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hmm in that case there's probably a problem with some other mod you have in your main folder...
Image
User avatar
Kate
Colour Sergeant
Posts: 83
Joined: Fri May 28, 2004 12:01 pm

Post by Kate »

Hi Again JV (sorry to be a pain in the butt)

i will try it in the clean version of mohaa i use for mapping (well trying to map hehe). That has no custom PK3 files in and will let you know what happens then.

Kate
Did you miss me? ..... Well get a better sight on your gun hehehe
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Ok cool :)

btw you're not a pain... I love reports from the field :wink:
Image
User avatar
Kate
Colour Sergeant
Posts: 83
Joined: Fri May 28, 2004 12:01 pm

Post by Kate »

Hi JV,

Good news it worked fine in the clean mohaa. so it must have been a custom PK3 maybe i need to take off my wallhack & aimbot ...just kiddin :lol:

btw Nice work on the bots

Kate
Did you miss me? ..... Well get a better sight on your gun hehehe
cassidy
Colour Sergeant
Posts: 89
Joined: Fri Apr 30, 2004 7:56 pm

Post by cassidy »

hey jv,

is there a way to control the bots' response time?

Most of the times, they shoot me instantly on sight. So in terms of reflexes, they own me :roll:

I'd like them to wait about 0.1-0.2 seconds before they shoot.
Is there a variable that controls that?

thanks
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Uhm no right now they basically start shooting instantly :?
Image
Post Reply