<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi Dmitry,<br><br>Thanks for your reply.<br>The map of our game is large(1000 * 1000 grids). If I use NIF to implement the A Star find path in C, can I allocate the map grid array(1000 * 1000) in C, and when map blocks changed, Erlang calls 'updateBlock' NIF to update the grid state in grid array in C?<br><br></div>Thanks!<br><br><br><br><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><br>At 2017-07-11 00:33:34, "Dmitry Kolesnikov" <dmkolesnikov@gmail.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div class="">Hello,</div><br class=""><div><blockquote type="cite" class=""><div class="">On 10 Jul 2017, at 19.11, skyman <<a href="mailto:cloudzen@163.com" class="">cloudzen@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><div class=""><span style="font-family: arial;" class="">Hi everybody,</span></div><div class=""><span style="font-family: arial;" class=""><br class=""></span></div><div class=""><span style="font-family: arial;" class="">Our game is using A Star </span><font face="arial" class="">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?<br class=""></font></div></div></div></blockquote><div><br class=""></div><div>Map is native data structure. However, you need to use enif interface to interact with it. </div><div><a href="http://erlang.org/doc/man/erl_nif.html#enif_get_map_value" class="">http://erlang.org/doc/man/erl_nif.html#enif_get_map_value</a></div><br class=""><blockquote type="cite" class=""><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><div class=""><font face="arial" class="">In addition, is there any better solution than NIF?<br class=""></font></div></div></div></blockquote><div><br class=""></div><div>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.      </div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><div class=""><font face="arial" class=""><br class=""></font></div><div class=""><font face="arial" class="">Thanks very much!</font></div></div></div></blockquote></div><br class=""><div class="">Best Regards, </div><div class="">Dmitry</div></blockquote></div><br><br><span title="neteasefooter"><p> </p></span>