Tangler Discussion Forums

Discuss

Topics

Click a Topicto start discussing

    <hugobrain> How many light years are we from AI?

    <Pistos> As for AI: I have been mulling things over in my head, because I think I'd have more fun programming an AI than playing myself.:)  First step is to have a robot login, which I haven't been able to accomplish yet.

    Once I have something going, I intend to open it up so that people can submit scripts for their AI.

    <luckymustard> i thought hugo was joking when he said "AI", but it seems like you're serious about it pistos, huh?  that'd be really cool to play against some AI players too.:)

    <hugobrain> Usually AI are not as challenging as (most/some) human players and tend to be predictable, but it's all good. Lux has some really great user-made AI, and a few very difficult ones too, each with their personality.

    I mentioned AI in relation to people being kicked and their units sitting by idly. At least if someone is removed an eventual AI could replace the player that's goner.

    <winter> Just make the AI flood that corner of the map with infantry, the 'Zapp Brannigan Method'

    <Pistos> hugo: The difference here would be that AI authors can refine and resubmit their scripts, making them smarter and smarter.

    <Alex(ander)> Allowing external AIs to play in regular games (properly marked as such of course) is hugely interesting to us. It would require a substantial extension to the api but it is defenitely something we want to offer eventually. Imagine you can start a game and invite a mix of humans and different remotely hosted AIs. It is the future! (sorry for high jacking the wwpa thread). We are not quite ready to support this but will hopefully soon be able to have an informed discussion.

    <Pistos> Alex: I'm ready whenever you guys are.  Any little bit of cooperation from your end would help my development a lot.  Otherwise, I am groping in the dark by reverse engineering your AJAX and form posts, etc.

    2007-10-29 21:25:22.0

    Okay, folks, I have just successfully logged in and clicked to move a unit on a map.  That is, I did those things with a script. :)  This opens up some exciting possibilities... stay tuned. ;)

    2007-10-29 21:26:11.0

    woah dude.

    2007-10-29 22:21:36.0

    Exactly.  Is there some IRC network and/or channel I'm not on?  I can't believe it.

    2007-10-29 23:10:35.0

    Ok.  I found out it was from the Weewar Players Association topic.  Any of the other fogeys on IRC anywhere?

    2007-10-30 06:20:25.0

    I'm in IRC nearly every day.  Catch me at irc.freenode.net #mathetes  or use http://chat.purepistos.net if you don't have an IRC client.

    2007-10-30 06:34:59.0

    And the above convo (as you discovered) is not from IRC, I was just using IRC syntax to quote some folks. :)

    2007-10-30 06:35:32.0

    hehe, when there's a good AI script out I want to start a fight between 2 instances of the same one, see what happens XP

    (Could also be a way of picking up imbalances in maps - let AIs fight it out and see which one wins, although that might miss advantages/disadvantages to different play-styles)

    2007-10-30 09:26:05.0

    I've played a few scripting based robot games before... "when in doubt, attack" is always a reallllly good fallback:)

    2007-10-30 09:41:17.0

    hey... "when in doubt, attack" is how i play.  am i a robot?

    2007-10-30 10:47:59.0

    Either that, or Napoleon.

    2007-10-30 11:42:25.0

    or patton.

    2007-10-30 14:55:27.0

    Okay, I have an initial prototype API working.  You can access arrays of bases and units, move units around, build infantry and repair units.  There is also some partial attacking code in place.

    Who wants to alpha test?
     

    2007-11-05 10:43:31.0

    Ok. Just stop twisting my arm.  I'll test it.:)

    2007-11-05 10:49:24.0

    hey Pistos, I would definitely like to try it out.  sounds interesting!

    2007-11-05 16:40:06.0

    Download http://weewar.purepistos.net/example-ai.rb and start writing some pseudocode.  I will begin documenting as much of the API as I can over the next few days.

    Submit your altered scripts here, or (preferrably) for download somewhere.
     

    2007-11-05 17:13:30.0

    You will need to create a weewar account for your AI robot, of course.

    2007-11-05 17:13:38.0

    Here's the Weewar AI API documentation.  Nearly all the public methods are documented, and I think most of it is self-explanatory.  The hard part is actually writing your clever AI algorithms, so have at it! :)

    2007-11-05 20:46:50.0

    Again, use the example code as a base, and work from there.

    2007-11-05 20:47:19.0

    ok, hope this is not a dumb question... once i have a script, how do i run it and test it out?

    2007-11-05 22:55:17.0

    I think I'm even more lost than Pluto.  When I click on the link above nothing downloads.  There's just some text there.  Is that the script or code?  If so, then how do I use it?  Thanks!

    2007-11-06 06:04:58.0

    When you open http://weewar.purepistos.net/example-ai.rb in your browser, save it to disk.  Non-windows users can just use wget or curl to grab the file.  It is a Ruby script.  Any seasoned programmer should have little trouble with the syntax.

    At the moment, you cannot run anything until I setup a locked-down chroot and sandbox for people to indiscriminately upload and run scripts.  For now, just put your AI script up for download somewhere, or (if you can't do that) paste it at a place like http://pastie.caboo.se and post the pastie URL in this thread.  I will download your scripts and then attempt to run them, making any adjustments that are necessary to make it work.

    If any of you want to discuss this in real time, come to my IRC channel: chat.freenode.net #mathetes .  If you don't have an IRC client, or don't know what IRC is, use http://chat.purepistos.net .
     

    2007-11-06 06:36:58.0

    Should I even be trying this if I'm not a "seasoned programmer"? :)

    2007-11-06 07:02:14.0

    this is really cool, but i think I'll wait until you have the sandbox going.  I prefer instant feedback when I'm programming. Laughing

    2007-11-06 07:11:23.0

    chroot, eh?  I guess I'll quit trying to write look_for_pistos_private_pr0^h^hictures.  Any ETA on the sandbox?  I was thinking of trying to write some stubs to make sure I was getting close before I tried uploading.  Or maybe I should get back to my project that I'm 5 days and 10 hours behind.

    2007-11-06 10:24:16.0

    This makes me want to dig up a copy of Scorched Earth and make multiple AIs based on those in the game.

    2007-11-06 10:28:55.0

    Totally understandable that you guys want a sandbox for immediate feedback. :)  I know it's hard to program without such.  I will work on that next before anything else, then.

    2007-11-07 05:57:30.0

    lucky: My aim is to make this relatively easy to understand, so even "bland" programmers;) can get a handle on things without too much difficulty.

    2007-11-07 05:58:46.0

    ha! lol... well... I wouldn't even say that I'm a "bland" programmer.  Or a programmer at all.  Way back in high school, junior or senior year, I took a quarter or two of Basic.  This was around 1994.  Never used it since.  The closest I've come would be messing around with html, and even with that I don't know much, just enough.

    Nonetheless, I just did the "Try Ruby! (in your browser)" at http://www.ruby-lang.org/en/ ... but I sure haven't downloaded anything... yet.  Is it really worth it?

    2007-11-07 07:15:54.0

    lucky: You don't need to download anything to use the Weewar AI API.  I'll set something up so you upload your script to the WWPA, then click a button to run it on my server.

    Of course, if you want to actually play with Ruby in general (irrespective of the WAIA), then you can do that, too.  You could get a better feel of the language this way.
     

    2007-11-07 10:14:43.0

    tx Pistos!  just need some instructions...

    2007-11-07 10:32:30.0

    Okay, folks, I announce to you the first semi-public alpha release of the Weewar AI interface.  Login to your WWPA account and then go to

    http://weewar.purepistos.net/wwpa/ai

    (there is no clickable link to that page yet)

    Read the example code, and read the API docs, then start testing the basic functionality available to you.  At the moment, you can only move, repair or build infantry.  I will add more shortly.
     

    2007-11-09 11:30:45.0

    lol!  that's so crazy!  i just played a quick game (#38756) against bizarro me! :)  thanks pistos!  truly lol!

    2007-11-09 13:00:54.0

    so real feedback here... i got an error at one point, waited a little bit, and then decided to just rerun the script, it came up with the right thing to do then.  so would you like me to explain the situation when i got that error?

    2007-11-09 13:14:49.0

    also, it's essentially stuck right now because i don't want to gain points off the game.  i've "accepted draw".  i think the ai needs to be able to have that capability too.  again, tx!

    2007-11-09 13:16:05.0

    ^ how's the AI? Did it kicked your (...)? Wink

    2007-11-09 15:51:04.0

    lucky: If possible, drop by my IRC channel with http://chat.purepistos.net .  That way we can discuss things real time.  But anyway, the whole system is in growth at the moment, since it is still in its infancy.  Thanks for testing and trying it out, though! :)

    Your note about being able to draw a game is an obvious omission on my part.  I will add the command ASAP.
     

    2007-11-09 18:16:14.0

    Added build commands for all land-based units.

    2007-11-09 18:41:54.0

    Added Game#accept_draw and Game#refuse_draw commands.

    2007-11-09 18:44:07.0

    Added Game#peacemakers, an array of Players who have offered peace in the game.  You could check for peace conditions with something like the following:

              if game.players - game.peacemakers == [ me ]
                    game.accept_draw
                    next
                end

     

    2007-11-09 20:08:35.0

    wow!!  this is mind bottlingly awesome!   really amazing, Pistos!

    i will give more thorough feedback when i test it more, but i already have one small request... and that is to be able to have your AI put something in the chat box.  I really want my robot to taunt the other players with "all your bases are belong to us!!!!"
     

    2007-11-09 21:13:19.0

    <3 ruby:)  Where else are you going to see code that pretty?  Subtracting one array from another?  It took me way too long to figure that out because I didn't expect it.

    2007-11-09 21:15:58.0

    Thanks, guys. :)  I hope you have fun with it.  I will work on a chat interface.

    2007-11-10 08:11:57.0

    even moreso than "being able to draw a game", i'm starting to think that you need to somehow make it the only way a game can be ended.  otherwise i envision people increasing there ranking by playing a stupid AI.  now if the AI is going to get a lot smarter, then i don't see it as being as big a deal.  just my two cents... :)

    2007-11-10 10:21:15.0

    How does the AI prevent itself from losing if the human player doesn't want to let it escape? If there was a way to do that then people could exploit it - it's why we have time limits and kicking and such.

    2007-11-10 11:15:40.0

    Unless of course the Weewar devs somehow program a special-case forced draw that only an AI can make use of, the "that only an AI can make use of" being the difficult part.

    2007-11-10 11:17:14.0

    let me try to explain this in a different way:  right now the AI is pretty dumb, IMO.  yesterday i played a game against my AI.  i essentially beat it except i haven't captured the last base.  i don't want to capture it and truly win the game, therefore increasing my ranking, because that would be like cheating.  i can see others exploiting this capability though.

    2007-11-10 12:02:26.0

    I understand the problem, but I don't think a solution exists - if someone wanted to play against a stupid AI to increase their ranking, there's no way for the AI's scripting to prevent it. Whatever happens, if the human player wants to win, and take points, then there's no way for the AI player to stop them, just as there's no way for a human player to prevent themselves from losing to an uncooperative opponent (except by out-playing them).

    It would need a get-out clause exclusively for AI players. Or for that get-out clause to be automatic to playing an AI, but then they would need to be registered separately or picked out in some other way.

    2007-11-10 13:37:38.0

    people, did we learn nothing from SkyNet??  the AI must be crippled!

    Sorry, I've been waiting to use that one.  Seriously though, this is a problem which needs to be discussed.  On one hand, it is already possible for people to cheat if they really want to, and that is by having two accounts.  It is tedious because you need two browsers, or two different computers, but still doable.  At present, the AI is just about as cumbersome.  However, when automatic turn-taking is implemented, it will definitely be easier to cheat.

    Unfortunately the options for fixing this all seem on the dev-side.  A few ideas:

    • Make games vs. AI's not count towards your points
    • Have a separate ranking system for games vs AI's
      • on the flip side of this, it might be cool to be able to eventually compare AI accounts by their points rankings, assuming that one could actually beat a human.
    • Make it impossible to defeat an AI.  I.e. you can take all bases and kill all units, but it never registers as a game win.
      • perhaps it is possible to do this script-side by giving the AI a hard-coded hidden unit that a human player will never be able to attack
      • or have the dev's add a new unit that is indestructible.  I.e., all other units are useless against it.

     

    Just some ideas.  Personally, I play just for fun and I don't really care about the cheaters or points, and I think most people are in this boat as well.  However, cheaters can ruin the experience, and I think the WWPA greylist is currently the best device we have, but it's good to think about these other options as well.

     

    2007-11-10 14:47:49.0

    Well, the way I see it, a human being (the AI creator) will be the one to have the AI accept game invitations.  And at the moment, you have to manually initiate each turn.  I don't expect programmers to really start sending their AIs against real human opponents yet.  I don't think the system is ready for such a thing. :)

    If you're going to enter your AI into a real, scored game, then you, your AI, and that opponent should accept all the consequences.

    If you're going to make a dumb AI to play against so YOU can get points... well that's a whole other story, and I'm not sure it's up to me or us to police the ethics of the situation.  Someone can just make two accounts and drone one of them to give the other account points -- so the issue is irrespective of AI.  After all, instead of bothering to activate the AI on each turn, you can just have it end turn all the time...

    I'm totally open to working with the Weewar dev team if they want to allow an account to be flagged as AI, which would do things like make all AI games unscored.  *shrugs*
     

    2007-11-10 15:11:46.0

    Okay, just implemented a Game#say( message ) method.  Taunt your opponents, greet them, whatever. :)

    2007-11-10 15:16:56.0

    I was thinking in terms of the end-goal for AIs (at least in part because I don't really know exactly what they can do so far) but it's true that you can do the same thing but more easily with a smurf account.

    Still.. looking back to how this side-lane of discussion started, it still makes it hard for a draw to be the only way to end an AI game, as Luckymustard was proposing, at least without co-operation from the devs to make it happen (with that co-operation, the world's your oyster... in Weewar terms)

    2007-11-10 15:32:36.0

    Well... I think the primary focus for me at the moment is getting the API filled out so that we can start programming some great AI opponents.  I'm just trusting and assuming that most people that will try it at the start will be honourable. :-/

    2007-11-10 17:09:46.0

    indeed, let's make this side-lane into a cul-de-sac ;)

    2007-11-10 17:14:49.0

    "people, did we learn nothing from SkyNet??  the AI must be crippled!"

    Pluto, truly lol!

    "Shall we play a game?"... "How about Global Thermonuclear War."

    2007-11-11 12:21:00.0

    haha... yeah, I thought of that one too Smile

    looking forward to some free time when I can try out the AI some more.
     

    2007-11-12 08:42:37.0

    i took a break from it for a couple/few days and just came back to it this morning... i was still getting errors, and so i tried something, which was to not put a color in where it said "me.colour" and (same for "game.id" - i didn't put a game name or number in) and it worked. :)

    so, i hope that helps if anyone else was having similar issues...
     

    2007-11-14 07:27:59.0

    lucky: Can you paste your "before" and "after" code snippet?  Chances are you had a syntax error, or were referring to a method which didn't exist.

    2007-11-14 07:30:01.0

    If you could paste your error output whenever you get it, that would help, too. :)

    2007-11-14 07:30:14.0

    sorry, i haven't been capturing it earlier this morning when i did get a few different kinds of errors.  i had posted some of my errors to your chat the other day.  at one point, i believe, you weren't around there.  next time i get one, i'll post it here.

     

    2007-11-14 07:33:05.0

    here's an error: "Errors end of file reached"

    2007-11-14 07:54:50.0

    i'm pretty sure at one point you said you didn't need the rest, but for this one here it is anyway: "/usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread' /usr/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill' /usr/lib/ruby/1.8/timeout.rb:56:in `timeout' /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'"

    2007-11-14 07:55:36.0

    Hm, can you get that consistently?  It could just be a timeout between my server and weewar.com.

    2007-11-14 08:10:30.0

    i don't think i could get that consistently.  in fact, i didn't get it consistently, but nor was i trying to get it consistently.  a lot of times this morning, after i had my breakthrough, when i got an error, i just ran it again and it ended up making its next turn.

    2007-11-14 08:50:56.0

    just got that same error again.  this is in a new game, 39874, much bigger map.  i'll rerun it.

    2007-11-14 10:00:30.0

    seems like every time after that error, when i rerun it it says "Running... Logging in as luckyAI... done. Fetching games... Game 38787 is in state 'finished' done. Found 3 game(s). Activating game 39874... done. I am red in game 39874 Sent 'finishturn' DONE"

    2007-11-14 10:04:01.0

    ok, now i've gotten that error three times in a row.  i think it might have something to do with it not having enough credits to buy the unit i told it to.

    2007-11-14 11:23:10.0

    changing it from tank to linf fixed it. :)

    2007-11-14 11:24:28.0

    Nice. :)

    2007-11-14 13:14:29.0

    I forgot, I need to put in some way to determine your current credit total.

    2007-11-14 13:15:25.0

    so what might the code look like if you want it to choose to build different units on its own?

    2007-11-14 14:18:31.0

    another error: "

    Errors

    nil can't be coerced into Fixnum"

    2007-11-14 14:23:32.0

    So, Pistos, are you planning to release the engine that makes this all runnable, so people could run it all themselves, and/or assist in developing it
    ?
     

    2007-11-14 15:49:51.0

    there's an engine that makes this all runnable?  i thought that the script was doing that...

    2007-11-14 18:10:27.0

    lucky: You (or the engine) has a variable that ends up with a nil value at some point, and the operation it's trying to perform won't work with nil values.  You need to see about ensuring that value doesn't become nil.

    Caligari: I've thought about it.  I'll need to do some more thinking. :)  I'd probably be more encouraged by greater interest in the project, though.
     

    2007-11-14 18:25:51.0

    i believe that the last error i got (above - "nil...fixnum") relates to the use of hovercraft which i have a feeling you, Pistos, haven't accounted for yet.

    2007-11-14 18:26:00.0

    lucky: Come to my chat room for more immediate tech support...

     

    2007-11-14 18:26:55.0

    i started two newer games, one that i quickly abandoned due to the hovercraft reason above, but the second one is on the map "old tragic triangle".  it is game number 39979.  in it, the player starts off with 3 raiders and one light infantry.  all four units move towards the top left uncaptured base.  how do we write the code so that it'll only send the unit that makes sense to capture the base, the l. inf. unit, and the other units, the raiders head toward the other opponent(s)?

    2007-11-14 18:29:00.0

    Pistos, wish I knew some Ruby.

    This is an excellent project. Don't be discouraged if there isn't much interest. Some may not see the potential. Maybe after finals I'll try to port my PHP knowledge to Ruby and see what I can get going...
     

    2007-11-18 23:46:16.0

    Thanks for your comments tbeseda.  I'm not totally discouraged, just have been a bit busier lately.  I know that I still want to try to develop my own AI algorithms, so the API will grow in that regard.  Right now, although it is just a foundation, it is still usable to create some decent AIs, I think.

    If anyone needs some extra functions or helper methods, just say so in here, and I can add them.
     

    2007-11-19 09:38:29.0

    We are also really into it - even we we can not assist you quite yet. It is way up there on our list: Next Steps

    2007-11-21 03:03:56.0

    Welp, my AI has just completed its first full game.  http://weewar.purepistos.net/wwpa/replayer/42039  As you can see, it didn't do very well, but I think it is a testament to the technology that it is able to play a game from start to finish, and not be a total embarassment.  The strategy flaws are obvious to me, so I know what to work on for the next version.

    Thanks to djdarkstar187 for agreeing to play.  Stay tuned for the next incarnation of Weewar AI!

    2007-11-23 21:43:13.0

    :( Tried to watch the replay but it stops playing at around 7 rounds in. Any magic you can work on that Pistos? ;)

    2007-11-24 02:37:01.0

    I'm watching it right now, and it's gone to round 9, and hasn't stopped.  There are no errors in my logs, either.  Try with a different browser?  Let me know.

    2007-11-24 09:42:28.0

    ah, now that the link is pointing at your replayer it's fine.. it was when I tried to view it from the game itself that it froze up.

    2007-11-24 09:52:39.0
To send a message, Join Now (it's quick and free) or Sign In
Edit Topic
Delete Topic
Are you sure you want to delete the topic