Week 2 Path Finding
Hey everyone, I spent most of this week tweaking my path finding code. I'm using A star, but needed to deal with impossible paths that are possible. What I mean is you can't walk through an enemies wall, but you can break it down. However why break it down when you can just walk around it. But what happens when the walls are in a large square pattern (like a base) and you want to get into the base. So the path finding needed to look for ways around walls and then eventually just go through them. In addition doors were added, so you go through them but the enemy can't.
I spent some time thinking about how to pre-generate paths but couldn't find a good solution. I did however realize I could pre-generate G values, and setup node trees, so only viable nodes are searched. This can be done a head of time with the map terrain and then updated when building are added. The game can now run 100 sprites constantly moving and path finding without slowing down.