]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/main.cpp
Mapgen is better now. Not a lot, but a bit!
[dragonfireclient.git] / src / main.cpp
index 2c9e9cf750d647fb272e107cccfb63c6f39fdc49..fb1b2d8fd9a80d00f4c6d0f59a41279d144a1425 100644 (file)
@@ -28,6 +28,9 @@ NOTE: VBO cannot be turned on for fast-changing stuff because there
 NOTE: iostream.imbue(std::locale("C")) is very slow\r
 NOTE: Global locale is now set at initialization\r
 \r
 NOTE: iostream.imbue(std::locale("C")) is very slow\r
 NOTE: Global locale is now set at initialization\r
 \r
+Random suggeestions:\r
+--------------------\r
+\r
 SUGG: Fix address to be ipv6 compatible\r
 \r
 NOTE: When a new sector is generated, it may change the ground level\r
 SUGG: Fix address to be ipv6 compatible\r
 \r
 NOTE: When a new sector is generated, it may change the ground level\r
@@ -116,11 +119,6 @@ Gaming ideas:
 Build system / running:\r
 -----------------------\r
 \r
 Build system / running:\r
 -----------------------\r
 \r
-FIXME: Some network errors on Windows that cause local game to not work\r
-       - See siggjen's emails.\r
-          - Is this the famous "windows 7 problem"?\r
-       - Apparently there might be other errors too\r
-\r
 Networking and serialization:\r
 -----------------------------\r
 \r
 Networking and serialization:\r
 -----------------------------\r
 \r
@@ -160,6 +158,11 @@ TODO: Make fetching sector's blocks more efficient when rendering
 \r
 TODO: Flowing water animation\r
 \r
 \r
 TODO: Flowing water animation\r
 \r
+* Combine meshes to bigger ones in ClientMap and set them EHM_STATIC\r
+\r
+SUGG: Draw cubes in inventory directly with 3D drawing commands, so that\r
+      animating them is easier.\r
+\r
 Configuration:\r
 --------------\r
 \r
 Configuration:\r
 --------------\r
 \r
@@ -182,7 +185,7 @@ TODO: Remove IrrlichtWrapper
 \r
 TODO: When player dies, throw items on map\r
 \r
 \r
 TODO: When player dies, throw items on map\r
 \r
-TODO: Make an option to the server to disable building and digging near\r
+SUGG: Make an option to the server to disable building and digging near\r
       the starting position\r
 \r
 TODO: Copy the text of the last picked sign to inventory in creative\r
       the starting position\r
 \r
 TODO: Copy the text of the last picked sign to inventory in creative\r
@@ -191,10 +194,13 @@ TODO: Copy the text of the last picked sign to inventory in creative
 TODO: Check what goes wrong with caching map to disk (Kray)\r
       - Nothing?\r
 \r
 TODO: Check what goes wrong with caching map to disk (Kray)\r
       - Nothing?\r
 \r
-TODO: When server sees that client is removing an inexistent block in\r
-      an existent position, resend the MapBlock.\r
+FIXME: Server sometimes goes into some infinite PeerNotFoundException loop\r
 \r
 \r
-FIXME: Server went into some infinite PeerNotFoundException loop\r
+* Fix the problem with the server constantly saving one or a few\r
+  blocks? List the first saved block, maybe it explains.\r
+  - It is probably caused by oscillating water\r
+* Make a small history check to transformLiquids to detect and log\r
+  continuous oscillations, in such detail that they can be fixed.\r
 \r
 Objects:\r
 --------\r
 \r
 Objects:\r
 --------\r
@@ -221,6 +227,15 @@ Block object server side:
 - When a statically stored active object comes near a player,\r
   recreate the active object\r
 \r
 - When a statically stored active object comes near a player,\r
   recreate the active object\r
 \r
+* Continue making the scripting system:\r
+  * Make updateNodeMesh for a less verbose mesh update on add/removenode\r
+  * Switch to using a safe way for the self and env pointers\r
+  * Make some global environment hooks, like node placed and general\r
+    on_step()\r
+* Add a global Lua spawn handler and such\r
+* Get rid of MapBlockObjects\r
+* Other players could be sent to clients as LuaCAOs\r
+\r
 Map:\r
 ----\r
 \r
 Map:\r
 ----\r
 \r
