NPC Pathing

Hello,

First let me say that I really enjoy MTE and you’re doing a great job. So many thanks for creating such a great engine. To my question/dilemma:

I’m trying to create an RPG and I want an NPC to follow a specified path using objects in Tiled. Right now I have a separate gameloop specifically for the NPCs that will populate the world using the code you have in the Castle Demo. Would you perhaps be able to provide an example of how to get this working so it appears my NPCs are walking around to create life to my towns and other game areas?

I think this is a question too broad in scope.

If you’re asking about hot to do this in MTE you’d essentially be moving NPCs the same way as the player - moveSpriteTo()

However the logic behind NPC movement is a far greater subject; at the very simplest you move between predetermined waypoints (these could be simply arrays of positions and movement times stored on the object or *possibly* created in Tiled?!?).

Anything more complicated and you’ll need to research Game AI - specifically Pathfinding, possibly States, and a good understanding of design patterns.

Thanks for the reply SegaBoy.

I’m trying to move my NPC sprites by adding them via mte.addSprite then using the object layer to set up a walking path for them. I’m nearly there after banging my head against this a little longer.

I think this is a question too broad in scope.

If you’re asking about hot to do this in MTE you’d essentially be moving NPCs the same way as the player - moveSpriteTo()

However the logic behind NPC movement is a far greater subject; at the very simplest you move between predetermined waypoints (these could be simply arrays of positions and movement times stored on the object or *possibly* created in Tiled?!?).

Anything more complicated and you’ll need to research Game AI - specifically Pathfinding, possibly States, and a good understanding of design patterns.

Thanks for the reply SegaBoy.

I’m trying to move my NPC sprites by adding them via mte.addSprite then using the object layer to set up a walking path for them. I’m nearly there after banging my head against this a little longer.