AI empires don't do nothing

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Message
Author
User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#16 Post by eleazar »

I saw AI activity sometime at the end of last year, but with recent playtesting, i didn't see much evidence of it, so today i used my cheat nearly-omniscient species to check things out, and, once again there is no AI ship movement.

The attached used night's binary from the 27th, though i suspect the issue existed in other binaries released in the past week or so. I haven't encountered an AI ship away from a capitol.
Attachments
logs-n-save.zip
(211.64 KiB) Downloaded 77 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI empires don't do nothing

#17 Post by Geoff the Medio »

From the logs, I see two problems. The main issue looks like the same Python library issue as before. Can you verify that this is occurring in Vezzra's builds as well? Edit: And could you determine if there's a specific build where this started happening? I don't think anything has changed in the relevant code, so hopefully it's just a matter of how night vs how Vezzra are making the builds... /Edit

Code: Select all

2012-01-27 10:29:00,999 DEBUG AI : Initializing C++ interfaces for Python
2012-01-27 10:29:01,157 DEBUG AI : Python stdout and stderr redirected
2012-01-27 10:29:01,160 ERROR AI : Traceback (most recent call last):
2012-01-27 10:29:01,160 ERROR AI :   File "/Users/jbjerk/Desktop/FreeOrion.app/Contents/Resources/default/AI/FreeOrionAI.py", line 2, in <module>
2012-01-27 10:29:01,160 ERROR AI :     import pickle                       # Python object serialization library
2012-01-27 10:29:01,160 ERROR AI :   File "/Users/jbjerk/Desktop/FreeOrion.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/pickle.py", line 34, in <module>
2012-01-27 10:29:01,160 ERROR AI :     import struct
2012-01-27 10:29:01,160 ERROR AI :   File "/Users/jbjerk/Desktop/FreeOrion.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/struct.py", line 1, in <module>
2012-01-27 10:29:01,160 ERROR AI :     from _struct import *
2012-01-27 10:29:01,160 ERROR AI : ImportError: No module named _struct
Also, it looks like there were more broken effectsgroups from your recent commenting out of krill spawning messages. I fixed one, but apparently there were more that I missed since I was only looking for issues with the krill 1 which I observed in game. The closing comment is before the closing brace of the parameters list, but should be after to comment out the whole effect. For example:

Code: Select all

                /*
                GenerateSitRepMessage
                    message = "EFFECT_MONSTER_SPAWNING"
                    parameters = [
                        tag = "predefinedshipdesign" data = "SM_KRILL_3"
                        tag = "system" data = Source.SystemID
                        */    <----- here
                    ]
In the logs, this is causing errors such as

Code: Select all

