Category: Steering Behaviours

2007-06-10

Permalink 12:45:48 am, Categories: Steering Behaviours  

More on Steering Behaviours

Cohesion, Separation and Direction Matching (this name is going to change probably for Velocity Matching) options are available now
by pressing keys '3', '4', and '5' in the steer application.

Cohesion will work pushing the entity towards the center of mass of a group of entities.
Separation will push the entity away

and Direction Matching will push it towards the same direction a group of entities have.

2007-06-07

Permalink 01:55:20 am, Categories: Steering Behaviours  

More on Steering Property class

Hello!

I've made some advances in pcsteer. Collision Avoidance is still not working, I've tried many things to solve it but I am having problems with csSectorHitBeamResult, I am using it to detect the nearest collision but, most of the time it fails to detect collisions even if it is in front of a wall =S. well, if any of you know how to fix this, please tell me =P.

However, I added the Pursue behaviour, it can be used in the steering application by pressing the 'p' key.
The npc will then pursue the player.

Pursue is different from Seek in:

1. It continues updating the players position until Interrupt() or StopMovement() are called.

2. It predicts a target future position: target_position += velocity*prediction

So Pursue can be used whenever you want an npc to follow a moving target and seek could be used if you want the npc to look for an object or any other non-moving targets.

Well, thats all for now =-)

2007-06-05

Permalink 04:28:29 am, Categories: Steering Behaviours  

Steering Application

Hello!

I've been working in Steering Behaviours this last weeks and I will continue working on it for about two more weeeks I think.

The steering property class is located at plugins/propclass/steer/
right now it supports seeking (with and withour arrival checking) and fleeing.
I already started collision avoidance but it is not fullu working (I hope I'll find out why tomorrow =P)

I've also created a Steering application which is located at apps/tutorial/steering/

All of the above is located it: https://cel.svn.sourceforge.net/svnroot/cel/cel/branches/soc2007/ai

To excecute the steering application you only need to run: ./steering (./steering -relight the first time).

The steering application is based in walktut, it is actually an upgrade on walktut. It has the same entities plus one npc which is able to perform
any action included in pcsteer.

Here is a little tutorial on how to test it:
Key Action
1 Activates arrival checking
2 Activates collision avoidance (this is not working right now)
s Seek (The npc will run in the players direction)
f Flee (The npc will run in the oposite direction to the player)

This is all for now, hope some of you have time to download and test this application, the idea is that I could get feedback in time to perform any changed =)

Bye!

2007-05-30

Soc Starts!

Hi there!

Well, coding time started this monday and I wanted to keep you informed on my progress and my schedule for the next weeks.

As I explained before, I will be working in three main sections (Steering Behaviours, Path Finding and Decision Making). I am planning to work four weeks in each of them (hoping I only need 3 weeks for the first too). I will be starting in steering behaviours (which is needed by pathfinding), then I'll be covering Pathfinding and, finally I'll be working with Decision Making.

After all of this I will make a simple but complete application showing how to use all of what I made.

I hope I'll be soon showing you some code from steer property class, I've already starting coding and I am waiting to test it in some application.

That's all for now,
talk to you soon =)

2007-05-13

Permalink 07:16:25 pm, Categories: Steering Behaviours  

Some examples

Hi there!

This few days I´ve been working in Steering Behaviours.
I´ve been writing some code, basically getting some ideas from pcmover property class and upgrading it.

This property class is based, mostly, in Linear Algebra and High School physics. Most of what I am doing in here is performing calculations with vectors.

For better understanding I will put some images I drew in paint (yeah I know is lame but is the best I could come up with =$)

As you can see, everything is about determining an entities direction to perform its current task.
This task could be seeking, pursuing of fleeing from a target; while avoiding obstacles, or separating
from other entities, etc.

2007-04-30

Permalink 02:40:49 am, Categories: Steering Behaviours  

In order to achieve better movements and steering behaviours from the entities I plan to make a Steering Property Class "pcsteer".
pcsteer will count of a set of properties and a set of functions, these two will blend to achieve more complex behaviours.

Some of the functions defined in pcsteer are:

Seek a target.

Flee from a target.

Pursue a moving target. This is different from seeking because it calculates the targets position in time T and, then, seeks it.

Wander This is done by randomly changing the entities direction between a given range.

Path FollowingThis will follow a sequence of Nodes. It can be used together with a pathfinding algorythm, ie: A*, to reach more complex targets.

Some of the properties are:
SeparationGiven a set of entities and a radius, a force would be created in order to flee from the center of mass of all the entities that are within the radius.

CohesionThis one works just like Separation but it will seek the center of mass of all the creatures that are outside the given radius.

Collision AvoidanceRight now pcmover checks if theres something between the entities and its target. If there is, it stops moving. Collision Avoidance will work like that, but instead of stoping it will add an evasive force to the entities movement.

How would a developer used all of the above?
Lets say we are this LOTR rip-off where three Trolls are trying to catch a Hobbit in the woods. There would be a bunch of trees we would like not to crash with, but besides from that there would not be any difficult spot to seek so we won´t need pathfinding.

Lets say we already created the entity and added pcsteer to it. We would need to define our steering properties:


/*
* We define a weight for each force in our movement and a distance
* from which we will start avoiding obstacles
*
*/
float weight = 2.0;
float distance = 7.0;
pcsteer[who]->collisionAvoidance(weight, distance);

/*
* We define a radius for cohesion and separation so our trolls will
* work together without bouncing to each other
*/
weight = 1.0;
float radius = 10.0;
pcsteer[who]->cohesion(weight, trolls, radius);

weight = 1.5;
radius = 5.0;
pcsteer[who]->separation(weight, trolls, radius);

//This have to be done for each troll in trolls

Now, we defined our static properties (they are not so static, we can change them whenever we want, but they will remain the same after any function call.
Now we would probably want to define a basic behaviour, lets say we want the Troll to wander through the woods until he sees the Hobbit:


trollBehaviour(int who){
//its more important not to crash than catching the hobbit
float weight = 1.0;
float radius = 5.0;
float offset = 3.0;
if(hobitSeen){
pcsteer[who]->pursue(weight, hobit);
} else {
pcsteer[who]->wander(weight, radius, offset);
}
}

As you can see we don´t have to worried for collisions, separation or cohesion while defining our behaviour because thats already defined during the creation of the npc. The idea is to have more complex behaviours too like formations, flocking and swarming, but I will add that later.

The only thing left for me to explain is the radius and the offset in wanders call. This is because the wander function I have in mind uses an invisible circle in front of the npc to calculate its new direction. offset is the distance between the entity and the circles center.

November 2014
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search

Archives

Misc

XML Feeds

What is this?

powered by
b2evolution