AI Ladder, 0.5 - Page 13

AI Ladder, 0.5

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

Moderators: hoijui, Moderators

User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Ok, fixed, should work ok now. (config.py issue)
aegis wrote:also reloading the staging website broke it hard, yay.
Fixed. should work now. (another config.py issue; I will probably migrate a chunk of it into a db table at some point to avoid this in the future)
the first error appears to be something to do with my moderately large collection of maps, and doesn't make me happy :(
Hmmm, ok ...

My original hypothesis was that you were uploading a map with a different archivechecksum to one I'd already uploaded, but since you're using the prod site, and I haven't uploaded any maps to that one, that hypothesis doesn't seem to hold.

Kind of strange that some maps upload, but not all...

Looks like there is a session.commit() after adding each map, and adding each supportedmap, so it's not like there are too many changes or something; and the sqlalchemy objects are re-requested after each commit, so there shouldn't be any expired objects hanging around?

I just checked that:
- BotRunnerSupportedMap.botrunner_id is marked as a foreignkey to botrunners.botrunner_id -> looks ok
- BotRunnerSupportedMap.map_id is marked as a foreignkey to maps.map_id and both map_id and botrunner_id are marked as 'primary_key' -> looks ok
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

aegis wrote:also reloading the staging website broke it hard, yay.

*sigh* might run it locally so I don't need to forward debug code through git
If you make a branch, I can point http://manageddreams.com/ailadderbranch to that branch if you want.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

By the way, just so you know, in git master, if you change dbengine in config.py to 'sqlite' and dbname to '/some/path/to/db.db' , it will use sqlite.

Edit: you will need to recreate the tables though:

in webserver/website:

Code: Select all

python consolesetup.py create
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: AI Ladder, 0.5

Post by aegis »

yeah I know how sqlalchemy is magic ;)

you know you can use a single dburl in config i.e. mysql://user:pass@server/db instead of a bunch of separate config vars... much cleaner imho
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

aegis wrote:yeah I know how sqlalchemy is magic ;)
You found my secret ;-)
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

aegis wrote:you know you can use a single dburl in config i.e. mysql://user:pass@server/db instead of a bunch of separate config vars... much cleaner imho
Both would work. My feeling at the moment is I'd prefer to keep them factorized, but if you feel strongly about it, feel free to change it.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: AI Ladder, 0.5

Post by aegis »

three reasons:

1. you're converting it back to the dburl already, and sqlite isn't handled cleanly in this case (extra/ambiguous config vars)

2. it's much easier to pass a dburl on a command line than many separate variables

3. it's easier to comment out one or many dburls than a bunch of separate config vars

