Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17063

Pathfinding, need feedback

$
0
0

I started work on the pathfinding algorithm. I know the stages of the algorithm (how it should look like in the end), bellow is almost pseudocode (it`s real code but I haven`t started building/debugging)

void FindPath(int Startx, int Startz, int Endx, int Endz)
{
	
	
	Surrounding Sectors[8];
	


	for(int i  = 0; i < 8; i++)
	{
		Sectors[i].distance = -1;
		Sectors[i].excluded = false;
	}
	if(NodeCoord(Startx, Startz +1).access)//N
	{
		
		Distancex = NodeCoord(Startx, Startz +1).x - Endx;
		Distancez =  NodeCoord(Startx, Startz +1).z - Endz;
		Sectors[0].distance = sqrtf(Distancex * Distancex + Distancez*Distancez);
		
	}
	else
	{
		Sectors[0].excluded = true …

Viewing all articles
Browse latest Browse all 17063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>