Open Letter to Online Game Developers: Allow Bots

As someone which a strong interest (and little experience) in artificial intelligence I have a short and to the point request for online game developers: allow bots.

Either have specific servers or, if you're single sharded, places in your game universe where bots are allowed.  Outside of those servers and places continue your battle against illegal macroing, gold farming and botting:
  • In the bot-legal places do allow human players.
  • When making a new account (or avatar) have a player flag it as being used by a bot.  It should still be able to be used by a human as well.
There's huge potential if people are able to legally run their AI projects in a gaming universe.  Witness the popularity of AI programming competitions like the Google AI Challenge, the Mario AI Competition, Starcraft AI Competitions and many others.

It would so be nice to be able to experiment with AI bots in online games without the fear of one's account being banned (and having to spend money on a new account).

This blog post is partly aimed at Blizzard since they represent such a large part of the PC online games market with Starcraft 2, World of Warcraft and, in a few months, Diablo 3.



Ghetto DNS

This is probably stupid, but…

I start my EC2 instance only when I need it but a while ago it was needed pretty often and figuring out the IP every time I wanted to SSH to the machine got annoying quickly.  Using the Dropbox Uploader bash script it was easy to set up a poor man's DNS since Amazon provides a way to figure out the public IP of an EC2 instance.

So by doing:
curl -s
and using Dropbox Uploader one can put that result into a text file (say ec2-hostname.txt) in a Dropbox folder and use it in an SSH command as follows:
ssh -i your-amazon.pem username@`cat ~Dropbox/ec2-hostname.txt`
This solution had a certain gum and wire charm that I had to try it out but it only suffices for one man in his attic. If you want robust and scalable solution you'll need to use real DNS or Amazon's Elastic IP.



VirtualBox Common Lisp Environment for Google AI Ants Challenge

(see the end of this post for remarks I've gotten about the vbox image)

So, the next Google AI Challenge seems to be almost ready to get going, albeit six months later than I expected.

As blogged about earlier this year I have been worked on the Common Lisp starter bot for the challenge, an alternative starter bot with a proxybot, some YouTube videos and now a VirtualBox image with an Emacs+Slime environment ready to go.

Due to the long delay for this challenge to get started some of these projects aren't quite up to date anymore but they should still be quite usable and at least get you started or help you along.

The VirtualBox image is up to date as of writing this post and any comments on it would be welcomed. I will not make a new image (although someone else is free to do so) but if possible I will provide a patch on the AI Challenge forums.

On booting the image it will start up SBCL, Emacs and Slime (connected to SBCL) with some instructions in the scratch buffer.  Perhaps it is a good start for another Lisp-in-a-box project.

I am not sure how much time I will be able to spend on the current challenge due to also participating in the online Introduction to Artificial Intelligence and starting a three month sabbatical gig writing an iPad client for a startup November 1st.

Specific Remarks about the VirtualBox Image

14:23 < Xach> the remapping of [] and () confused me though.
Right, I've been computing like this for so many years that I totally forgot about this.  The parens have been swapped with the brackets otherwise Lisp programming becomes quite painful.  If you want to reset this check out keycodes 18, 19, 34 and 35 in ~/.xmodmaprc and reboot the image.

Now that I think of it, Control and Caps Lock are probably swapped as well.  That's done in the ~/.xmodmaprc as well.

Labels: , , , , ,


Adding Text to PNGs

(I'm putting this out here since Google queries for this situation didn't turn up anything useful for me.)

Last night I had to add some text ± 5000 PNG files and I knew about Zach Beane's ZPNG package for reading PNGs but I didn't know of a package that would read them.

A quicklisp:system-apropos turned up png-read written by Ramarren which looked simple enough to use so I went with that. After initially failing to get ZPNG to use png-read's image-data slot I gave up and wrote a little loop to copy the values over to zpng:data-array. This was succesful after one or two tries:

(asdf :png-read)
(asdf :zpng)

;; http://imgur.com/qtriH.png
(defparameter png (png-read:read-png-file "qtriH.png"))
(defparameter zpng (make-instance 'zpng:png :color-type :truecolor
                                  :width (png-read:width png)
                                  :height (png-read:height png)))

(loop for y from 0 below (zpng:height zpng)
      do (loop for x from 0 below (zpng:width zpng)
               do (loop for rgb from 0 below 3
                        do (setf (aref (zpng:data-array zpng) y x rgb)
                                 (aref (png-read:image-data png) x y rgb)))))

(zpng:write-png zpng "tmp.png")

I'm sure Zach had a good reason to reverse the x and y in ZPNG but I can't deduce it.

So, reading and writing the files was working but now I realized ZPNG didn't have any functionality for generating text. (Why should it? It shouldn't.) I started thinking of Vecto since I had used that before and also recalled that it actually used ZPNG for saving PNGs. Now all I needed to do was getting the original image into Vecto so text could be written over it.

Going through Vecto's source showed me I could get at the ZPNG object through the (shadowed) *GRAPHICS-STATE* global. It wasn't exported from the Vecto package but since I was in hack mode anyway it didn't really matter. I used the (slightly adapted) code above, drew some text, did a VECTO:SAVE-PNG and got an empty image.

In Vecto's source I noticed the ZPNG object had four channels instead of the three I was using so I set the fourth channel (alpha) to opaque and got my input PNG back with the custom text generated by Vecto. Done!

(asdf :png-read)
(asdf :vecto)

(use-package :vecto)

;; http://imgur.com/qtriH.png
(defparameter png (png-read:read-png-file "qtriH.png"))
(defparameter zpng (make-instance 'zpng:png :color-type :truecolor
                                  :width (png-read:width png)
                                  :height (png-read:height png)))

(with-canvas (:width (zpng:width zpng) :height (zpng:height zpng))
  (loop for y from 0 below (zpng:height zpng)
        do (loop for x from 0 below (zpng:width zpng)
                 do (loop for rgb from 0 below 4
                          do (if (< rgb 3)
                                 (setf (aref (zpng:data-array (vecto::image vecto::*graphics-state*)) y x rgb)
                                       (aref (png-read:image-data png) x y rgb))
                                 (setf (aref (zpng:data-array (vecto::image vecto::*graphics-state*)) y x rgb)
  (set-font (get-font "font.ttf") 32)
  (draw-centered-string (floor (/ (zpng:width zpng) 2))
                        (- (zpng:height zpng) 80)
                        "Hello, World!")
  (save-png "tmp.png"))

Labels: , , , , ,


What has happened to David O'Toole?

Update: he linked me to this restatement on #lisp: http://cryptome.org/0005/dod-lisp-sol.htm

Does anyone know what has happened to David O'Toole?  He hasn't been heard of since a last curious post to the lisp-games-dev mailing list: http://lists.common-lisp.net/pipermail/lisp-game-dev/2011-July/000158.html (read the whole thread)

His website, blog, twitter and github have all been either removed or cleared:

Labels: , ,