Implementing Dijkstra's Algorithm in UnityScript


I’m working on a turn-based tactics game in which the action takes place on a 2D grid. (I should probably mention that this is my first major Unity project.) I’d like to use Dijkstra’s algorithm for finding the movement and attack ranges of units in Manhattan distance. However, Unity doesn’t appear to support some of the data structures I need for this implementation (specifically priority queue, map, and list types). What are the best ways to resolve this?

Right now, I’d like to import standard JavaScript library implementations, but it doesn’t seem like that’s possible. I might be overlooking something really obvious, but as far as I can tell so far, Unity isn’t compatible with standard JavaScript. My background is in design and not engineering, so I’m not too enthusiastic about having to write efficient custom implementations of these. Any recommendations? Thanks in advance.

You might want to check out the source for Three.js Many of the algorithms can be ported over to Unity by simply fixing the namespace of the class references and function names.

If nothing else you could probably prototype your game in WebGL using Three.js and then work backwards porting in to unity from there (if it’s even required.)