FreeOrion

Forums for the FreeOrion project
It is currently Tue May 21, 2013 6:40 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Rev 4891+ AI not working
PostPosted: Sat Jun 09, 2012 1:03 pm 
Offline
Space Krill
User avatar

Joined: Sat Jun 09, 2012 12:45 pm
Posts: 3
PriorityAI.py:
calculateIndustryPriority uses fo.resourceType.minerals which has been removed in Rev 4891 and therefore causes the AI to crash


On a side note (not a problem due to the fact that PRIORITY FOOD and MINERALS are commented out in PriorityAI.py:
ResourcesAI.py
setCapitalIDResourceFocus and setGeneralPlanetResourceFocus have "if topPriority == AIPriorityType.PRIORITY_RESOURCE_FOOD:" and "elif topPriority == AIPriorityType.PRIORITY_RESOURCE_MINERALS:" which don't apply any more due to removal of food and minerals.
+ maybe GROWTH could be added so AIs can also profit from the benefits of this feature


Top
 Profile  
 
 Post subject: Re: Rev 4891+ AI not working
PostPosted: Sat Jun 09, 2012 5:41 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7888
Location: Vancouver, BC
Patches welcome....


Top
 Profile  
 
 Post subject: Re: Rev 4891+ AI not working
PostPosted: Sun Jun 10, 2012 9:28 pm 
Offline
Space Floater
User avatar

Joined: Tue May 29, 2012 9:15 pm
Posts: 23
Is the food, mining and production code now settled, such that I can make some bolder changes to the AI?

_________________
--Steaker--


Top
 Profile  
 
 Post subject: Re: Rev 4891+ AI not working
PostPosted: Sun Jun 10, 2012 9:56 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7888
Location: Vancouver, BC
I don't think there will be any more resources removed, but the game's continually changing. If you want to work on AI, you might as well start now, though...


Top
 Profile  
 
 Post subject: Re: Rev 4891+ AI not working
PostPosted: Mon Jun 11, 2012 4:38 pm 
Offline
Space Krill
User avatar

Joined: Sat Jun 09, 2012 12:45 pm
Posts: 3
Until Steaker gets around to make a new improved AI the current problem can be fixed quickly with the following adaptions. Downside of this "quick fix": production gets a priority based on nothing. Although in a "reference game" AI behaved similar to earlier games (built lots of ships at home world and happily colonized planets until reaching a guard ship which it spammed with 1 Mark VI every turn...).

It surely would be better to base it for example on actual need for production (for example on current production queue length). But I'm - not yet - familiar enough with the available Python API to incorporate this.

Index: PriorityAI.py
===================================================================
--- PriorityAI.py (revision 4899)
+++ PriorityAI.py (working copy)
@@ -96,13 +96,14 @@
empire = fo.getEmpire()

# get current minerals and industry production
- mineralsProduction = empire.resourceProduction(fo.resourceType.minerals)
- mineralsStockpile = empire.resourceStockpile(fo.resourceType.minerals)
- mineralsTurns = mineralsStockpile / (mineralsProduction + 0.001)
+ #mineralsProduction = empire.resourceProduction(fo.resourceType.minerals)
+ #mineralsStockpile = empire.resourceStockpile(fo.resourceType.minerals)
+ #mineralsTurns = mineralsStockpile / (mineralsProduction + 0.001)
industryProduction = empire.resourceProduction(fo.resourceType.industry)

# increase demand for industry if mineralsProduction is higher
- industryPriority = 38 * (mineralsProduction - mineralsTurns) / (industryProduction + 0.001)
+ industryPriority = 38
+ #industryPriority = 38 * (mineralsProduction - mineralsTurns) / (industryProduction + 0.001)

print ""
# print "minerals production : " + str(mineralsProduction)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

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