remstart
Dark AI Tutorial
By Steve Vink for The Game Creators Ltd
remend

` The debug switch allows us to show waypoints manually.
` The automatic debug visibility is not appropriate,
` because of the different landscape heights
#constant cDEBUG 1

` To store the positions of objects and entities efficiently,
` we will use a user defined type to hold the 3 coordinates.

Type tPos
	x as float
	y as float
	z as float
endtype


	` Waypoint positions will be stored in an array for future reference
	dim gWaypoints() as tPos
	
	` Basic Setup
	set window on
	SYNC ON: SYNC RATE 60
	autocam off
	AI start
	
	` *********************************************************************
	` Make the scene using advanced terrain and some scenery
	makeTerrain()
	
	` *********************************************************************
	` Add waypoints to the map, to mark out the relevant paths
	createWaypoints()
	
	` *********************************************************************
	` Make a character
	makeCharacter()


	` Create a Path for the character to follow,
	` and assign it as teh Patrol path.
	AI make path between points 1, gWaypoints(0).x,gWaypoints(0).z,gWaypoints(1).x,gWaypoints(1).z
	AI entity assign patrol path cCHARACTER, 1
	
	do
		
		AI Update
		` Position the character
		posChar(50)
		text 5,5, "x: " + str$(camera position x(),4)
		text 5,25, "Y: " + str$(camera position Y(),4)
		text 5,45, "Z: " + str$(camera position Z(),4)
		text 5,65, AI get entity state$(50)
	
		set camera to follow object position x(50), object position y(50), object position z(50), object angle y(50), 30, 5,100,0
		position camera camera position x(), get terrain ground height(1,camera position x(),camera position z()) + 5,camera position z()
		point camera object position x(50), object position y(50), object position z(50)
		update terrain
		sync
		
	loop

	end

		 