How do I make NPC grid-based movement with pathfinding?

1 favourites
  • 4 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Heya,

    I'm trying to replicate NPCs behavior in old-school RPGs like FF, Pokémon, or more recently Stardew Valley.

    Reference video:

    https://youtu.be/ot7uXNQskhs?t=102s

    As you can see, NPCs are living their lives while walking from point A to point B. In SV, their path is predetermined, while in some games they can wander around randomly for some time. Anyway, I want my NPCs to walk in a 4 directional movement and taking the shortest path while avoiding obstacles.

    I already tried:

    - Tile movement behavior with scripted events like "run toward this direction and change direction when there's something in the way". They can walk toward a direction, but if there's an obstacle they're stuck.

    - Pathfinding. 4 directional movement is complicated, even with diagonals option unchecked, the angles are often smoothed out, and the movement looks very unnatural.

    Well, thanks in advance!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi Skdf, I'm French

    I didn't know this game, it looks very fun, but it's not in French:(

    I'd like to help you, but I don't know how to do what you ask.

    Would you like to do a similar game again?

  • Hi Skdf, I'm French

    I didn't know this game, it looks very fun, but it's not in French:(

    I'd like to help you, but I don't know how to do what you ask.

    Would you like to do a similar game again?

    Hi! It's fun indeed, even if a bit grindy :) There's a beta for French on PC so you should check it out on Steam.

    I'm not making a similar game in terms of gameplay but yeah it's set in a small village with lots of NPCs so I guess there are similarities.

  • construct.net/en/forum/extending-construct-2/addons-29/behavior-easystar-js-pathfindi-96215

    In c2 you have plugin solutions. You can also do a manual implementation of A* algorithm through pure eventing.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)