Mod Processing Time... |
I've stumbled on to something that might speed up processing time of turns. This is a change that has to be done to an AI file, so only try this if you know something of what you're doing there. Please give this a shot, and tell me if it makes any difference. My computer is fast enough that I really can't tell.
In Script_AI_Politics.txt.
Stock code:
//------------------------------------------------------------------------
// Calculate_Current_Anger
//------------------------------------------------------------------------
function Calculate_Current_Anger returns boolean
vars
list_count: long
list_index: long
final_anger: long
our_alliance_id: long
begin
// Calculate current anger towards each player
call lst_Politics_Total_Anger_Towards_Player.clear()
call lst_Politics_Total_Anger_Towards_Alliance.clear()
set our_alliance_id := Sys_Empire_Politics_In_Alliance_ID(sys_long_Player_ID)
set list_count := Sys_Get_Number_Of_Players()
for list_index := 1 to list_count do
set final_anger := 0
if (list_index <> sys_long_Player_ID) then
if (Sys_Empire_Politics_In_Alliance_ID(list_index) = 0) then
set final_anger := Calculate_Current_Anger_For_Entity(list_index, 0)
endif
endif
call lst_Politics_Total_Anger_Towards_Player.add(final_anger)
endfor
set list_count := Sys_Get_Number_Of_Alliances()
for list_index := 1 to list_count do
set final_anger := 0
if (list_index <> our_alliance_id) then
set final_anger := Calculate_Current_Anger_For_Entity(0, list_index)
endif
call lst_Politics_Total_Anger_Towards_Alliance.add(final_anger)
endfor
return TRUE
end
Modified code:
//------------------------------------------------------------------------
// Calculate_Current_Anger
//------------------------------------------------------------------------
function Calculate_Current_Anger returns boolean
vars
list_count: long
list_index: long
final_anger: long
our_alliance_id: long
is_known: boolean
begin
// Calculate current anger towards each player
call lst_Politics_Total_Anger_Towards_Player.clear()
call lst_Politics_Total_Anger_Towards_Alliance.clear()
set our_alliance_id := Sys_Empire_Politics_In_Alliance_ID(sys_long_Player_ID)
set list_count := Sys_Get_Number_Of_Players()
for list_index := 1 to list_count do
set final_anger := 0
if (list_index <> sys_long_Player_ID) then
set is_known := Sys_Empire_Politics_Is_Player_Known(sys_long_Player_ID, list_index)
if (Sys_Empire_Politics_In_Alliance_ID(list_index) = 0) and (is_known) then
set final_anger := Calculate_Current_Anger_For_Entity(list_index, 0)
endif
endif
endfor
set list_count := Sys_Get_Number_Of_Alliances()
call lst_Anger_Towards_Alliance.fill(list_count, 0)
for list_index := 1 to list_count do
set final_anger := 0
if (list_index <> our_alliance_id) then
set is_known := Sys_Empire_Politics_Is_Alliance_Known(sys_long_Player_ID, list_index)
if (is_known) then
set final_anger := Calculate_Current_Anger_For_Entity(0, list_index)
endif
endif
endfor
return TRUE
end
In stock, the AI goes through all of its mood/anger calculations for every single player and alliance. The modified code changes this so that the AI only calculates its mood/anger when it knows of an empire or alliance. If it doesn't know of them, it skips that. Obviously, this doesn't help in games where everyone knows of everyone else. However, this might help in earlier games.
I'm attaching a Script_AI_Politics.txt file which has this change, and ONLY this change, in it. All the rest of the code in it is stock.
Let me know if this makes any difference.
Be sure to rename the downloaded file (if you use it) to Script_AI_Politics.txt before compiling.
EDIT: Figures, I would post the wrong code and attach the wrong file. Corrections made, this should work.
| Fichier attaché | Taille |
|---|---|
| Script_AI_Politics.txt | 154.35 Ko |

Re: Mod Processing Time...
The green bar is the movement phase (ie execution of orders). Red bar is combat.




Re: Mod Processing Time...
The script execution time (pause before green bar appears) is next to nothing, so it won't make any noticeable difference. The three areas that take most of the time is research, design creation (which isn't every turn), and ship orders - particularly when there are lots of ships etc.
Space Empires Depot | SE:V Balance Mod