Re:Pathfinding for Tower Defense
by wycy on Tuesday January 01, 2019 @11:59AM
(#18800950)
This would’ve been a handy article to have read before/during Advent of Code 2018. There were multiple path finding problems I struggled through.
[ Parent
| on HN ]
Oh man, day 15 is almost a party pooper to me, not because of the algorithm, but the edge cases. Took me ages to debug. It gives me perspectives to game development.
I don't know that it's quite similar though: advent's day 15 is about replicating exactly the algorithm used by the system designer, except using a somewhat hand-wavy description. Because of the testing methodology/system, it adds a lot of complexity to the task of aggro/pathfinding.
Yeah, you are right, it just happens to remind me day 15. The description is surely not the best, but I don’t think it’s hand wavy, it went great length to explain what happens which I appreciate. What frustrates me is it does not help me to discover certain edge cases. But it reflects reality, there are bugs you can never imagine until you run into.
Yeah, my day 15 part 2 is still somewhat bugged. At termination, I print out 6 possible answers, each of which represents an off-by-one error. My correct answer is fortunately one of these: its the round * (elves HP + 3), which indicates that my elves sustain one too many attacks before the game ends. I still have no idea where this extra attack is coming in, but I’ve basically given up on perfecting my day 15 code. It was incredibly frustrating.
That sounds very similar to what I experienced, my bug was that a player A plays twice in a round because it steps into a spot yielded by player B which died in the same round. My mistake was bookkeeping in an incorrect (which is only so for a few cases) way. Hope that helps.