@@ -230,9 +245,6 @@ TODO: Mineral and ground material properties
 \r
 TODO: Flowing water to actually contain flow direction information\r
 \r
 \r
 TODO: Flowing water to actually contain flow direction information\r
 \r
-TODO: Remove duplicate lighting implementation from Map (leave\r
-      VoxelManipulator, which is faster)\r
-\r
 FEATURE: Create a system that allows a huge amount of different "map\r
             generator modules/filters"\r
 \r
 FEATURE: Create a system that allows a huge amount of different "map\r
             generator modules/filters"\r
 \r
@@ -247,42 +259,10 @@ FEATURE: Erosion simulation at map generation time
                - Simulate rock falling from cliffs when water has removed\r
                  enough solid rock from the bottom\r
 \r
                - Simulate rock falling from cliffs when water has removed\r
                  enough solid rock from the bottom\r
 \r
-Doing now (most important at the top):\r
---------------------------------------\r
-# maybe done\r
-* not done\r
-\r
-=== Next\r
-* Somehow generate trees\r
-\r
-=== Fixmes\r
-* Check the fixmes in the list above\r
-* Make server find the spawning place from the real map data, not from\r
-  the heightmap\r
-  - But the changing borders of chunk have to be avoided, because\r
-    there is time to generate only one chunk.\r
+Mapgen v2 (not doing):\r
+* only_from_disk might not work anymore - check and fix it.\r
 * Make the generator to run in background and not blocking block\r
   placement and transfer\r
 * Make the generator to run in background and not blocking block\r
   placement and transfer\r
-* only_from_disk might not work anymore - check and fix it.\r
-\r
-=== Making it more portable\r
-* Some MSVC: std::sto* are defined without a namespace and collide\r
-  with the ones in utility.h\r
-\r
-=== Features\r
-* Continue making the scripting system:\r
-  * Make updateNodeMesh for a less verbose mesh update on add/removenode\r
-  * Switch to using a safe way for the self and env pointers\r
-  * Make some global environment hooks, like node placed and general\r
-    on_step()\r
-* Map should make the appropriate MapEditEvents\r
-* Add a global Lua spawn handler and such\r
-* Get rid of MapBlockObjects\r
-* Other players could be sent to clients as LuaCAOs\r
-* Add mud underground\r
-* Make an "environment metafile" to store at least time of day\r
-* Move digging property stuff from material.{h,cpp} to mapnode.cpp...\r
-  - Or maybe move content_features to material.{h,cpp}?\r
 * Add some kind of erosion and other stuff that now is possible\r
 * Make client to fetch stuff asynchronously\r
   - Needs method SyncProcessData\r
 * Add some kind of erosion and other stuff that now is possible\r
 * Make client to fetch stuff asynchronously\r
   - Needs method SyncProcessData\r
@@ -292,16 +272,45 @@ Doing now (most important at the top):
   and stuff yet and the ground is fairly flat, the mud will flow to\r
   the other chunk making nasty straight walls when the other chunk\r
   is generated. Fix it.\r
   and stuff yet and the ground is fairly flat, the mud will flow to\r
   the other chunk making nasty straight walls when the other chunk\r
   is generated. Fix it.\r
