AI Ladder, 0.5 - Page 4

AI Ladder, 0.5

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Idea for someone enterprising: create an AI ladder

Post by aegis »

net-booting ubuntu server atm, doing the same with windows would be much less flexible ;)

they find my computer with pxe, loads the linux kernel and initrd over tftp, mounts hdd with nfs, mounts things like /tmp to ramdisk, then boot!
twas annoying to set up, too... had to use some weird hard-to-find settings <_<
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea for someone enterprising: create an AI ladder

Post by hughperkins »

Sweet :-)

Ubuntu here too, so perfect match.

The netbooting sounds cool :-) And fun :-D
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea for someone enterprising: create an AI ladder

Post by hughperkins »

By the way, I'm kind of working on the bit of the website that connects the calcengine to the website, ie the calcenginegetrequest.py script that is in github, and a new file like calcenginesubmitresult.py.

All the other bits, like registering ais, registering calcengines, and these bits I'm not working on just yet.

The bit that pumps requests into the queue, I'll probably get to after getting the link between the calcengines and the webserver working.

Do you have any thoughts on language? The language on the calcengines and on the webserver can be different, the connection is just xml requests going between them over http. For the moment, I'm doing everything in python, since it seems to be relatively available, quite fast, and I know how to use python already.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Idea for someone enterprising: create an AI ladder

Post by aegis »

I can do python, though I'm not sure how your coding style + organization are :P
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea for someone enterprising: create an AI ladder

Post by hughperkins »

Well... everyone's style is better than everyone else's right :-DDD

Which bits of the website are you most interested in coding? I'm kind of thinking of getting the following working in the short-term, and then 'other people' can handle the other bits :-DDD

- when things are added to the match queue on the website, the engines automatically run those matches
- ... and the results end up in the matchresults table on the website, ideally with a replay, but possibly not just yet, to keep it simple for now.

I think I might make a dummy version of spring which looks like spring, produces an infolog, and does one of the following things randomly:
- crashes: just terminates with no message, or maybe I deliberately create a divide by zero exception
- hangs permanently, ie just sleeps permanently
- ai0 dies, after 3 seconds, with an appropriate message in the infolog; spring then hangs
- ai1 dies, after 3 seconds, with an appropriate message in the infolog; spring then hangs
- both ai0 and ai1 die, after 3 seconds, with an appropriate message in the infolog; spring then hangs

... this makes it fairly easy to test that this stuff works without having to wait for loads of actual games to go through.

I'll probably write the spring dummy in c/c++ if it's not too difficult, so that it looks like an executable, and not a shell script.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Idea for someone enterprising: create an AI ladder

Post by aegis »

don't bother writing it as an executable - any sort of file marked as executable (with the proper header) will work.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea for someone enterprising: create an AI ladder

Post by hughperkins »

abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Idea for someone enterprising: create an AI ladder

Post by abma »

It's a bit off-topic:

Read about this?

http://botprize.org/

The bots are tested for the turing test. It's for UnrealTournement, but spring would be interesting too... :-)
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea for someone enterprising: create an AI ladder

Post by hughperkins »

Turing test for spring AIs versus human players? Does make a certain sense.

Easy enough to spot a bot though. Bots have many weaknesses, but things like micromanagement are not one of them.

Of course, you could dumb down the bot so that it shows similar flaws to a human: make it only look at one part of the map at a time for example, and not notice attacks elsewhere, but ...
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea for someone enterprising: create an AI ladder

Post by hughperkins »

Right, I kind of regret the title of the thread now, cos it looks like I was setting myself up to be the 'enterprising' someone, but I wasn't really intending to do any work on this, it just sort of started off with the script that found out which ai had won...

Anyway, work on the script to feed a match request to the calcengines is almost done, then I will look at doing the script to process the result.

it's all very basic, lots of placeholders, for example we assume that the calcengines already have every mod and map they need for the things in the queue, but that's ok, because we can start off with only feeding in requests that all run on the same map and mod, and then go from there.

Reminder: git repository for code is here:

http://github.com/hughperkins/ailadder/

The calcengine code is here:

http://github.com/hughperkins/ailadder/ ... cengine.py

The database tables on the webserver are defined here:

http://github.com/hughperkins/ailadder/ ... db/tables/

Once the scripts to pump requests through from the webserver db to the calcengine and back into the results table on the webserver db is done, my intention is to stop and wait for other people to add some stuff to this :-D
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea: create an AI ladder

Post by hughperkins »

Made a fair amount of progress on a baseline website today.

Basically, targeting a simple use-at-home scenario, where one has one's own Apache installation, requests a bunch of games to run, goes to bed, and when one wakees up in the morning, ploof! the results!

Some teaser pics:

Image

Image

Image

As far as what works: pretty much everything as pictured here ;-) Just didn't get the calcengine to actually upload the result yet. Also, it woudl be nice if the server uploaded screenplays to the server, but I feel that can wait temporarily. Perhaps, at least upload the name of the replay file for now?

There are loads of features that would be nice to have that aren't impplemented yet, such as automatic map downloading etc by the calcengines.

