AI Ladder, 0.5
Moderators: hoijui, Moderators
Re: AI Ladder, v0.1
That would be how to setup a client to run for the current setup you have.
What I want is to set it up then remove ALL internet connections, and runt he entire thing on a single machine. If I cannot do that, then I cannot call it a reliable test for the purposes of academia.
Either way I would focus on reducing the number of steps required to set this up for the purposes of gaining traction
What I want is to set it up then remove ALL internet connections, and runt he entire thing on a single machine. If I cannot do that, then I cannot call it a reliable test for the purposes of academia.
Either way I would focus on reducing the number of steps required to set this up for the purposes of gaining traction
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Yes, you are right... perhaps set up with default maps and stuff? By the way, by default, the following maps, mods and AIs are pre-configured:AF wrote:Either way I would focus on reducing the number of steps required to set this up for the purposes of gaining traction
- SmallDivide
- BA6.96
- HughAI v0.1, E323AI v2.12
Perhaps I can add some more default maps and mods, at least update to BA7.01? If you happen to have the hash for that, I'll add it into the static data.
Also, maybe worth adding AAI and so on?
Ok, you can do that, but it's a little more workWhat I want is to set it up then remove ALL internet connections, and runt he entire thing on a single machine. If I cannot do that, then I cannot call it a reliable test for the purposes of academia.

You will need (prerequisites):
- a web server (tested with Apache2)
- python (tested with 2.3 and 2.6)
- web server should run .py and .cgi scripts in cgi
- python MySQLdb
- MySQL
- the name of a MySQL database, and a username and password
Procedure:
- grab the latest zip/tarball, unzip/untar
- webserver/db/createall.sh is a script that sets up your database
-- run ./createall.sh <username> <password> <database name> localhost
-- that should set up your tables, and populate them
- webserver/website is the website, so you can create a soft link to that from your website, or create a virtual directory in your website to point to it
Lastly, in the website directory, copy config.py.template to config.py, and enter the connection details for your database into it.
-> hopefully, cross fingers, you can open the website now, and configure it as you wish.
Re: AI Ladder, v0.1
Could you not setup the database from python? Doing so would allow you to simply test for the database on the index page and redirect to a setup page, thus removing a handful of steps in the process and making things more flexible.
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Hmmm, that sounds like a good idea.
Re: AI Ladder, v0.1
yeah.. it needs to get simpler altogether.
about auto downloading:
i would not like it if everyone with admin access to the website could download AIs/Maps and Mods to my machine (bot battle runner).
Maybe the battle runners(=calc engines) could assemble a list of all installed maps/mods/AIs, and send them to the website when connecting. on the website we could see on how many calc-engines a particular AI is on.
currently, best way is probably parsing ArchiveCacheV7.lua, or if that is too cumbersome, we probably have to think about using unitsync to fetch info about the isntalled spring.
i was running a calc-engine on my headless machine, a few days ago, scheduled a battle.. but it was still running after 3 hours or so, and i was not able to think of a good way to see what was going on.
I think i ran KAIk vs RAI, and wiht a test game on my other machine, under same conditions (same map, same AIs, same mod) it ended in 15 mins or so.
one minor thing: when scheduling a battle, and selecting an AI shortName, it shows all the AIs versions, not just hte selected ones.
definatly nothing that hurries :D
about auto downloading:
i would not like it if everyone with admin access to the website could download AIs/Maps and Mods to my machine (bot battle runner).
Maybe the battle runners(=calc engines) could assemble a list of all installed maps/mods/AIs, and send them to the website when connecting. on the website we could see on how many calc-engines a particular AI is on.
currently, best way is probably parsing ArchiveCacheV7.lua, or if that is too cumbersome, we probably have to think about using unitsync to fetch info about the isntalled spring.
i was running a calc-engine on my headless machine, a few days ago, scheduled a battle.. but it was still running after 3 hours or so, and i was not able to think of a good way to see what was going on.
I think i ran KAIk vs RAI, and wiht a test game on my other machine, under same conditions (same map, same AIs, same mod) it ended in 15 mins or so.
one minor thing: when scheduling a battle, and selecting an AI shortName, it shows all the AIs versions, not just hte selected ones.
definatly nothing that hurries :D
Re: AI Ladder, v0.1
trademark and I were working on a lua + flash dotwars.. could be used to view headless battles.hoijui wrote:but it was still running after 3 hours or so, and i was not able to think of a good way to see what was going on.
Re: AI Ladder, v0.1
sounds perfect... can i use it already?
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Done. Don't say I never listen to you AFAF wrote:Could you not setup the database from python? Doing so would allow you to simply test for the database on the index page and redirect to a setup page, thus removing a handful of steps in the process and making things more flexible.

