View previous topic :: View next topic |
Author |
Message |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Sat Jan 16, 2010 8:07 am Post subject: DP Bot Spawning |
|
|
I'm spawning bots using DP's "spawnclient" and am using the snipet of code example provided within the dpextensions.qc.
When bots spawn I noticed that they aren't facing in the correct direction... actually, all of the bots are facing in the same direction.
Are they somehow ignoring self.angles = spot.angles in PutClientInServer? _________________ Good God! You shot my leg off! |
|
Back to top |
|
 |
c0burn
Joined: 05 Nov 2004 Posts: 158 Location: Liverpool, England
|
|
Back to top |
|
 |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Sat Jan 16, 2010 8:18 pm Post subject: |
|
|
Hi c0burn and thanks,
I've included sv_user.qc, but am still having the same problem. I've looked through the qc file a bit and am not sure where it would orient the bot to the proper spawning angles. Also, I don't have PlayerPrePhysics() in any of my qc files... did you mean PlayerPreThink?
Here are a few images of what I am seeing:
In all images the bot should be facing toward you.
As you hop into the start level and go to these areas you will see that the above bots all face the same direction.
As mentioned in my first post I am using DP's "spawnclient". Is it true that DP treats these bots the same as real clients? Or do I need to plug in some code to get them to face in the proper angles? _________________ Good God! You shot my leg off! |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Sat Jan 16, 2010 9:16 pm Post subject: |
|
|
players have a .v_angle field which logically overwrites their .angles.
.angles only overwrites .v_angles when fixangle is true.
Not sure how bots interact with any of that. Try setting .v_angle. _________________ What's a signature? |
|
Back to top |
|
 |
c0burn
Joined: 05 Nov 2004 Posts: 158 Location: Liverpool, England
|
Posted: Sat Jan 16, 2010 9:50 pm Post subject: |
|
|
Spike wrote: | players have a .v_angle field which logically overwrites their .angles.
.angles only overwrites .v_angles when fixangle is true.
Not sure how bots interact with any of that. Try setting .v_angle. |
As they are true clients they should mirror client behaviour. Looks like a bug to me. |
|
Back to top |
|
 |
c0burn
Joined: 05 Nov 2004 Posts: 158 Location: Liverpool, England
|
Posted: Sat Jan 16, 2010 11:39 pm Post subject: |
|
|
Change
self.angles = spot.angles;
in PutClientInServer() to
self.angles = self.v_angle = spot.angles;
Fixed it for me. |
|
Back to top |
|
 |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Sun Jan 17, 2010 1:44 am Post subject: |
|
|
c0burn wrote: | Change
self.angles = spot.angles;
in PutClientInServer() to
self.angles = self.v_angle = spot.angles;
Fixed it for me. |
And for me as well. Thanks!
Well now, that seems odd. Do you still think it is a bug or is it intentional? _________________ Good God! You shot my leg off! |
|
Back to top |
|
 |
Wazat
Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA
|
Posted: Sun Jan 17, 2010 5:07 am Post subject: |
|
|
Junrall wrote: | Well now, that seems odd. Do you still think it is a bug or is it intentional? |
Could be a bug, or just the natural consequences of how clients work. Human clients have .fixangle, which is auto-handled for them but (apparently) not for bots. Fixangle says to a human client "set your v_angles to your angles". This is apparently not occurring for bots, possibly to give the mod author full control of the bot. Or possibly it's a mistake...
Or possibly it's following a limitation in the framework. When you set the player's v_angle directly in QC, I believe it's set right back again by the client next frame (setting v_angle = someAngle does not affect the client's view). You have to use the camera writebyte to force-change the player's view. I would guess from this that an actual server->client message is triggered by setting .fixangle. However, bots are pseudo clients that have to do such things themselves.
Now that we've confirmed it is an issue with v_angle, a more general fix may be to have your bot code watch for .fixangle to be true, and set v_angles = self.angles when it is (before any code that frame tries to use .v_angles or .angles). Then you won't have to change the spawn code (and possibly lots of other code) to get the bot working.
I'm guessing if the issue is that your bot is using v_angle like any good bot should (emulating a true client), but that v_angle just wasn't being initialized on spawn by the bot code. In other words, your bot is v_angles driven and it sets its angles from that. When the bot spawns, the engine doesn't set its v_angles automatically from fixangle, and then your QC code probably sets the angles from v_angles. This undoes the self.angles = spot.angles spawn code and produces the problem you're seeing.
Fixangle is the only time .v_angle is driven by .angles (the rest of the time it's the other way around). If you watch for .fixangle and act on it, you can emulate clients properly.
The engine seems to leave a lot of stuff for fake clients to handle in the QC (friction for movetype_walk, etc), so this is par for the course.
Hopefully I'm correct in these guesses and being helpful, instead of confusing. Good luck! _________________ When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work. |
|
Back to top |
|
 |
|