1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                Ken Stevens, Steve McClure, Markus Armbruster
5  *
6  *  Empire 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 3 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, see <http://www.gnu.org/licenses/>.
18  *
19  *  ---
20  *
21  *  See files README, COPYING and CREDITS in the root of the source
22  *  tree for related information and legal notices.  It is expected
23  *  that future projects/authors will amend these files as needed.
24  *
25  *  ---
26  *
27  *  constants.c: Global constants
28  *
29  *  Known contributors to this file:
30  *     Ken Stevens, 1995
31  *     Steve McClure, 1996
32  *     Markus Armbruster, 2004-2020
33  */
34 
35 #include <config.h>
36 
37 #include "optlist.h"
38 
39 /* Name of the deity */
40 char *privname = "Deity forgot to edit econfig";
41 /* E-mail of the deity */
42 char *privlog = "careless@invalid";
43 /* Divine hosts and networks */
44 char *privip = "127.0.0.1 ::1"
45 #ifndef HAVE_WORKING_IN6_IS_ADDR_V4MAPPED
46     " ::ffff:127.0.0.1"		/* See sockaddr_ntop() */
47 #endif
48     ;
49 
50 char *post_crash_dump_hook = "";
51 
52 char *disabled_commands = "";
53 
54 int running_test_suite = 0;	/* For use by "make check" only */
55 
56 int keep_journal = 0;		/* journal log file enabled */
57 
58 int WORLD_X = 64;		/* World size - x */
59 int WORLD_Y = 32;		/* World size - y */
60 
61 int MARK_DELAY = 7200;		/* Seconds to bid on commodities */
62 int TRADE_DELAY = 7200;		/* Seconds to bid on units */
63 
64 int m_m_p_d = 1440;		/* max mins of play per day (per country) */
65 int etu_per_update = 60;	/* # of ETUs per update */
66 int update_window = 0;		/* update window adjustment, in seconds */
67 int update_demand = UPD_DEMAND_NONE;
68 int update_wantmin = 1;		/* votes required for demand update */
69 char *update_demandtimes = "";	/* demand update time ranges */
70 char *game_days = "";		/* days game is running */
71 char *game_hours = "";		/* hours game is running */
72 char *pre_update_hook = "";
73 int max_idle = 15;		/* session dies after max_idle minutes idle */
74 int max_idle_visitor = 5;	/* same for visitors */
75 int login_grace_time = 120;	/* Grace time for completing login (sec) */
76 
77 int sect_mob_max = 127;		/* sector mobility limits */
78 float sect_mob_scale = 1.0;	/* accumulation multiplier */
79 int land_mob_max = 127;		/* land mobility limits */
80 float land_mob_scale = 1.0;	/* accumulation multiplier */
81 int ship_mob_max = 127;		/* ship mobility limits */
82 float ship_mob_scale = 1.5;	/* accumulation multiplier */
83 int plane_mob_max = 127;	/* plane mobility limits */
84 float plane_mob_scale = 1.0;	/* accumulation multiplier */
85 
86 float fire_range_factor = 1.0;	/* Increase/reduce firing ranges */
87 
88 int morale_base = 42;		/* base for morale */
89 
90 /* opt_MOB_ACCESS */
91 int sect_mob_neg_factor = 2;	/* ETU/neg_factor = negative amount of mobility
92 				   a sector has after being taken */
93 
94 int anno_keep_days = 7;		/* How long until annos expire (<0 never) */
95 int news_keep_days = 10;	/* How long until news expire */
96 int lost_keep_hours = 48;	/* How long until lost items expire */
97 
98 double combat_mob = 5.0;	/* how much mob do units spend for combat? */
99 
100 /* if you find that naving is taking too long, try reducing these */
101 int fort_max_interdiction_range = 8;
102 int ship_max_interdiction_range = 8;
103 int land_max_interdiction_range = 8;
104 
105 double unit_damage = 0.30;	/* Units take this fraction of normal damage */
106 double people_damage = 1.00;	/* Civs/mil/uw take this fraction of damage */
107 double collateral_dam = 0.10;	/* Side effect damage to sector */
108 double assault_penalty = 0.50;	/* attack factor for para & assault troops */
109 
110 float land_grow_scale = 2.0;	/* how fast eff grows for land units (xETUS) */
111 float ship_grow_scale = 3.0;	/* how fast eff grows for ships (xETUS) */
112 float plane_grow_scale = 2.0;	/* 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 babyeat = 0.0060;	/* food to mature 1 baby into a civilian */
118 
119 double obrate = 0.005;		/* other sectors birth rate */
120 double uwbrate = 0.0025;	/* uncompensated worker birth rate */
121 				/* values > 0.25 for either will overflow */
122 int rollover_avail_max = 50;	/* max. avail that can roll over an update */
123 
124 /* opt_FALLOUT */
125 double decay_per_etu = 0.006;	/* This gives a half life of ? ETUs,
126 				   about ? days.
127 				   half life in Jt
128 				   log(.5) / log(1-decay_per_etu)
129 				   Calculate your own if you don't like it.
130 				   If you want a specific half life you can
131 				   calc it with this formula:
132 				   decay_per_etu = 1 - (.5)^(1/etus)
133 				   due to the discrete nature of empire
134 				   you can not get a precise number
135 				   without intensive simulation
136 				   (more than 3 digits). */
137 double fallout_spread = 0.005;	/* fraction of fallout that leaks into
138 				   each surrounding sector */
139 /* end opt_FALLOUT */
140 
141 double bankint = 0.25;		/* bank interest rate (dt * bars) */
142 
143 /* Note in the taxes below:
144    tradetax - this is charged to the seller, so it is < 1 (because the seller
145 	      gets the (price paid * tradetax)
146    buytax - this is charged to the buyer, so it is > 1 (because the buyer is
147 	      charged (price paid * buytax).
148    Not perfect, but it works. :) */
149 
150 double tradetax = 0.99;		/* Tax charged on trade */
151 double buytax = 1.0;		/* Tax charged on market purchases */
152 int startmob = 127;		/* Sanctuary starting mobility */
153 float flakscale = 1.75f;	/* Scale factor for flak damage */
154 
155 /* money gained from taxes, paid to military, and reservists */
156 double money_civ = 0.0083333;
157 double money_uw = 0.0017777;
158 double money_mil = -0.0833333;
159 double money_res = -0.0083333;
160 
161 /* pct cost per ETU for maintaining a ship or plane or land unit */
162 double money_plane = -0.001;
163 double money_ship = -0.001;
164 double money_land = -0.001;
165 
166 /* edu and hap consumption factors -- hap_cons civs need 1 hap --> hlev++ */
167 double hap_cons = 600000.0;
168 double edu_cons = 600000.0;
169 
170 /* hap and edu avg mean that the weight on current happiness is
171  *  (cur_hap * hap_avg + hap_prod * etu) / (hap_avg + etu); */
172 float hap_avg = 16.0 * 3.0;
173 float edu_avg = 16.0 * 12.0;
174 
175 
176 /* tech build limitations. */
177 float easy_tech = 1.00;		/* amount of tech built with no penality */
178 float tech_log_base = 2.0;	/* base of log to take of in-efficient tech */
179 
180 float ally_factor = 2.0;	/* shared tech with allies = 1/factor */
181 float level_age_rate = 96.0;	/* 1% per 96 ETUs; 0 -> no decline */
182 
183 
184 int players_at_00 = 0;		/* players coord system on deity 0,0? */
185 int at_least_one_100 = 1;	/* init player with 100/100/100/100 sector? */
186 
187 
188 
189 float btu_build_rate = 0.0012;	/* etu * civ * eff * btu_build_rate */
190 				/* 8 * 999 * 100 * 0.0004 = 319 */
191 int max_btus = 640;		/* maximum # of BTUs */
192 
193 double buil_bt = 10.0;		/* tech level required to build a bridge */
194 int buil_bh = 100;		/* hcm required to build a bridge */
195 double buil_bc = 1000.0;	/* cash required to build a bridge */
196 
197 double buil_tower_bt = 100.0;	/* tech level required to build a tower */
198 int buil_tower_bh = 300;	/* hcm required to build a bridge tower */
199 double buil_tower_bc = 3000.0;	/* cash required to build a bridge tower */
200 
201 float drnuke_const = 0.0;	/* research must be at least drnuke_const*tech */
202 				/* in order to build a nuke. For example, if
203 				 * drnuke_const is .25, you need a 75 res to
204 				 * build a nuke that takes 300 tech
205 				 */
206 /* trade ships */
207 int trade_1_dist = 8;		/* less than this gets no money */
208 int trade_2_dist = 14;		/* less than this gets trade_1 money */
209 int trade_3_dist = 25;		/* less than this gets trade_2 money */
210 float trade_1 = 0.025;		/* return on trade_1 distance */
211 float trade_2 = 0.035;		/* return on trade_2 distance */
212 float trade_3 = 0.050;		/* return on trade_3 distance */
213 float trade_ally_bonus = 0.20;	/* 20% bonus for trading with allies */
214 float trade_ally_cut = 0.10;	/* 10% bonus for ally you trade with */
215 
216 int torpedo_damage = 40;	/* damage is X + 1dX + 1dX, so 40+1d40+1d40 */
217 
218 int start_cash = 25000;
219 
220 /* initial levels */
221 float start_education = 0.0;
222 float start_happiness = 0.0;
223 float start_technology = 0.0;
224 float start_research = 0.0;
225 
226 /* econfig keys */
227 static int emp_config_dummy;
228 struct keymatch configkeys[] = {
229 #define EMP_CONFIG_C_OUTPUT
230 #include "econfig-spec.h"
231 #undef	EMP_CONFIG_C_OUTPUT
232 };
233