Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   A* Movement System (https://forums.graalonline.com/forums/showthread.php?t=134264033)

Twinny 07-30-2011 01:14 AM

Quote:

Originally Posted by DustyPorViva (Post 1660868)
I was thinking Bezier Curves combined with my above method O.o though I imagine that would be just as taxing.

It's not so taxing if done right. For known paths between things, you put preset nodes. That way, you only have to A* to get to one of the nodes. After that, you can put preset paths in place for NPCs to follow to their destinations.

Example: you have a road between two towns. A NPC gets distracted by a bunny and gets lead of the road a bit. The NPC only needs to A* (if necessary) to get onto the nearest node on the road. Once on he is set.

Can use a quick tool online to put all these node paths in easily enough. Depending on the realism you want, may need the occasional diversion around a player /object but other than that it's nice enough.

Televangelist 08-21-2011 07:40 PM

Interesting! Pardon me, but I have a noob question...

how difficult would it be to have an 'if interrupted on the path' condition? The guy plots out the path, the guy tries to move along the path, and if for some reason he's blocked along the way, he takes a certain action?

DrakilorP2P 08-23-2011 01:12 AM

Quote:

Originally Posted by Televangelist (Post 1664668)
Interesting! Pardon me, but I have a noob question...

how difficult would it be to have an 'if interrupted on the path' condition? The guy plots out the path, the guy tries to move along the path, and if for some reason he's blocked along the way, he takes a certain action?

Shouldn't be a problem.

DeCeaseD 07-04-2012 01:41 AM

Don't disregard my post actually! Lol. For some reason, when I try to make an NPC move, it always returns error: blocking, no matter the x/y input or it's origin x/y.. Anyone know the cause of this? Could it be because I'm trying to place it on a gmap? Also, it doesn't only work with pics1 type tiles, does it.. ?

Come to the conclusion that it's neither of the things I mentioned. Anything else it could be.. ?

Posting my class code for reference:

PHP Code:

function onPlayerchats() 
{
  if ( 
player.chat == "/destroy" && player.account == "DeCeaseD"destroy();
}

//#CLIENTSIDE
function onCreated() 
{
  
this.join("astar");
  
showCharacter();
  
  
this.plyr findnearestplayer(this.xthis.y);
  
  
moveTothis.plyr.xthis.plyr.y);


Also, note that I am placing these NPC's using a class spawner, and not actually adding them to the level via level editor. Could this be what's wrong?

xXziroXx 07-04-2012 03:07 AM

You need to configure either newtilesetlevels or newtilesets in serveroptions to let the server know which levels are using type 1 tiles.

DeCeaseD 07-04-2012 03:16 AM

Quote:

Originally Posted by xXziroXx (Post 1698909)
You need to configure either newtilesetlevels or newtilesets in serveroptions to let the server know which levels are using type 1 tiles.

Not sure how to configure either of the things you mentioned Ziro. :P

xXziroXx 07-04-2012 03:26 AM

Quote:

Originally Posted by DeCeaseD (Post 1698912)
Not sure how to configure either of the things you mentioned Ziro. :P

Example:

PHP Code:

newtilesetlevels=myfirstlevel.nw,mysecondlevel.nw,mylevels_ 

If your entire server is type 1, you can just set newtilesets=true though.

DeCeaseD 07-04-2012 04:57 PM

Oh okayy.. well played good sir! But, apparently this is not the problem as the NPC is still returning "Error: Blocking!"

xXziroXx 07-04-2012 07:50 PM

Quote:

Originally Posted by DeCeaseD (Post 1698933)
Oh okayy.. well played good sir! But, apparently this is not the problem as the NPC is still returning "Error: Blocking!"

Try it in a type 0 level and see if it works.

Hezzy002 07-04-2012 08:10 PM

You should use A* with waypoints and a navigation mesh instead of tiles, it's less intensive and looks better, although it creates some manual labor for the person creating the level. Maybe you could fall back to tiles if there are no waypoints in the area.

xAndrewx 08-13-2012 08:06 PM

awesome xx


All times are GMT +2. The time now is 12:41 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.