Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

When I did briefly think about it, I thought it sounded tricky to check every possible path from say, bottom left upwards, then move one along and repeat it - 1)  I had no idea how to code that and 2) I thought it sounded quite intensive for the Playdate, though there's not that many squares so I guess it would be fine. 

Thanks for the link, that's going to be an interesting read.

Come to think of it, the Wikipedia page I linked to is a bit dry and used a lot of computer science and graph theory jargon. The concepts behind it are not very difficult at all though: they boil down to traversing your grid in a particular way while keeping track of which spaces you've already visited. I would instead recommend to Google for "game pathfinding" or "depth-first search" and look for a more straightforward explanation.

Besides graph search there are also "shortest path" algorithms (like Dijkstra's or A*) that give you the shorter path from A to B that doesn't go through obstacles. You don't really need those because you just want to check if the path exists at all. But if you happen to find a library that does shortest path that will also work, because those algorithms will return an error or report that the "shortest path is infinity long" if no path can be found at all. 

All these algorithms are actually very efficient (execution time "scales linearly" depending on the size of your grid). I recently implemented one in Commodore 64 Basic and that worked fine, so for the Playdate it should definitely not be a problem!