Topic: News about AI
| Tibor Topic Opener | Posted at:
        
            
    2017-11-20, 22:33 UTC+1.0 
 Those site are internally in AI identified as "recruitment" one. The willingness to build them is controlled by genetic algoithm, also, you can look at the code here: http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai.cc#L4404 
 Sorry, militarysites of course... And still I think training would help this. But you need maps with a lot of such setups... 
 No, such list of such fields would be completely useless. Reading the map directly is not more time consuming. Connectivity between two points can be verified only with pathfinding algorithm...  Top  Quote | 
| GunChleoc   | Posted at:
        
            
    2017-11-21, 08:36 UTC+1.0 
 Maybe the AI could read if there is a full flag, or if there is a busy road without a carrier2, and have that influence the training? 
 I agree with Tibor here. Terrains can be changed by scripting, so that's not possible. Also, nodes with rocks or trees on them are impassable, and those will obviously change all the time. It would be better to first find candidate fields the same way it is done right now, and then do a reachability test for the candidates before placing the building. Retry this for a maximum number of times before rescheduling the task. Code can probably be adapted from the run_find... worker programs. Busy indexing nil values  Top  Quote | 
| Tibor Topic Opener | Posted at:
        
            
    2017-11-21, 13:42 UTC+1.0 
 Yes, count of busy roads, the time when the recruitment site was built (how long ago), whether it is stocked with inputs and so on can be considered. But the problem is that this will make tiny difference during AI playing/testing so good mutations in this area are not strongly propagated.... 
 The problem is that first you calculate this for field x,y, then for x+1,y, then x,y+1, then x-1, y-1 and next and next, and basically we are repeating pathfinding algorithm over and over while it would be enough to pass one result to neighbours... "microregions" concept could mitigate this.... 
            Edited:
            
                
    2017-11-21, 17:05 UTC+1.0
            
          Top  Quote | 
| GunChleoc   | Posted at:
        
            
    2017-11-21, 18:01 UTC+1.0 This should do for a connectivity check: 
            Edited:
            
                
    2017-11-21, 18:02 UTC+1.0
            
         Busy indexing nil values  Top  Quote | 
| hessenfarmer   | Posted at:
        
            
    2017-11-21, 21:47 UTC+1.0 
 ok had a look to the code If I got it right two military numbers are influencing this behaviour together with the surrounding code. What I couldn't check is if the values calculated for necessity could ever lead to a building built and which values would be needed for the military numbers to get a high ranking in the building algorithm. 
 could you give a hint to the line in the code where the decision is calculated where to place a military building? Just to get an understanding of what is done in there. thanks.  Top  Quote | 
| Tibor Topic Opener | Posted at:
        
            
    2017-11-21, 22:54 UTC+1.0 
 You can enter simple printf into code to verify if the BuildingNecessity::kNeeded is returned and with what primary priority... Overall priority includes probably some impact of actual field considered for construction of this site. But there is no hard limit that guarantees that the site will be built.... What you can do it to modify manually these two military numbers and check if the behavior is changed.... 
 AI first decides if particular type of militarysite would be considered, using this function: And here is scoring specific field for specific militarysite: http://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/ai/defaultai.cc#L2765  Top  Quote | 
| hessenfarmer   | Posted at:
        
            
    2017-11-22, 20:40 UTC+1.0 
 That is exactly what came to my mind today. Will give it a try. 
 Ok I think I found an issue in the code which explains the noticed behaviour. In Line 2772 there is a check included whether buildable fiels are in the distance that would be conquered. Although the comment in the code is mentioning mining sites I traced the definition of buildable thriugh the code and found in the lines followin line 1052 that buildable is defined as has Buildcaps small or medium or big. This does not include has buildcaps mine which is a different attribute. Therefore I think AI will never build a military building to conquer mountains. If you can confirm my findings we should open a bug report and fix this. (at least line 2787 suggests that it was desired to conquer mountains to get more mineable fields) regards  Top  Quote | 
| Tibor Topic Opener | Posted at:
        
            
    2017-11-22, 21:55 UTC+1.0 
 This is quite good comment. As I remember the logic here it is to allow conquering new buildable spots to be able to build new militarysites and expand. However including mines here makes sense as well. As this change will have some impact on scoring and everything, some amount of training is desired afterwards. 
 There was some discussioin and some guy created these attributes for various military sites. This is just another hint for AI 
 Yes, I think such change can be reasonable, however some play-testing would be nice...  Top  Quote | 
| hessenfarmer   | Posted at:
        
            
    2017-11-26, 22:52 UTC+1.0 ok playtesting should not be the problem.   Top  Quote | 
| Tibor Topic Opener | Posted at:
        
            
    2017-11-27, 07:38 UTC+1.0 Yes, do it please  Top  Quote | 

 
         
		 
		 
		 
		