• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker mp_grid direction constraints?

Hi, so i ran into an issue with an RPG game i've been making.
I am trying to create maps with "fake height", like in this example:


i have implemented the use of mp_grid into the game and all the characters move around the map by calculating a path using mp_grid_path, and mp_potential_step between points (which works well enough).

However I cant figure out how i can make some cells in the grid passable only in some directions.
Heres an example of what i'm trying to achieve:


Is it even possible with the use of mp_grid? and if not how can do that?
Thanks!
 

TheouAegis

Member
You're going to need to come up with your own algorithm. Because if you define the impassable terrain before you actually generate the path, then you would be marking passable terrain as impassable and impassable terrain as passable quite possibly depending on where the path takes the player. So then you would need to redefine the impasses every x number of steps, but then that could completely reroute the enemy. In other words, you need to make up your own algorithm.
 

NightFrost

Member
However I cant figure out how i can make some cells in the grid passable only in some directions.
Yeah, not possible with mp_grid. You pretty much need to read about A* (a-star) algorithm and how it uses graphs to represent neighbouring cells. Once you understand the procedure, a one-way connection means node X lists node Y as a neighbour so there is a connection for pathfinding, but node Y does not list node X as a neighbour so pathfinding between them will not be performed.
 

Evanski

Raccoon Lord
Forum Staff
Moderator
Like the others said you;d need to write your own algorithm/script or whatever but then you can have mp_grid "piggyback" off of that
 
Top