Page 1 of 1

I want to test swarm-like behaviour in Quake some day ...

Posted: Thu May 05, 2011 11:43 pm
by daemonicky
You can read about swarms on wiki. They can be used to model clouds, flock of birds ... Flocking is pretty interesting http://www.red3d.com/cwr/steer/ , one can model even cars I guess. So I thought that I will try to implement it in Quake, it might be easy ...

I just love how the rules for behaviour are simple. It reminds me of fractal rules, like the one to make Mandelbrot set ...

I wonder if one can use this to make moster AI. It may be used to make brawling like in God Of War http://www.gamasutra.com/view/feature/3 ... awling.php . But its purpose is to model groups not single monsters ...

I am just musing. Maybe someone tried some interesting things with it. If so, how it was?

Posted: Fri May 06, 2011 6:17 pm
by goldenboy
There is a mod that does swarm behaviour in quake. Search idgames2.

Posted: Wed May 25, 2011 12:04 pm
by MauveBib
I made a swarming test mod once too.

Posted: Tue Jun 21, 2011 9:12 pm
by tZork
Basically what you do push/pull for every member in the group/swarm/flock. I wrote some code for this in nexuiz, heres the relevant part:

Code: Select all

vector steerlib_repell(vector point,float maximal_distance)
{
    float distance;
    vector direction;

    distance = bound(0.001,vlen(self.origin - point),maximal_distance);
    direction = normalize(self.origin - point);

    return  direction * (1-(distance / maximal_distance));
}

vector steerlib_arrive(vector point,float maximal_distance)
{
    float distance;
    vector direction;

    distance = bound(0.001,vlen(self.origin - point),maximal_distance);
    direction = normalize(point - self.origin);
    return  direction * (distance / maximal_distance);
}

.float flock_id;
vector steerlib_flock(float radius, float standoff,float separation_force,float flock_force)
{
    entity flock_member;
    vector push,pull;
    float ccount;

    flock_member = findradius(self.origin,radius);
    while(flock_member)
    {
        if(flock_member != self)
        if(flock_member.flock_id == self.flock_id)
        {
            ++ccount;
            push = push + (steerlib_repell(flock_member.origin,standoff) * separation_force);
            pull = pull + (steerlib_arrive(flock_member.origin + flock_member.velocity,radius) * flock_force);
        }
        flock_member = flock_member.chain;
    }
    return push + (pull* (1 / ccount));
}