- map generation
Generating chunks was a good idea but not all chunks are perfect. There are cases that some chunks may leave isolated tiles and/or buildings after the generation. E.g
0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0this chunk is totally ok as long as it’s not placed at the bottom left quadrant. If it is the bottom left tile is an island and pointless. Since we are playing on an limit 8x8 board, we can’t have useless islands taking up precious space. So to battle this I set out the write a connectivity check from tile to tile and tile to building (all building need to be reachable as well). Tile to tile checking is easy with a DFS and check if every tile node is visted. Build to tile check required a pairwise reachability check. It takes about 1 ~ 2 seconds to generate a valid map, which is acceptable. Next up the movement of pieces and enemies where happening with place swaps, so it was impossible to tell who went where and what happened. I decided to draw a route line that indicated what happened to understand the movement of pieces better. This lead to me realizing a bug in the path finding code and I changed that completely. Previously I was using a BFS with a parent/child relationship map and back tracking the nodes to build the path. I switched over to Lee’s algorithm which is similar in concept but simpler. Here is a more detailed approach on this algorithm. With the path finder working again I completed the line drawing showing the route the pieces had taken and also prevented pieces from jump over other pieces blocking their way. This made the game a bit harder and more restricting, I don’t know how it will impact the feedback during test plays.