Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 3 of 4 1 2 3 4
Re: Pathfinding on native Gamestudio graphs [Re: Tai] #304208
01/05/10 19:16
01/05/10 19:16
Joined: Sep 2008
Posts: 68
T
Tai Offline
Junior Member
Tai  Offline
Junior Member
T

Joined: Sep 2008
Posts: 68
Sorry about the triple post here, but it's still working great. I have a suspicion that you were right; and that the nodes were too far away to find the players position. One quick question though, how would you advise doing a cost function for nodes moving upwards so that the path doesn't calculate a straight line in the air?

Re: Pathfinding on native Gamestudio graphs [Re: Tai] #304310
01/06/10 16:35
01/06/10 16:35
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Don't mind the triple post!
I just didn't get round to write a reply.

Now let me see whether I understand this correctly:
Do you want (as an example) a path leading up a hill to have higher costs than a regular path? Or something different?

Re: Pathfinding on native Gamestudio graphs [Re: Saturnus] #304318
01/06/10 17:12
01/06/10 17:12
Joined: Sep 2008
Posts: 68
T
Tai Offline
Junior Member
Tai  Offline
Junior Member
T

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 Offline OP
Member
Saturnus  Offline 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:

Code:
// 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 Offline
Senior Member
NeoNeper  Offline
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 Offline
Senior Member
NeoNeper  Offline
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 Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Here is an alternative download link:
pfind_gs.zip

It'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 Offline
Senior Member
NeoNeper  Offline
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 Offline
Senior Member
NeoNeper  Offline
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 Offline
Senior Member
NeoNeper  Offline
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
already I obtained sucess...
its work...
See..
pathfinder.c

Code:
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.
_______________________________________________________
Page 3 of 4 1 2 3 4

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1