Author Topic: using rpc to create a bot  (Read 7213 times)

inkha

  • Newbie
  • *
  • Posts: 8
    • View Profile
using rpc to create a bot
« on: June 24, 2014, 03:42:06 PM »
is that doable? how are move commands issued to act on the game_gethpath results?

domob

  • Developer
  • Sr. Member
  • *****
  • Posts: 285
    • View Profile
Re: using rpc to create a bot
« Reply #1 on: June 25, 2014, 06:17:45 AM »
It is definitely doable, I actually did it in the very beginning - although with just a very stupid bot, and I do not run it anymore.  (Was just for fun, and only controlled max 8 hunters.)  The basic procedure to move your hunter to some target coordinate with game_getpath is this:
  • Get the hunter's coordinate from game state.
  • Call "game_getpath [X1,Y1] [X2,Y2]", where (X1, Y1) is your coordinate and (X2, Y2) the target.
  • Update the name to this value: {"1":{"wp":[1,1,2,2,3,3]}}, where "1" is your hunter's index and the array contains the result of "game_getpath".
Use your Namecoin-ID as OpenID: https://nameid.org/
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | HBkxA5QmYSATFoPN1wFk8eBkgwPpY97Mfu