]> git.pond.sub.org Git - empserver/blob - src/lib/global/constants.c
Import of Empire 4.2.12
[empserver] / src / lib / global / constants.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23  *  related information and legal notices. It is expected that any future
24  *  projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  constants.c: Global constants file.  Note that the "hours" file can
29  *               override these, as does the global "econfig" file.
30  * 
31  *  Known contributors to this file:
32  *     Ken Stevens, 1995
33  *     Steve McClure, 1996
34  *     
35  */
36
37 #include "gamesdef.h"
38 #include "misc.h"
39 #include "xy.h"
40
41 s_char    *privname   = PRVNAM; /* name of priv user */
42 s_char    *privlog    = PRVLOG; /* logname of priv user */
43
44 int     WORLD_X = DEF_WORLD_X;  /* World size - x */
45 int     WORLD_Y = DEF_WORLD_Y;  /* World size - y */
46
47 int     MARK_DELAY = 7200;      /* Seconds to bid on commodities */
48 int     TRADE_DELAY = 7200;     /* Seconds to bid on units */
49
50 int     m_m_p_d     = 1440;     /* max mins of play per day (per country) */
51 long    s_p_etu = DEF_S_P_ETU;  /* seconds per Empire time unit */
52 int     etu_per_update = ETUS;  /* # of etu's per update, from misc.h */
53 long    adj_update  = 0;        /* update time adjustment */
54 int     update_window  = 0;     /* update window adjustment */
55 int     hourslop    = 5;        /* amount of slop to match update times */
56 s_char  *update_times = "";     /* times regular update is allowed */
57 int     update_policy = 0;      /* update policy for regular updates */
58 int     update_demandpolicy = 2;/* update policy for demand updates */
59 int     update_missed = 999;    /* demand updates missed before veto */
60 int     update_wantmin = 0;     /* number of votes required for demand update */
61 int     blitz_time = 10;        /* number of minutes between blitz updates */
62 s_char  *update_demandtimes = "";/* times demand update is allowed */
63 s_char  *game_days = "";        /* days game is running */
64 s_char  *game_hours = "";       /* hours game is running */
65 int     max_idle    = 15;       /* session dies after max_idle minutes idle */
66
67 int     sect_mob_max = 127;     /* sector mobility limits */
68 float   sect_mob_scale = 1.0;   /* accumulation multiplier */
69 int     land_mob_max = 127;     /* land mobility limits */
70 float   land_mob_scale = 1.0;   /* accumulation multiplier */
71 int     ship_mob_max = 127;     /* ship mobility limits */
72 float   ship_mob_scale = 1.5;   /* accumulation multiplier */
73 int     plane_mob_max = 127;    /* plane mobility limits */
74 float   plane_mob_scale = 1.0;  /* accumulation multiplier */
75
76 float   fire_range_factor = 1.0;/* Increase/reduce firing ranges */
77
78 int     morale_base = 42;  /* base for morale */
79
80 /* opt_MOB_ACCESS */
81 int     sect_mob_neg_factor = 2;/* ETU/neg_factor = negative amount of mobility
82                                    a sector has after being taken */
83 int     updating_mob = 1;       /* If we are currently updating mob */
84 int     timestamp_fixing = 0;   /* If we are currently fixing timestamps */
85
86 int     lost_items_timeout = 172800; /* How long before removing from database */
87
88 double  combat_mob=5.0; /* how much mob do units spend for combat? */
89
90 /* if you find that naving is taking too long, try reducing these */
91 int fort_max_interdiction_range = 8;
92 int ship_max_interdiction_range = 8;
93 int land_max_interdiction_range = 8;
94
95 double mission_mob_cost = 0.0;  /* Cost is percentage of max mob */
96
97 double  unit_damage = 0.30;     /* Units take this % of normal damage */
98 double  people_damage = 1.00;   /* Civs/Mil/Uw take this % of normal damage */
99 double  collateral_dam = 0.10;  /* Side effect damage to sector */
100 double  assault_penalty = 0.50; /* attack factor for para & assault troops */
101
102 /* START_UNITS */
103 #ifdef START_UNITS
104 int     start_unit_type[START_UNITS] = {0, 1};  /* type of unit */
105 #endif /* START_UNITS */
106
107 /* opt_FUEL */
108 int     fuel_mult = 10;         /* 1 fuel = 10 mob */
109
110 int     land_grow_scale = 2;    /* how fast eff grows for land units (xETUS) */
111 int     ship_grow_scale = 3;    /* how fast eff grows for ships (xETUS) */
112 int     plane_grow_scale = 2;   /* how fast eff grows for planes (xETUS) */
113
114 double   fgrate      = 0.0012;  /* food growth rate (dt * fert) */
115 double   fcrate      = 0.0013;  /* food cultivate rate (dt * workforce) */
116 double   eatrate     = 0.0005;  /* food eating rate (dt * people) */
117 /*double   eatrate     = 0.0001;*/      /* food eating rate (dt * people) */
118 double   babyeat     = 0.0060;  /* food to mature 1 baby into a civilian */
119 /*double   babyeat     = 0.0000;*/      /* food to mature 1 baby into a civilian */
120
121 double   obrate      = 0.005;   /* other sectors birth rate */
122 double   uwbrate     = 0.0025;  /* uncompensated worker birth rate */
123                                 /* values > 0.25 for either will overflow */
124
125 /* opt_FALLOUT */
126 /* these are the radioactive decay constants */
127 /* fraction of commodity destroyed is
128    etus*fallout/(1000*melt_item_denom[item])
129    higher denominators for tougher commodities */
130 int      melt_item_denom[] = 
131         /*   civ mil shell gun pet iron dust bar*/
132         { 0, 4,  20, 80,   100,50, 100, 100, 200,
133            2,  50, 100,100,2, 1000 };
134         /*food oil lcm hcm UW rads */
135 double   decay_per_etu = 0.006; /* This gives a half life of ? etus,
136                                    about ? days.
137                                    half life in Jt
138                                    log(.5) / log(1-decay_per_etu)
139                                    Calculate your own if you don't like it.
140                                    If you want a specific half life you can
141                                    calc it with this formula:
142                                    decay_per_etu = 1 - (.5)^(1/etus)
143                                    due to the discrete nature of empire
144                                    you can not get a precise number
145                                    without intensive simulation
146                                    (more than 3 digits). */
147 double   fallout_spread = 0.005;  /* fraction of fallout that leaks into 
148                                     each surrounding sector */
149 /* end opt_FALLOUT */
150
151 double   bankint     = 0.25;    /* bank interest rate (dt * bars) */
152
153 /* Note in the taxes below:
154    tradetax - this is charged to the seller, so it is < 1 (because the seller
155               gets the (price paid * tradetax)
156    buytax - this is charged to the buyer, so it is > 1 (because the buyer is
157               charged (price paid * buytax).
158    Not perfect, but it works. :) */
159
160 double   minmult     = 0.5;     /* minimum trade mulitple */
161 double   maxmult     = 10.0;    /* maximum trade multiple */
162 double   tradetax    = 0.99;    /* Tax charged on trade */
163 double   buytax      = 1.0;     /* Tax charged on market purchases */
164 int      startmob    = 127;     /* Sanctuary starting mobility */
165 double   flakscale   = 1.75;    /* Scale factor for flak damage */
166
167 /* money gained from taxes, paid to military, and reservists */
168 double  money_civ       = 0.0083333;
169 double  money_uw        = 0.0017777;
170 double  money_mil       = -0.0833333;
171 double  money_res       = -0.0083333;
172
173 /* pct cost per ETU for maintaining a ship or plane or land unit */
174 double  money_plane     = -0.001;
175 double  money_ship      = -0.001;
176 double  money_land      = -0.001;
177
178 /* edu and hap consumption factors -- hap_cons civs need 1 hap --> hlev++ */
179 double  hap_cons        = 600000.0;
180 double  edu_cons        = 600000.0;
181
182 /* hap and edu avg mean that the weight on current happiness is
183  *  (cur_hap * hap_avg + hap_prod * etu) / (hap_avg + etu);             */
184 float   hap_avg = 16.0 * 3.0;
185 float   edu_avg = 16.0 * 12.0;
186
187
188 /* tech build limitations.  Tech limits only apply after easy_tech.
189  * Two ways of limiting tech: asymptotic or logrithmic:
190  * tech_hard is asymptopic limitation, tech_log_base is the logrithmic
191  * limitation.  set tech_log_base > 1.0 to have it take effect,
192  * set hard_tech > 0 to have it take effect
193  * for log based, only tech values where the slop is < 1 are used       */
194
195 float   easy_tech = 1.00;       /* amount of tech built with no penality */
196 float   hard_tech = 10.0;       /* amount of in-efficiently built tech */
197 float   tech_log_base = 2.0;    /* base of log to take of in-efficient tech */
198
199 float   ally_factor = 2.0;      /* shared tech with allies = 1/factor */
200 float   level_age_rate = 96.0;  /* 1% per 96 etu's; 0 -> no decline */
201
202
203 int     players_at_00 = 0;      /* players coord system on deity 0,0? */
204 int     at_least_one_100 = 1;   /* init player with 100/100/100/100 sector? */
205
206
207
208 float   btu_build_rate = 0.0012;/* etu * civ * eff * btu_build_rate */
209                                 /* 8 * 999 * 100 * 0.0004 = 319 */
210 int     max_btus = 640;         /* maximum # of btu's */
211 double  powe_cost = 10.0;       /* btu cost to gen a power report */
212
213 double  buil_bt = 10.0;         /* tech level required to build a bridge */
214 int     buil_bh = 100;          /* hcm required to build a bridge */
215 double  buil_bc = 2000.0;       /* cash required to build a bridge */
216
217 double  buil_tower_bt = 100.0;  /* tech level required to build a tower */
218 int     buil_tower_bh = 400;    /* hcm required to build a bridge tower */
219 double  buil_tower_bc = 7500.0; /* cash required to build a bridge tower */
220
221 /* opt_SLOW_WAR */
222 int     War_Cost = 1000;        /* Cost to declare war */
223
224 /* opt_DEMANDUPDATE */
225 long    last_demand_update=0;   /* When was last demand update? */
226
227
228 /* opt_DRNUKE */
229 float   drnuke_const = .33;     /* research must be at least drnuke_const*tech*/
230                                 /* in order to build a nuke. For example, if
231                                  * drnuke_const is .25, you need a 75 res to
232                                  * build a nuke that takes 300 tech
233                                  */
234 /* opt_TRADESHIPS */
235 int   trade_1_dist = 8;         /* less than this gets no money */
236 int   trade_2_dist = 14;        /* less than this gets trade_1 money */
237 int   trade_3_dist = 25;        /* less than this gets trade_2 money */
238 float trade_1 = 0.025;          /* return on trade_1 distance */
239 float trade_2 = 0.035;          /* return on trade_2 distance */
240 float trade_3 = 0.050;          /* return on trade_3 distance */
241 float trade_ally_bonus = 0.20;  /* 20% bonus for trading with allies */
242 float trade_ally_cut = 0.10;    /* 10% bonus for ally you trade with */
243 /* end opt_TRADESHIPS */
244
245 int     torpedo_damage = 40;    /* damage is X + 1dX + 1dX, so 40+1d40+1d40 */
246
247 /* initial levels */
248 float start_education = 0.0;
249 float start_happiness = 0.0;
250 float start_technology = 0.0;
251 float start_research = 0.0;