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

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Tue Oct 28, 2008 9:18 pm Post subject: CheckClient |
|
|
I hate this function because it makes monsters see only player clients and not other monsters
Is there a replacement that lets it see both? Because I want a monster to hate another monster by getting into its view rather than provoked by friendly fire from monster. |
|
Back to top |
|
 |
Chris
Joined: 05 Aug 2006 Posts: 78
|
Posted: Tue Oct 28, 2008 10:43 pm Post subject: |
|
|
I agree it would be nice, and a bit too taxing to do in QC. Possibly a generic findentity search function that you can pass a 'classname' string into or something along those lines. |
|
Back to top |
|
 |
Wazat
Joined: 15 Oct 2004 Posts: 732 Location: Middle 'o the desert, USA
|
Posted: Wed Oct 29, 2008 6:25 am Post subject: |
|
|
If you give a special string (such as .targettype) to all valid "squishy" entities that monsters should be considering for possible aggression, then you could simply use the find command.
However, find would have every monster looking at every monster in the map. To take some of the burden off the QC, you could instead use findradius. This would trim all entities that are outside of the monster's "wake up and kill" range (I think this is RANGE_FAR in QC but not sure) in the engine with much less work on the QC end. Findradius also ignores entities that are nonsolid I think, so really it's ammo, buttons, monsters, players, triggers, things like those that you'd be sorting through.
Another advantage is if a monster checks another monster and says "oh, that guy's my ally and I don't want to attack him", it can then check "hmm... is he mad at something I can see? Or if I can see him, is he mad at something he can still see? Well then I'm mad at it too" and accomplish multiple tasks with the same loop.
Even if there's a lot of entities in a small area, if the monsters are each only scanning every 0.1 or even 0.5 seconds (using some .float timer to space out the scans), then it shouldn't be bad at all.
I hope that helps! _________________ 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 |
|
 |
jim

Joined: 05 Aug 2005 Posts: 400 Location: In The Sun
|
Posted: Wed Oct 29, 2008 12:29 pm Post subject: |
|
|
Cool, I've been wanting to do this too! _________________ zbang! |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Wed Oct 29, 2008 9:33 pm Post subject: |
|
|
the problem is the function returns one player per frame.
make it return one player or monster per frame and you end up with really slow reacting monsters (average map of 60? thats 6 seconds to see a nearby monster).
So any 'replacement' would have to be noticably different in design.
'Findradius also ignores entities that are nonsolid I think'
DP finds them.
Findradius is a suitable replacement, so long as its slightly staggered between monsters. While 6 seconds is too slow, 0.5 is imho fine for non-player entities, though you'd want to spot players a little faster really.
if (e.flags & (FL_MONSTER | FL_CLIENT))
that would do nicely. _________________ What's a signature? |
|
Back to top |
|
 |
MauveBib

Joined: 04 Nov 2004 Posts: 602
|
Posted: Sun Nov 02, 2008 1:14 am Post subject: |
|
|
Spike wrote: |
Findradius is a suitable replacement, so long as its slightly staggered between monsters. While 6 seconds is too slow, 0.5 is imho fine for non-player entities, though you'd want to spot players a little faster really.
|
That's pretty much what I've always done for bots, RTS units etc.
I normally have them do a findradius at random times between 0.1 and 1 seconds each, to nicely stagger them out and have a slight variance in reaction times. _________________ Apathy Now! |
|
Back to top |
|
 |
|