So, it should present a configuration page the first time you open the site, and then once it's created a configuration file, it will show you the main website from then on.
It detects whether it's been configured or not by the presence of either of config.py or config.pyc, so if you delete both of those files, you should see the configuration page (in latest version of git).
It needs the website directory to be writable to the webserver account, which I think is how most 'standard' things work, ie mediawiki, and so on?
@hoijui,
Ok, that's an interesting idea. I'll take a look. There's already commandline arguments to spring to get a list of ais I think? Perhaps that could be extended for maps and mods too? It'd need to output the maphash and the modhash as used in the startscript, to be useful.could assemble a list of all installed maps/mods/AIs, and send them to the website when connecting. on the website we could see on how many calc-engines a particular AI is on.
currently, best way is probably parsing ArchiveCacheV7.lua, or if that is too cumbersome, we probably have to think about using unitsync to fetch info about the isntalled spring
I can think of several possibilities off the top of my head:but it was still running after 3 hours or so, and i was not able to think of a good way to see what was going on.
- the AIs ground to a stalemate somehow
- the AIs both stalled somehow (lots of AIs do this under certain circumstances)
- the game finished, but you weren't using the BA mod, and the death message was different. Can you confirm which mod you were using? Was there anything interesting in the infolog.txt?
For the first two, really, the game should be timed out automatically by the bot runner. The code is already all over the place to do this (config values and stuff), but the timeout is not yet checked in the botrunner


For the last one.... basically, if the mod issues a death message, we can make that message configurable per mod in the AILadder configuration, fairly easy. If the mod doesn't even issue a death message, there's not much that can be done without modifying spring or the mod

Edit: ps: can't you just look at the replay to see what happened?
Also, if we had a standardized source of entropy, it'd make it easy-peasy to replay exactly what happened, even without the actual replay! (see earlier post above, in this thread, search for entropy)
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
That looks doable. How do I get the path in a platform-independent way?hoijui wrote: parsing ArchiveCacheV7.lua
Re: AI Ladder, v0.1
I was thinking at exactly this as well. The thing is.. i could possibly add this.. but this really are things that unitsync is meant to be used for, not spring(.exe). unitsync alreayd has functions for all this.hughperkins wrote:There's already commandline arguments to spring to get a list of ais I think? Perhaps that could be extended for maps and mods too? It'd need to output the maphash and the modhash as used in the startscript, to be useful.
In case you do not now what unitsync is:
It is a library used by all the lobbies ot get info abot the installed spring. traditionally it was hte list of units of a mod (or something like that), therefore the name. now it includes:
Mod list, Map list, AI list and more.
The thing is, this is a shared library, and as i have never used phyton, i dont know how hard it is to load and use it from there. If it is not very hard, this would probably best to use, as it already has all we have in a convenient form, and the path to unitsync is usually the same like the one to the spring executable (though some linux packages have it in a different location). in spirnglobby you need to set the two paths separately.
ArchiveCacheV7.lua should always be in the writeable data directory, but ... it may not be a good idea to use this, as it can contian outdated info, and only exists after runnig spring a first time.
about unitsync:
in spring source code, the main header is under tools/unitsync/unitsync_api.h
i used BA for testing, and. i think i never looked at infolog or the demo :D

will do that.
Re: AI Ladder, v0.1
oh, can't you just copy the replay and watch it without killing spring?
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Ok, so, think 'loading java from spring'hoijui wrote:The thing is, this is a shared library, and as i have never used phyton, i dont know how hard it is to load and use it from there.

Basically, you can call out from python into c, but, big but, you need to use something called SWIG, and SWIG is ... a lot of work. At least, I feel it is a lot of work, and I've done loads of SWIG before ( http://www.panda3d.org/phpbb2/viewtopic ... highlight= , one more of my never-to-be-used projects

