Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, rki), 390 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Tpathfinding plugin #425575
07/08/13 16:24
07/08/13 16:24
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
I found the "Tpathfinding plugin" and I eminently tryed to use it.
However, when commend the AI to follow the player it just stands there...

Here:
Code:
////////////////////////////////////////////////////////////
#define AI_state skill1
#define AI_idle 0
#define AI_chase 1
#define AI_go_home 2
//////////
action AI()
{
	me.group=2;
	my.eflags |= FAT | NARROW;
	//////////
	vec_set(my.min_x,vector(-10,-10,-10));
	vec_set(my.max_x,vector(10,10,10));
	//////////
	PathFinder* my_pathfinder=tpf_CreatePathFinder(me);
	//////////
	random_seed(0);
	//
	var find_time=random(3);
	var find_now=find_time;
	//////////
	var my_ani=0;
	//////////
	VECTOR pos_node;
	ANGLE angle_node;
	//////////
	var go_home_find=false;
	me.AI_state= AI_chase;
	//////////
	random_seed(0);
	int random_cost=random(6);
	//////////
	//////////
	ENTITY* move_ent = ent_create (NULL, my.x, moveing_ent);
	//////////
	while(1)
	{
		switch(my.AI_state)
		{
			case AI_idle:
			if(vec_dist(move_ent.x,player.x)>=dist_goal)
			{
				me.AI_state=AI_chase;
			}
			break;
			case AI_chase:
			//don't find path very often
			if(find_now>=find_time )
			{
				tpf_Clear(my_pathfinder);
				tpf_FindPath(move_ent.x, player.x,my_pathfinder,2,10,0,0);
			}
			find_now-=time_step/16;
			if(find_now<0)
			{
				find_now=find_time;
			}
			if(tpf_IsPathValid(my_pathfinder))
			{
				my.x = move_ent.x;my.y = move_ent.y;
				//////////
				if(my.state == 0)
				{
					if(c_trace(move_ent.x,player.x,IGNORE_ME | IGNORE_PASSABLE)>0 && you == player)
					{
						vec_set(pos_node.x,player.x);
						vec_sub(pos_node.x,move_ent.x);
						vec_to_angle(angle_node, pos_node);
						move_ent.pan += ang(angle_node.pan - move_ent.pan) * 0.5 * time_step;
						c_move(move_ent,vector(10*time_step,0,0),NULL,IGNORE_PASSABLE | GLIDE);
					}
					else
					{
						VECTOR* my_vec =tpf_NextPos(my_pathfinder,50);
						if(my_vec)
						{
							vec_set(pos_node.x,my_vec.x);
							vec_sub(pos_node.x,move_ent.x);
							vec_to_angle(angle_node, pos_node);
							move_ent.pan += ang(angle_node.pan - move_ent.pan) * 0.5 * time_step;
							c_move(move_ent,vector(10*time_step,0,0),NULL,IGNORE_PASSABLE | GLIDE);
						}
					}
				}
			}				
			break;
		}
		//////////
		wait(1);
	}
}



Now comes the wired part. When I replace "player" with "camera" the script works, but only if the camera is in a certain distance and hight. So you have to play around with the camera position in order to make the AI move...

Does anybody know what I missed???

Thanks future more.



Re: Tpathfinding plugin [Re: Random] #425581
07/08/13 18:25
07/08/13 18:25

M
Malice
Unregistered
Malice
Unregistered
M



Just my opinion, I wouldn't use Tpathingfinding. I ran into trouble with it and it throw errors in a langue I couldn't read ( Chinese I think ). I contacted the write who told me that he no longer works with 3dgs and doesn't provide support for the plugin any more. It was awesome till I hit some kind of entity limit.

Just a opinion.
Mal

Last edited by Malice; 07/08/13 18:26.
Re: Tpathfinding plugin [Re: ] #425583
07/08/13 18:44
07/08/13 18:44
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
so, what do you use then?



Re: Tpathfinding plugin [Re: Random] #425586
07/08/13 19:52
07/08/13 19:52
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
it works pretty well fort me, what kind of troubles you've faced


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Tpathfinding plugin [Re: 3run] #425600
07/09/13 09:02
07/09/13 09:02
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I suggest you use my very simple and easy-to-use pathfinding script from the goodies.zip archive, I used (modified versions of) it for all my games.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Tpathfinding plugin [Re: Superku] #425629
07/09/13 13:50
07/09/13 13:50

M
Malice
Unregistered
Malice
Unregistered
M



The last time I used one ( over a year now) it was Tpathfinding. And like I said it was awesome, till my problem. I couldn't tell you which to use as this is not my area of focus.

Re: Tpathfinding plugin [Re: ] #425756
07/10/13 14:56
07/10/13 14:56
Joined: Feb 2010
Posts: 886
Random Offline OP
User
Random  Offline OP
User

Joined: Feb 2010
Posts: 886
The pathfinding from the "goodies.zip" is amazing!
I am really thankful for that.

Again, great solutions from you guys!




Moderated by  HeelX, Spirit 

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