Skip to content

Commit

Permalink
Improved AI poison pill (made eyecandy units less attractive to AI pl…
Browse files Browse the repository at this point in the history
…ayers)
  • Loading branch information
audigex committed Dec 5, 2024
1 parent ea5f1c1 commit b71ce2d
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 65 deletions.
3 changes: 1 addition & 2 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
- GWR Great Bear and Hall class rework
- Class 56
- Class 69
- Made eyecandy, debug, and departmental vehicles unattractive to AI
- GWR Dean 25ft 4 Compartment Second Class (SY), Diagram S1/LA9N, Built 1871, seats 32
- BRT Whisky CovHop (PAV) - Only variant code needed
- Metropolitan Class G
Expand All @@ -34,7 +33,7 @@
- Added BRT PAA Covered Hopper
- Added LNER Coronation Train Set, and individual articulated coaches
- Added SR Bulleid Q1
- Adjusted EyeCandy engine to hopefully discourage AI use
- Made eyecandy, debug, and departmental vehicles unattractive to AI (hopefully)
- Reworked Southern Region CC Class (OG BR Class 70)
- Added a pile of liveries for Class 66
- Added some LNER Black 5 and Jubilee liveries
Expand Down
64 changes: 64 additions & 0 deletions src/trains/_spriteset/Eyecandy_Switches.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// These switches should be used for eye candy, debug, developmental etc unit
// They make vehicles less attractive to the AI while keeping them useful for the player
// The most common callbacks are:


/*
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
*/

switch(FEAT_TRAINS, SELF, sw_EyeCandy_AllowMove, company_type)
{
PLAYERTYPE_AI: return(string(STR_EyeCandy_AI));
CB_RESULT_NO_TEXT;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_RunningCost_Movement, vehicle_is_stopped)
{
0: 255;
1: 0;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_RunningCost, company_type)
{
PLAYERTYPE_AI: 255;
sw_EyeCandy_RunningCost_Movement;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_PurchaseCost, company_type)
{
PLAYERTYPE_AI: 255;
PLAYERTYPE_HUMAN: 0;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_Power, company_type)
{
PLAYERTYPE_AI: 0;
PLAYERTYPE_HUMAN: 10000;
}

// km/h
switch(FEAT_TRAINS, SELF, sw_EyeCandy_Speed, company_type)
{
PLAYERTYPE_AI: 1;
PLAYERTYPE_HUMAN: 80;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_Weight, company_type)
{
PLAYERTYPE_AI: 10000;
PLAYERTYPE_HUMAN: 30;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_TE, company_type)
{
PLAYERTYPE_AI: 0;
PLAYERTYPE_HUMAN: 255;
}
9 changes: 9 additions & 0 deletions src/trains/departmental/BRMPV_DualFreight.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,14 @@ item (FEAT_TRAINS, item_MPV_DualFreight, 136) {
colour_mapping: return PALETTE_CC_FIRST;
create_effect: sw_MPV_DualFreight_effect;
sound_effect: sw_dmu_sound;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}
9 changes: 9 additions & 0 deletions src/trains/departmental/BRMPV_DualTrack.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,14 @@ item (FEAT_TRAINS, item_MPV_DualTrack, 234) {
colour_mapping: return PALETTE_CC_FIRST;
create_effect: sw_MPV_DualTrack_effect;
sound_effect: sw_dmu_sound;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}
9 changes: 9 additions & 0 deletions src/trains/departmental/BRMPV_Single.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,14 @@ item (FEAT_TRAINS, item_MPV_Single, 235) {
colour_mapping: return PALETTE_CC_FIRST;
create_effect: sw_MPV_Single_effect;
sound_effect: sw_dmu_sound;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}
12 changes: 9 additions & 3 deletions src/trains/departmental/FlyingBanana.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ item (FEAT_TRAINS, item_FlyingBanana, 687) {
colour_mapping: return PALETTE_CC_FIRST;
create_effect: diesel_create_visual_effect;
sound_effect: sw_voyager_sound;
cargo_capacity: return(0);
cost_factor: return(GetAdjustedCost(1));
running_cost_factor: return(GetAdjustedCost(1));
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}
54 changes: 3 additions & 51 deletions src/trains/utility_development_and_debug/EyeCandyLocomotive.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ spriteset(spriteset_EyeCandy_Depot, "gfx/EyeCandy.png") {
switch(FEAT_TRAINS, SELF, sw_EyeCandy_AllowMove_Length, num_vehs_in_consist)
{
1: return(string(STR_EyeCandy_NoAttachedUnit));
CB_RESULT_NO_TEXT;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_AllowMove, company_type)
{
PLAYERTYPE_AI: return(string(STR_EyeCandy_AI));
sw_EyeCandy_AllowMove_Length;
sw_EyeCandy_AllowMove;
}

switch(FEAT_TRAINS,SELF,sw_EyeCandy_Sprites, vehicle_is_in_depot)
Expand All @@ -27,49 +21,6 @@ switch(FEAT_TRAINS,SELF,sw_EyeCandy_Sprites, vehicle_is_in_depot)
1: spriteset_EyeCandy_Depot;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_RunningCost_Movement, vehicle_is_stopped)
{
0: 255;
1: 0;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_RunningCost, company_type)
{
PLAYERTYPE_AI: 255;
sw_EyeCandy_RunningCost_Movement;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_PurchaseCost, company_type)
{
PLAYERTYPE_AI: 255;
PLAYERTYPE_HUMAN: 0;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_Power, company_type)
{
PLAYERTYPE_AI: 0;
PLAYERTYPE_HUMAN: 10000;
}

