/*\r
-(c) 2010 Perttu Ahola <celeron55@gmail.com>\r
+Minetest-c55\r
+Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>\r
+\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License along\r
+with this program; if not, write to the Free Software Foundation, Inc.,\r
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+*/\r
\r
-Minetest\r
+/*\r
+=============================== NOTES ==============================\r
\r
NOTE: VBO cannot be turned on for fast-changing stuff because there\r
is an apparanet memory leak in irrlicht when using it\r
\r
TODO: Make the video backend selectable\r
\r
-TODO: A timestamp to blocks\r
-\r
-TODO: Client side:\r
- - The server sends all active objects of the active blocks\r
- at constant intervals. They should fit in a few packets.\r
- - The client keeps track of what blocks at the moment are\r
- having active objects in them.\r
- - All blocks going in and out of the active buffer are recorded.\r
- - For outgoing blocks, objects are removed from the blocks\r
- and from the scene\r
- - For incoming blocks, objects are added to the blocks and\r
- to the scene.\r
-\r
-TODO: Server side:\r
+Block object server side:\r
- A "near blocks" buffer, in which some nearby blocks are stored.\r
- For all blocks in the buffer, objects are stepped(). This\r
means they are active.\r
- - All blocks going in and out of the buffer are recorded.\r
- - For outgoing blocks, a timestamp is written.\r
- - For incoming blocks, the time difference is calculated and\r
+ - TODO All blocks going in and out of the buffer are recorded.\r
+ - TODO For outgoing blocks, a timestamp is written.\r
+ - TODO For incoming blocks, the time difference is calculated and\r
objects are stepped according to it.\r
+TODO: A timestamp to blocks\r
\r
TODO: Add config parameters for server's sending and generating distance\r
\r
-TODO: Make amount of trees and other plants configurable\r
- - Save to a metafile\r
-\r
TODO: Copy the text of the last picked sign to inventory in creative\r
mode\r
\r
TODO: Untie client network operations from framerate\r
\r
-TODO: Make a copy of close-range environment on client for showing\r
+SUGG: Make a copy of close-range environment on client for showing\r
on screen, with minimal mutexes to slow the main loop down\r
\r
-TODO: Make a PACKET_COMBINED which contains many subpackets. Utilize\r
+SUGG: Make a PACKET_COMBINED which contains many subpackets. Utilize\r
it by sending more stuff in a single packet.\r
+ - Add a packet queue to RemoteClient, from which packets will be\r
+ combined with object data packets\r
+ - This is not exactly trivial: the object data packets are\r
+ sometimes very big by themselves\r
+\r
+SUGG: Split MapBlockObject serialization to to-client and to-disk\r
+ - This will allow saving ages of rats on disk but not sending\r
+ them to clients\r
+\r
+TODO: Fix the long-lived Server Block Emerge Jam bug\r
+ - Is it related to the client deleting blocks?\r
\r
Doing now:\r
======================================================================\r
// All range-related stuff below is locked behind this\r
JMutex g_range_mutex;\r
\r
-// Blocks are generated in this range from the player\r
-// This is limited vertically to half by Client::fetchBlocks()\r
-s16 g_forcedfetch_range_nodes = FORCEDFETCH_RANGE;\r
-\r
// Blocks are viewed in this range from the player\r
s16 g_viewing_range_nodes = 60;\r
\r
\r
// Server stuff\r
bool g_creative_mode = false;\r
-MapgenParams g_mapgen_params;\r
+HMParams g_hm_params;\r
+MapParams g_map_params;\r
+float g_objectdata_interval = 0.2;\r
+u16 g_active_object_range = 2;\r
\r
/*\r
Random stuff\r
}\r
else if(name == "viewing_range_nodes_max")\r
{\r
- s32 v = atoi(value.c_str());\r
- if(v < 0)\r
- v = 0;\r
- if(v > 32767)\r
- v = 32767;\r
- g_viewing_range_nodes_max = v;\r
+ g_viewing_range_nodes_max = stoi(value, 0, 32767);\r
}\r
else if(name == "viewing_range_nodes_min")\r
{\r
- s32 v = atoi(value.c_str());\r
- if(v < 0)\r
- v = 0;\r
- if(v > 32767)\r
- v = 32767;\r
- g_viewing_range_nodes_min = v;\r
+ g_viewing_range_nodes_min = stoi(value, 0, 32767);\r
}\r
else if(name=="screenW")\r
g_screenW = value;\r
{\r
s32 d = atoi(value.c_str());\r
if(d > 0 && (d & (d-1)) == 0)\r
- g_mapgen_params.heightmap_blocksize = d;\r
+ g_hm_params.heightmap_blocksize = d;\r
else\r
dstream<<"Invalid value in config file: \""\r
<<line<<"\""<<std::endl;\r
}\r
else if(name == "mapgen_height_randmax")\r
- g_mapgen_params.height_randmax = value;\r
+ g_hm_params.height_randmax = value;\r
else if(name == "mapgen_height_randfactor")\r
- g_mapgen_params.height_randfactor = value;\r
+ g_hm_params.height_randfactor = value;\r
else if(name == "mapgen_height_base")\r
- g_mapgen_params.height_base = value;\r
+ g_hm_params.height_base = value;\r
else if(name == "mapgen_plants_amount")\r
- g_mapgen_params.plants_amount = value;\r
+ {\r
+ std::istringstream vis(value);\r
+ vis>>g_map_params.plants_amount;\r
+ }\r
+ else if(name == "objectdata_inverval")\r
+ {\r
+ std::istringstream vis(value);\r
+ vis>>g_objectdata_interval;\r
+ }\r
+ else if(name == "active_object_range")\r
+ g_active_object_range = stoi(value, 0, 65535);\r
\r
else\r
{\r
std::cout<<"========================"<<std::endl;\r
std::cout<<std::endl;\r
\r
- Server server("../map", g_creative_mode, g_mapgen_params);\r
+ Server server("../map", g_creative_mode, g_hm_params,\r
+ g_map_params, g_objectdata_interval,\r
+ g_active_object_range);\r
server.start(port);\r
\r
for(;;)\r
*/\r
SharedPtr<Server> server;\r
if(hosting){\r
- server = new Server("../map", g_creative_mode, g_mapgen_params);\r
+ server = new Server("../map", g_creative_mode, g_hm_params,\r
+ g_map_params, g_objectdata_interval,\r
+ g_active_object_range);\r
server->start(port);\r
}\r
\r