The Wave Function Collapse Algorithm and its Application to AI Navigation
DOI:
https://doi.org/10.47611/jsr.v11i2.1626Keywords:
Wave Function Collapse Algorithm, Artificial Intelligence, Navigation, Unity EngineAbstract
For so long, game developers have had to hand place waypoints, leading to linear paths being taken by Artificial Intelligence (AI) which move between them. These paths often loop, and if they don’t, they only serve to move an AI from point A to point B in the same way time and time again. A more dynamic solution is needed, and the Wave Function Collapse Algorithm is suited to provide that. This solution was implemented in the Unity engine using C#. By utilizing the provided Wave Function Collapse Algorithm template, waypoints were able to be substituted for game objects. When implemented in this manner, the Wave Function Collapse Algorithm places waypoints within a defined area allowing an AI navigator to maneuver between them. Should a waypoint be inaccessible, the waypoints will regenerate. Waypoints, upon the map regenerating, are removed so that any of those colliding waypoints cannot be accessed by the AI. This creates a dynamic path for an AI to traverse. The AI only moves between active waypoints and the map is able to regenerate so that the paths laid out do not succumb to the same pitfalls that traditionally plotted paths do. The next logical step is to apply the Wave Function Collapse Algorithm to a generated map. By allowing the Wave Function Collapse Algorithm to plot waypoints dynamically and continuously, different applications can utilize this to allow an AI to traverse a map in a unique way.
Downloads
Metrics
References or Bibliography
Parker, J. (2017). Generating worlds with wave function collapse. Generating Worlds With Wave Function Collapse - PROCJAM Tutorials. Retrieved February 28, 2022, from https://www.procjam.com/tutorials/wfc/#:~:text=Wave%20Function%20Collapse%20(WFC)%20by,patterns%20from%20a%20sample%20image.&text=The%20traditional%20approach%20to%20this,to%20alter%20your%20game%20map.
selfsame. (2016, October 29). Unity-wave-function-collapse by selfsame. itch.io. Retrieved February 28, 2022, from https://selfsame.itch.io/unitywfc
Published
How to Cite
Issue
Section
Copyright (c) 2022 Luke Trefry
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright holder(s) granted JSR a perpetual, non-exclusive license to distriute & display this article.