Skip to main content

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

Nice puzzle game!

I was wondering about the algorithm you used to generate levels. Did you use a shortest path finding algo the like Dijkstra's algorithm to find the path with desired length (with random neighbour selection)? And once the path is found, then I guess you can set the pipe style to fit with the path direction and randomize the pipe rotation?

(1 edit)

Thank you for playing! I used a simple algorithm that recursively visits all the tiles in random order and uses backtracing to "burn" paths that did not reach the target tile. This way I have no control over the path distance unfortunately but I was planning on controlling the level difficulty by locking a variable number of pipes in the correct position depending on the level. 

Like you said once I have a path I can just find which pipes are needed to traverse it and then rotate them randomly and fill the rest of the board with random tiles. 

The board is just an array of integers that represent that pipe connections with 4 bits (1=top, 2=right, 4=bottom,8=left) so once you map the values to the different pipe graphics it's trivial to query things like "give me a pipe that connects the top tile to the bottom tile" with simple bitwise operations. This actually already works with other pipe shapes like T shapes (i.e. a value of 7 is a top-right-bottom pipe) or cross shapes but I decided eliminate those in the end because it was creating too many levels where the path is too easy to find

(+1)

Thank you for the in depth reply. 

This is why I love game development, it's so satisfying to combine a series of instructions to create a gameplay mechanic. And once again, I really enjoyed your game, best of luck with your future games!