Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Quad, 7th_zorro, Ayumi), 926 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
planes ignore path #406407
08/19/12 18:58
08/19/12 18:58
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Anybody got a quick answer to why some planes follow their path but others fly around in circles? All have the same action.

Re: planes ignore path [Re: JazzDude] #406411
08/19/12 19:24
08/19/12 19:24
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You should have posted the code that you are using, this way it's only a guessing game: Some of your planes do not get close enough to their current path target, then they try to turn around but as the angular speed is limited, they never get the right angle and thus always fly around the current node.


"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: planes ignore path [Re: Superku] #406414
08/19/12 20:00
08/19/12 20:00
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Here's the action code:

Code:
action bomber_target
{
	wait(1);
	c_setminmax(my);
	my.fat=off;
	my.narrow=on;
	
	plane = me;
	
	my.transparent = on;
	my.alpha = 100;

	my.enable_shoot = on; 
	my.event = my_hit;
	
	ent_handle[my.ent_id] = handle(me);
	
	if(my.my_path==1){
		path_set(my, "path_001");	
	}
	if(my.my_path==2){
		path_set(my, "path_002");	
	}
	if(my.my_path==3){
		path_set(my, "path_003");	
	}
	if(my.my_path==4){
		path_set(my, "path_004");	
	}
	if(my.my_path==5){
		path_set(my, "path_005");	
	}
	
	path_getnode(my,my.start_node,my.temp1_posx, null);

	move_bomber();
	
	while(1)
	{
		my.path_dist = vec_dist(my.x, my.temp1_posx);  // close to node?
		
		if(my.path_dist < 85)
		{
			my.start_node = path_nextnode(my,my.skill2,1);
			if(my.start_node == 0) {
				my.start_node = 1;
			} 
			//if the last node was reached, start again with the first one
			path_getnode(my,my.start_node,my.temp1_posx, null);
			vec_to_angle(my.temp__pan,vec_diff(my.temp2_posx,my.temp1_posx,my.x));		
		}
		
		wait(1);
	}
}



Re: planes ignore path [Re: JazzDude] #406417
08/19/12 20:16
08/19/12 20:16
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
the paths:



Re: planes ignore path [Re: JazzDude] #406504
08/22/12 04:14
08/22/12 04:14
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
The solution was simple.

if(my.path_dist < 200)

Re: planes ignore path [Re: JazzDude] #406506
08/22/12 06:29
08/22/12 06:29
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
maybe you can do some better solution:
if(my.path_dist < my.bomber_speed * time_step)


Visit my site: www.masterq32.de
Re: planes ignore path [Re: MasterQ32] #406524
08/22/12 23:27
08/22/12 23:27
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
MasterQ32 is right, your code could still fail on lower framerates.
Btw I still think my guess was right, the assimilation of my.pan to my.temp__pan is too slow.


"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

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