|
Re: Pathfinding on native Gamestudio graphs
[Re: Saturnus]
#304318
01/06/10 17:12
01/06/10 17:12
|
Joined: Sep 2008
Posts: 68
Tai
Junior Member
|
Junior Member
Joined: Sep 2008
Posts: 68
|
Sort of like that. I want the pathfinding to work as if gravity was in effect, so that the entity won't just look up and fly.
EDIT: To clarify further, I just want the pathfinding to consider the z axis. I'm assuming I'll have to implement my own cost function?
Last edited by Tai; 01/06/10 17:20.
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: Tai]
#304503
01/08/10 13:57
01/08/10 13:57
|
Joined: Dec 2008
Posts: 271
Saturnus
OP
Member
|
OP
Member
Joined: Dec 2008
Posts: 271
|
Note that the pathfinding code just computes a path - it doesn't control how the entity follows this path. The pathfinding function should return a path that is actually walkable for the pathfinding entity. If the entity can't swim for example, all edges leading through water should be ruled out in the pathfinding process by the cost function. This could be done by setting the edge's skill to a specific value indicating that the edge can only be traversed by swimming. This skill value can then be evaluated within the cost function:
// remark: edge_skill is set by path_getedge()
if ((edge_skill[2] == THROUGH_WATER) && (entity_can_swim == FALSE))
{
return -1; // edge cannot be traversed by this entity
}
But as said as before the movement code has to take care of how the entity ultimately follows the path. If the entity can't fly, the movement code should steer the entity in a way that it can arrive the nodes with gravity in effect.
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: Saturnus]
#312155
02/23/10 14:16
02/23/10 14:16
|
Joined: Nov 2007
Posts: 318 Brasil, Paraná
NeoNeper
Senior Member
|
Senior Member
Joined: Nov 2007
Posts: 318
Brasil, Paraná
|
Heloo.. the url for download not found... Plz plzz .. you can up the file again. Tnkxs
Please! Use easy words to be translated. because my English is not very good! Grateful. _______________________________________________________
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: NeoNeper]
#314716
03/10/10 14:22
03/10/10 14:22
|
Joined: Nov 2007
Posts: 318 Brasil, Paraná
NeoNeper
Senior Member
|
Senior Member
Joined: Nov 2007
Posts: 318
Brasil, Paraná
|
somebody can up file again?
Please! Use easy words to be translated. because my English is not very good! Grateful. _______________________________________________________
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: NeoNeper]
#314718
03/10/10 14:44
03/10/10 14:44
|
Joined: Dec 2008
Posts: 271
Saturnus
OP
Member
|
OP
Member
Joined: Dec 2008
Posts: 271
|
Here is an alternative download link: pfind_gs.zipIt's the rescent version of the script. German documentation is included. I didn't have time to spare for an English offline documentation (there's still the online doc, though).
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: Saturnus]
#314833
03/11/10 13:04
03/11/10 13:04
|
Joined: Nov 2007
Posts: 318 Brasil, Paraná
NeoNeper
Senior Member
|
Senior Member
Joined: Nov 2007
Posts: 318
Brasil, Paraná
|
yataaaaaaaaaaaaaaaaaaaaaaaa... Tnkx man... very tankx... (^.^) Arigatooooooooo
Please! Use easy words to be translated. because my English is not very good! Grateful. _______________________________________________________
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: NeoNeper]
#322368
05/06/10 13:53
05/06/10 13:53
|
Joined: Nov 2007
Posts: 318 Brasil, Paraná
NeoNeper
Senior Member
|
Senior Member
Joined: Nov 2007
Posts: 318
Brasil, Paraná
|
exists some forms to make the entity to move itself using (c_move). I tried but I did not have success.
Please! Use easy words to be translated. because my English is not very good! Grateful. _______________________________________________________
|
|
|
Re: Pathfinding on native Gamestudio graphs
[Re: NeoNeper]
#322377
05/06/10 15:05
05/06/10 15:05
|
Joined: Nov 2007
Posts: 318 Brasil, Paraná
NeoNeper
Senior Member
|
Senior Member
Joined: Nov 2007
Posts: 318
Brasil, Paraná
|
already I obtained sucess... its work... See.. pathfinder.c
void ent_pathfinder()
{
entPathfinder = my;
ent_setState(my, STATE_IDLE);
ent_setPath(my, NULL);
my->flags &= ~PASSABLE;
path_set(my, "path_000");
VECTOR vec_to_target;
while (1)
{
if (ent_getState(my) == STATE_FOLLOW_PATH)
{
ent_drawPath(my, vector(0, 255, 0)); // display path
LL_PFIND_PATH_NODE *node = ent_getFirstPathNode(my);
if (node) // path is not empty
{
VECTOR vec_to_node;
VECTOR *node_pos = ll_pfind_getPathNodePos(node);
var dist = vec_dist(&my->x, node_pos);
//vec_diff(&vec_to_node, node_pos, &my->x);
//vec_to_angle(&my->pan, &vec_to_node);
// vec_add(&my->x, &vec_to_node);
vec_diff(&vec_to_target, &node->pos, &my->x);
vec_to_angle(&my->pan, &vec_to_target);
my->tilt=0;
vec_normalize(&vec_to_target, minv(dist, PATHFINDER_SPEED * time_step));
c_move(my, vector(10 * time_step, 0, -1), nullvector, GLIDE);
if (dist < 10) // node reached
{
ll_pfind_stringPullingFirst(my, ent_getPath(my), 3, ent_isReachable);
ent_removeFirstPathNode(my);
}
}
else // end of path reached
{
ent_setState(my, STATE_IDLE);
ent_setPath(my, NULL);
}
}
wait(1);
}
}
Last edited by NeoNeper; 05/06/10 15:06.
Please! Use easy words to be translated. because my English is not very good! Grateful. _______________________________________________________
|
|
|
|