playMaker

Author Topic: Grid Based Movement  (Read 6434 times)

SeanC

  • Junior Playmaker
  • **
  • Posts: 61
Grid Based Movement
« on: December 04, 2012, 08:15:37 PM »
Hey all!

So I was attempting to see if there was a way to build tile based movement using only playmaker.

My idea was to use the navmesh actions and generate a path between two objects, and then sample known distances along the path, get the nearest tile (gameobject) and move the unit to those tiles in order. Unfortunately, I cant seem to find a way to do much with the generated path. I tried the "Sample Point on Path" action, but that doesnt seem to do what I think it does. Is there was a way to sample a point that is at a specified distance along a path and store it?

For now, i just spawn a dummy object, have it move along the path storing the tiles it collides with along the way in an array, and then i move the enemy to those positions in order. Unfortunately, this is a somewhat slow process (i have to wait for the dummy object to record the positions).

Any ideas?

Thanks,
Sean
« Last Edit: December 04, 2012, 08:43:49 PM by SeanC »

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: Grid Based Movement
« Reply #1 on: December 05, 2012, 03:58:24 PM »
Perhaps you'd prefer to integrate this with Playmaker? I guess it'd be quite easier and faster than looking for a way to do it only with Playmaker?

http://forum.unity3d.com/threads/138355-Tile-Based-Map-amp-Nav
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

SeanC

  • Junior Playmaker
  • **
  • Posts: 61
Re: Grid Based Movement
« Reply #2 on: December 05, 2012, 05:08:38 PM »
Yeah, Ive responded on that post as well. I would love to get something like that implemented, however, I am no programmer, so until someone is able to do that, I must look for my own humble solution.

I have actually been able to get grid based movement working very well doing what I stated above, but there is a slight delay (less than a second) in time while the NPC sends out the pathfinding dummy to record the next cells to move to, which feels a little odd. A solution where I could perhaps build a path from navmesh and then record points along the path at specific increments and then find the cells nearest those points, would be a faster way to do it.

Out of curiosity, what exactly is the "Agent Sample Point on Path" action intended to be used for?

asano83

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Grid Based Movement
« Reply #3 on: December 05, 2012, 09:46:21 PM »
Hi SeanC,

I am actually working on a similar issue right now.  I am trying to find a way to do hex based movement though I was trying to use uScript and script it myself (though I also have poor programming skills).  I actually have taken a look at the Tile Based Map and Nav and have purchased those assets.  That system used a node on each hex and a series of recursives to basically search for connected nodes to the active hex.  It works but is very complicated (for a newbie programmer).  I am hoping we can find a way to make Playmaker do something similar.  I will post any breakthroughs I find, and if you want to do the same hopefully we can work together to find a solution.