GameMaker [SOLVED] Possible bug in mp_linear_path_object()

S

Satori

Guest
My top-down game uses procedurally generated levels, and I use the function mp_linear_path_object() after the map is completed to make sure there is a clear path to the exit. In theory, this function should return true if a path is found and false if it isn't. My problem is that in rare instances the function will return true even if the path is completely blocked.

Here is the code I use in a user event of obj_player:
Code:
if !mp_linear_path_object(path0, global.strdn.x+64, global.strdn.y+260, 2000, obj_wallblock)
{
    global.flrseeds[global.flr] = 0; // Erase random seed
    room_restart();
}
This checks for a path between the player's starting location and a spot just in front of the stairs. If the path is blocked, it erases the random seed for the level and starts over. But as I said, sometimes it returns true even when the path is blocked.

Am I doing something wrong, or is this a bug in the function? Is there a better way to do this?
 
I

icuurd12b42

Guest
stepsize of 2000!!! you are telling it your instance is moving at speed of 2000 pixels per step
 
S

Satori

Guest
stepsize of 2000!!! you are telling it your instance is moving at speed of 2000 pixels per step
Yes, I know, but the instance isn't really moving, it's only checking to see if a path exists. The actual path is never executed. I've tried using smaller numbers, but then it takes longer to calculate and sometimes it returns false when a path does exist (the opposite of my current problem). The room size is 5760 x 5760, which is why I used such a large number.
 
I

icuurd12b42

Guest
you may have better luck with
mp_grid_path

grid cell size of 32x32 should be cost effective on a room that size
 
S

Satori

Guest
you may have better luck with
mp_grid_path

grid cell size of 32x32 should be cost effective on a room that size
Thanks for the suggestion. I've never used any mp_grid functions before, so I'll have to research that. Looks like there's a bit more setup involved, but I'll check it out when I have more time.
 
S

Satori

Guest
mp_grid_path seems to be working perfectly. Thanks for your help!
 
I

icuurd12b42

Guest
if you have a version of the dysfunctional project that is easy to understand, you should probably report this to yoyo, It feels like a bug to me...
 
Top