FS2_Open
Open source remastering of the Freespace 2 engine
ai_profiles.h
Go to the documentation of this file.
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 
16 // flag int defines
17 #define AIP_FLAG 1
18 #define AIP_FLAG2 2
19 
20 // flags
21 #define AIPF_SMART_SHIELD_MANAGEMENT (1 << 0)
22 #define AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS (1 << 1)
23 #define AIPF_SMART_PRIMARY_WEAPON_SELECTION (1 << 2)
24 #define AIPF_SMART_SECONDARY_WEAPON_SELECTION (1 << 3)
25 #define AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE (1 << 4)
26 #define AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS (1 << 5)
27 #define AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY (1 << 6)
28 #define AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY (1 << 7)
29 #define AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS (1 << 8)
30 #define AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP (1 << 9)
31 #define AIPF_NO_MIN_DOCK_SPEED_CAP (1 << 10)
32 #define AIPF_DISABLE_LINKED_FIRE_PENALTY (1 << 11)
33 #define AIPF_DISABLE_WEAPON_DAMAGE_SCALING (1 << 12)
34 #define AIPF_USE_ADDITIVE_WEAPON_VELOCITY (1 << 13)
35 #define AIPF_USE_NEWTONIAN_DAMPENING (1 << 14)
36 #define AIPF_INCLUDE_BEAMS_IN_STAT_CALCS (1 << 15)
37 #define AIPF_KILL_SCORING_SCALES_WITH_DAMAGE (1 << 16)
38 #define AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE (1 << 17)
39 #define AIPF_ALLOW_MULTI_EVENT_SCORING (1 << 18)
40 #define AIPF_SMART_AFTERBURNER_MANAGEMENT (1 << 19)
41 #define AIPF_FIX_LINKED_PRIMARY_BUG (1 << 20)
42 #define AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE (1 << 21)
43 #define AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS (1 << 22)
44 #define AIPF_FIX_HEAT_SEEKER_STEALTH_BUG (1 << 23)
45 #define AIPF_MULTI_ALLOW_EMPTY_PRIMARIES (1 << 24)
46 #define AIPF_MULTI_ALLOW_EMPTY_SECONDARIES (1 << 25)
47 #define AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY (1 << 26)
48 #define AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS (1 << 27)
49 #define AIPF_ALLOW_VERTICAL_DODGE (1 << 28) //Allows AI ships to evade weapons vertically as well as horizontally
50 #define AIPF_FORCE_BEAM_TURRET_FOV (1 << 29)
51 #define AIPF_FIX_AI_CLASS_BUG (1 << 30)
52 
53 // flags2
54 #define AIPF2_TURRETS_IGNORE_TARGET_RADIUS (1 << 0)
55 #define AIPF2_NO_SPECIAL_PLAYER_AVOID (1 << 1)
56 #define AIPF2_PERFORM_FEWER_SCREAM_CHECKS (1 << 2)
57 #define AIPF2_ALL_SHIPS_MANAGE_SHIELDS (1 << 3)
58 #define AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS (1 << 4)
59 #define AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV (1 << 5)
60 #define AIPF2_AI_AIMS_FROM_SHIP_CENTER (1 << 6)
61 #define AIPF2_ALLOW_PRIMARY_LINK_AT_START (1 << 7)
62 #define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
63 #define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
64 #define AIPF2_NO_WARP_CAMERA (1 << 10)
65 #define AIPF2_ASPECT_LOCK_COUNTERMEASURE (1 << 11)
66 #define AIPF2_AI_GUARDS_SPECIFIC_SHIP_IN_WING (1 << 12)
67 #define AIPF2_FIX_AI_PATH_ORDER_BUG (1 << 13)
68 #define AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING (1 << 14)
69 #define AIPF2_ASPECT_INVULNERABILITY_FIX (1 << 15)
70 #define AIPF2_GLIDE_DECAY_REQUIRES_THRUST (1 << 16)
71 
72 // AI Path types
73 #define AI_PATH_MODE_NORMAL 0
74 #define AI_PATH_MODE_ALT1 1
75 
76 #define MAX_AI_PROFILES 5
77 
78 typedef struct ai_profile_t {
79 
81 
82  int flags;
83  int flags2;
84 
85  // difficulty-related values
86  int max_incoming_asteroids[NUM_SKILL_LEVELS]; // max number of asteroids thrown at friendlies
87  int max_allowed_player_homers[NUM_SKILL_LEVELS]; // max number of simultaneous homing weapons on player
88  int max_attackers[NUM_SKILL_LEVELS]; // max number of ships that can attack a ship
89  fix predict_position_delay[NUM_SKILL_LEVELS]; // how long until AI predicts a ship position
90  float in_range_time[NUM_SKILL_LEVELS]; // seconds to add to time it takes to get enemy in range (only for player's enemies)
91  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)
92 
93  // AI ships link primaries if energy levels greater than these percents
95  float link_energy_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
96 
97  // AI ships link primaries if ammunition levels greater than these percents
99  float link_ammo_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
100  float primary_ammo_burst_mult[NUM_SKILL_LEVELS]; // SUSHI: Multiplier adjusting burst frequency for ballistic primary weapons
101 
102  // difficulty-related scales
103  float cmeasure_life_scale[NUM_SKILL_LEVELS]; // life of countermeasures
104  float cmeasure_fire_chance[NUM_SKILL_LEVELS]; // chance a countermeasure will be fired based on skill level (also scaled by ai_class)
105  float weapon_energy_scale[NUM_SKILL_LEVELS]; // weapon energy available
106  float shield_energy_scale[NUM_SKILL_LEVELS]; // shield energy available
107  float afterburner_recharge_scale[NUM_SKILL_LEVELS]; // speed of afterburner recharge
108  float player_damage_scale[NUM_SKILL_LEVELS]; // damage applied to the player
109 
110  float subsys_damage_scale[NUM_SKILL_LEVELS]; // damage applied to a player subsystem
111  float beam_friendly_damage_cap[NUM_SKILL_LEVELS]; // damage cap values for friendly beam fire
112  float turn_time_scale[NUM_SKILL_LEVELS]; // speed at which enemy ships turn
113  float glide_attack_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "glide attack" move
114  float circle_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "circle strafe" move
115  float glide_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use glide when strafing capships
116  float random_sidethrust_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to randomly use sidethrust while dogfihthing
117  float stalemate_time_thresh[NUM_SKILL_LEVELS]; // SUSHI: The amount of time required for the AI to detect (and try to break) dogfight stalemate
118  float stalemate_dist_thresh[NUM_SKILL_LEVELS]; // SUSHI: The maximum distance the AI and target must be within for a stalemate
119  float max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: The maximum delay before the AI updates their aim against small ships
120  float turret_max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: As above, but for turrets updating their aim
121 
122  // Multiplicative delay factors for increasing skill levels.
125 
126  // Multiplicative secondary delay factors for increasing skill levels.
129 
130  // Maximum turrets of one ship allowed to shoot the same target
133 
134  // percentage of damage caused required for a kill/assist
137 
138  // percentage of the capships score given to other team mates on a kill
140 
141  // the number of points subtracted from score for a rearm started on a player
143 
145 
146  // the chance (x/7) that ship is allowed to fire missiles at player ship.
148 
149  // Player-specific autoaim FOV override
151 
152  float detail_distance_mult[MAX_DETAIL_LEVEL + 1]; //MAX_DETAIL_LEVEL really needs to be 4
153 
155 
156  // Ships flying bay paths will gradually accelerate/decelerate instead of
157  // flying the whole path at max speed
160 
161 } ai_profile_t;
162 
163 
164 extern int Num_ai_profiles;
165 extern int Default_ai_profile;
167 
168 
169 void ai_profiles_init();
170 
171 int ai_profile_lookup(char *name);
172 
173 #endif
int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:147
float beam_friendly_damage_cap[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:111
float glide_strafe_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:115
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:124
float stalemate_time_thresh[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:117
ai_profile_t Ai_profiles[MAX_AI_PROFILES]
Definition: ai_profiles.cpp:22
float turn_time_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:112
#define NUM_SKILL_LEVELS
Definition: systemvars.h:150
float player_autoaim_fov[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:150
float link_energy_levels_always[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:94
float bay_arrive_speed_mult
Definition: ai_profiles.h:158
float bay_depart_speed_mult
Definition: ai_profiles.h:159
float link_ammo_levels_maybe[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:99
float assist_award_percentage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:139
float ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:128
struct ai_profile_t ai_profile_t
float subsys_damage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:110
int repair_penalty[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:142
float delay_bomb_arm_timer[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:144
float primary_ammo_burst_mult[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:100
float cmeasure_life_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:103
int Default_ai_profile
Definition: ai_profiles.cpp:21
int ai_profile_lookup(char *name)
int max_allowed_player_homers[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:87
#define MAX_AI_PROFILES
Definition: ai_profiles.h:76
float player_damage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:108
int max_attackers[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:88
char profile_name[NAME_LENGTH]
Definition: ai_profiles.h:80
long fix
Definition: pstypes.h:54
float weapon_energy_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:105
float afterburner_recharge_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:107
int Num_ai_profiles
Definition: ai_profiles.cpp:20
int max_incoming_asteroids[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:86
float detail_distance_mult[MAX_DETAIL_LEVEL+1]
Definition: ai_profiles.h:152
float max_aim_update_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:119
GLuint const GLchar * name
Definition: Glext.h:5608
float turret_max_aim_update_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:120
float circle_strafe_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:114
float in_range_time[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:90
#define NAME_LENGTH
Definition: globals.h:15
float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:127
float link_ammo_levels_always[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:98
float glide_attack_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:113
fix predict_position_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:89
float cmeasure_fire_chance[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:104
float shield_energy_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:106
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:123
float kill_percentage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:135
float shield_manage_delay[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:91
float random_sidethrust_percent[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:116
int max_turret_ownage_target[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:131
#define MAX_DETAIL_LEVEL
Definition: systemvars.h:159
int max_turret_ownage_player[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:132
float assist_percentage_scale[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:136
float stalemate_dist_thresh[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:118
float link_energy_levels_maybe[NUM_SKILL_LEVELS]
Definition: ai_profiles.h:95
void ai_profiles_init()