<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 10 June 2017 at 03:18, James Paige <span dir="ltr"><<a href="mailto:Bob@hamsterrepublic.com" target="_blank">Bob@hamsterrepublic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Thu, Jun 8, 2017 at 9:06 PM, Ralph Versteegen <span dir="ltr"><<a href="mailto:teeemcee@gmail.com" target="_blank">teeemcee@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-m_5601504667057585870m_-5996999995656701772gmail-">On 9 June 2017 at 10:32,  <span dir="ltr"><<a href="mailto:subversion@hamsterrepublic.com" target="_blank">subversion@hamsterrepublic.co<wbr>m</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">james<br>
2017-06-08 15:32:01 -0700 (Thu, 08 Jun 2017)<br>
235<br>
Add preliminary scripting interface for NPC pathfinding. None of these are documented yet, because I gotta do testing first<br>
  pathfind npc to (n, x, y)<br>
  npc chases npc (n, dest n, stop when reached)<br>
  cancel npc movement override (n)<br>
---<br>
U   wip/<a href="http://const.bi" rel="noreferrer" target="_blank">const.bi</a><br>
U   wip/game.bas<br>
U   wip/<a href="http://game.bi" rel="noreferrer" target="_blank">game.bi</a><br>
U   wip/plotscr.hsd<br>
U   wip/scriptcommands.bas<br>
U   wip/<a href="http://udts.bi" rel="noreferrer" target="_blank">udts.bi</a><br></blockquote><div><br></div></span><div>Cool!<br></div><div>Instead of cancelnpcmovementoverride I think we should add a generic stopnpc command to stop the current walk. Currently you have to script it yourself by doing walknpc(npc, left, 0) , walknpc(npc, down, 0), but that's non-obvious and can leave the npc misaligned (I guess we can add an arg whether to finish the current tile's movement or stop immediately).<br></div></div></div></div></blockquote><div><br></div></span><div>We definitely need a stopnpc command, but "cancel npc movement override" is doing something dramatically different.<br><br></div><div>stopnpc would be canceling a step, either from a walk npc, or from a movement type.<br><br></div><div>"cancel npc movement override" would allow the npc to revert to their normal movement type, which would only mean stopping if their previous movement type was non-walking, or if "suspend npcs" was active<br><br></div><div>...actually, if "suspend npcs" is not active, then "stop npcs" would also allow the NPC to resume their normal movement... so I guess the difference isn't that big.<br></div></div></div></div></blockquote><div><br></div><div>Actually, I don't see any difference at all (assuming that the command waits for the current step to end).<br></div><div>I guess I should have called it cancelnpcmovement instead of stopnpc, but stopnpc is so, so much shorter. I meant a command to stop any current walk command or pathfind, so that the npc returns to its normal movement type.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Which reminds me, the way I implemented the pathfinding override is currently broken in regards to suspend npcs, so that is the next thing I need to fix. <br></div><span> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>I think that the NPC/hero pathfinding commands should behave like other NPC/hero walking commands; for example waitfornpc should work,</div></div></div></div></blockquote><div><br></div></span>Yes, I definitely want to be able to use waitfornpc with the pathfinding commands,<br><br></div><div class="gmail_quote">I was also thinking about adding an optional argument to wait for npc allow it to time-out on an endless path.<br><br></div><div class="gmail_quote">Right now endless paths happen when an npc can't reach its destination, and waffles between two equally good consolation destinations. I think I can reduce the risk of that with better tie-breaking, but it is guaranteed to always be possible once other moving npcs are added to the equation.<br></div></div></div></blockquote><div><br></div><div>Really? I haven't seen any NPCs pathing forever. However there's a lot of bad back-and-forth behaviour due to other NPCs moving and changing the available paths. It encourages me to argue for a more complicated cost scheme for NPCs rather than just whether they're been stationary.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"></div><div class="gmail_quote"> <br></div><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> and using walknpc would cancel pathfinding and vice versa. (Is it useful enough to have a way to move an npc without cancelling pathfinding to go to the trouble of special commands? I guess they would be 'pause' and 'resume' commands.)<br></div></div></div></div></blockquote><div><br></div></span><div>I like having walknpc cancel pathfinding.<br><br></div>I haven't tested yet, but I think that pathfinding will already wait for a walk npc command to finish before it begins pathing.<br><br></div><div class="gmail_quote">I'm glad you reminded me to test how simultaneous pathfinding and walknpc will interact with each other.<br><br><br></div><div class="gmail_quote"><br> <br></div><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>Still, I guess npciswalking should probably return false for a pathfinding npc that's currently stuck for consistency, with a separate way to check whether an npc is pathfinding.<br></div><div><br></div></div></div></div></blockquote><div><br></div></span><div>I agree. "stuck" in the sense of unable to reach the desired target, but reached a consolation destination okay should definitely count as npciswalking == false<br><br></div><div>I was thinking of having an optional maximum number of retries that autopathing will attempt before giving up and cancelling a movement entirely<br></div></div></div></div></blockquote><div><br></div><div>That could be useful, but because the path is recalculated after every step as the npc moves towards a consolation tile, the retry count would effectively be the number of steps to take before halting.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><span><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>I know we're not using script error levels for much currently, but I expect they will be more important in future (in particular, I'd like to add a script error log where you can see warning messages without them causing annoying notifications). Don't use serrBound for new script commands. Use serrBadOp. That's already the default for get_valid_npc_id.<br></div></div></div></div></blockquote><div><br></div></span><div>Ah, thanks! I'll fix that. I copy-pasted those serrBound lines from some other command.<br><br> <br></div><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br>pathfinder_stop_when_npc_reach<wbr>ed won't work if the dest npc is just over the map edge.<br></div></div></div></div></blockquote><div><br></div></span><div>Oops! Good catch.<br><br></div><div>I should write a xypair_wrapping_manhattan_dist<wbr>ance() function that checks gmap(5)<br></div></div></div></div></blockquote><div><br>xypair_manhattan_dist<wbr>ance seems like a crazy name to me; why not manhattan_dist<wbr>ance?<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>I'm rather amazed that it's possible to define constants with names npc and pos, which are used elsewhere as variable names...<br></div></div><br></div></div></blockquote></span></div><br></div><div class="gmail_extra">I think it only works because they are in the scope of the ENUM, and I use the full enum name when I refer to them.<br></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br>---<br></div><div class="gmail_extra">James<br></div><div class="gmail_extra"><br></div></div>
<br>______________________________<wbr>_________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org" target="_blank">ohrrpgce@lists.motherhamster.o<wbr>rg</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" rel="noreferrer" target="_blank">http://lists.motherhamster.org<wbr>/listinfo.cgi/ohrrpgce-motherh<wbr>amster.org</a><br>
<br></blockquote></div><br></div></div>