1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef _GLOBAL_CONSTANTS_H
4 #define _GLOBAL_CONSTANTS_H
5 
6 /**
7  * @brief square size
8  *
9  * Defines the size of 1 heightmap square as 8 elmos.
10  */
11 const int SQUARE_SIZE = 8;
12 
13 /**
14  * @brief footprint scale
15  *
16  * Multiplier for {Unit, Feature, Move}Def footprint sizes which are
17  * assumed to be expressed in "TA units". The resolution of Spring's
18  * blocking-map is twice that of TA's; a "TA-footprint" square covers
19  * SQUARE_SIZE*2 x SQUARE_SIZE*2 elmos.
20  */
21 const int SPRING_FOOTPRINT_SCALE = 2;
22 
23 /**
24  * conversion factor from elmos to meters
25  */
26 const float ELMOS_TO_METERS = 1.0f / SQUARE_SIZE;
27 
28 /**
29  * @brief game speed
30  *
31  * Defines the game-/sim-frames per second.
32  */
33 const int GAME_SPEED = 30;
34 
35 /**
36  * @brief unit SlowUpdate rate
37  *
38  * Defines the interval of SlowUpdate calls in sim-frames.
39  */
40 const int UNIT_SLOWUPDATE_RATE = 16;
41 
42 /**
43  * @brief team SlowUpdate rate
44  *
45  * Defines the interval of CTeam::SlowUpdate calls in sim-frames.
46  */
47 const int TEAM_SLOWUPDATE_RATE = 32;
48 
49 /**
50  * @brief max teams
51  *
52  * Defines the maximum number of teams as 255
53  * (254 real teams, and an extra slot for the GAIA team).
54  */
55 const int MAX_TEAMS = 255;
56 
57 /**
58  * @brief max players
59  *
60  * This is the hard limit.
61  * It is currently 251. as it isrestricted by the size of the player-ID field
62  * in the network, which is 1 byte (=> 255), plus 4 slots reserved for special
63  * purposes, resulting in 251.
64  */
65 const int MAX_PLAYERS = 251;
66 
67 /**
68  * @brief max AIs
69  *
70  * This is the hard limit.
71  * It is currently 255. as it isrestricted by the size of the ai-ID field
72  * in the network, which is 1 byte (=> 256), with the value 255 reserved for
73  * special purpose, resulting in 255.
74  */
75 const int MAX_AIS = 255;
76 
77 /**
78  * @brief max units
79  *
80  * Defines the absolute global maximum number of units allowed to exist in a
81  * game at any time.
82  * NOTE: This must be <= SHRT_MAX (32'766) because current network code
83  * transmits unit-IDs as signed shorts. The effective global unit limit is
84  * stored in UnitHandler::maxUnits, and is always clamped to this value.
85  */
86 const int MAX_UNITS = 32000;
87 
88 /**
89  * @brief max weapons per unit
90  *
91  * Defines the maximum weapons per single unit type as 32.
92  */
93 const int MAX_WEAPONS_PER_UNIT = 32;
94 
95 /**
96  * @brief randint max
97  *
98  * Defines the maximum random integer as 0x7fff.
99  */
100 const int RANDINT_MAX = 0x7fff;
101 
102 /**
103  * maximum speed (elmos/frame) a unit is allowed to have outside the map
104  */
105 const float MAX_UNIT_SPEED = 1e3f;
106 
107 /**
108  * maximum impulse strength an explosion is allowed to impart on a unit
109  */
110 const float MAX_EXPLOSION_IMPULSE = 1e4f;
111 
112 /**
113  * if explosion distance is less than speed of explosion multiplied by
114  * this factor, units are damaged directly rather than N>=1 frames later
115  */
116 const float DIRECT_EXPLOSION_DAMAGE_SPEED_SCALE = 4.0f;
117 
118 /**
119  * maximum range of a weapon-projectile with a flight-time member
120  */
121 const float MAX_PROJECTILE_RANGE = 1e6f;
122 
123 /**
124  * maximum absolute height a projectile is allowed to reach
125  */
126 const float MAX_PROJECTILE_HEIGHT = 1e6f;
127 
128 #endif // _GLOBAL_CONSTANTS_H
129