Hacker News new | past | comments | ask | show | jobs | submit login

I'm using flow field pathing in the MMO game I'm making. It was surprisingly easy and intuitive to implement! And you can have huge gains if you cache paths to target cells and re-use them across different agents. Its kind of crazy how just a few lines of code can change your implementation from flow-field to A* to Dijkstra, or whatever. I think implementing these algorithms is a fun exercise in recursion it forces you to enter a different head space. Also some crazy overlap with other AI systems, as things like A* are used for goal planning. So its worth to learn all this stuff if you want to program game AI.

The backend of my game is written in Elixir. And the world grid used for path-finding is represented as a global shared ETS table (distributed data store) with 1 writer (world server) + multiple readers (ai unit controllers). It works so well, and I can even have sub processes that evict cached paths when dynamic "obstructions" like resources spawn into the world. The ETS table structure also can partition cells/grids/paths by "level/map" and server instance. And you can profile it in real-time and see how much memory the ETS table is using, time-to-pathfind, and other metrics.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: