FreeOrion

Forums for the FreeOrion project
It is currently Fri May 24, 2013 3:42 am

All times are UTC




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: AI programming
PostPosted: Sat May 17, 2008 8:44 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 395
Location: Würzburg, Germany
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:
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!


Top
 Profile  
 
 Post subject: Re: AI programming
PostPosted: Sat May 17, 2008 9:35 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7893
Location: Vancouver, BC
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".


Top
 Profile  
 
 Post subject: Re: AI programming
PostPosted: Sat May 17, 2008 11:32 pm 
Offline
Space Squid

Joined: Wed Mar 19, 2008 4:40 pm
Posts: 53
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.

_________________
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate


Top
 Profile  
 
 Post subject: Re: AI programming
PostPosted: Thu May 29, 2008 1:13 pm 
Offline
Space Squid

Joined: Wed Mar 19, 2008 4:40 pm
Posts: 53
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.


Attachments:
File comment: Really bad and incomplete resource script. Needs tons of work.
ResourceAI.py.zip [1.27 KiB]
Downloaded 60 times

_________________
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: AhrefsBot and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group