SPYSpheres
|
00001 /************************ 00002 * * 00003 * * 00004 * * 00005 * Constants * 00006 * 6/12/14 * 00007 * * 00008 * * 00009 * * 00010 ************************/ 00011 00012 /** 00013 * \file Constants.h 00014 * 00015 * A list of constants used in the ZR program. 00016 */ 00017 00018 #ifndef Constants_H 00019 #define Constants_H 00020 #pragma once 00021 00022 extern "C" { 00023 #include "math_matrix.h" 00024 } 00025 00026 /** 00027 * \var const float EARTH[3] 00028 * 00029 * Contains the attitude towards Earth. The satellite's attidude must be within MAX_FACING_ANGLE to this attitude 00030 */ 00031 const float EARTH[3] = {0.0f, 0.0f, 1.0f}; // TBD 00032 00033 #undef ZR2D 00034 #undef ZR3D 00035 #undef ALLIANCE 00036 #define ALLIANCE 00037 00038 #define SHOW_GAME_TRACE // If this is undef, then the GAME_TRACEs won't show up. 00039 00040 /** 00041 * \var int GAME_TIME 00042 * 00043 * The time at game start. 00044 */ 00045 #define GAME_TIME 0 00046 00047 /***************************************************************************************** 00048 **** SPHERE PROPERTIES **** 00049 *****************************************************************************************/ 00050 00051 //#define SPHERE_MAX_VEL 0.05f // Obsolete #1 00052 //#define SPHERE_RADIUS 0.11f // Obsolete #2 00053 00054 /** 00055 * \var int VEL_X 00056 * 00057 * The index for the beginning of the velocity array inside of ZRState. 00058 */ 00059 #define VEL_X 3 00060 00061 /** 00062 * \var int MAX_GAME_TIME 00063 * 00064 * Length of the whole game in seconds. 00065 */ 00066 #define MAX_GAME_TIME 180 00067 00068 /** 00069 * \var float MAX_FACING_ANGLE 00070 * 00071 * Cosine of the angle at which pictures may be taken/uploaded. 00072 */ 00073 #define MAX_FACING_ANGLE 0.968912f // ~cosf(0.25f) 00074 00075 #define UPLOAD_ANG_VEL 0.05f //!< The maximum speed at which pictures can be uploaded in rads/s, which is roughly equal to 2.8 deg/s. This is calculated by taking the absolute value of the magnitude of the attitude rate vector. 00076 00077 //#define MAX_PICTURE_ANGLE_1 0.92f // increased by 15% for ISS --- was 0.8f // ~~ 0.7853981f // Obsolete #3 00078 //#define MAX_PICTURE_ANGLE_2 0.46f // increased by 15% for ISS --- was 0.4f // ~~ 0.3926991f // Obsolete #4 00079 00080 00081 /***************************************************************************************** 00082 **** ITEM PROPERTIES **** 00083 *****************************************************************************************/ 00084 00085 //TODO: Replace these with an enum 00086 #define ITEM_TYPE_ADD_SCORE 0 //!< The type identifier for a score item. 00087 #define ITEM_TYPE_ADD_ENERGY 1 //!< The type identifier for an energy item. 00088 #define ITEM_TYPE_MIRROR 2 //!< The type identifier for a mirror. 00089 00090 #define ITEM_SCORE 1.5f //!< The added score given by a score item. 00091 #define ITEM_ENERGY MAX_ENERGY //!< The added energy given by an energy item. 00092 #define ITEM_MIRROR_DURATION 24 //!< The length a mirror lasts once activated. 00093 #define NUM_ITEMS 9 //!< The number of items in the game. 00094 #define STARTING_MIRRORS 0 //!< The number of mirrors each sphere starts with 00095 00096 //#define MEMORY_PACK 1 // Obsolete #5 00097 #ifndef ZR2D 00098 00099 #ifdef ZR3D 00100 /** 00101 * Array that outlines the locations of each item. 00102 * Usage: ITEM_LOC[int ItemID] 00103 * Each element is an array of three floats for the XYZ coordinates. 00104 */ 00105 const float ITEM_LOC[NUM_ITEMS][3] = 00106 { 00107 { 0.3,-0.2, 0.3}, 00108 {-0.3,-0.2, 0.3}, 00109 { 0.0, 0.0, 0.3}, 00110 { 0.0, 0.6, 0.4}, 00111 { 0.4, 0.6, 0.0}, 00112 {-0.4, 0.6, 0.0}, 00113 { 0.0, 0.6,-0.4}, 00114 {-0.4, 0.15,-0.4}, 00115 { 0.4, 0.15,-0.4} 00116 00117 00118 }; 00119 #endif 00120 // Alliance coordinates to be determined in initItems 00121 00122 /** 00123 * Array that outlines the types of each item. 00124 * Usage: ITEM_TYPES[int ItemID] 00125 * Each element is an integer that refers to one of the previously defined item types. 00126 */ 00127 const int ITEM_TYPES[NUM_ITEMS] = 00128 { 00129 ITEM_TYPE_ADD_ENERGY, 00130 ITEM_TYPE_ADD_ENERGY, 00131 ITEM_TYPE_ADD_ENERGY, 00132 ITEM_TYPE_ADD_SCORE, 00133 ITEM_TYPE_ADD_SCORE, 00134 ITEM_TYPE_ADD_SCORE, 00135 ITEM_TYPE_ADD_SCORE, 00136 ITEM_TYPE_MIRROR, 00137 ITEM_TYPE_MIRROR 00138 }; 00139 00140 #else 00141 00142 00143 /** 00144 * Array that outlines the locations of each item. 00145 * Usage: ITEM_LOC[int ItemID] 00146 * Each element is an array of three floats for the XYZ coordinates. 00147 */ 00148 00149 const float ITEM_LOC[NUM_ITEMS][3] = 00150 { 00151 { 0.3, 0.0, 0.0}, 00152 {-0.3, 0.0, 0.0}, 00153 { 0.0, 0.3, 0.0}, 00154 { 0.0,-0.3, 0.0}, 00155 { 0.0, 0.6, 0.0}, 00156 { 0.4, 0.6, 0.0}, 00157 {-0.4, 0.6, 0.0}, 00158 { 0.6,-0.7, 0.0}, 00159 {-0.6,-0.7, 0.0} 00160 00161 }; 00162 00163 /** 00164 * Array that outlines the types of each item. 00165 * Usage: ITEM_TYPES[int ItemID] 00166 * Each element is an integer that refers to one of the previously defined item types. 00167 00168 */ 00169 const int ITEM_TYPES[NUM_ITEMS] = 00170 { 00171 ITEM_TYPE_ADD_ENERGY, 00172 ITEM_TYPE_ADD_ENERGY, 00173 ITEM_TYPE_ADD_ENERGY, 00174 ITEM_TYPE_ADD_ENERGY, 00175 ITEM_TYPE_ADD_SCORE, 00176 ITEM_TYPE_ADD_SCORE, 00177 ITEM_TYPE_ADD_SCORE, 00178 ITEM_TYPE_MIRROR, 00179 ITEM_TYPE_MIRROR 00180 }; 00181 #endif 00182 00183 #define MP_SPEED 0.01f //!< The maximum speed at which an item may be picked up. 00184 #define MP_RADIUS 0.05f //!< The maximum distance from which an item may be picked up. 00185 #define MP_ROTATION_ANGLE 0.707106f //!<(rad) Rotation of satellite needed to pick up item (cos(90/2)) 00186 //#define MAX_START_MP 0.04f // Obsolete #6 - Found in a comment in ZRItems 00187 #define MP_EMPTY 0x0fff 00188 00189 // Light properties 00190 #define LIGHT_SWITCH_PERIOD 60 //!< The light switches this number of seconds after the first flip in the 2D/3D versions of the game. 00191 #define LIGHT_SPEED .025f //!< The light moves at this speed (in m/s) during the Alliance portion of the game. 00192 #define LIGHT_WIDTH .8 //!< The width of the area that is not dark. Note that this includes the grey zone. 00193 #define LIGHT_GREY_WIDTH .2 //!< The width of the grey zone in the 2D/3D versions. The width of each grey zone in Alliance is LIGHT_GREY_WIDTH/2. 00194 00195 00196 00197 // Camera Properties 00198 #define DISABLE_CAMERA_TIME 3 //!< The camera is disabled for this many seconds after taking and uploading pictures. 00199 #define CAMERA_DEFAULT_MEMORY 2 //!< The number of memory slots an unmodified camera has. 00200 #define CAMERA_MAX_MEMORY 4 //!< The number of memory slots the camera may have at a maximum. 00201 00202 #define PHOTO_MIN_DISTANCE 0.5 //!< The minimum distance the sphere may be from the target of its photograph. 00203 00204 //Fuel Management Variables 00205 #define MIN_FUEL(a, b) ((a < b) ? b : a) // Prevents fuel from being less than 0 00206 #define MAX_FUEL(c, d) ((c < d) ? c : d) // Prevents fuel from being greater than PROP_ALLOWED_SECONDS 00207 #define PROP_ALLOWED_SECONDS 60.0f //!< Total time in thruster-seconds allowed per user. Full tank ~500 seconds. 00208 00209 00210 // Energy properties 00211 #define MAX_ENERGY 5.0f //!< Energy capacity 00212 #define STARTING_ENERGY MAX_ENERGY //!< Starting energy 00213 #define ENERGY_GAIN_RATE 0.5f //!< Energy gained per second 00214 #define ENERGY_COST_TAKE_PICTURE 1.0f //!< The energy cost to take a picture 00215 #define ENERGY_COST_GET_OTHER_ENERGY 0.0f //!< The energy cost to determine how much energy your opponent has. 00216 #define ENERGY_COST_GET_PIC_POINTS 0.1f //!< The energy cost to determine how many points taking a picture right now would be worth, should you choose to take it. 00217 00218 00219 #define ENERGY_COST_UPLOAD_PICTURES 1.0f //!< The energy cost to upload pictures 00220 #define ENERGY_COST_THRUSTERS (.001f)*(.3f) //!< The energy cost to use one thousandth of a second of fuel. 00221 00222 00223 //Penalty Variables 00224 #define OFFSIDES_PENALTY .02*PROP_ALLOWED_SECONDS // Fuel penalty per second of being out of bounds 00225 #define OOBgain 10.0f // Used to slow down satellite 00226 #define DRAG 1000.0f // DRAG coefficient while in obstacle 00227 00228 //Scoring constants 00229 //#define LOW_ORBIT_SCORE 2 // Obsolete #7 00230 //#define HIGH_ORBIT_SCORE 3 // Obsolete #8 00231 #define START_SCORE 0.0f //!< Your score upon starting the game. 00232 00233 //#define DEAD_ZONE_WIDTH 0.11f // need to be verified // Obsolete #9 00234 //#define LOW_ORBIT_ZONE_WIDTH 0.11f // before finalized. // Obsolete #10 00235 //#define HIGH_ORBIT_ZONE_WIDTH 0.11f // Obsolete #11 00236 //#define MAX_PIC_TAKE_RADIUS 0.53f // Obsolete #12 00237 00238 //Interaction zone limits 00239 #define ZONE_pX 0.64f //!< The highest X coordinate in bounds. 00240 #define ZONE_pY 0.80f //!< The highest Y coordinate in bounds. 00241 #define ZONE_pZ 0.64f //!< The highest Z coordinate in bounds. 00242 #define ZONE_nX -ZONE_pX //!< The lowest X coordinate in bounds. 00243 #define ZONE_nY -ZONE_pY //!< The lowest Y coordinate in bounds. 00244 #define ZONE_nZ -ZONE_pZ //!< The lowest Z coordinate in bounds. 00245 00246 const float limits[3] = {ZONE_pX,ZONE_pY,ZONE_pZ}; //!< The limits of the interaction zone. 00247 00248 #endif