Page 3 of 3

Re: AI programming

Posted: Sat May 17, 2008 8:44 pm
by The Silent One
freereign wrote:Okay, I had this bookmarked before, and now I can't find it. What variable sets a planet's primary and secondary focus? (WOW its been along time since I've been on here.
This is what you are looking for (AIInterface.cpp):

Code: Select all

int IssueChangeFocusOrder(int planet_id, FocusType focus_type, bool primary)
Not sure how to determine what focus a planet currently has, though... it probably has not been exposed to python yet. Anyway, if you want to code AI modules, it will help you a lot if you familiarise yourself with AIInterface.cpp (in fo/AI) as well as all .cpp files in fo/python. Are you working on resource management? Keep us informed, please!

Re: AI programming

Posted: Sat May 17, 2008 9:35 pm
by Geoff the Medio
The Silent One wrote:Not sure how to determine what focus a planet currently has, though... it probably has not been exposed to python yet.
Planet is a ResourceCenter, and ResourceCenter has properties exposed to python "primaryFocus" and "secondaryFocus" that return the enum focusType, which as values "balanced", "farming", "industry", "mining", "research", and "trade".

Re: AI programming

Posted: Sat May 17, 2008 11:32 pm
by freereign
Thanks. I have been working my way through the python interface, somehow I missed that command though. And yes I am working on Resource AI.

Re: AI programming

Posted: Thu May 29, 2008 1:13 pm
by freereign
Unfortunately, something has happened that means I will be able to do next to no work on anything for the next two months or so. I have attached what I have done on it (which is pretty awful right now) if anyone else wants to work on it, please do. If not, I will pick it back up when I can.