Forum

Getting monsters unstuck!

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Getting monsters unstuck!

Postby blubswillrule » Sat Mar 19, 2011 4:13 am

As some of you know (if you've played Nazi Zombies Portable), the zombies sometimes get stuck when 2 or more hop over the barricade, and then they can't move.

I have been' trying to fix this problem by making a function to see if there is a zombie inside of another zombie, if so, push the other one out, I have had VERY mixed success, I tweak one thing, it works in one scenario, but messes it up in another, and vice versa, and it's rather frustrating.

Here is my function., this function is called every .5 seconds (changed from a previous 2 seconds)
Code: Select all
void() check_stuck
{
   local entity thing;
   thing = findradius(self.origin, 10);
   while (thing.classname == "monster_knight")
   {
      if(thing != self)
      {
         if(thing.classname == "monster_knight")
         {
            bprint("zombie is stuck! \n");
            self.other_angle_y = vectoyaw(thing.origin - self.origin);
            makevectors(self.other_angle);
            
               
            thing.origin = thing.origin + ((v_right) * 5);
         
            thing.origin = thing.origin + ((v_forward) * 5);
         
         
            bprint(vtos(self.other_angle));
            bprint("\n");
            bprint(vtos(thing.velocity));
            bprint("\n");
         
            
            
            {
            
            }
         }
      }
      thing = thing.chain;
   }
   
};


as you can see, i'm basically trying to find the angle between 2 zombies, and push them in the opposite direction of each other (just imagine them pushing each other away)

I've tried using velocity (which worked a bit more), but I would have problems of where to take off the FL_ONGROUND flag (which also interferes with other stuff :\ _)

well, this is one way to do it.

I could try telefragging, but that wouldn't look too cool xD

Anyone have any ideas on how to make zombies not get stuck inside of each other? :\

Thanks ;D
A truly rewarding experience for an AI coder: watching your ai navigate the map... makes all the time invested in the code worth it :)
User avatar
blubswillrule
 
Posts: 68
Joined: Mon Oct 04, 2010 9:08 pm
Location: Lincoln, California

Postby Spike » Sat Mar 19, 2011 4:39 pm

firstly: any direct assignments of origin is a bug, potentially resulting in both invisible entities and non-solid entities.
secondly: any assignments of origin which do not consider the bsp state of the map and any pushers is a bug.
thirdly: knights are generally not zombies.
fourthly: findradius is generally not viable for an actual non-radius bbox-based collision.
fifthly: what happens if one is standing directly on the other's head.

consider using walkmove. it will take care of geometry, step up steps, and will report if the entity is completely stuck.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby ceriux » Sat Mar 19, 2011 4:50 pm

or why not just make one solid_not? or what ever? then change him back after he's un stuck. or even better.. only let one zombie climb a wall at a time.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby blubswillrule » Sat Mar 19, 2011 10:33 pm

Spike wrote:firstly: any direct assignments of origin is a bug, potentially resulting in both invisible entities and non-solid entities.
secondly: any assignments of origin which do not consider the bsp state of the map and any pushers is a bug.
thirdly: knights are generally not zombies.
fourthly: findradius is generally not viable for an actual non-radius bbox-based collision.
fifthly: what happens if one is standing directly on the other's head.

consider using walkmove. it will take care of geometry, step up steps, and will report if the entity is completely stuck.


yes, I can see how the direct assignment of the origin is a bug, but is removing the monster's on_ground (or whatever it may be, forgot at the moment) the only way to have velocity affect it?

and I know knights are not zombies, but they were the closest monster to the zombies we were trying to make, thus we based it on them. (ironically we just ended up redoing the whole monster code, yet I kept the monster_knight, too many dependancies I believe.)

and @ceriux, i'm currently experimenting with solid_not
A truly rewarding experience for an AI coder: watching your ai navigate the map... makes all the time invested in the code worth it :)
User avatar
blubswillrule
 
Posts: 68
Joined: Mon Oct 04, 2010 9:08 pm
Location: Lincoln, California

Postby blubswillrule » Sun Mar 20, 2011 5:11 am

I've gotten' this mostly figured out (and functional), but I have one question that I need answered.

Is there any way to make velocity affect monsters WITHOUT removing their FL_ONGROUND flag?(I really need this)
A truly rewarding experience for an AI coder: watching your ai navigate the map... makes all the time invested in the code worth it :)
User avatar
blubswillrule
 
Posts: 68
Joined: Mon Oct 04, 2010 9:08 pm
Location: Lincoln, California


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest