[erlang-questions] How to implement the A Star find path algorithm using NIF?

Dmitry Kolesnikov <>
Mon Jul 10 18:33:34 CEST 2017


Hello,

> On 10 Jul 2017, at 19.11, skyman <> wrote:
> 
> Hi everybody,
> 
> Our game is using A Star algorithm to find path. For performance I want to write it in C language, and Erlang calls it by NIF. I don't know whether the map data is maintained in C or in Erlang. Can anyone tell me?

Map is native data structure. However, you need to use enif interface to interact with it. 
http://erlang.org/doc/man/erl_nif.html#enif_get_map_value

> In addition, is there any better solution than NIF?

I’ve used to solve a “routing” issues on pure Erlang using ETS, lists, etc. However, this mainly depends on your traffic, latency and size of routing tables. It is hard to give a straight forward answer not knowing this figures.      


> 
> Thanks very much!

Best Regards, 
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170710/229e322d/attachment.html>


More information about the erlang-questions mailing list