How would I go about Turn-Based Pathfinding using a Tilemap/Array?

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

    I'm trying to make an oldschool dungeon crawler like ROGUE, I'm wondering how it's possible to achieve turn based pathfinding using arrays or tilemaps. I'll give a quick run-down of how my project works:

    I've got a procedural generation dungeon created in a 50x30 cell Array. 0 being a wall, 1 being floor. To which I do a 'For Each X&Y Element' condition to render each cell to it's counterpart on the tilemap. It all works nice.

    However the problem comes with enemies, Construct 2 has built in path-finding. However it uses actual collision checks with objects to which i'm not using objects for my walls. I figured since the map is procedural generated for each tile that's not equal to 1 i'll create an invisible wall object the size of each tile. So that the pathfinding will work. But the problem lies that my game's map is 50x30 tiles per floor. And some floors will only have about 200 of the tiles as walk-able flooring so you can imagine how intensive that'll be to run having over a thousand invisible objects on run time?

    And factoring in the problem of i'm using turn based movement instead of Construct 2's pathfinding movement. I figured I would call a 'FindPath' action and then use the 'Pathfinding.NodeX' and 'Pathfinding.NodeY' expressions to determine which tile to move to. Every turn it would recall the 'FindPath Action'to update. But this is only achievable if I can find a way for the PathFinding behavior to work with either a tilemap/array.

    Does anyone have any suggestions?

    Thank you, Pixel.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this behavior:

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

    I used it just a few days ago in a project and it's great! Very fast, and it allows to regenerate a map and find path in one tick.

  • This is exactly what i'm looking for, cheer for the quick response!

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