forked from Mirrorlandia_minetest/minetest
mapgen work-in-progress
This commit is contained in:
parent
9a22d02903
commit
2e7b15fed3
BIN
data/water.png
BIN
data/water.png
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 556 B |
@ -511,9 +511,12 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||||||
player->setPosition(playerpos_f);
|
player->setPosition(playerpos_f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(datasize >= 2+1+6+8)
|
||||||
|
{
|
||||||
// Get map seed
|
// Get map seed
|
||||||
m_map_seed = readU64(&data[2+1+6]);
|
m_map_seed = readU64(&data[2+1+6]);
|
||||||
dstream<<"Client: received map seed: "<<m_map_seed<<std::endl;
|
dstream<<"Client: received map seed: "<<m_map_seed<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Reply to server
|
// Reply to server
|
||||||
u32 replysize = 2;
|
u32 replysize = 2;
|
||||||
|
@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#define DEBUGFILE "debug.txt"
|
#define DEBUGFILE "debug.txt"
|
||||||
|
|
||||||
#define WATER_ALPHA 160
|
#define WATER_ALPHA 160
|
||||||
|
//#define WATER_ALPHA 190
|
||||||
|
|
||||||
// Define for simulating the quirks of sending through internet.
|
// Define for simulating the quirks of sending through internet.
|
||||||
// Causes the socket class to deliberately drop random packets.
|
// Causes the socket class to deliberately drop random packets.
|
||||||
|
170
src/main.cpp
170
src/main.cpp
@ -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
|
NOTE: iostream.imbue(std::locale("C")) is very slow
|
||||||
NOTE: Global locale is now set at initialization
|
NOTE: Global locale is now set at initialization
|
||||||
|
|
||||||
|
Random suggeestions:
|
||||||
|
--------------------
|
||||||
|
|
||||||
SUGG: Fix address to be ipv6 compatible
|
SUGG: Fix address to be ipv6 compatible
|
||||||
|
|
||||||
NOTE: When a new sector is generated, it may change the ground level
|
NOTE: When a new sector is generated, it may change the ground level
|
||||||
@ -116,11 +119,6 @@ Documentation:
|
|||||||
Build system / running:
|
Build system / running:
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
FIXME: Some network errors on Windows that cause local game to not work
|
|
||||||
- See siggjen's emails.
|
|
||||||
- Is this the famous "windows 7 problem"?
|
|
||||||
- Apparently there might be other errors too
|
|
||||||
|
|
||||||
Networking and serialization:
|
Networking and serialization:
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
@ -160,6 +158,8 @@ TODO: Make fetching sector's blocks more efficient when rendering
|
|||||||
|
|
||||||
TODO: Flowing water animation
|
TODO: Flowing water animation
|
||||||
|
|
||||||
|
* Combine meshes to bigger ones in ClientMap and set them EHM_STATIC
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ Server:
|
|||||||
|
|
||||||
TODO: When player dies, throw items on map
|
TODO: When player dies, throw items on map
|
||||||
|
|
||||||
TODO: Make an option to the server to disable building and digging near
|
SUGG: Make an option to the server to disable building and digging near
|
||||||
the starting position
|
the starting position
|
||||||
|
|
||||||
TODO: Copy the text of the last picked sign to inventory in creative
|
TODO: Copy the text of the last picked sign to inventory in creative
|
||||||
@ -191,11 +191,14 @@ TODO: Copy the text of the last picked sign to inventory in creative
|
|||||||
TODO: Check what goes wrong with caching map to disk (Kray)
|
TODO: Check what goes wrong with caching map to disk (Kray)
|
||||||
- Nothing?
|
- Nothing?
|
||||||
|
|
||||||
TODO: When server sees that client is removing an inexistent block in
|
|
||||||
an existent position, resend the MapBlock.
|
|
||||||
|
|
||||||
FIXME: Server went into some infinite PeerNotFoundException loop
|
FIXME: Server went into some infinite PeerNotFoundException loop
|
||||||
|
|
||||||
|
* Fix the problem with the server constantly saving one or a few
|
||||||
|
blocks? List the first saved block, maybe it explains.
|
||||||
|
- It is probably caused by oscillating water
|
||||||
|
* Make a small history check to transformLiquids to detect and log
|
||||||
|
continuous oscillations, in such detail that they can be fixed.
|
||||||
|
|
||||||
Objects:
|
Objects:
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@ -221,6 +224,15 @@ Block object server side:
|
|||||||
- When a statically stored active object comes near a player,
|
- When a statically stored active object comes near a player,
|
||||||
recreate the active object
|
recreate the active object
|
||||||
|
|
||||||
|
* Continue making the scripting system:
|
||||||
|
* Make updateNodeMesh for a less verbose mesh update on add/removenode
|
||||||
|
* Switch to using a safe way for the self and env pointers
|
||||||
|
* Make some global environment hooks, like node placed and general
|
||||||
|
on_step()
|
||||||
|
* Add a global Lua spawn handler and such
|
||||||
|
* Get rid of MapBlockObjects
|
||||||
|
* Other players could be sent to clients as LuaCAOs
|
||||||
|
|
||||||
Map:
|
Map:
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -247,42 +259,10 @@ FEATURE: Erosion simulation at map generation time
|
|||||||
- Simulate rock falling from cliffs when water has removed
|
- Simulate rock falling from cliffs when water has removed
|
||||||
enough solid rock from the bottom
|
enough solid rock from the bottom
|
||||||
|
|
||||||
Doing now (most important at the top):
|
Mapgen v2:
|
||||||
--------------------------------------
|
* only_from_disk might not work anymore - check and fix it.
|
||||||
# maybe done
|
|
||||||
* not done
|
|
||||||
|
|
||||||
=== Next
|
|
||||||
* Generate trees better
|
|
||||||
- Add a "trees_added" flag to sector, or something
|
|
||||||
|
|
||||||
=== Fixmes
|
|
||||||
* Check the fixmes in the list above
|
|
||||||
* Make server find the spawning place from the real map data, not from
|
|
||||||
the heightmap
|
|
||||||
- But the changing borders of chunk have to be avoided, because
|
|
||||||
there is time to generate only one chunk.
|
|
||||||
* Make the generator to run in background and not blocking block
|
* Make the generator to run in background and not blocking block
|
||||||
placement and transfer
|
placement and transfer
|
||||||
* only_from_disk might not work anymore - check and fix it.
|
|
||||||
|
|
||||||
=== Making it more portable
|
|
||||||
* Some MSVC: std::sto* are defined without a namespace and collide
|
|
||||||
with the ones in utility.h
|
|
||||||
|
|
||||||
=== Features
|
|
||||||
* Continue making the scripting system:
|
|
||||||
* Make updateNodeMesh for a less verbose mesh update on add/removenode
|
|
||||||
* Switch to using a safe way for the self and env pointers
|
|
||||||
* Make some global environment hooks, like node placed and general
|
|
||||||
on_step()
|
|
||||||
* Add a global Lua spawn handler and such
|
|
||||||
* Get rid of MapBlockObjects
|
|
||||||
* Other players could be sent to clients as LuaCAOs
|
|
||||||
* Add mud underground
|
|
||||||
* Make an "environment metafile" to store at least time of day
|
|
||||||
* Move digging property stuff from material.{h,cpp} to mapnode.cpp...
|
|
||||||
- Or maybe move content_features to material.{h,cpp}?
|
|
||||||
* Add some kind of erosion and other stuff that now is possible
|
* Add some kind of erosion and other stuff that now is possible
|
||||||
* Make client to fetch stuff asynchronously
|
* Make client to fetch stuff asynchronously
|
||||||
- Needs method SyncProcessData
|
- Needs method SyncProcessData
|
||||||
@ -292,16 +272,36 @@ Doing now (most important at the top):
|
|||||||
and stuff yet and the ground is fairly flat, the mud will flow to
|
and stuff yet and the ground is fairly flat, the mud will flow to
|
||||||
the other chunk making nasty straight walls when the other chunk
|
the other chunk making nasty straight walls when the other chunk
|
||||||
is generated. Fix it.
|
is generated. Fix it.
|
||||||
* Fix the problem with the server constantly saving one or a few
|
|
||||||
blocks? List the first saved block, maybe it explains.
|
Mapgen v3:
|
||||||
- It is probably caused by oscillating water
|
* Generate trees better
|
||||||
* Make a small history check to transformLiquids to detect and log
|
- Add a "trees_added" flag to sector, or something
|
||||||
continuous oscillations, in such detail that they can be fixed.
|
* How 'bout making turbulence controlled so that for a given 2d position
|
||||||
* Combine meshes to bigger ones in ClientMap and set them EHM_STATIC
|
it can be completely turned off, and is usually so. This way generation
|
||||||
|
can be sped up a lot.
|
||||||
|
|
||||||
|
Mapgen v4:
|
||||||
|
* only_from_disk might not work anymore - check and fix it.
|
||||||
|
* Make the generator to run in background and not blocking block
|
||||||
|
placement and transfer
|
||||||
|
* Make chunks to be tiled vertically too
|
||||||
|
|
||||||
|
Misc. stuff:
|
||||||
|
------------
|
||||||
|
* Make an "environment metafile" to store at least time of day
|
||||||
|
* Move digging property stuff from material.{h,cpp} to mapnode.cpp...
|
||||||
|
- Or maybe move content_features to material.{h,cpp}?
|
||||||
* Maybe:
|
* Maybe:
|
||||||
Make a system for pregenerating quick information for mapblocks, so
|
Make a system for pregenerating quick information for mapblocks, so
|
||||||
that the client can show them as cubes before they are actually sent
|
that the client can show them as cubes before they are actually sent
|
||||||
or even generated.
|
or even generated.
|
||||||
|
* Optimize VoxelManipulator lighting implementation by using indices
|
||||||
|
in place of coordinates?
|
||||||
|
|
||||||
|
Making it more portable:
|
||||||
|
------------------------
|
||||||
|
* Some MSVC: std::sto* are defined without a namespace and collide
|
||||||
|
with the ones in utility.h
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
@ -1306,8 +1306,49 @@ void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,
|
|||||||
c.set(255, 160, 160, 160);
|
c.set(255, 160, 160, 160);
|
||||||
else if(h < WATER_LEVEL - 0.5) // Water
|
else if(h < WATER_LEVEL - 0.5) // Water
|
||||||
c.set(255, 50, 50, 255);
|
c.set(255, 50, 50, 255);
|
||||||
else if(h < WATER_LEVEL + 2 // Sand
|
#if 0
|
||||||
&& get_have_sand(client->getMapSeed(), pf))
|
else if(get_have_sand_ground(client->getMapSeed(), pf)
|
||||||
|
|| (h < WATER_LEVEL + 2
|
||||||
|
&& get_have_sand_coast(client->getMapSeed(), pf)))
|
||||||
|
{
|
||||||
|
h -= WATER_LEVEL;
|
||||||
|
h /= 50.0;
|
||||||
|
h = 1.0 - exp(-h);
|
||||||
|
|
||||||
|
video::SColor c1(255,237,201,175);
|
||||||
|
//video::SColor c2(255,20,20,20);
|
||||||
|
video::SColor c2(255,150,0,0);
|
||||||
|
c = c2.getInterpolated(c1, h);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
h -= WATER_LEVEL;
|
||||||
|
h /= 50.0;
|
||||||
|
h = 1.0 - exp(-h);
|
||||||
|
|
||||||
|
video::SColor c1(255,110,185,90);
|
||||||
|
//video::SColor c2(255,20,20,20);
|
||||||
|
video::SColor c2(255,150,0,0);
|
||||||
|
c = c2.getInterpolated(c1, h);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
#if 0
|
||||||
|
else if(get_have_sand_ground(client->getMapSeed(), pf))
|
||||||
|
{
|
||||||
|
h -= WATER_LEVEL;
|
||||||
|
h /= 20.0;
|
||||||
|
h = 1.0 - exp(-h);
|
||||||
|
|
||||||
|
video::SColor c1(255,237,201,175);
|
||||||
|
//video::SColor c2(255,20,20,20);
|
||||||
|
video::SColor c2(255,150,0,0);
|
||||||
|
c = c2.getInterpolated(c1, h);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// Sand
|
||||||
|
else if(h < WATER_LEVEL + 2
|
||||||
|
&& get_have_sand_coast(client->getMapSeed(), pf))
|
||||||
c.set(255, 237, 201, 175);
|
c.set(255, 237, 201, 175);
|
||||||
#if 1
|
#if 1
|
||||||
else if(h < WATER_LEVEL + 10)
|
else if(h < WATER_LEVEL + 10)
|
||||||
@ -1325,14 +1366,7 @@ void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,
|
|||||||
else
|
else
|
||||||
c.set(255, 255, 255, 255); // White
|
c.set(255, 255, 255, 255); // White
|
||||||
#endif
|
#endif
|
||||||
/*else if(h < WATER_LEVEL + d1)
|
#endif
|
||||||
{
|
|
||||||
h -= WATER_LEVEL;
|
|
||||||
u32 a = (u32)(h / d1 * 255);
|
|
||||||
if(a > 255)
|
|
||||||
a = 255;
|
|
||||||
c.set(255, 0, a, 0);
|
|
||||||
}*/
|
|
||||||
#if 0
|
#if 0
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1350,6 +1384,22 @@ void updateMapPlotTexture(v2f centerpos, video::IVideoDriver* driver,
|
|||||||
a = 255-a;
|
a = 255-a;
|
||||||
c.set(255, a, a, a);*/
|
c.set(255, a, a, a);*/
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
if(h >= WATER_LEVEL - 0.5
|
||||||
|
&& get_have_sand_ground(client->getMapSeed(), pf))
|
||||||
|
{
|
||||||
|
video::SColor c1(255,237,201,175);
|
||||||
|
c = c.getInterpolated(c1, 0.5);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
double tf = get_turbulence_factor_2d(client->getMapSeed(), pf);
|
||||||
|
if(tf > 0.001)
|
||||||
|
{
|
||||||
|
video::SColor c1(255,255,0,0);
|
||||||
|
c = c.getInterpolated(c1, 1.0-(0.5*tf));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
img->setPixel(x, y, c);
|
img->setPixel(x, y, c);
|
||||||
}
|
}
|
||||||
@ -2911,7 +2961,7 @@ int main(int argc, char *argv[])
|
|||||||
driver->setFog(
|
driver->setFog(
|
||||||
bgcolor,
|
bgcolor,
|
||||||
video::EFT_FOG_LINEAR,
|
video::EFT_FOG_LINEAR,
|
||||||
range*0.6,
|
range*0.4,
|
||||||
range*1.0,
|
range*1.0,
|
||||||
0.01,
|
0.01,
|
||||||
false, // pixel fog
|
false, // pixel fog
|
||||||
|
882
src/map.cpp
882
src/map.cpp
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
double base_rock_level_2d(u64 seed, v2f p);
|
double base_rock_level_2d(u64 seed, v2f p);
|
||||||
bool get_have_sand(u64 seed, v2f p);
|
bool get_have_sand_coast(u64 seed, v2f p);
|
||||||
|
bool get_have_sand_ground(u64 seed, v2f p);
|
||||||
|
double get_turbulence_factor_2d(u64 seed, v2f p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
@ -44,10 +44,10 @@ double linearInterpolation(double x0, double x1, double t){
|
|||||||
}
|
}
|
||||||
|
|
||||||
double biLinearInterpolation(double x0y0, double x1y0, double x0y1, double x1y1, double x, double y){
|
double biLinearInterpolation(double x0y0, double x1y0, double x0y1, double x1y1, double x, double y){
|
||||||
/*double tx = easeCurve(x);
|
double tx = easeCurve(x);
|
||||||
double ty = easeCurve(y);*/
|
double ty = easeCurve(y);
|
||||||
double tx = x;
|
/*double tx = x;
|
||||||
double ty = y;
|
double ty = y;*/
|
||||||
double u = linearInterpolation(x0y0,x1y0,tx);
|
double u = linearInterpolation(x0y0,x1y0,tx);
|
||||||
double v = linearInterpolation(x0y1,x1y1,tx);
|
double v = linearInterpolation(x0y1,x1y1,tx);
|
||||||
return linearInterpolation(u,v,ty);
|
return linearInterpolation(u,v,ty);
|
||||||
|
@ -3430,9 +3430,9 @@ Player *Server::emergePlayer(const char *name, const char *password,
|
|||||||
!= m_env.getServerMap().sector_to_chunk(sectorpos+v2s16(-1,-1)))
|
!= m_env.getServerMap().sector_to_chunk(sectorpos+v2s16(-1,-1)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Get sector
|
// Get sector (NOTE: Don't get because it's slow)
|
||||||
m_env.getMap().emergeSector(sectorpos);
|
//m_env.getMap().emergeSector(sectorpos);
|
||||||
// Get ground height at point
|
// Get ground height at point (fallbacks to heightmap function)
|
||||||
groundheight = m_env.getServerMap().findGroundLevel(nodepos);
|
groundheight = m_env.getServerMap().findGroundLevel(nodepos);
|
||||||
// Don't go underwater
|
// Don't go underwater
|
||||||
if(groundheight < WATER_LEVEL)
|
if(groundheight < WATER_LEVEL)
|
||||||
@ -3440,7 +3440,15 @@ Player *Server::emergePlayer(const char *name, const char *password,
|
|||||||
//dstream<<"-> Underwater"<<std::endl;
|
//dstream<<"-> Underwater"<<std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#if 0 // Doesn't work, generating blocks is a bit too complicated for doing here
|
// Don't go to high places
|
||||||
|
if(groundheight > WATER_LEVEL + 4)
|
||||||
|
{
|
||||||
|
//dstream<<"-> Underwater"<<std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Doesn't work, generating blocks is a bit too complicated for doing here
|
||||||
// Get block at point
|
// Get block at point
|
||||||
v3s16 nodepos3d;
|
v3s16 nodepos3d;
|
||||||
nodepos3d = v3s16(nodepos.X, groundheight+1, nodepos.Y);
|
nodepos3d = v3s16(nodepos.X, groundheight+1, nodepos.Y);
|
||||||
@ -3466,6 +3474,7 @@ Player *Server::emergePlayer(const char *name, const char *password,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Found a good place
|
// Found a good place
|
||||||
dstream<<"Searched through "<<i<<" places."<<std::endl;
|
dstream<<"Searched through "<<i<<" places."<<std::endl;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user