Quick answer: GameMaker mp_grid_path returning false after the room dynamically resizes? The grid’s width/height are baked at creation; growing the room doesn’t extend the grid.

A procedural dungeon grows during play. AI pathfinding misses target cells outside the original grid bounds.

Grid Is Static Size

mp_grid_create takes width / height parameters. The grid stores a fixed array of cells. Room resize doesn’t resize the grid.

Recreate on Resize

mp_grid_destroy(grid);
grid = mp_grid_create(0, 0, new_w/32, new_h/32, 32, 32);
// repopulate cells from current world geometry

Destroy then create. Repopulating is O(N) over cells — can spike on huge maps.

Sparse Grids

For very large worlds, consider chunked grids — one per region. AI paths within a chunk; cross-chunk paths handled by waypoints between chunks.

Trade Accuracy for Size

Lower cell resolution = smaller grid. 32px cells vs 16px cells = 1/4 the memory. Tune to gameplay needs.

Verifying

Pathfinding works on the full current room. Resizing dynamically repopulates the grid; paths reflect new geometry.

“mp_grid size is fixed at create. Recreate on room resize.”

If your world dimensions are unpredictable, allocate a generous grid up front — cheaper than per-resize rebuilds.