Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What language is best for programming a MUD/online game bot?

  1. Mar 5, 2010 #1
    My goal is just a simple bot that could "play" or do basic functions without human aid, on a online game of some sort, for example facebook's farmville or something similar.
  2. jcsd
  3. Mar 6, 2010 #2
    What definition of MUD are you using? The only one I'm familiar with is "Multi-User Dungeon", which was generally a text-based online game-- sort of a do-it-yourself style MMOG from the 90's.

    Anyway, I think most programming languages would be pretty equal to the task, although if you're planning to dissect the HTML and JavaScript, you'll probably want something with strong regular expression handling.

    Otherwise, you can accomplish the same feat quasi-manually, depending on the task at hand. You'll have to examine and duplicate the cookies used in the browser (so the bot has to be able to "log in" as a believable entity), possibly duplicate the browser type, and determine the correct series of HTTP calls to use for the tasks you have in mind. You may be able to get these using Firefox's HTTP Live Headers plugin, and slogging through all the calls you're making; then replicating them in your bot with a pretty standard HTTP call library.

    I guess the thing I don't know would be how to effectively "hack in" to things like Flash or Silverlight applications. THAT's hard. They can connect back to their servers in whatever method they choose, so it depends on the application.

    I think in general, it'll take more knowledge of how the web works to get this going as opposed to programming language requirements. You could write this in C, C++, Java, Perl, Python, or probably a good dozen more popular languages. Heck, you could probably write it in JavaScript!

    Anyway, good luck!

  4. Mar 6, 2010 #3


    User Avatar
    Gold Member

    You don't need to hack into flash for most of these games. Most have a very simple network protocol. If you use something like WireShark to see what a game like FarmVille actually sends to the server it's a plaintext string like "Plow: [{0,0},{0,1},...]"

    It will probably end up getting you banned though.
  5. Mar 8, 2010 #4
    I guess I was curious more along the lines of authentication-- the data itself I would guess is simple, but I have no idea how the authentication works. I assume it works in correlation with Facebook to get the initial authentication going, and from then on sends an identity token of some sort with each request? Not that it couldn't do its OWN bizarre auth protocol each time if it felt like being nasty!

    Anyway, that's the part I would assume would be tricky? To initiate it for Farmville in particular, I would think you'd need to be able to log into Facebook automatically (no idea how hard that is, but probably not easy), replicate the cookies, and possibly traverse some oddities with the remote server until you got a valid token to pass. Is there anything out there that will auto-login to Facebook via an API? I admittedly haven't even so much as Googled it (shame on me!).

    The flipside might be a bit easier, but require some manual effort, like logging in manually, and copy/pasting the already-validated cookie into your code (along with other potentially necessary info like the USER_AGENT, and so forth, that they might use to double-check. That's relatively simple; it's just not quite as automatic.

    As for banning, I guess it depends on what you're doing with it. I've never played Farmville, but for other games I've played there's a limit to how much you can do. So having a bot log in to play for you probably isn't too bad, unless there ISN'T a limit. It'd be more like having a bot play for you while you were away on vacation, or to make sure you didn't forget to do your daily routine.

    The other banning potential is of course if you're making false accounts and having bots play them. That's against the rules for Facebook, and possibly other sites as well.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook