Procedural pathfinding for 2D-platformers in Godot.
NOTE: Consider this a pre-alpha release.
- This framework still has many rough edges, is still changing a lot, and is probably a lot more inflexible than you would need (it makes a lot of assumptions about how you’ve structured your app).
- See the Still not working? docs for more context into how difficult this may be for you to use.
AI and pathfinding for 2D-platformers in Godot.
“Surfacer”: Like a platformer, but with walking, climbing, and jumping on all surfaces!
NOTE: This framework depends the separate Scaffolder library.
tl;dr: Surfacer works by pre-parsing a level into a “platform graph”. The nodes are represented by points along the different surfaces in the level (floors, walls, and ceilings). The edges are represented by possible movement trajectories between points along surfaces. There are different types of edges for different types of movement (e.g., jumping from a floor to a floor, falling from a wall, walking along a floor). At run time, A* search is used to calculate a path to a given destination.
Some features include:
Because there aren’t many other tools out there for intelligent pathfinding in a platformer.
The vast majority of platformers use pretty simple npc AI for movement—for example:
Most examples of more sophisticated AI pathfinding behavior are still pretty limited. One common technique uses machine-learning and is trained by hundreds to thousands of human-generated jumps on an explicit pre-fabricated level. This makes level-generation difficult and is not flexible to dynamic platform creation/movement.
There are two key reasons why good path-finding AI isn’t really used in platformers:
But there are use-cases for which we really benefit from an AI that can accurately immitate the same movement mechanics of the character. One example is if we want to be able to control the character by tapping on locations that they should move toward through the level. Another example is if we want to have a flexible game mode in which an npc can swap in for a player character depending on how many players are present.
assets/images/
, assets/music/
, and assets/sounds/
) are published under the CC0 1.0 Universal license.