3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <IrrCompileConfig.h>
25 #include "constants.h"
27 #include "mapgen/mapgen.h" // Mapgen::setDefaultSettings
28 #include "util/string.h"
30 void set_default_settings(Settings *settings)
33 settings->setDefault("language", "");
34 settings->setDefault("name", "");
35 settings->setDefault("bind_address", "");
36 settings->setDefault("serverlist_url", "servers.minetest.net");
39 settings->setDefault("address", "");
40 settings->setDefault("enable_sound", "true");
41 settings->setDefault("sound_volume", "0.8");
42 settings->setDefault("mute_sound", "false");
43 settings->setDefault("enable_mesh_cache", "false");
44 settings->setDefault("mesh_generation_interval", "0");
45 settings->setDefault("meshgen_block_cache_size", "20");
46 settings->setDefault("enable_vbo", "true");
47 settings->setDefault("free_move", "false");
48 settings->setDefault("pitch_move", "false");
49 settings->setDefault("fast_move", "false");
50 settings->setDefault("noclip", "false");
51 settings->setDefault("screenshot_path", "screenshots");
52 settings->setDefault("screenshot_format", "png");
53 settings->setDefault("screenshot_quality", "0");
54 settings->setDefault("client_unload_unused_data_timeout", "600");
55 settings->setDefault("client_mapblock_limit", "5000");
56 settings->setDefault("enable_build_where_you_stand", "false");
57 settings->setDefault("curl_timeout", "5000");
58 settings->setDefault("curl_parallel_limit", "8");
59 settings->setDefault("curl_file_download_timeout", "300000");
60 settings->setDefault("curl_verify_cert", "true");
61 settings->setDefault("enable_remote_media_server", "true");
62 settings->setDefault("enable_client_modding", "false");
63 settings->setDefault("max_out_chat_queue_size", "20");
64 settings->setDefault("pause_on_lost_focus", "false");
65 settings->setDefault("enable_register_confirmation", "true");
68 settings->setDefault("remote_port", "30000");
69 settings->setDefault("keymap_forward", "KEY_KEY_W");
70 settings->setDefault("keymap_autoforward", "");
71 settings->setDefault("keymap_backward", "KEY_KEY_S");
72 settings->setDefault("keymap_left", "KEY_KEY_A");
73 settings->setDefault("keymap_right", "KEY_KEY_D");
74 settings->setDefault("keymap_jump", "KEY_SPACE");
75 settings->setDefault("keymap_sneak", "KEY_LSHIFT");
76 settings->setDefault("keymap_drop", "KEY_KEY_Q");
77 settings->setDefault("keymap_zoom", "KEY_KEY_Z");
78 settings->setDefault("keymap_inventory", "KEY_KEY_I");
79 settings->setDefault("keymap_special1", "KEY_KEY_E");
80 settings->setDefault("keymap_chat", "KEY_KEY_T");
81 settings->setDefault("keymap_cmd", "/");
82 settings->setDefault("keymap_cmd_local", ".");
83 settings->setDefault("keymap_minimap", "KEY_F9");
84 settings->setDefault("keymap_console", "KEY_F10");
85 settings->setDefault("keymap_rangeselect", "KEY_KEY_R");
86 settings->setDefault("keymap_freemove", "KEY_KEY_K");
87 settings->setDefault("keymap_pitchmove", "KEY_KEY_P");
88 settings->setDefault("keymap_fastmove", "KEY_KEY_J");
89 settings->setDefault("keymap_noclip", "KEY_KEY_H");
90 settings->setDefault("keymap_hotbar_next", "KEY_KEY_N");
91 settings->setDefault("keymap_hotbar_previous", "KEY_KEY_B");
92 settings->setDefault("keymap_mute", "KEY_KEY_M");
93 settings->setDefault("keymap_increase_volume", "");
94 settings->setDefault("keymap_decrease_volume", "");
95 settings->setDefault("keymap_cinematic", "");
96 settings->setDefault("keymap_toggle_hud", "KEY_F1");
97 settings->setDefault("keymap_toggle_chat", "KEY_F2");
98 settings->setDefault("keymap_toggle_fog", "KEY_F3");
100 settings->setDefault("keymap_toggle_update_camera", "KEY_F4");
102 settings->setDefault("keymap_toggle_update_camera", "");
104 settings->setDefault("keymap_toggle_debug", "KEY_F5");
105 settings->setDefault("keymap_toggle_profiler", "KEY_F6");
106 settings->setDefault("keymap_camera_mode", "KEY_F7");
107 settings->setDefault("keymap_screenshot", "KEY_F12");
108 settings->setDefault("keymap_increase_viewing_range_min", "+");
109 settings->setDefault("keymap_decrease_viewing_range_min", "-");
110 settings->setDefault("keymap_slot1", "KEY_KEY_1");
111 settings->setDefault("keymap_slot2", "KEY_KEY_2");
112 settings->setDefault("keymap_slot3", "KEY_KEY_3");
113 settings->setDefault("keymap_slot4", "KEY_KEY_4");
114 settings->setDefault("keymap_slot5", "KEY_KEY_5");
115 settings->setDefault("keymap_slot6", "KEY_KEY_6");
116 settings->setDefault("keymap_slot7", "KEY_KEY_7");
117 settings->setDefault("keymap_slot8", "KEY_KEY_8");
118 settings->setDefault("keymap_slot9", "KEY_KEY_9");
119 settings->setDefault("keymap_slot10", "KEY_KEY_0");
120 settings->setDefault("keymap_slot11", "");
121 settings->setDefault("keymap_slot12", "");
122 settings->setDefault("keymap_slot13", "");
123 settings->setDefault("keymap_slot14", "");
124 settings->setDefault("keymap_slot15", "");
125 settings->setDefault("keymap_slot16", "");
126 settings->setDefault("keymap_slot17", "");
127 settings->setDefault("keymap_slot18", "");
128 settings->setDefault("keymap_slot19", "");
129 settings->setDefault("keymap_slot20", "");
130 settings->setDefault("keymap_slot21", "");
131 settings->setDefault("keymap_slot22", "");
132 settings->setDefault("keymap_slot23", "");
133 settings->setDefault("keymap_slot24", "");
134 settings->setDefault("keymap_slot25", "");
135 settings->setDefault("keymap_slot26", "");
136 settings->setDefault("keymap_slot27", "");
137 settings->setDefault("keymap_slot28", "");
138 settings->setDefault("keymap_slot29", "");
139 settings->setDefault("keymap_slot30", "");
140 settings->setDefault("keymap_slot31", "");
141 settings->setDefault("keymap_slot32", "");
143 // Some (temporary) keys for debugging
144 settings->setDefault("keymap_quicktune_prev", "KEY_HOME");
145 settings->setDefault("keymap_quicktune_next", "KEY_END");
146 settings->setDefault("keymap_quicktune_dec", "KEY_NEXT");
147 settings->setDefault("keymap_quicktune_inc", "KEY_PRIOR");
151 settings->setDefault("show_debug", "false");
153 settings->setDefault("show_debug", "true");
155 settings->setDefault("fsaa", "0");
156 settings->setDefault("undersampling", "0");
157 settings->setDefault("world_aligned_mode", "enable");
158 settings->setDefault("autoscale_mode", "disable");
159 settings->setDefault("enable_fog", "true");
160 settings->setDefault("fog_start", "0.4");
161 settings->setDefault("3d_mode", "none");
162 settings->setDefault("3d_paralax_strength", "0.025");
163 settings->setDefault("tooltip_show_delay", "400");
164 settings->setDefault("tooltip_append_itemname", "false");
165 settings->setDefault("fps_max", "60");
166 settings->setDefault("pause_fps_max", "20");
167 settings->setDefault("viewing_range", "100");
169 settings->setDefault("near_plane", "0.1");
171 settings->setDefault("screen_w", "1024");
172 settings->setDefault("screen_h", "600");
173 settings->setDefault("autosave_screensize", "true");
174 settings->setDefault("fullscreen", "false");
175 settings->setDefault("fullscreen_bpp", "24");
176 settings->setDefault("vsync", "false");
177 settings->setDefault("fov", "72");
178 settings->setDefault("leaves_style", "fancy");
179 settings->setDefault("connected_glass", "false");
180 settings->setDefault("smooth_lighting", "true");
181 settings->setDefault("lighting_alpha", "0.0");
182 settings->setDefault("lighting_beta", "1.5");
183 settings->setDefault("display_gamma", "1.0");
184 settings->setDefault("lighting_boost", "0.2");
185 settings->setDefault("lighting_boost_center", "0.5");
186 settings->setDefault("lighting_boost_spread", "0.2");
187 settings->setDefault("texture_path", "");
188 settings->setDefault("shader_path", "");
190 #ifdef _IRR_COMPILE_WITH_OGLES1_
191 settings->setDefault("video_driver", "ogles1");
193 settings->setDefault("video_driver", "ogles2");
196 settings->setDefault("video_driver", "opengl");
198 settings->setDefault("cinematic", "false");
199 settings->setDefault("camera_smoothing", "0");
200 settings->setDefault("cinematic_camera_smoothing", "0.7");
201 settings->setDefault("enable_clouds", "true");
202 settings->setDefault("view_bobbing_amount", "1.0");
203 settings->setDefault("fall_bobbing_amount", "0.03");
204 settings->setDefault("enable_3d_clouds", "true");
205 settings->setDefault("cloud_radius", "12");
206 settings->setDefault("menu_clouds", "true");
207 settings->setDefault("opaque_water", "false");
208 settings->setDefault("console_height", "0.6");
209 settings->setDefault("console_color", "(0,0,0)");
210 settings->setDefault("console_alpha", "200");
211 settings->setDefault("formspec_fullscreen_bg_color", "(0,0,0)");
212 settings->setDefault("formspec_fullscreen_bg_opacity", "140");
213 settings->setDefault("formspec_default_bg_color", "(0,0,0)");
214 settings->setDefault("formspec_default_bg_opacity", "140");
215 settings->setDefault("selectionbox_color", "(0,0,0)");
216 settings->setDefault("selectionbox_width", "2");
217 settings->setDefault("node_highlighting", "box");
218 settings->setDefault("crosshair_color", "(255,255,255)");
219 settings->setDefault("crosshair_alpha", "255");
220 settings->setDefault("recent_chat_messages", "6");
221 settings->setDefault("hud_scaling", "1.0");
222 settings->setDefault("gui_scaling", "1.0");
223 settings->setDefault("gui_scaling_filter", "false");
224 settings->setDefault("gui_scaling_filter_txr2img", "true");
225 settings->setDefault("desynchronize_mapblock_texture_animation", "true");
226 settings->setDefault("hud_hotbar_max_width", "1.0");
227 settings->setDefault("enable_local_map_saving", "false");
228 settings->setDefault("show_entity_selectionbox", "true");
229 settings->setDefault("texture_clean_transparent", "false");
230 settings->setDefault("texture_min_size", "64");
231 settings->setDefault("ambient_occlusion_gamma", "2.2");
233 settings->setDefault("enable_shaders", "false");
235 settings->setDefault("enable_shaders", "true");
237 settings->setDefault("enable_particles", "true");
238 settings->setDefault("arm_inertia", "true");
240 settings->setDefault("enable_minimap", "true");
241 settings->setDefault("minimap_shape_round", "true");
242 settings->setDefault("minimap_double_scan_height", "true");
245 settings->setDefault("directional_colored_fog", "true");
246 settings->setDefault("inventory_items_animations", "false");
247 settings->setDefault("mip_map", "false");
248 settings->setDefault("anisotropic_filter", "false");
249 settings->setDefault("bilinear_filter", "false");
250 settings->setDefault("trilinear_filter", "false");
251 settings->setDefault("tone_mapping", "false");
252 settings->setDefault("enable_bumpmapping", "false");
253 settings->setDefault("enable_parallax_occlusion", "false");
254 settings->setDefault("generate_normalmaps", "false");
255 settings->setDefault("normalmaps_strength", "0.6");
256 settings->setDefault("normalmaps_smooth", "1");
257 settings->setDefault("parallax_occlusion_mode", "1");
258 settings->setDefault("parallax_occlusion_iterations", "4");
259 settings->setDefault("parallax_occlusion_scale", "0.08");
260 settings->setDefault("parallax_occlusion_bias", "0.04");
261 settings->setDefault("enable_waving_water", "false");
262 settings->setDefault("water_wave_height", "1.0");
263 settings->setDefault("water_wave_length", "20.0");
264 settings->setDefault("water_wave_speed", "5.0");
265 settings->setDefault("enable_waving_leaves", "false");
266 settings->setDefault("enable_waving_plants", "false");
270 settings->setDefault("invert_mouse", "false");
271 settings->setDefault("mouse_sensitivity", "0.2");
272 settings->setDefault("repeat_rightclick_time", "0.25");
273 settings->setDefault("safe_dig_and_place", "false");
274 settings->setDefault("random_input", "false");
275 settings->setDefault("aux1_descends", "false");
276 settings->setDefault("doubletap_jump", "false");
277 settings->setDefault("always_fly_fast", "true");
279 settings->setDefault("autojump", "true");
281 settings->setDefault("autojump", "false");
283 settings->setDefault("continuous_forward", "false");
284 settings->setDefault("enable_joysticks", "false");
285 settings->setDefault("joystick_id", "0");
286 settings->setDefault("joystick_type", "");
287 settings->setDefault("repeat_joystick_button_time", "0.17");
288 settings->setDefault("joystick_frustum_sensitivity", "170");
291 settings->setDefault("main_menu_style", "full");
292 settings->setDefault("main_menu_path", "");
293 settings->setDefault("serverlist_file", "favoriteservers.txt");
296 settings->setDefault("freetype", "true");
297 settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "Arimo-Regular.ttf"));
298 settings->setDefault("font_path_italic", porting::getDataPath("fonts" DIR_DELIM "Arimo-Italic.ttf"));
299 settings->setDefault("font_path_bold", porting::getDataPath("fonts" DIR_DELIM "Arimo-Bold.ttf"));
300 settings->setDefault("font_path_bold_italic", porting::getDataPath("fonts" DIR_DELIM "Arimo-BoldItalic.ttf"));
301 settings->setDefault("font_bold", "false");
302 settings->setDefault("font_italic", "false");
303 settings->setDefault("font_shadow", "1");
304 settings->setDefault("font_shadow_alpha", "127");
305 settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "Cousine-Regular.ttf"));
306 settings->setDefault("mono_font_path_italic", porting::getDataPath("fonts" DIR_DELIM "Cousine-Italic.ttf"));
307 settings->setDefault("mono_font_path_bold", porting::getDataPath("fonts" DIR_DELIM "Cousine-Bold.ttf"));
308 settings->setDefault("mono_font_path_bold_italic", porting::getDataPath("fonts" DIR_DELIM "Cousine-BoldItalic.ttf"));
309 settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf"));
311 settings->setDefault("fallback_font_shadow", "1");
312 settings->setDefault("fallback_font_shadow_alpha", "128");
314 std::string font_size_str = std::to_string(TTF_DEFAULT_FONT_SIZE);
316 settings->setDefault("fallback_font_size", font_size_str);
318 settings->setDefault("freetype", "false");
319 settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans"));
320 settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans"));
322 std::string font_size_str = std::to_string(DEFAULT_FONT_SIZE);
324 settings->setDefault("font_size", font_size_str);
325 settings->setDefault("mono_font_size", font_size_str);
326 settings->setDefault("contentdb_url", "https://content.minetest.net");
328 settings->setDefault("contentdb_flag_blacklist", "nonfree, android_default");
330 settings->setDefault("contentdb_flag_blacklist", "nonfree, desktop_default");
335 settings->setDefault("disable_escape_sequences", "false");
336 settings->setDefault("strip_color_codes", "false");
339 settings->setDefault("enable_ipv6", "true");
340 settings->setDefault("ipv6_server", "false");
341 settings->setDefault("max_packets_per_iteration","1024");
342 settings->setDefault("port", "30000");
343 settings->setDefault("strict_protocol_version_checking", "false");
344 settings->setDefault("player_transfer_distance", "0");
345 settings->setDefault("max_simultaneous_block_sends_per_client", "40");
346 settings->setDefault("time_send_interval", "5");
348 settings->setDefault("default_game", "minetest");
349 settings->setDefault("motd", "");
350 settings->setDefault("max_users", "15");
351 settings->setDefault("creative_mode", "false");
352 settings->setDefault("enable_damage", "true");
353 settings->setDefault("default_password", "");
354 settings->setDefault("default_privs", "interact, shout");
355 settings->setDefault("enable_pvp", "true");
356 settings->setDefault("enable_mod_channels", "false");
357 settings->setDefault("disallow_empty_password", "false");
358 settings->setDefault("disable_anticheat", "false");
359 settings->setDefault("enable_rollback_recording", "false");
361 settings->setDefault("deprecated_lua_api_handling", "legacy");
363 settings->setDefault("deprecated_lua_api_handling", "log");
366 settings->setDefault("kick_msg_shutdown", "Server shutting down.");
367 settings->setDefault("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected.");
368 settings->setDefault("ask_reconnect_on_crash", "false");
370 settings->setDefault("chat_message_format", "<@name> @message");
371 settings->setDefault("profiler_print_interval", "0");
372 settings->setDefault("active_object_send_range_blocks", "4");
373 settings->setDefault("active_block_range", "3");
374 //settings->setDefault("max_simultaneous_block_sends_per_client", "1");
375 // This causes frametime jitter on client side, or does it?
376 settings->setDefault("max_block_send_distance", "10");
377 settings->setDefault("block_send_optimize_distance", "4");
378 settings->setDefault("server_side_occlusion_culling", "true");
379 settings->setDefault("csm_restriction_flags", "62");
380 settings->setDefault("csm_restriction_noderange", "0");
381 settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096");
382 settings->setDefault("time_speed", "72");
383 settings->setDefault("world_start_time", "6125");
384 settings->setDefault("server_unload_unused_data_timeout", "29");
385 settings->setDefault("max_objects_per_block", "64");
386 settings->setDefault("server_map_save_interval", "5.3");
387 settings->setDefault("chat_message_max_size", "500");
388 settings->setDefault("chat_message_limit_per_10sec", "8.0");
389 settings->setDefault("chat_message_limit_trigger_kick", "50");
390 settings->setDefault("sqlite_synchronous", "2");
391 settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
392 settings->setDefault("dedicated_server_step", "0.09");
393 settings->setDefault("active_block_mgmt_interval", "2.0");
394 settings->setDefault("abm_interval", "1.0");
395 settings->setDefault("nodetimer_interval", "0.2");
396 settings->setDefault("ignore_world_load_errors", "false");
397 settings->setDefault("remote_media", "");
398 settings->setDefault("debug_log_level", "action");
399 settings->setDefault("debug_log_size_max", "50");
400 settings->setDefault("emergequeue_limit_total", "512");
401 settings->setDefault("emergequeue_limit_diskonly", "64");
402 settings->setDefault("emergequeue_limit_generate", "64");
403 settings->setDefault("num_emerge_threads", "1");
404 settings->setDefault("secure.enable_security", "true");
405 settings->setDefault("secure.trusted_mods", "");
406 settings->setDefault("secure.http_mods", "");
409 settings->setDefault("movement_acceleration_default", "3");
410 settings->setDefault("movement_acceleration_air", "2");
411 settings->setDefault("movement_acceleration_fast", "10");
412 settings->setDefault("movement_speed_walk", "4");
413 settings->setDefault("movement_speed_crouch", "1.35");
414 settings->setDefault("movement_speed_fast", "20");
415 settings->setDefault("movement_speed_climb", "3");
416 settings->setDefault("movement_speed_jump", "6.5");
417 settings->setDefault("movement_liquid_fluidity", "1");
418 settings->setDefault("movement_liquid_fluidity_smooth", "0.5");
419 settings->setDefault("movement_liquid_sink", "10");
420 settings->setDefault("movement_gravity", "9.81");
423 settings->setDefault("liquid_loop_max", "100000");
424 settings->setDefault("liquid_queue_purge_time", "0");
425 settings->setDefault("liquid_update", "1.0");
428 settings->setDefault("mg_name", "v7");
429 settings->setDefault("water_level", "1");
430 settings->setDefault("mapgen_limit", "31000");
431 settings->setDefault("chunksize", "5");
432 settings->setDefault("fixed_map_seed", "");
433 settings->setDefault("max_block_generate_distance", "8");
434 settings->setDefault("enable_mapgen_debug_info", "false");
435 Mapgen::setDefaultSettings(settings);
437 // Server list announcing
438 settings->setDefault("server_announce", "false");
439 settings->setDefault("server_url", "");
440 settings->setDefault("server_address", "");
441 settings->setDefault("server_name", "");
442 settings->setDefault("server_description", "");
444 settings->setDefault("high_precision_fpu", "true");
445 settings->setDefault("enable_console", "false");
447 // Altered settings for macOS
448 #if defined(__MACH__) && defined(__APPLE__)
449 settings->setDefault("keymap_sneak", "KEY_SHIFT");
450 settings->setDefault("fps_max", "0");
453 // Altered settings for Android
455 settings->setDefault("screen_w", "0");
456 settings->setDefault("screen_h", "0");
457 settings->setDefault("fullscreen", "true");
458 settings->setDefault("touchtarget", "true");
459 settings->setDefault("TMPFolder", porting::getDataPath("tmp" DIR_DELIM));
460 settings->setDefault("touchscreen_threshold","20");
461 settings->setDefault("fixed_virtual_joystick", "false");
462 settings->setDefault("virtual_joystick_triggers_aux", "false");
463 settings->setDefault("smooth_lighting", "false");
464 settings->setDefault("max_simultaneous_block_sends_per_client", "10");
465 settings->setDefault("emergequeue_limit_diskonly", "16");
466 settings->setDefault("emergequeue_limit_generate", "16");
467 settings->setDefault("max_block_generate_distance", "5");
468 settings->setDefault("enable_3d_clouds", "false");
469 settings->setDefault("fps_max", "30");
470 settings->setDefault("pause_fps_max", "10");
471 settings->setDefault("max_objects_per_block", "20");
472 settings->setDefault("sqlite_synchronous", "1");
473 settings->setDefault("server_map_save_interval", "15");
474 settings->setDefault("client_mapblock_limit", "1000");
475 settings->setDefault("active_block_range", "2");
476 settings->setDefault("viewing_range", "50");
477 settings->setDefault("leaves_style", "simple");
478 settings->setDefault("curl_verify_cert","false");
480 // Apply settings according to screen size
481 float x_inches = ((double) porting::getDisplaySize().X /
482 (160 * porting::getDisplayDensity()));
484 if (x_inches < 3.7f) {
485 settings->setDefault("hud_scaling", "0.6");
486 settings->setDefault("font_size", "14");
487 settings->setDefault("mono_font_size", "14");
488 } else if (x_inches < 4.5f) {
489 settings->setDefault("hud_scaling", "0.7");
490 settings->setDefault("font_size", "14");
491 settings->setDefault("mono_font_size", "14");
492 } else if (x_inches < 6.0f) {
493 settings->setDefault("hud_scaling", "0.85");
494 settings->setDefault("font_size", "14");
495 settings->setDefault("mono_font_size", "14");
497 // Tablets >= 6.0 use non-Android defaults for these settings
499 settings->setDefault("screen_dpi", "72");