AI Speedup

This page presents some results from AI autogame testing, with the goal of speeding up the Freeciv AI. Freeciv issue #695447. This change will improve performance of the server at turn-change and improve gameplay-experience by reduced waiting at end-turn, at the cost of some correctness of the AI (since the the AI will only look for threats near their cities).
Testing of autogame with 300 turns and map size=6. The patch will limit the distance for evaluating enemy units. Normal, Hard and Cheating AI's are limited to a distance of max 40 tiles, while Easy and Novice AI's are limited to a distance of max 20 tiles. (max 6 tiles on Freeciv-web). 
The idea is that as you get further away from a city, then the units far away will be less important than the units which are close to a city. So determining the danger for a city should be based on threatening units near to it, instead of iterating over all units.
 	
Easy AI, with patch (Freeciv-web setting) 	
assess_turns 	2
Distance searching for units: 	Max 6 tiles
Total time: 	9:57 mins
Score of top AI: 	680
Performance improvement with patch 	56%
 	
Easy AI, with patch (Freeciv desktop setting)	
assess_turns 	2
Distance searching for units: 	Max 20 tiles
Total time: 	16:22 mins
Score of top AI: 	1104
Performance improvement with patch 	28%
 	
Easy AI, without patch 	
assess_turns 	3
Distance searching for units: 	All units
Total time: 	22:35:00
Score of top AI: 	621
 	
Hard AI, with patch 	
assess_turns 	3
Distance searching for units: 	Max 40 tiles
Total time: 	06:00 mins
Score of top AI: 	311
Performance improvement with patch 	7%
 	
Hard AI, without patch 	
assess_turns 	3
Distance searching for units: 	All units
Total time: 	06:30 min
Score of top AI: 	311
Settings script:
 cmdlevel ctrl first
 set topology WRAPX
 set nationset all
 set compresstype xs
 set maxplayers 32
 set allowtake H1Ah1adOo
 set autotoggle enabled
 set netwait 150
 set nettimeout 120
 set pingtime 1800
 set maxconnectionsperhost 256
 set threaded_save enabled
 set scorelog enabled
 set size 6
 set landm 50
 set aifill 8
 metamessage Freeciv-web autogame testing
 set timeout -1
 set endt 300
 set gameseed 42
 set mapseed 42
 set minp 0
Category:AI