edit: no luck with sqlite :( gonna switch to mysql

http://lunix.bochs.info/ailadder :)
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

aegis wrote:3. it's easier to comment out one or many dburls than a bunch of separate config vars
Fair enough...
Cool!
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Update to git master:
- configuration values for website - other than those to connect to the database - are now stored in a new db table Config
- the advantage to this is it should solve issues where config.py is out of sync with a new version of the code
- this implies that if you update to head, you will need to recreate the tables ('python consolesetup.py reload')
Last edited by hughperkins on 19 Oct 2009, 09:58, edited 1 time in total.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

@AF, or anyone else that wants to set up their own website:

I'm playing with a new packager for the website. There are now two packages output, rather than just one:
- botrunner_[version].tar.bz2
- website_[version].tar.bz2

I'd quite like to get some feedback on how well the resulting website package, an example of which can be found at:

http://manageddreams.com/ailadder/downl ... er.tar.bz2

The installer is now command-line based: type "python setupwebsite.py", and answer the question prompts.

The installer tries to solve the problems:
- how to make it easy to install sqlalchemy
- how to install sqlalchemy on a shared hosting?
- how to handle environments like dh, where /usr/bin/python is 2.3, and we need /usr/bin/python2.4, and need to update the #! paths at the head of each webpage

The presented solutions in the packager are:
- sqlalchemy is included in the package, and installed by the installer
- the package includes virtualenv, and provides an option in the installation process to install to a virtual environment, which it sets up for you
- the package installer searches and replaces the #! bing paths in the webpages during the install

Ideas to improve this?

(Note: the actual code is in the branch 'doublepackager')
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

aegis wrote:the first error appears to be something to do with my moderately large collection of maps, and doesn't make me happy :(
Hi Aegis,

I tried a stress-test with 300 fake maps. In botrunner, line 324 - 327:

Code: Select all

   for i in xrange( 300 ):
      import random
      testchecksum = random.randint(0,2000000000)
      multicall.registersupportedmap( config.botrunnername, config.sharedsecret, stringhelper.getRandomAlphaNumericString(10), str(testchecksum) )
It seemed to work just fine on my machine, running against http://manageddreams.com/ailadderstaging :

Code: Select all

Sessionid: yJ4Omr0lvt5sKJXtspnfb5VxwFmUcv2sg1bA94YFlh6SWLXSZ6GoNRmvswPh
Connection test to server http://localhost/ailadder was successfull.
['Comet Catcher Redux.smf', 'Sands of War v2.smf', 'Small Supreme Battlefield.smf', 'SmallDivide.smf']
300 successes out of 300
List of 300 random maps:

http://manageddreams.com/ailadderstaging/viewmaps.py

Idea: you have two maps with the same name?
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Apparently, it seems sufficient to register two maps with the same name and checksum :-D I'll take a look.

Code: Select all

330   testchecksum = random.randint(0,2000000000)
331   getxmlrpcproxy().registersupportedmap( config.botrunnername, config.sharedsecret, mapname, str(testchecksum) )
332   getxmlrpcproxy().registersupportedmap( config.botrunnername, config.sharedsecret, mapname, str(testchecksum) )

Code: Select all

  File "./botrunner.py", line 332, in registermaps
    getxmlrpcproxy().registersupportedmap( config.botrunnername, config.sharedsecret, mapname, str(testchecksum) )
...
xmlrpclib.Fault: <Fault 1: "<class 'sqlalchemy.orm.exc.FlushError'>:New instance <BotRunnerSupportedMap at 0xa4958cc> with identity key (<class 'core.tableclasses.BotRunnerSupportedMap'>, (1L, 305L)) conflicts with persistent instance <BotRunnerSupportedMap at 0xa4f648c>">
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Ok, the issue with map registration should be fixed in git master, git 0.5 branch, and in the http://manageddreams.com/ailadderstaging website.

0.5.9 release:

http://manageddreams.com/ailadder/downl ... .9.tar.bz2
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: AI Ladder, 0.5

Post by aegis »

botrunner is working better, now getting a spring segfault :(

running with the same .springrc as hoijui, both on ubuntu server 9.04... though he's on 32-bit and I'm on 64-bit

ba 7.01, brazillian battlefield remake v2
(gdb) backtrace
#0 0x0000000000000000 in ?? ()
#1 0x00000000009ac1aa in CBFGroundDrawer::SetupTextureUnits (this=0x43e2a20, drawReflection=false) at /home/aegis/springheadless/rts/Map/SMF/BFGroundDrawer.cpp:1252
#2 0x00000000009ac7a4 in CBFGroundDrawer::Draw (this=0x43e2a20, drawWaterReflection=false, drawUnitReflection=false, VP=0) at /home/aegis/springheadless/rts/Map/SMF/BFGroundDrawer.cpp:707
#3 0x000000000078134c in CGame::DrawWorld (this=0x3f02e50) at /home/aegis/springheadless/rts/Game/Game.cpp:2851
#4 0x000000000078268f in CGame::Draw (this=0x3f02e50) at /home/aegis/springheadless/rts/Game/Game.cpp:3149
#5 0x0000000000cd0261 in SpringApp::Update (this=0x7fffdb821e70) at /home/aegis/springheadless/rts/System/SpringApp.cpp:964
#6 0x0000000000cdbd5b in SpringApp::Run (this=0x7fffdb821e70, argc=2, argv=0x7fffdb821fa8) at /home/aegis/springheadless/rts/System/SpringApp.cpp:1052
#7 0x0000000000cf9991 in Run (argc=2, argv=0x7fffdb821fa8) at /home/aegis/springheadless/rts/System/Main.cpp:111
#8 0x0000000000cf99e6 in main (argc=2, argv=0x7fffdb821fa8) at /home/aegis/springheadless/rts/System/Main.cpp:127
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Ladder, 0.5

Post by hoijui »

it now works for me, btw :-)
though KAIK is crasheing after about 15 minutes or so, it is now running headless for real. aegis foudn out that the resolution has to be at least 113x0, anything less will cause a segfault :D (i had it at 10x10)

this is the config file (~/.springrc) that works for me:
http://pastebin.com/f45917dd6
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: AI Ladder, 0.5

Post by aegis »

well, 10x10 actually appears to cause an endless loop, not a segfault
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Nice work guys! Cool!
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Slight bugfix to 0.5:
- corrected logout, which didn't always seem to work

http://manageddreams.com/ailadder/downl ... 10.tar.bz2

corresponding git code is "0.5" branch.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Update to git master branch:
- migrated to jinja

Edit: whoops, somehow merged into 0.5 instead. fixing that...

Edit2: corrected that. jinja branch now merged to master. However, if you pulled from 0.5 during the last few minutes, you might need to reclone, since I just did a 'git reset HARD' followed by a 'git push -f'.
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: AI Ladder, 0.5

Post by hughperkins »

Updated website configuration, specifically, moved http://manageddreams.com/ailadder to 0.5 branch:

http://manageddreams.com/ailadder contains 0.5 branch:
- http://manageddreams.com/ailadder/updatesite.cgi will update site to latest 0.5 git
- intentionally, no link to reload the database

http://manageddreams.com/ailadderstaging contains master:
- http://manageddreams.com/ailadderstaging/updatesite.cgi will update site to latest git master
- http://manageddreams.com/ailadderstaging/reloaddb.cgi will reload the database (purges all data in the process...)
Post Reply

Return to “AI”