1 /* 2 * Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project. 3 * You may not sell or otherwise commercially exploit the source or things you 4 * create based on the source. 5 */ 6 7 8 9 #ifndef _AI_PROFILES_H_ 10 #define _AI_PROFILES_H_ 11 12 #include "globalincs/globals.h" 13 #include "globalincs/pstypes.h" 14 #include "globalincs/systemvars.h" 15 #include "ai/ai_flags.h" 16 17 // AI Path types 18 #define AI_PATH_MODE_NORMAL 0 19 #define AI_PATH_MODE_ALT1 1 20 21 #define AI_RANGE_AWARE_SEC_SEL_MODE_RETAIL 0 22 #define AI_RANGE_AWARE_SEC_SEL_MODE_AWARE 1 23 24 #define MAX_AI_PROFILES 5 25 26 class ai_profile_t { 27 public: 28 char profile_name[NAME_LENGTH]; 29 30 flagset<AI::Profile_Flags> flags; 31 32 // difficulty-related values 33 int max_incoming_asteroids[NUM_SKILL_LEVELS]; // max number of asteroids thrown at friendlies 34 int max_allowed_player_homers[NUM_SKILL_LEVELS]; // max number of simultaneous homing weapons on player 35 int max_attackers[NUM_SKILL_LEVELS]; // max number of ships that can attack a ship 36 fix predict_position_delay[NUM_SKILL_LEVELS]; // how long until AI predicts a ship position 37 float in_range_time[NUM_SKILL_LEVELS]; // seconds to add to time it takes to get enemy in range (only for player's enemies) 38 float shield_manage_delay[NUM_SKILL_LEVELS]; // how long before AI manages shields (note that the player's team always uses the average skill's delay) 39 40 // AI ships link primaries if energy levels greater than these percents 41 float link_energy_levels_always[NUM_SKILL_LEVELS]; // always link 42 float link_energy_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low 43 44 // AI ships link primaries if ammunition levels greater than these percents 45 float link_ammo_levels_always[NUM_SKILL_LEVELS]; // always link 46 float link_ammo_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low 47 float primary_ammo_burst_mult[NUM_SKILL_LEVELS]; // SUSHI: Multiplier adjusting burst frequency for ballistic primary weapons 48 49 // difficulty-related scales 50 float cmeasure_life_scale[NUM_SKILL_LEVELS]; // life of countermeasures 51 float cmeasure_fire_chance[NUM_SKILL_LEVELS]; // chance a countermeasure will be fired based on skill level (also scaled by ai_class) 52 float weapon_energy_scale[NUM_SKILL_LEVELS]; // weapon energy available 53 float shield_energy_scale[NUM_SKILL_LEVELS]; // shield energy available 54 float afterburner_recharge_scale[NUM_SKILL_LEVELS]; // speed of afterburner recharge 55 float player_damage_scale[NUM_SKILL_LEVELS]; // damage applied to the player 56 57 float subsys_damage_scale[NUM_SKILL_LEVELS]; // damage applied to a player subsystem 58 float beam_friendly_damage_cap[NUM_SKILL_LEVELS]; // damage cap values for friendly beam fire 59 float turn_time_scale[NUM_SKILL_LEVELS]; // speed at which enemy ships turn 60 float glide_attack_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "glide attack" move 61 float circle_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "circle strafe" move 62 float glide_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use glide when strafing capships 63 float random_sidethrust_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to randomly use sidethrust while dogfihthing 64 float stalemate_time_thresh[NUM_SKILL_LEVELS]; // SUSHI: The amount of time required for the AI to detect (and try to break) dogfight stalemate 65 float stalemate_dist_thresh[NUM_SKILL_LEVELS]; // SUSHI: The maximum distance the AI and target must be within for a stalemate 66 float max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: The maximum delay before the AI updates their aim against small ships 67 float turret_max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: As above, but for turrets updating their aim 68 69 // Multiplicative delay factors for increasing skill levels. 70 float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS]; 71 float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS]; 72 73 // Multiplicative secondary delay factors for increasing skill levels. 74 float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS]; 75 float ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS]; 76 77 // Maximum turrets of one ship allowed to shoot the same target 78 int max_turret_ownage_target[NUM_SKILL_LEVELS]; 79 int max_turret_ownage_player[NUM_SKILL_LEVELS]; 80 81 // percentage of damage caused required for a kill/assist 82 float kill_percentage_scale[NUM_SKILL_LEVELS]; 83 float assist_percentage_scale[NUM_SKILL_LEVELS]; 84 85 // percentage of the capships score given to other team mates on a kill 86 float assist_award_percentage_scale[NUM_SKILL_LEVELS]; 87 88 // the number of points subtracted from score for a rearm started on a player 89 int repair_penalty[NUM_SKILL_LEVELS]; 90 91 float delay_bomb_arm_timer[NUM_SKILL_LEVELS]; 92 93 // the chance (x/7) that ship is allowed to fire missiles at player ship. 94 int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS]; 95 96 // Player-specific autoaim FOV override 97 float player_autoaim_fov[NUM_SKILL_LEVELS]; 98 99 float detail_distance_mult[MAX_DETAIL_LEVEL + 1]; //MAX_DETAIL_LEVEL really needs to be 4 100 101 int ai_path_mode; 102 103 // radii to use for the radius for subsystem path points and default value --wookieejedi 104 int subsystem_path_radii; 105 106 // Ships flying bay paths will gradually accelerate/decelerate instead of 107 // flying the whole path at max speed 108 float bay_arrive_speed_mult; 109 float bay_depart_speed_mult; 110 111 // How much 0-1 of a second-order lead prediction factor to add to lead indicators. Affects only the HUD indicator, and autoaim. 112 float second_order_lead_predict_factor; 113 114 //Controls if the AI is dumb enough to keep trying to use out-of-range secondaries. 115 int ai_range_aware_secondary_select_mode; 116 117 void reset(); 118 }; 119 120 121 extern int Num_ai_profiles; 122 extern int Default_ai_profile; 123 extern ai_profile_t Ai_profiles[MAX_AI_PROFILES]; 124 125 #define AI_PROFILES_INDEX(ai_p) ((int)((ai_p) - Ai_profiles)) 126 127 void ai_profiles_init(); 128 129 int ai_profile_lookup(char *name); 130 131 #endif 132