-* Fix the problem with the server constantly saving one or a few\r
-  blocks? List the first saved block, maybe it explains.\r
-  - It is probably caused by oscillating water\r
-* Make a small history check to transformLiquids to detect and log\r
-  continuous oscillations, in such detail that they can be fixed.\r
-* Combine meshes to bigger ones in ClientMap and set them EHM_STATIC\r
+\r
+Mapgen v4 (not doing):\r
+* only_from_disk might not work anymore - check and fix it.\r
+* Make the generator to run in background and not blocking block\r
+  placement and transfer\r
+* Make chunks to be tiled vertically too\r
+* MAKE IT FASTER\r
+\r
+Mapgen v3 (not doing):\r
+* Generate trees better\r
+  - Add a "trees_added" flag to sector, or something\r
+* How 'bout making turbulence controlled so that for a given 2d position\r
+  it can be completely turned off, and is usually so. This way generation\r
+  can be sped up a lot.\r
+* Add a way to generate a block partly, so that trees are not added, like\r
+  the chunks in v2\r
+* Add mud "discretely", not by guessing from the noise\r
+\r
+Mapgen v4:\r
+* This will be the final way.\r
+* Generate blocks in the same way as chunks, by copying a VoxelManipulator\r
+  from the map that is one block larger in all directions.\r
+\r
+Misc. stuff:\r
+------------\r
+* Make an "environment metafile" to store at least time of day\r
+* Move digging property stuff from material.{h,cpp} to mapnode.cpp...\r
+  - Or maybe move content_features to material.{h,cpp}?\r
 * Maybe:\r
   Make a system for pregenerating quick information for mapblocks, so\r
   that the client can show them as cubes before they are actually sent\r
   or even generated.\r
 * Maybe:\r
   Make a system for pregenerating quick information for mapblocks, so\r
   that the client can show them as cubes before they are actually sent\r
   or even generated.\r
+* Optimize VoxelManipulator lighting implementation by using indices\r
+  in place of coordinates?\r
+\r
+Making it more portable:\r
+------------------------\r
+* Some MSVC: std::sto* are defined without a namespace and collide\r
+  with the ones in utility.h\r
 \r
 ======================================================================\r
 \r
 \r
 ======================================================================\r
 \r
@@ -496,7 +505,7 @@ Inventory local_inventory;
 u16 g_selected_item = 0;\r
 \r
 bool g_show_map_plot = false;\r
 u16 g_selected_item = 0;\r
 \r
 bool g_show_map_plot = false;\r