// km/h
switch(FEAT_TRAINS, SELF, sw_EyeCandy_Speed, company_type)
{
PLAYERTYPE_AI: 1;
PLAYERTYPE_HUMAN: 80;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_Weight, company_type)
{
PLAYERTYPE_AI: 10000;
PLAYERTYPE_HUMAN: 30;
}

switch(FEAT_TRAINS, SELF, sw_EyeCandy_TE, company_type)
{
PLAYERTYPE_AI: 0;
PLAYERTYPE_HUMAN: 255;
}

item (FEAT_TRAINS, item_EyeCandy, 578) {
property {
name: string(STR_NAME_EyeCandy);
Expand Down Expand Up @@ -112,7 +63,8 @@ item (FEAT_TRAINS, item_EyeCandy, 578) {
default: sw_EyeCandy_Sprites;
purchase: spriteset_EyeCandy_Purchase;
colour_mapping: return PALETTE_CC_FIRST;
start_stop: sw_EyeCandy_AllowMove;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove_Length;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
Expand Down
108 changes: 99 additions & 9 deletions src/trains/utility_development_and_debug/TemplateTrains.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ item (FEAT_TRAINS, item_UtilityTrain12px, 601) {
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility12;
purchase: spriteset_Utility12_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -148,7 +157,16 @@ item (FEAT_TRAINS, item_UtilityTrain4px, 609) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility4;
purchase: spriteset_Utility4_Purchase;
purchase: spriteset_Utility4_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -187,7 +205,16 @@ item (FEAT_TRAINS, item_UtilityTrain8px, 610) {
can_attach_wagon: CB_RESULT_ATTACH_ALLOW;
cargo_capacity: return 0;
default: spriteset_Utility8;
purchase: spriteset_Utility8_Purchase;
purchase: spriteset_Utility8_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -228,7 +255,16 @@ item (FEAT_TRAINS, item_UtilityTrain16px, 602) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility16;
purchase: spriteset_Utility16_Purchase;
purchase: spriteset_Utility16_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -269,7 +305,16 @@ item (FEAT_TRAINS, item_UtilityTrain20px, 603) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility20;
purchase: spriteset_Utility20_Purchase;
purchase: spriteset_Utility20_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -309,7 +354,16 @@ item (FEAT_TRAINS, item_UtilityTrain24px, 604) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility24;
purchase: spriteset_Utility24_Purchase;
purchase: spriteset_Utility24_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -349,7 +403,16 @@ item (FEAT_TRAINS, item_UtilityTrain28px, 605) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility28;
purchase: spriteset_Utility28_Purchase;
purchase: spriteset_Utility28_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -389,7 +452,16 @@ item (FEAT_TRAINS, item_UtilityTrain32px, 606) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility32;
purchase: spriteset_Utility32_Purchase;
purchase: spriteset_Utility32_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -429,7 +501,16 @@ item (FEAT_TRAINS, item_UtilityTrain28pxOLD, 607) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility28OLD;
purchase: spriteset_Utility28OLD_Purchase;
purchase: spriteset_Utility28OLD_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

Expand Down Expand Up @@ -469,6 +550,15 @@ item (FEAT_TRAINS, item_UtilityTrain32pxOLD, 608) {
cargo_capacity: return 0;
additional_text: return(string(STR_DESC_Utility));
default: spriteset_Utility32OLD;
purchase: spriteset_Utility32OLD_Purchase;
purchase: spriteset_Utility32OLD_Purchase;
// AI Poison Pill below
start_stop: sw_EyeCandy_AllowMove;
cost_factor: sw_EyeCandy_PurchaseCost;
running_cost_factor: sw_EyeCandy_RunningCost;
purchase_running_cost_factor: sw_EyeCandy_RunningCost;
power: sw_EyeCandy_Power;
speed: sw_EyeCandy_Speed;
weight: sw_EyeCandy_Weight;
tractive_effort_coefficient: sw_EyeCandy_TE;
}
}

0 comments on commit b71ce2d

Please sign in to comment.