Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Akow, 1 invisible), 1,404 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
please give example or idea for cars AI #349120
12/04/10 06:53
12/04/10 06:53
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
I'm currently making a simple 3d driving game. I've use the lite-c script from the car demo inside the 3dgs directory. I want to implement AI for the cars that drive around the city level.

How do I combine the car demo codes to the AI cars and make them follow a path around the city?

Re: please give example or idea for cars AI [Re: jpxtreme] #349137
12/04/10 11:14
12/04/10 11:14
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
look for path_spline in the manual, it has also an example


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: please give example or idea for cars AI [Re: painkiller] #349797
12/11/10 02:34
12/11/10 02:34
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Just a hint:
1.create path, start from the start grin
3.check for a next path_node distance
4.if it's still far turn the car to the path_node direction
5.if it's near_node enough switch to another next path_node
6.repeat until next path_node is the finish_node

also add a collision detection and obstacle avoidance to the AI and you're good to go

Re: please give example or idea for cars AI [Re: bart_the_13th] #349798
12/11/10 02:44
12/11/10 02:44
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline
Junior Member
carla_mariz  Offline
Junior Member
C

Joined: Sep 2010
Posts: 97
@bar_the_13: is there a sample code that will show on how to find the nearest path_node distance? and is it possible to use a path_node for the character but @ the same time will look for other direction and them goes back to the nearest node he could found?

thanks! laugh

Re: please give example or idea for cars AI [Re: carla_mariz] #349799
12/11/10 03:06
12/11/10 03:06
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Code:
...
//start from node 1(start)
//put this at the beginning/initialization of the action
current_node = 1;
path_set(me,"path_001"); //
...
//this one is on the main loop
path_setnode(my,current_node,target.x, null);	//find the next node position
if(vec_dist(my.x,target.x)>min_dist)            //find the distance, min_dist is the minimum distance needed to switch node
{
   ...//turn the car so it facing to the target.x
}else
{
   current_node+=1;
}
...


Originally Posted By: carla_mariz
...and is it possible to use a path_node for the character but @ the same time will look for other direction and them goes back to the nearest node he could found?
thanks! laugh

I guess it's possible :D, you can use path_scan for that:
http://www.conitec.net/beta/apath_scan.htm

Re: please give example or idea for cars AI [Re: bart_the_13th] #349800
12/11/10 04:14
12/11/10 04:14
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline
Junior Member
carla_mariz  Offline
Junior Member
C

Joined: Sep 2010
Posts: 97
geez..i hope i could put these code correctly..:D

thanks!@bar_the_13th..god bless!:)

Re: please give example or idea for cars AI [Re: carla_mariz] #349900
12/12/10 01:25
12/12/10 01:25
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline
Junior Member
carla_mariz  Offline
Junior Member
C

Joined: Sep 2010
Posts: 97
i think this is too much for you, but pls can you help me where to put that code? grin

im just new to this, so pls help me...
Code:
action blue_follow_path()
	{
		var dist = 0; // entity walk speed
		var LastPos[3];
		var Dir[3];
		var movement_speed;
		//my.shadow = on;
		path_set(my, "bluepath"); // Change way1 to the name of your path set in WED
		
		while(1)
		{

			path_spline(me,my.x,dist); // spline curve for smooth walking
			dist += 12*time_step; // change this to change the walk speed
			c_move(me,vector(1*time_step,0,0),nullvector,IGNORE_YOU); // this is for collision but you donīt need
			vec_diff(Dir,my.x,LastPos);
			vec_to_angle(my.pan,Dir);
			vec_set(LastPos,my.x);
			ent_animate(my, "run", movement_speed, ANM_CYCLE);
			movement_speed += 10 * time_step;
			//camera_on_me();
			wait(1);
		}	
	}



i just got that code from the workshop & edited some so that it will run for my work. i'm trying my best to work on that, but i still need some help.

thanks!

Re: please give example or idea for cars AI [Re: carla_mariz] #349915
12/12/10 11:32
12/12/10 11:32
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
This is C-Script, isn't it?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: please give example or idea for cars AI [Re: 3run] #350029
12/13/10 12:06
12/13/10 12:06
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline
Junior Member
carla_mariz  Offline
Junior Member
C

Joined: Sep 2010
Posts: 97
i think soooo..?.?

Re: please give example or idea for cars AI [Re: carla_mariz] #350059
12/13/10 15:10
12/13/10 15:10
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
You better look into the perfect AI from AUM. You'll learn a lot. Good luck.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

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