Also, this is pretty far from an automated ai ladder, but I'm hoping that once this works there is enough useful stuff here that either it might be used in its own right, or someone will add in the extra stuff to make a fully-fledged automated ladder?

PS figured out I can edit the first post to change the thread title ;-)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Idea: create an AI ladder

Post by hoijui »

coool! :D
Masure
Posts: 581
Joined: 30 Jan 2007, 15:23

Re: Idea: create an AI ladder

Post by Masure »

No offense but I still don't understand why "AI Ladder"

A common ladder for players (human & bots) would be just as fine.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Idea: create an AI ladder

Post by hoijui »

we discussed this quite some times already Masure. Conclusion was, this makes sense, and it does not hinder nayone else from having an AI vs Human Ladder.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea: create an AI ladder

Post by hughperkins »

Thanks hoijui!

Right, release v0.1!

Here it is:

http://manageddreams.com/ailadder/AILadder.tar.bz2

There are three parts essentially:
- calcengine runs on the calcengines
- - essentially, tweak the config.py, and run ./calcengine.py

- webserver/db/createall.sh will setup your Mysql database
- - you only need to do this on the webserver
- - you will need a mysql database, and the username and password that goes with it for this

- webserver/website is the website, which runs under apache, or basically anything that can run python as cgi, which is many things, but it is tested on apache2, with python 2.6.2 on Ubuntu Jaunty
- - tweak the config.py (copy from config.py.template), create a 'replays' subdirectory, and make sure the replays directory is writable to the webserver

There are instructions floating around inside the installation. For the website, there is a link 'Setup notes' on the index page of the website.

This is not yet a fully-fledged automated ladder, but what you can do with it is:
- install it on any webserver, including localhost
- run as many calcengines as you like, just tweak their config.py to point to your webserver
- submit requests for lots of matches, and when you come back a bit later, the results should be available, along with the replays!

The replays are tar.bz2'd then uploaded to the website. That conflicts slightly with the philosophy of keeping the website 'lightweight', essentially, is this compatible with running it on springrts.com sometime? Unsure. Better ideas for the replays?

Screenshot of new results page (note: the results were created using a spring simulator, for ease of development, so take no notice of the ratio of draws and so on):

Image
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Idea: create an AI ladder

Post by aegis »

er apache+mysql+mod_python/wsgi is way overkill imho for home deployment - you could do this in pure python and use sqlite or a pickled db.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea: create an AI ladder

Post by hughperkins »

No need for mod_python, it's pure cgi.

The ultimate goal is to make an ailadder website running on http://springrts.com. Having a single-user site is an intermediate goal to get things moving.

dreamhost.com is a typical webhost and supports python cgi, mysql and so on out of the box with no special modifications.

On Ubuntu, I needed to do the following to install stuff:

Code: Select all

sudo apt-get install apache2
sudo apt-get install python-mysqldb
sudo apt-get install mysql-client
sudo apt-get install mysql-server
.... then I gave the mysql root user a password, and created a database using that root user, without creating any other users:

Code: Select all

mysql -u root -p
<enter password>
create database ailadder;
quit
... and that was it: just run ./createall.sh ,and the tables should be created ok.

Apache2 on Ubuntu creates a virtual site at /var/www . Being lazy, all I did was:

Code: Select all

cd /var/www
sudo ln -s /data/git/AILadder/webserver/website ailadder
... bingo! the website is available at http://localhost/ailadder

There is a small tweak to make to Apache configuration to allow python cgi, which is detailed in

http://github.com/hughperkins/ailadder/ ... wtouse.txt
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea: create an AI ladder

Post by hughperkins »

Addendum: to be honest, you don't really need to do any of this, since we only need one website. I'll set it up on my hosting, and then the calcengines can point to that.
Last edited by hughperkins on 24 Sep 2009, 06:16, edited 1 time in total.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea: create an AI ladder

Post by hughperkins »

Right, there is a website at:

http://manageddreams.com/ailadder

login is admin, admin. When there is too much abuse, I'll start to lock that down and assign per-user accounts. For now, I don't imagine it will get abused straight away. Maybe...

To configure your calcengines to point to it, in the config.py, simply set:

Code: Select all

websiteurl = "http://manageddreams.com/ailadder"
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Idea: create an AI ladder

Post by hughperkins »

Created a staging website:

http://manageddreams.com/ailadderstaging/

The advantage of this website, aside from if it breaks it doesn't affect anything, since it's staging, is that you can reload the website yourself from git by doing:

http://manageddreams.com/ailadderstaging/updatesite.cgi

And you can reload the database schema (loses all data of course...) by doing:

http://manageddreams.com/ailadderstaging/reloaddb.cgi

If you create an account on github and give me your username, I can add you to the ailadder repository. "You" specifically meant aegis when I wrote that sentence, but could mean anyone in fact. Anyone who wants to do some website dev on ailadder anyway ;-)

Edit: note that you can add data into the 'webserver/db/staticdata' directory, and it will be automatically loaded into the db after a db reload.

Edit2: anyone who accidentally destroys my entire website by some python bug: Grrrr! but I'm pretty sure dreamhost has daily and hourly snapshots anyway, so it's not a huge deal. If I find out soon enough...
Post Reply

Return to “AI”