I feel it would be much simpler if there was either:
- a command-line front end to unitsync, could be quite a thin layer I feel?
- a command-line interface via spring
Maybe I can just throw together a command-line front end to unitsync, specific to AILadder? Do you have any code segments that could be useful?
Re: AI Ladder, v0.1
i worked wiht SWING aswell, started with that for the Java interface stuff.. you dont have to tell me about it :D
ugly stuff!
dont have code segments that would be usefull really. maybe i am just not thinking on the right thing.. what did you think of?
ah yeah ...
when using unitsync, you first have to call some init method, and then yo ucan already querry for mods and maps. to querry for AIs, you first have to set a mod, if am not wrong, cause this way you will also get Lua AIs, and without setting the mod first, it may fail.
edit:
basically, you first querry numMods, then querry info for mod 0 till (numMods-1), and same for mods and AIs

good idea!hughperkins wrote:Maybe I can just throw together a command-line front end to unitsync, specific to AILadder? Do you have any code segments that could be useful?
dont have code segments that would be usefull really. maybe i am just not thinking on the right thing.. what did you think of?
ah yeah ...
when using unitsync, you first have to call some init method, and then yo ucan already querry for mods and maps. to querry for AIs, you first have to set a mod, if am not wrong, cause this way you will also get Lua AIs, and without setting the mod first, it may fail.
edit:
basically, you first querry numMods, then querry info for mod 0 till (numMods-1), and same for mods and AIs
Re: AI Ladder, v0.1
oh hugh, I wrapped unitsync using pure python (ctypes) a while ago... it's not completely updated, but it should still work and includes a usage example
edit: just checked and it still works on current unitsync to parse maps/mods
it reads them into easy dictionaries... I'll add AI parsing and pastebin it.
edit: changed it to a parser and example script, pass it unitsync_api.h and it'll generate pure python bindings for it
edit: just checked and it still works on current unitsync to parse maps/mods
it reads them into easy dictionaries... I'll add AI parsing and pastebin it.
edit: changed it to a parser and example script, pass it unitsync_api.h and it'll generate pure python bindings for it
Re: AI Ladder, v0.1
...and here it is.
unitsync.py is the library, example.py is a usage example, and generate.py can generate unitsync.py from the unitsync_api.h header
unitsync.py is the library, example.py is a usage example, and generate.py can generate unitsync.py from the unitsync_api.h header
- Attachments
-
- unitsync.zip
- (4.64 KiB) Downloaded 17 times
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Hey hoijui,
Just occurred to me: adding stuff in C++ to the bot runner makes the bot runner quite hard to package for lots of platforms.
I feel it's important that the bot runner is as easy to install and run and package as possible, since we probably want it to be able to run on as many machines as possible.
Maybe it might make it easier to install and run and package the bot runner if we obtained a list of maps and mods and so on through one of the other methods:
- obtain the path to the archivelist from spring ("spring --getarchivefilepath"?), and parse that
- get spring to tell us a list of maps and mods ("spring --list-available-maps", "spring --list-available-mods"?)
What do you think?
Just occurred to me: adding stuff in C++ to the bot runner makes the bot runner quite hard to package for lots of platforms.
I feel it's important that the bot runner is as easy to install and run and package as possible, since we probably want it to be able to run on as many machines as possible.
Maybe it might make it easier to install and run and package the bot runner if we obtained a list of maps and mods and so on through one of the other methods:
- obtain the path to the archivelist from spring ("spring --getarchivefilepath"?), and parse that
- get spring to tell us a list of maps and mods ("spring --list-available-maps", "spring --list-available-mods"?)
What do you think?
Re: AI Ladder, v0.1
did you miss aegis posts? :D
the two right before yours.
He has a solution ready to use in phyton, to call unitsync.
edit: unitsync comes with every install of spring
the two right before yours.
He has a solution ready to use in phyton, to call unitsync.
edit: unitsync comes with every install of spring
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Yes. Checking those now!hoijui wrote:did you miss aegis posts? :D
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: AI Ladder, v0.1
Woh :-Oaegis wrote:...and here it is.
unitsync.py is the library, example.py is a usage example, and generate.py can generate unitsync.py from the unitsync_api.h header


I don't know how that works, but it ... just worked! I just ran "python example.py" and it told me. ... lots! Even the start positions on the maps!
So... to add this to AILadder... I just add generate.py and unitsync.py into the source somewhere (maybe in a sub-directory 'unitsync'), and then add stuff from 'example.py' into the bot runner?
Easy easy... cool! So, no need for any C++ stuff anywhere? Just works by the magic of Python .. .somehow?
Edit: by the way, can I just clarify: can I wack on a GPLv2 license header onto your code? What name do you want me to put in the copyright notice?