2012-01-27 10:29:08,495 ERROR AI : /Users/jbjerk/Desktop/FreeOrion.app/Contents/Resources/default/ship_hulls.txt:1931:12: Parse error.  Expected string here:
              scope = And [
              ^

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#18 Post by eleazar »

Geoff the Medio wrote:From the logs, I see two problems. The main issue looks like the same Python library issue as before. Can you verify that this is occurring in Vezzra's builds as well? Edit: And could you determine if there's a specific build where this started happening? I don't think anything has changed in the relevant code, so hopefully it's just a matter of how night vs how Vezzra are making the builds... /Edit
I downloaded Vezzra's r4615 build and RC2. Played for about ten turns and none of the AI fleets moved, in either.
I don't want to try all the builds blindly. Is there somewhere i should start?

Geoff the Medio wrote:Also, it looks like there were more broken effectsgroups from your recent commenting out of krill spawning messages. I fixed one, but apparently there were more that I missed since I was only looking for issues with the krill 1 which I observed in game.
Looks like i got them all wrong. :oops: Should be fixed in revision 4625.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI empires don't do nothing

#19 Post by Geoff the Medio »

eleazar wrote:I don't want to try all the builds blindly. Is there somewhere i should start?
I don't know what would have changed that would affect the AI scripts, so try a binary search? Try the latest working version to make sure it's still works, then try the release in the middle, and go forward or back by half way to locate the latest working build...?

Edit: I looked at the commit logs for the XCode project file for a hint as to when things might have gotten messed up, and the most recent change was revision 4550, so if you could try FreeOrion-4541-Test-MacOSX-10.6.zip.tar.gz from the Test folder on sourceforge downloads to see if Python AI works in that version, it might be telling. Also, the revision in which the previously-working Python fix was applied was 4525, and I don't think anything relevant in that file has changed since, so unless it is related to the project files or how the app bundle is being set up, I don't know what could have changed to make it stop working...

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI empires don't do nothing

#20 Post by Vezzra »

Ok, I just started to look into the matter. First thing I tried was updating to latest SVN (r4625), making a build for that revision and run a test game. Interestingly, everything worked just fine - that is, like it has been working before. I just played 9 turns, but I encountered 2 scouts from an AI empire moving happily around. I also checked the AI logs for error messages - none found. I've attached the AI logs to this post.

I'm currently uploading this build (SVN 4625 for MacOSX) to my dropbox. When the upload is finished, I'll post the link to the "Up-to-date FreeOrion Mac-SDK and build - Test please!" thread in General Discussion. Eleazar, can you try this build and report the results?
Attachments
AI_logs.zip
AI log files
(55.61 KiB) Downloaded 59 times

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#21 Post by eleazar »

Geoff the Medio wrote:...so if you could try FreeOrion-4541-Test-MacOSX-10.6.zip.tar.gz from the Test folder on sourceforge downloads to see if Python AI works in that version, it might be telling.
--downloading

Vezza:
I'll try it when it's ready.

HINT
For easier testing remove the "/*" and "*/" from species.txt.
This will enable the species "Super-Testers", which have a vision range that encompasses most galaxies.

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI empires don't do nothing

#22 Post by Vezzra »

eleazar wrote:...HINT
For easier testing remove the "/*" and "*/" from species.txt.
This will enable the species "Super-Testers", which have a vision range that encompasses most galaxies.
Oh, thanks! I just tried that, works great. I now can report that all AI empires move their ships around, try to use their troop ships to capture enemy colonies, even colonize other planets (only one, because they have only the one starting colony ship and apparently don't produce new ones).

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#23 Post by eleazar »

There's no ship movement for me with this one:
FreeOrion-4541-Test-MacOSX-10.6.zip.tar.gz from the Test folder on sourceforge

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI empires don't do nothing

#24 Post by Vezzra »

eleazar wrote:...Vezza:
I'll try it when it's ready...
Upload finished. Posted link here.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#25 Post by eleazar »

Vezzra wrote:Upload finished. Posted link here.
Same thing. No AI ship movement.
Attachments
4625.zip
(59.24 KiB) Downloaded 78 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI empires don't do nothing

#26 Post by Geoff the Medio »

Is there a version in which you know AI ships did move, and can you check if they still do move in that version on your system?

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI empires don't do nothing

#27 Post by Vezzra »

Geoff the Medio wrote:Is there a version in which you know AI ships did move, and can you check if they still do move in that version on your system?
Hm, he did mention he saw AI ships moving in this post. I don't know exactly which build he used, but the post immediately before his was mine with the link to the SVN 4521 build with my python patch applied (wasn't in SVN at that time). So I assume it was this build he used.

This build is still available and can be downloaded.

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI empires don't do nothing

#28 Post by Vezzra »

Ok, I've looked into the matter a bit, this is what I discovered so far:

The problem is that the python interpreter on eleazer's system fails to locate the _struct module - but why, that's the big mystery here. The _struct module is included in the python framework that is bundled with the FO app, according to the logs eleazar provided the module search path is set correctly, the directory containing this module shows up in the list of python modules search paths.

When I load eleazar's savegame, I can play without problems, the AI fleets are moving, and no error messages show up in my AI logs.

Eleazar, could you try the following:
  • Go into the terminal
  • Invoke the python interpreter
  • At the python prompt, type "import _struct"
  • If that command throws an error, please report the error messages
  • Otherwise, type "print _struct" and report the result
Another thing you can check:
  • Show the contents of the FO app package
  • Go to Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/lib-dynload
  • Look for the file "_struct.so" and tell me if it's there or if it's missing
Once I have these infos I'll try to work from there... but I have to admit, I'm really scratching my head atm... :?

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#29 Post by eleazar »

Vezzra wrote:[*]Invoke the python interpreter
How do i do that?
Vezzra wrote:Look for the file "_struct.so" and tell me if it's there or if it's missing
The closest file is named: "_struct.so000755 " Does that count?

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI empires don't do nothing

#30 Post by eleazar »

Vezzra wrote:
Geoff the Medio wrote:Is there a version in which you know AI ships did move, and can you check if they still do move in that version on your system?
Hm, he did mention he saw AI ships moving in this post. I don't know exactly which build he used, but the post immediately before his was mine with the link to the SVN 4521 build with my python patch applied (wasn't in SVN at that time). So I assume it was this build he used.
I'm downloading that, and will try it next...

I appreciate the effort in trying to solve this.

Post Reply