-bool g_refresh_map_plot = true;\r
+bool g_refresh_map_plot = false;\r
 \r
 /*\r
        Debug streams\r
 \r
 /*\r
        Debug streams\r
@@ -1267,7 +1276,7 @@ void draw_hotbar(video::IVideoDriver *driver, gui::IGUIFont *font,
 }\r
 \r
 video::ITexture *g_map_plot_texture = NULL;\r
 }\r
 \r
 video::ITexture *g_map_plot_texture = NULL;\r
-float g_map_plot_texture_scale = 2;\r
+float g_map_plot_texture_scale = 4;\r
 \r
 void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,\r
                Client *client)\r
 \r
 void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,\r
                Client *client)\r
@@ -1306,28 +1315,67 @@ void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,
                        c.set(255, 160, 160, 160);\r
                else if(h < WATER_LEVEL - 0.5) // Water\r
                        c.set(255, 50, 50, 255);\r
                        c.set(255, 160, 160, 160);\r
                else if(h < WATER_LEVEL - 0.5) // Water\r
                        c.set(255, 50, 50, 255);\r
-               else if(h < WATER_LEVEL + 2) // Sand\r
-                       c.set(255, 237, 201, 175);\r
-#if 1\r
-               else if(h < WATER_LEVEL + 10) // Green\r
-                       c.set(255, 50, 150, 50);\r
-               else if(h < WATER_LEVEL + 20) // Greenish yellow\r
-                       c.set(255, 110, 185, 50);\r
-               else if(h < WATER_LEVEL + 50) // Yellow\r
-                       c.set(255, 220, 220, 50);\r
-               else if(h < WATER_LEVEL + 100) // White\r
-                       c.set(255, 180, 180, 180);\r
+#if 0\r
+               else if(get_have_sand_ground(client->getMapSeed(), pf)\r
+                               || (h < WATER_LEVEL + 2\r
+                               && get_have_sand_coast(client->getMapSeed(), pf)))\r
+               {\r
+                       h -= WATER_LEVEL;\r
+                       h /= 50.0;\r
+                       h = 1.0 - exp(-h);\r
+\r
+                       video::SColor c1(255,237,201,175);\r
+                       //video::SColor c2(255,20,20,20);\r
+                       video::SColor c2(255,150,0,0);\r
+                       c = c2.getInterpolated(c1, h);\r
+               }\r
                else\r
                else\r
-                       c.set(255, 255, 255, 255);\r
+               {\r
+                       h -= WATER_LEVEL;\r
+                       h /= 50.0;\r
+                       h = 1.0 - exp(-h);\r
+\r
+                       video::SColor c1(255,110,185,90);\r
+                       //video::SColor c2(255,20,20,20);\r
+                       video::SColor c2(255,150,0,0);\r
+                       c = c2.getInterpolated(c1, h);\r
+               }\r
 #endif\r
 #endif\r
-               /*else if(h < WATER_LEVEL + d1)\r
+#if 1\r
+#if 0\r
+               else if(get_have_sand_ground(client->getMapSeed(), pf))\r
                {\r
                        h -= WATER_LEVEL;\r
                {\r
                        h -= WATER_LEVEL;\r
-                       u32 a = (u32)(h / d1 * 255);\r
-                       if(a > 255)\r
-                               a = 255;\r
-                       c.set(255, 0, a, 0);\r
-               }*/\r
+                       h /= 20.0;\r
+                       h = 1.0 - exp(-h);\r
+\r
+                       video::SColor c1(255,237,201,175);\r
+                       //video::SColor c2(255,20,20,20);\r
+                       video::SColor c2(255,150,0,0);\r
+                       c = c2.getInterpolated(c1, h);\r
+               }\r
+#endif\r
+               // Sand\r
+               else if(h < WATER_LEVEL + 2\r
+                               && get_have_sand_coast(client->getMapSeed(), pf))\r
+                       c.set(255, 237, 201, 175);\r
+#if 1\r
+               else if(h < WATER_LEVEL + 10)\r
+                       c.set(255, 50, 150, 50); // Green\r
+               else if(h < WATER_LEVEL + 20)\r
+                       c.set(255, 110, 185, 50); // Yellowish green\r
+               else if(h < WATER_LEVEL + 40)\r
+                       c.set(255, 180, 210, 50); // Greenish yellow\r
+               else if(h < WATER_LEVEL + 60)\r
+                       c.set(255, 220, 220, 50); // Yellow\r
+               else if(h < WATER_LEVEL + 80)\r
+                       c.set(255, 200, 200, 110); // Yellowish white\r
+               else if(h < WATER_LEVEL + 100)\r
+                       c.set(255, 190, 190, 190); // Grey\r
+               else\r
+                       c.set(255, 255, 255, 255); // White\r
+#endif\r
+#endif\r
 #if 0\r
                else\r
                {\r
 #if 0\r
                else\r
                {\r
@@ -1345,6 +1393,22 @@ void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,
                        a = 255-a;\r
                        c.set(255, a, a, a);*/\r
                }\r
                        a = 255-a;\r
                        c.set(255, a, a, a);*/\r
                }\r
+#endif\r
+#if 1\r
+               if(h >= WATER_LEVEL - 0.5\r
+                       && get_have_sand_ground(client->getMapSeed(), pf))\r
+               {\r
+                       video::SColor c1(255,237,201,175);\r
+                       c = c.getInterpolated(c1, 0.5);\r
+               }\r
+#endif\r
+#if 1\r
+               double tf = get_turbulence_factor_2d(client->getMapSeed(), pf);\r
+               if(tf > 0.001)\r
+               {\r
+                       video::SColor c1(255,255,0,0);\r
+                       c = c.getInterpolated(c1, 1.0-(0.5*tf));\r
+               }\r
 #endif\r
                img->setPixel(x, y, c);\r
        }\r
 #endif\r
                img->setPixel(x, y, c);\r
        }\r
@@ -2906,7 +2970,7 @@ int main(int argc, char *argv[])
                        driver->setFog(\r
                                bgcolor,\r
                                video::EFT_FOG_LINEAR,\r
                        driver->setFog(\r
                                bgcolor,\r
                                video::EFT_FOG_LINEAR,\r
-                               range*0.6,\r
+                               range*0.4,\r
                                range*1.0,\r
                                0.01,\r
                                false, // pixel fog\r
                                range*1.0,\r
                                0.01,\r
                                false, // pixel fog\r