A downloadable tool for Windows and Linux

Download NowName your own price

GMS2's built in motion planning functions were designed to be used under very specific circumstances. If your use case does not fit within the requirements of GMS2's motion planning functions, then you may find yourself either out of luck, or wrestling with the functions to try to make them work with your system.

These scripts were written to provide GMS2 users with a far more flexible pathfinding system, as well as implement some functionality that is not currently present in the motion planning functions.

Features

  • Three different pathfinding algorithms to choose from: breadth-first search, depth-first search, and A* search.
  • Simple inputs and outputs, without forced use of GML data structures or paths.
  • Support for grid squares of varying weight.
  • No memory management required. All scripts take in and return 1D and 2D arrays.
  • A sample project to reference while implementing the scripts into your own project.
  • Completely free and open source!

Requirements

  • GMS2 2.3.0 runtime. While these scripts may work in newer versions, they have not been tested.
  • A game space that can be represented as a 2D array of instances.

Reference Project Controls

  • Left click on grid to place the currently selected object
  • Right click on the grid to remove an object, or increment the square's weight if weights are toggled on.
  • Button 1: Cycles through the currently selected object.
  • Button 2: Cycles through the currently selected algorithm.
  • Button 3:  Toggles visibility of square weights (Note: square weights only impact the A* algorithm).
  • Button 4: Displays the microseconds required to calculate the last path.
  • Button 5: Calculates the path from the start object to the end object if they are present on the grid.

If you have any questions, have a bug to report, or need help with implementing these scripts in your project, feel free to shoot me a message on Twitter @ProtonSquid. I will do my best to help.

These scripts, as well as all the code files in the reference project have been released under the MIT Open Source License.

Thanks to Vurmux for use of their 1bit tileset, and Davit Masia for use of their MATRIAX8C color palette in the reference project.

StatusReleased
CategoryTool
PlatformsWindows, Linux
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorProton Squid
TagsGameMaker, Open Source, sourcecode

Download

Download NowName your own price

Click download now to get access to the following files:

Scripts.zip 3 kB
Reference_Project_Source.zip 84 kB
Reference_Project_Windows.zip 2 MB
Reference_Project_Linux.zip 2 MB

Development log

Comments

Log in with itch.io to leave a comment.

omg how have I never found this before!

Hello! Awesome scripts!I found that under the A* weight script, there was A memory leak because the path was drawn in real time and A* script was called A lot. However, I could never find the cause of the memory leak.

Hi! Thank you so much for pointing this out. Thought I was pretty good about memory management in there, but I must have missed something. I am going to try to get this sorted out and hopefully have a fix out in the next week.

Thank you for your help

After many hours of debugging, I believe I have found a solution to the memory leak problem. Unfortunately, its going to require me to refactor a decent chunk of the scripts. So it may be a couple more days until I am able to upload the new version.

OMG,You're amazing,

(+1)

I have just uploaded version 1.1 of the scripts and reference project! To my knowledge, all the memory leak bugs have been fixed. In a test project, I called all three algorithms every step for 5 minutes straight and saw no increase in memory usage. So hopefully this will solve your problem.

I apologize for any delay this might have caused in your development. As always, if you have any more issues with the scripts, you can post again here or message me on Twitter.

Hello! Awesome scripts! Have you an example to show how use it in order to move the object with the path ? Thank you!

Not at the moment! But that is a great idea for an additional script that could be added to this! I may do that in the near future.

The pathfinding scripts all output arrays of coordinates, so if you want an object to follow a calculated path, then you could always convert those coordinates into a GMS path.

https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/paths/inde...

I hope this helps! If you have more questions, feel free to shoot me a message on Twitter. I am more likely to respond quickly on there.

@ProtonSquid

Thanks you!