Download last version there (v33) ->
viewtopic.php?p=1194298#p1194298
List of current features for this patch (v33):
a) Maximum no. competitors cap have been raised from 14 to 15. This is useful for multiplayer and dedicated server games.
b) All slots are configurable and visible, regardless of the current value of Maximum no. competitors. This means they're all highlighted in orange text in the AI/Game Script Configuration/Settings window.
b.1) AI slots are identified with its respective Company ID number.
b.2) Status icons may be displayed next to each slot to reflect the current state of a script.
b.2.1) A Warning Sign indicates that a Human Company is, or will be in this slot and that this AI configuration won't be used.
b.2.2) Yellow indicates an eligible AI or GS that is yet to start.
b.2.3) Green indicates an AI or GS script in this slot that started and is alive.
b.2.4) Red indicates an AI or GS script in this slot that started but died.
b.2.5) No Yellow icons are displayed if the value of Maximum no. competitors doesn't allow more AIs to start, or if no GS is configured.
b.3) AIs that started as random are identifiable with a newspaper icon next to the first icon.
c) Note: While in the main menu, slot 1 may be configurable, but beware: when starting a single or multiplayer game, the first company is always human and will start on slot 1. Making slot 1 configurable from gui is especialy useful when setting AIs for multiplayer or dedicated server games.
d) While in a game, depending on the status, some slots in the AI/Game Script Settings window have these additional behaviours:
d.1) Warning sign - Permits AI slot movement up or down. Permits selection of another AI. Displays the "Configure" button. Permits changes to all AI parameters.
d.2) Yellow status - Permits AI slot movement up or down. Permits selection of another AI. Displays the "Configure" button. Permits changes to all AI parameters.
d.3) Green status - Disables AI slot movement up or down. Disables selection of another AI or GS. Displays the "Settings" button. Permits changes to some AI or GS parameters.
d.4) Red status - Disables AI slot movement up or down. Disables selection of another AI or GS. Displays the "Configure" button. Permits changes to all AI or GS parameters.
d.5) No status displayed - Permits AI slot movement up or down. Permits selection of another AI. Displays the "Configure" button. Permits changes to all AI parameters.
e) While a game is running, AIs can be started or stopped from the AI/Game Script Settings window. You may also alter their parameters if you so desire:
e.1) To stop an AI, select the AI from the list, then click Stop AI. Be aware that by doing so, you are removing the AI Company from the game.
e.2) If the current number of running AI companies is less than the maximum number of competitors, you may start an AI on any empty slot by selecting it and clicking Start AI.
e.3) If you are receiving a message telling that you can't start an AI, make sure you are allowing AI competitors in multiplayer games.
f) While hosting a server, AIs or GS are not going to be requested to save their data when a client attempts to join. But should you manually save the game or perform autosaves, AIs or GS are still going to be requested to save their data. This permits scripts that usually take too long to save to be useable while running a server for as long as no autosaves or manual saves are done during the session.
Screenshot valid for v30, v31, v32, v33
Screenshot valid for v21, v22, v23, v24, v25, v26
Screenshot valid for v15
Screenshot valid for v14
Screenshot valid for v10
Screenshot valid for v4, v5, v6, v7
Previous versions (v3, v2, v1):
- [+] Spoiler
-
Code: Select all
Index: ai/ai_gui.cpp
===================================================================
--- ai/ai_gui.cpp (revision 27536)
+++ ai/ai_gui.cpp (working copy)
@@ -779,11 +779,11 @@
if (slot == OWNER_DEITY) return _game_mode != GM_NORMAL || Game::GetInstance() != NULL;
if (_game_mode != GM_NORMAL) {
- return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
+ return slot >= 0 && slot <= MAX_COMPANIES - 1;
}
- if (Company::IsValidID(slot) || slot < 0) return false;
+ if (Company::IsValidHumanID(slot) || slot < 0) return false;
- int max_slot = GetGameSettings().difficulty.max_no_competitors;
+ int max_slot = MAX_COMPANIES - 1;
for (CompanyID cid = COMPANY_FIRST; cid < (CompanyID)max_slot && cid < MAX_COMPANIES; cid++) {
if (Company::IsValidHumanID(cid)) max_slot++;
}
@@ -812,7 +812,7 @@
for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) {
StringID text;
- if ((_game_mode != GM_NORMAL && i == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(i))) {
+ if (_game_mode == GM_NORMAL && Company::IsValidHumanID(i)) {
text = STR_AI_CONFIG_HUMAN_PLAYER;
} else if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != NULL) {
SetDParamStr(0, AIConfig::GetConfig((CompanyID)i)->GetInfo()->GetName());
@@ -821,7 +821,7 @@
text = STR_AI_CONFIG_RANDOM_AI;
}
DrawString(r.left + 10, r.right - 10, y + WD_MATRIX_TOP, text,
- (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? TC_ORANGE : TC_SILVER));
+ (this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? (Company::IsValidAiID(i)) ? TC_BLUE : TC_ORANGE : TC_SILVER));
y += this->line_height;
}
break;
@@ -845,7 +845,7 @@
if (widget == WID_AIC_DECREASE) {
new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1);
} else {
- new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1);
+ new_value = min(MAX_COMPANIES, GetGameSettings().difficulty.max_no_competitors + 1);
}
IConsoleSetSetting("difficulty.max_no_competitors", new_value);
this->InvalidateData();
@@ -922,7 +922,7 @@
if (!gui_scope) return;
this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
- this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
+ this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES);
this->SetWidgetDisabledState(WID_AIC_CHANGE, (this->selected_slot == OWNER_DEITY && _game_mode == GM_NORMAL) || this->selected_slot == INVALID_COMPANY);
this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || GetConfig(this->selected_slot)->GetConfigList()->size() == 0);
this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == OWNER_DEITY || this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
Index: table/settings.ini
===================================================================
--- table/settings.ini (revision 27536)
+++ table/settings.ini (working copy)
@@ -103,7 +103,7 @@
from = 97
def = 0
min = 0
-max = MAX_COMPANIES - 1
+max = MAX_COMPANIES
interval = 1
proc = MaxNoAIsChange
cat = SC_BASIC
This patch allows up to 15 AIs to be automatically started on dedicated servers by increasing the cap from 14 to 15. This setting can also be configured from the main menu.
v3 r27536:
- All 15 slots are configurable now, regardless of the current value of Maximum no. competitors. This means they're all highlighted as orange.
- During a game, AI slots that started are highlighted as blue, instead of silver. Human occupied slots are still in silver. All other slots are orange.
- In addition, blue slots can be altered from its current AI script to another. To start the newly selected AI, click Reload in the AI Debug window.
To do:
- Switching AI scripts while another is running is buggy, though. Parameters from the newly selected AI will be in conflict with the parameters from the previous AI. I'd like to improve on this.
v2 r27536:
- slot 1 may now be configurable from the main menu.
- Maximum no. competitors setting now affect the entire range of slots, from 1 to 15.
- I'm still not happy about the interaction between the max no. competitors setting. As an example, with this patch, if I set a max of 10 competitors, then start a single player or non-dedicated multiplayer game, the first slot will be immediately taken by a human, but only the first 10 slots were configured from the main menu. The game will still start 10 AI's, the 10th AI taking use of whatever configuration was in the locked 11th slot. Maybe I should just unlock the entire slots, independently of the max no of competitor value.
v1 r27529:
- I'd like to improve the gui window even further, though. It currently doesn't let configure the AI parameters for slot 1 because of the Human player.