tweaking around, including mapgen, player speed in water, settings
This commit is contained in:
parent
023876dafb
commit
cfaa15895a
|
@ -40,12 +40,19 @@ void set_default_settings()
|
||||||
|
|
||||||
// Server stuff
|
// Server stuff
|
||||||
g_settings.setDefault("creative_mode", "false");
|
g_settings.setDefault("creative_mode", "false");
|
||||||
g_settings.setDefault("heightmap_blocksize", "32");
|
/*g_settings.setDefault("heightmap_blocksize", "32");
|
||||||
g_settings.setDefault("height_randmax", "constant 45.0");
|
g_settings.setDefault("height_randmax", "constant 45.0");
|
||||||
g_settings.setDefault("height_randfactor", "constant 0.6");
|
g_settings.setDefault("height_randfactor", "constant 0.6");
|
||||||
g_settings.setDefault("height_base", "linear 0 0 0");
|
g_settings.setDefault("height_base", "linear 0 0 0");
|
||||||
g_settings.setDefault("plants_amount", "1.0");
|
g_settings.setDefault("plants_amount", "1.0");
|
||||||
g_settings.setDefault("ravines_amount", "1.0");
|
g_settings.setDefault("ravines_amount", "1.0");
|
||||||
|
g_settings.setDefault("coal_amount", "1.0");*/
|
||||||
|
g_settings.setDefault("heightmap_blocksize", "16");
|
||||||
|
g_settings.setDefault("height_randmax", "linear 0 0 40");
|
||||||
|
g_settings.setDefault("height_randfactor", "linear 0.60 -0.10 0");
|
||||||
|
g_settings.setDefault("height_base", "linear 5 0 0");
|
||||||
|
g_settings.setDefault("plants_amount", "0.2");
|
||||||
|
g_settings.setDefault("ravines_amount", "0");
|
||||||
g_settings.setDefault("coal_amount", "1.0");
|
g_settings.setDefault("coal_amount", "1.0");
|
||||||
|
|
||||||
g_settings.setDefault("objectdata_interval", "0.2");
|
g_settings.setDefault("objectdata_interval", "0.2");
|
||||||
|
@ -55,7 +62,7 @@ void set_default_settings()
|
||||||
g_settings.setDefault("disable_water_climb", "true");
|
g_settings.setDefault("disable_water_climb", "true");
|
||||||
g_settings.setDefault("endless_water", "true");
|
g_settings.setDefault("endless_water", "true");
|
||||||
g_settings.setDefault("max_block_send_distance", "5");
|
g_settings.setDefault("max_block_send_distance", "5");
|
||||||
g_settings.setDefault("max_block_generate_distance", "4");
|
g_settings.setDefault("max_block_generate_distance", "5");
|
||||||
g_settings.setDefault("time_send_interval", "20");
|
g_settings.setDefault("time_send_interval", "20");
|
||||||
g_settings.setDefault("time_speed", "96");
|
g_settings.setDefault("time_speed", "96");
|
||||||
g_settings.setDefault("server_unload_unused_sectors_timeout", "60");
|
g_settings.setDefault("server_unload_unused_sectors_timeout", "60");
|
||||||
|
|
|
@ -121,7 +121,7 @@ void Environment::step(float dtime)
|
||||||
f32 max_down = 1.0*BS;
|
f32 max_down = 1.0*BS;
|
||||||
if(speed.Y < -max_down) speed.Y = -max_down;
|
if(speed.Y < -max_down) speed.Y = -max_down;
|
||||||
|
|
||||||
f32 max = 2.0*BS;
|
f32 max = 2.5*BS;
|
||||||
if(speed.getLength() > max)
|
if(speed.getLength() > max)
|
||||||
{
|
{
|
||||||
speed = speed / speed.getLength() * max;
|
speed = speed / speed.getLength() * max;
|
||||||
|
|
139
src/main.cpp
139
src/main.cpp
|
@ -23,20 +23,21 @@ NOTE: Things starting with TODO are sometimes only suggestions.
|
||||||
|
|
||||||
NOTE: VBO cannot be turned on for fast-changing stuff because there
|
NOTE: VBO cannot be turned on for fast-changing stuff because there
|
||||||
is an apparanet memory leak in irrlicht when using it (not sure)
|
is an apparanet memory leak in irrlicht when using it (not sure)
|
||||||
|
- It is not a memory leak but some kind of a buffer.
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
SUGG: Fix address to be ipv6 compatible
|
SUGG: Fix address to be ipv6 compatible
|
||||||
|
|
||||||
FIXME: 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
|
||||||
of it's and it's neighbors border that two blocks that are
|
of it's and it's neighbors border that two blocks that are
|
||||||
above and below each other and that are generated before and
|
above and below each other and that are generated before and
|
||||||
after the sector heightmap generation (order doesn't matter),
|
after the sector heightmap generation (order doesn't matter),
|
||||||
can have a small gap between each other at the border.
|
can have a small gap between each other at the border.
|
||||||
SUGGESTION: Use same technique for sector heightmaps as what we're
|
SUGG: Use same technique for sector heightmaps as what we're
|
||||||
using for UnlimitedHeightmap? (getting all neighbors
|
using for UnlimitedHeightmap? (getting all neighbors
|
||||||
when generating)
|
when generating)
|
||||||
|
|
||||||
SUGG: Transfer more blocks in a single packet
|
SUGG: Transfer more blocks in a single packet
|
||||||
SUGG: A blockdata combiner class, to which blocks are added and at
|
SUGG: A blockdata combiner class, to which blocks are added and at
|
||||||
|
@ -78,10 +79,6 @@ SUGG: Split MapBlockObject serialization to to-client and to-disk
|
||||||
SUGG: Implement lighting using VoxelManipulator
|
SUGG: Implement lighting using VoxelManipulator
|
||||||
- Would it be significantly faster?
|
- Would it be significantly faster?
|
||||||
|
|
||||||
FIXME: Rats somehow go underground sometimes (you can see it in water)
|
|
||||||
- Does their position get saved to a border value or something?
|
|
||||||
- Does this happen anymore?
|
|
||||||
|
|
||||||
SUGG: MovingObject::move and Player::move are basically the same.
|
SUGG: MovingObject::move and Player::move are basically the same.
|
||||||
combine them.
|
combine them.
|
||||||
|
|
||||||
|
@ -90,6 +87,8 @@ SUGG: Implement a "Fast check queue" (a queue with a map for checking
|
||||||
- Use it in active block queue in water flowing
|
- Use it in active block queue in water flowing
|
||||||
|
|
||||||
SUGG: Precalculate lighting translation table at runtime (at startup)
|
SUGG: Precalculate lighting translation table at runtime (at startup)
|
||||||
|
- This is not doable because it is currently hand-made and not
|
||||||
|
based on some mathematical function.
|
||||||
|
|
||||||
SUGG: A version number to blocks, which increments when the block is
|
SUGG: A version number to blocks, which increments when the block is
|
||||||
modified (node add/remove, water update, lighting update)
|
modified (node add/remove, water update, lighting update)
|
||||||
|
@ -105,41 +104,87 @@ SUGG: Meshes of blocks could be split into 6 meshes facing into
|
||||||
different directions and then only those drawn that need to be
|
different directions and then only those drawn that need to be
|
||||||
- Also an 1-dimensional tile map would be nice probably
|
- Also an 1-dimensional tile map would be nice probably
|
||||||
|
|
||||||
TODO: Untie client network operations from framerate
|
Networking:
|
||||||
- Needs some input queues or something
|
|
||||||
- Not really necessary?
|
TODO: Get rid of GotSplitPacketException
|
||||||
|
|
||||||
|
GUI:
|
||||||
|
|
||||||
|
TODO: Add gui option to remove map
|
||||||
|
|
||||||
|
TODO: Startup and configuration menu
|
||||||
|
|
||||||
|
Graphics:
|
||||||
|
|
||||||
|
TODO: Optimize day/night mesh updating somehow
|
||||||
|
- create copies of all textures for all lighting values and only
|
||||||
|
change texture for material?
|
||||||
|
- Umm... the collecting of the faces is the slow part
|
||||||
|
-> what about just changing the color values of the existing
|
||||||
|
meshbuffers? It should go quite fast.
|
||||||
|
|
||||||
|
TODO: Draw big amounts of torches better (that is, throw them in the
|
||||||
|
same meshbuffer (can the meshcollector class be used?))
|
||||||
|
|
||||||
TODO: Combine MapBlock's face caches to so big pieces that VBO
|
TODO: Combine MapBlock's face caches to so big pieces that VBO
|
||||||
gets used
|
gets used
|
||||||
- That is >500 vertices
|
- That is >500 vertices
|
||||||
|
|
||||||
TODO: Startup and configuration menu
|
TODO: Make fetching sector's blocks more efficient when rendering
|
||||||
|
sectors that have very large amounts of blocks (on client)
|
||||||
|
|
||||||
TODO: There are some lighting-related todos and fixmes in
|
Configuration:
|
||||||
ServerMap::emergeBlock
|
|
||||||
|
|
||||||
TODO: Proper handling of spawning place (try to find something that
|
TODO: Make the video backend selectable
|
||||||
is not in the middle of an ocean (some land to stand on at
|
|
||||||
least) and save it in map config.
|
Client:
|
||||||
|
|
||||||
|
TODO: Untie client network operations from framerate
|
||||||
|
- Needs some input queues or something
|
||||||
|
- Not really necessary?
|
||||||
|
|
||||||
|
Server:
|
||||||
|
|
||||||
|
TODO: When player dies, throw items on map
|
||||||
|
|
||||||
|
TODO: Make an option to the server to disable building and digging near
|
||||||
|
the starting position
|
||||||
|
|
||||||
TODO: Players to only be hidden when the client quits.
|
TODO: Players to only be hidden when the client quits.
|
||||||
TODO: - Players to be saved on disk, with inventory
|
TODO: - Players to be saved on disk, with inventory
|
||||||
TODO: Players to be saved as text in map/players/<name>
|
TODO: Players to be saved as text in map/players/<name>
|
||||||
TODO: Player inventory to be saved on disk
|
TODO: Player inventory to be saved on disk
|
||||||
|
|
||||||
TODO: Make fetching sector's blocks more efficient when rendering
|
TODO: Proper handling of spawning place (try to find something that
|
||||||
sectors that have very large amounts of blocks (on client)
|
is not in the middle of an ocean (some land to stand on at
|
||||||
|
least) and save it in map config.
|
||||||
TODO: Make the video backend selectable
|
|
||||||
|
|
||||||
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
|
||||||
mode
|
mode
|
||||||
|
|
||||||
TODO: Get rid of GotSplitPacketException
|
|
||||||
|
|
||||||
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 or
|
||||||
|
adding a block to an existent position, resend the MapBlock.
|
||||||
|
|
||||||
|
Objects:
|
||||||
|
|
||||||
|
TODO: Better handling of objects and mobs
|
||||||
|
- Scripting?
|
||||||
|
- There has to be some way to do it with less spaghetti code
|
||||||
|
- Make separate classes for client and server
|
||||||
|
- Client should not discriminate between blocks, server should
|
||||||
|
- Make other players utilize the same framework
|
||||||
|
- This is also needed for objects that don't get sent to client
|
||||||
|
but are used for triggers etc
|
||||||
|
|
||||||
|
SUGG: Signs could be done in the same way as torches. For this, blocks
|
||||||
|
need an additional metadata field for the texts
|
||||||
|
- This is also needed for item container chests
|
||||||
|
TODO: There has to be some better way to handle static objects than to
|
||||||
|
send them all the time. This affects signs and item objects.
|
||||||
|
|
||||||
Block object server side:
|
Block object server side:
|
||||||
- A "near blocks" buffer, in which some nearby blocks are stored.
|
- A "near blocks" buffer, in which some nearby blocks are stored.
|
||||||
- For all blocks in the buffer, objects are stepped(). This
|
- For all blocks in the buffer, objects are stepped(). This
|
||||||
|
@ -151,40 +196,14 @@ Block object server side:
|
||||||
- TODO: For incoming blocks, time difference is calculated and
|
- TODO: For incoming blocks, time difference is calculated and
|
||||||
objects are stepped according to it.
|
objects are stepped according to it.
|
||||||
|
|
||||||
TODO: Better handling of objects and mobs
|
Map generator:
|
||||||
- Scripting?
|
|
||||||
- There has to be some way to do it with less spaghetti code
|
|
||||||
- Make separate classes for client and server
|
|
||||||
- Client should not discriminate between blocks, server should
|
|
||||||
- Make other players utilize the same framework
|
|
||||||
- This is also needed for objects that don't get sent to client
|
|
||||||
but are used for triggers etc
|
|
||||||
|
|
||||||
TODO: Draw big amounts of torches better (that is, throw them in the
|
TODO: There are some lighting-related todos and fixmes in
|
||||||
same meshbuffer (can the meshcollector class be used?))
|
ServerMap::emergeBlock
|
||||||
|
|
||||||
TODO: Make an option to the server to disable building and digging near
|
TODO: When generating a block, check that there is no sunlight
|
||||||
the starting position
|
below the block if the bottom of the block doesn't have
|
||||||
|
sunlight. If it has, add it to the invalid lighting list.
|
||||||
SUGG: Signs could be done in the same way as torches. For this, blocks
|
|
||||||
need an additional metadata field for the texts
|
|
||||||
- This is also needed for item container chests
|
|
||||||
TODO: There has to be some better way to handle static objects than to
|
|
||||||
send them all the time. This affects signs and item objects.
|
|
||||||
|
|
||||||
TODO: When server sees that client is removing an inexistent block or
|
|
||||||
adding a block to an existent position, resend the MapBlock.
|
|
||||||
|
|
||||||
TODO: When player dies, throw items on map
|
|
||||||
|
|
||||||
TODO: Use porting::path_userdata for configuration file
|
|
||||||
|
|
||||||
TODO: Optimize day/night mesh updating somehow
|
|
||||||
- create copies of all textures for all lighting values and only
|
|
||||||
change texture for material?
|
|
||||||
- Umm... the collecting of the faces is the slow part
|
|
||||||
-> what about just changing the color values of the existing
|
|
||||||
meshbuffers? It should go quite fast.
|
|
||||||
|
|
||||||
TODO: Map generator version 2
|
TODO: Map generator version 2
|
||||||
- Create surface areas based on central points; a given point's
|
- Create surface areas based on central points; a given point's
|
||||||
|
@ -193,8 +212,6 @@ TODO: Map generator version 2
|
||||||
- Flat land, mountains, forest, jungle
|
- Flat land, mountains, forest, jungle
|
||||||
- Cliffs, arcs
|
- Cliffs, arcs
|
||||||
|
|
||||||
TODO: Add gui option to remove map
|
|
||||||
|
|
||||||
Doing now:
|
Doing now:
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
|
|
260
src/map.cpp
260
src/map.cpp
|
@ -1482,8 +1482,10 @@ MapSector * ServerMap::emergeSector(v2s16 p2d)
|
||||||
sector->setHeightmap(p_in_sector, hm);
|
sector->setHeightmap(p_in_sector, hm);
|
||||||
|
|
||||||
//TODO: Make these values configurable
|
//TODO: Make these values configurable
|
||||||
|
|
||||||
//hm->generateContinued(0.0, 0.0, corners);
|
//hm->generateContinued(0.0, 0.0, corners);
|
||||||
hm->generateContinued(0.5, 0.2, corners);
|
hm->generateContinued(0.25, 0.2, corners);
|
||||||
|
//hm->generateContinued(0.5, 0.2, corners);
|
||||||
//hm->generateContinued(1.0, 0.2, corners);
|
//hm->generateContinued(1.0, 0.2, corners);
|
||||||
//hm->generateContinued(2.0, 0.2, corners);
|
//hm->generateContinued(2.0, 0.2, corners);
|
||||||
|
|
||||||
|
@ -1712,6 +1714,7 @@ MapBlock * ServerMap::emergeBlock(
|
||||||
{
|
{
|
||||||
underground_emptiness[i] = 0;
|
underground_emptiness[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate dungeons
|
// Generate dungeons
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1863,6 +1866,10 @@ continue_generating:
|
||||||
// DEBUG
|
// DEBUG
|
||||||
//sector->printHeightmaps();
|
//sector->printHeightmaps();
|
||||||
|
|
||||||
|
// Set to true if has caves.
|
||||||
|
// Set when some non-air is changed to air when making caves.
|
||||||
|
bool has_caves = false;
|
||||||
|
|
||||||
for(s16 z0=0; z0<MAP_BLOCKSIZE; z0++)
|
for(s16 z0=0; z0<MAP_BLOCKSIZE; z0++)
|
||||||
for(s16 x0=0; x0<MAP_BLOCKSIZE; x0++)
|
for(s16 x0=0; x0<MAP_BLOCKSIZE; x0++)
|
||||||
{
|
{
|
||||||
|
@ -1894,6 +1901,7 @@ continue_generating:
|
||||||
float max_slope = 1.20;
|
float max_slope = 1.20;
|
||||||
float min_slope_depth = 5.0;
|
float min_slope_depth = 5.0;
|
||||||
float max_slope_depth = 0;
|
float max_slope_depth = 0;
|
||||||
|
|
||||||
if(slope < min_slope)
|
if(slope < min_slope)
|
||||||
surface_depth = min_slope_depth;
|
surface_depth = min_slope_depth;
|
||||||
else if(slope > max_slope)
|
else if(slope > max_slope)
|
||||||
|
@ -1935,101 +1943,85 @@ continue_generating:
|
||||||
// Else it's ground or dungeons (air)
|
// Else it's ground or dungeons (air)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create dungeons
|
// If it's surface_depth under ground, it's stone
|
||||||
if(underground_emptiness[
|
if(real_y <= surface_y - surface_depth)
|
||||||
ued*ued*(z0*ued/MAP_BLOCKSIZE)
|
|
||||||
+ued*(y0*ued/MAP_BLOCKSIZE)
|
|
||||||
+(x0*ued/MAP_BLOCKSIZE)])
|
|
||||||
{
|
|
||||||
n.d = CONTENT_AIR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If it's surface_depth under ground, it's stone
|
|
||||||
if(real_y <= surface_y - surface_depth)
|
|
||||||
{
|
|
||||||
n.d = CONTENT_STONE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// It is mud if it is under the first ground
|
|
||||||
// level or under water
|
|
||||||
if(real_y < WATER_LEVEL || real_y <= surface_y - 1)
|
|
||||||
{
|
|
||||||
n.d = CONTENT_MUD;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n.d = CONTENT_GRASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//n.d = CONTENT_MUD;
|
|
||||||
|
|
||||||
/*// If under water level, it's mud
|
|
||||||
if(real_y < WATER_LEVEL)
|
|
||||||
n.d = CONTENT_MUD;
|
|
||||||
// Only the topmost node is grass
|
|
||||||
else if(real_y <= surface_y - 1)
|
|
||||||
n.d = CONTENT_MUD;
|
|
||||||
else
|
|
||||||
n.d = CONTENT_GRASS;*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
else if(real_y <= surface_y - surface_depth)
|
|
||||||
{
|
|
||||||
// Create dungeons
|
|
||||||
if(underground_emptiness[
|
|
||||||
ued*ued*(z0*ued/MAP_BLOCKSIZE)
|
|
||||||
+ued*(y0*ued/MAP_BLOCKSIZE)
|
|
||||||
+(x0*ued/MAP_BLOCKSIZE)])
|
|
||||||
{
|
|
||||||
n.d = CONTENT_AIR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
n.d = CONTENT_STONE;
|
n.d = CONTENT_STONE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// If node is at or under heightmap y
|
|
||||||
else if(real_y <= surface_y)
|
|
||||||
{
|
|
||||||
// If under water level, it's mud
|
|
||||||
if(real_y < WATER_LEVEL)
|
|
||||||
n.d = CONTENT_MUD;
|
|
||||||
// Only the topmost node is grass
|
|
||||||
else if(real_y <= surface_y - 1)
|
|
||||||
n.d = CONTENT_MUD;
|
|
||||||
// Else it's the main material
|
|
||||||
else
|
else
|
||||||
n.d = material;
|
{
|
||||||
|
// It is mud if it is under the first ground
|
||||||
|
// level or under water
|
||||||
|
if(real_y < WATER_LEVEL || real_y <= surface_y - 1)
|
||||||
|
{
|
||||||
|
n.d = CONTENT_MUD;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n.d = CONTENT_GRASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//n.d = CONTENT_MUD;
|
||||||
|
|
||||||
|
/*// If under water level, it's mud
|
||||||
|
if(real_y < WATER_LEVEL)
|
||||||
|
n.d = CONTENT_MUD;
|
||||||
|
// Only the topmost node is grass
|
||||||
|
else if(real_y <= surface_y - 1)
|
||||||
|
n.d = CONTENT_MUD;
|
||||||
|
else
|
||||||
|
n.d = CONTENT_GRASS;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create dungeons
|
||||||
|
if(underground_emptiness[
|
||||||
|
ued*ued*(z0*ued/MAP_BLOCKSIZE)
|
||||||
|
+ued*(y0*ued/MAP_BLOCKSIZE)
|
||||||
|
+(x0*ued/MAP_BLOCKSIZE)])
|
||||||
|
{
|
||||||
|
// Has now caves if previous content is air
|
||||||
|
if(n.d != CONTENT_AIR)
|
||||||
|
{
|
||||||
|
has_caves = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
n.d = CONTENT_AIR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
block->setNode(v3s16(x0,y0,z0), n);
|
block->setNode(v3s16(x0,y0,z0), n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculate is_underground
|
Calculate completely_underground
|
||||||
*/
|
*/
|
||||||
// Probably underground if the highest part of block is under lowest
|
// Completely underground if the highest part of block is under lowest
|
||||||
// ground height
|
// ground height.
|
||||||
bool is_underground = (block_y+1) * MAP_BLOCKSIZE <= lowest_ground_y;
|
// This has to be very sure; it's probably one too strict now but
|
||||||
block->setIsUnderground(is_underground);
|
// that's just better.
|
||||||
|
bool completely_underground =
|
||||||
|
block_y * MAP_BLOCKSIZE + MAP_BLOCKSIZE < lowest_ground_y;
|
||||||
|
|
||||||
|
// This isn't used anymore (?) but set it anyway
|
||||||
|
block->setIsUnderground(completely_underground);
|
||||||
|
|
||||||
|
bool some_part_underground = block_y * MAP_BLOCKSIZE <= highest_ground_y;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Force lighting update if some part of block is underground
|
Force lighting update if some part of block is partly
|
||||||
This is needed because of caves.
|
underground and has caves.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool some_part_underground = (block_y+0) * MAP_BLOCKSIZE < highest_ground_y;
|
if(some_part_underground && !completely_underground && has_caves)
|
||||||
if(some_part_underground)
|
|
||||||
//if(is_underground)
|
|
||||||
{
|
{
|
||||||
|
//dstream<<"Half-ground caves"<<std::endl;
|
||||||
lighting_invalidated_blocks[block->getPos()] = block;
|
lighting_invalidated_blocks[block->getPos()] = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DEBUG: Always update lighting
|
||||||
|
//lighting_invalidated_blocks[block->getPos()] = block;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add some minerals
|
Add some minerals
|
||||||
*/
|
*/
|
||||||
|
@ -2041,9 +2033,9 @@ continue_generating:
|
||||||
/*
|
/*
|
||||||
Add meseblocks
|
Add meseblocks
|
||||||
*/
|
*/
|
||||||
for(s16 i=0; i<underground_level*1; i++)
|
for(s16 i=0; i< underground_level/4 + 1; i++)
|
||||||
{
|
{
|
||||||
if(myrand()%2 == 0)
|
if(myrand()%10 == 0)
|
||||||
{
|
{
|
||||||
v3s16 cp(
|
v3s16 cp(
|
||||||
(myrand()%(MAP_BLOCKSIZE-2))+1,
|
(myrand()%(MAP_BLOCKSIZE-2))+1,
|
||||||
|
@ -2112,7 +2104,7 @@ continue_generating:
|
||||||
/*
|
/*
|
||||||
Create a few rats in empty blocks underground
|
Create a few rats in empty blocks underground
|
||||||
*/
|
*/
|
||||||
if(is_underground)
|
if(completely_underground)
|
||||||
{
|
{
|
||||||
//for(u16 i=0; i<2; i++)
|
//for(u16 i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
|
@ -2157,7 +2149,33 @@ continue_generating:
|
||||||
v2s16 p2d(p.X,p.Z);
|
v2s16 p2d(p.X,p.Z);
|
||||||
u8 d = i.getNode()->getValue();
|
u8 d = i.getNode()->getValue();
|
||||||
|
|
||||||
//v3s16 p = p_sector - v3s16(0, block_y*MAP_BLOCKSIZE, 0);
|
// Ground level point (user for stuff that is on ground)
|
||||||
|
v3s16 gp = p;
|
||||||
|
bool ground_found = true;
|
||||||
|
|
||||||
|
// Search real ground level
|
||||||
|
try{
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
MapNode n = sector->getNode(gp);
|
||||||
|
|
||||||
|
// If not air, go one up and continue to placing the tree
|
||||||
|
if(n.d != CONTENT_AIR)
|
||||||
|
{
|
||||||
|
gp += v3s16(0,1,0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If air, go one down
|
||||||
|
gp += v3s16(0,-1,0);
|
||||||
|
}
|
||||||
|
}catch(InvalidPositionException &e)
|
||||||
|
{
|
||||||
|
// Ground not found.
|
||||||
|
ground_found = false;
|
||||||
|
// This is most close to ground
|
||||||
|
gp += v3s16(0,1,0);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2175,40 +2193,64 @@ continue_generating:
|
||||||
}
|
}
|
||||||
else if(d == SECTOR_OBJECT_TREE_1)
|
else if(d == SECTOR_OBJECT_TREE_1)
|
||||||
{
|
{
|
||||||
v3s16 p_min = p + v3s16(-1,0,-1);
|
if(ground_found == false)
|
||||||
v3s16 p_max = p + v3s16(1,4,1);
|
continue;
|
||||||
|
|
||||||
|
v3s16 p_min = gp + v3s16(-1,0,-1);
|
||||||
|
v3s16 p_max = gp + v3s16(1,5,1);
|
||||||
if(sector->isValidArea(p_min, p_max,
|
if(sector->isValidArea(p_min, p_max,
|
||||||
&changed_blocks_sector))
|
&changed_blocks_sector))
|
||||||
{
|
{
|
||||||
MapNode n;
|
MapNode n;
|
||||||
n.d = CONTENT_TREE;
|
n.d = CONTENT_TREE;
|
||||||
sector->setNode(p+v3s16(0,0,0), n);
|
sector->setNode(gp+v3s16(0,0,0), n);
|
||||||
sector->setNode(p+v3s16(0,1,0), n);
|
sector->setNode(gp+v3s16(0,1,0), n);
|
||||||
sector->setNode(p+v3s16(0,2,0), n);
|
sector->setNode(gp+v3s16(0,2,0), n);
|
||||||
sector->setNode(p+v3s16(0,3,0), n);
|
sector->setNode(gp+v3s16(0,3,0), n);
|
||||||
|
|
||||||
n.d = CONTENT_LEAVES;
|
n.d = CONTENT_LEAVES;
|
||||||
|
|
||||||
sector->setNode(p+v3s16(0,4,0), n);
|
if(rand()%4!=0) sector->setNode(gp+v3s16(0,5,0), n);
|
||||||
|
|
||||||
sector->setNode(p+v3s16(-1,4,0), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(-1,5,0), n);
|
||||||
sector->setNode(p+v3s16(1,4,0), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(1,5,0), n);
|
||||||
sector->setNode(p+v3s16(0,4,-1), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(0,5,-1), n);
|
||||||
sector->setNode(p+v3s16(0,4,1), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(0,5,1), n);
|
||||||
sector->setNode(p+v3s16(1,4,1), n);
|
/*if(rand()%3!=0) sector->setNode(gp+v3s16(1,5,1), n);
|
||||||
sector->setNode(p+v3s16(-1,4,1), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(-1,5,1), n);
|
||||||
sector->setNode(p+v3s16(-1,4,-1), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(-1,5,-1), n);
|
||||||
sector->setNode(p+v3s16(1,4,-1), n);
|
if(rand()%3!=0) sector->setNode(gp+v3s16(1,5,-1), n);*/
|
||||||
|
|
||||||
sector->setNode(p+v3s16(-1,3,0), n);
|
sector->setNode(gp+v3s16(0,4,0), n);
|
||||||
sector->setNode(p+v3s16(1,3,0), n);
|
|
||||||
sector->setNode(p+v3s16(0,3,-1), n);
|
|
||||||
sector->setNode(p+v3s16(0,3,1), n);
|
|
||||||
sector->setNode(p+v3s16(1,3,1), n);
|
|
||||||
sector->setNode(p+v3s16(-1,3,1), n);
|
|
||||||
sector->setNode(p+v3s16(-1,3,-1), n);
|
|
||||||
sector->setNode(p+v3s16(1,3,-1), n);
|
|
||||||
|
|
||||||
|
sector->setNode(gp+v3s16(-1,4,0), n);
|
||||||
|
sector->setNode(gp+v3s16(1,4,0), n);
|
||||||
|
sector->setNode(gp+v3s16(0,4,-1), n);
|
||||||
|
sector->setNode(gp+v3s16(0,4,1), n);
|
||||||
|
sector->setNode(gp+v3s16(1,4,1), n);
|
||||||
|
sector->setNode(gp+v3s16(-1,4,1), n);
|
||||||
|
sector->setNode(gp+v3s16(-1,4,-1), n);
|
||||||
|
sector->setNode(gp+v3s16(1,4,-1), n);
|
||||||
|
|
||||||
|
sector->setNode(gp+v3s16(-1,3,0), n);
|
||||||
|
sector->setNode(gp+v3s16(1,3,0), n);
|
||||||
|
sector->setNode(gp+v3s16(0,3,-1), n);
|
||||||
|
sector->setNode(gp+v3s16(0,3,1), n);
|
||||||
|
sector->setNode(gp+v3s16(1,3,1), n);
|
||||||
|
sector->setNode(gp+v3s16(-1,3,1), n);
|
||||||
|
sector->setNode(gp+v3s16(-1,3,-1), n);
|
||||||
|
sector->setNode(gp+v3s16(1,3,-1), n);
|
||||||
|
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(-1,2,0), n);
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(1,2,0), n);
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(0,2,-1), n);
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(0,2,1), n);
|
||||||
|
/*if(rand()%3!=0) sector->setNode(gp+v3s16(1,2,1), n);
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(-1,2,1), n);
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(-1,2,-1), n);
|
||||||
|
if(rand()%3!=0) sector->setNode(gp+v3s16(1,2,-1), n);*/
|
||||||
|
|
||||||
|
// Objects are identified by wanted position
|
||||||
objects_to_remove.push_back(p);
|
objects_to_remove.push_back(p);
|
||||||
|
|
||||||
// Lighting has to be recalculated for this one.
|
// Lighting has to be recalculated for this one.
|
||||||
|
@ -2218,13 +2260,17 @@ continue_generating:
|
||||||
}
|
}
|
||||||
else if(d == SECTOR_OBJECT_BUSH_1)
|
else if(d == SECTOR_OBJECT_BUSH_1)
|
||||||
{
|
{
|
||||||
if(sector->isValidArea(p + v3s16(0,0,0),
|
if(ground_found == false)
|
||||||
p + v3s16(0,0,0), &changed_blocks_sector))
|
continue;
|
||||||
|
|
||||||
|
if(sector->isValidArea(gp + v3s16(0,0,0),
|
||||||
|
gp + v3s16(0,0,0), &changed_blocks_sector))
|
||||||
{
|
{
|
||||||
MapNode n;
|
MapNode n;
|
||||||
n.d = CONTENT_LEAVES;
|
n.d = CONTENT_LEAVES;
|
||||||
sector->setNode(p+v3s16(0,0,0), n);
|
sector->setNode(gp+v3s16(0,0,0), n);
|
||||||
|
|
||||||
|
// Objects are identified by wanted position
|
||||||
objects_to_remove.push_back(p);
|
objects_to_remove.push_back(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,6 +876,7 @@ bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources)
|
||||||
{
|
{
|
||||||
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
for(s16 z=0; z<MAP_BLOCKSIZE; z++)
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
bool no_sunlight = false;
|
bool no_sunlight = false;
|
||||||
bool no_top_block = false;
|
bool no_top_block = false;
|
||||||
// Check if node above block has sunlight
|
// Check if node above block has sunlight
|
||||||
|
@ -901,6 +902,23 @@ bool MapBlock::propagateSunlight(core::map<v3s16, bool> & light_sources)
|
||||||
// No sunlight here
|
// No sunlight here
|
||||||
//no_sunlight = true;
|
//no_sunlight = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if 0 // Doesn't work; nothing gets light.
|
||||||
|
bool no_sunlight = true;
|
||||||
|
bool no_top_block = false;
|
||||||
|
// Check if node above block has sunlight
|
||||||
|
try{
|
||||||
|
MapNode n = getNodeParent(v3s16(x, MAP_BLOCKSIZE, z));
|
||||||
|
if(n.getLight(LIGHTBANK_DAY) == LIGHT_SUN)
|
||||||
|
{
|
||||||
|
no_sunlight = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(InvalidPositionException &e)
|
||||||
|
{
|
||||||
|
no_top_block = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*std::cout<<"("<<x<<","<<z<<"): "
|
/*std::cout<<"("<<x<<","<<z<<"): "
|
||||||
<<"no_top_block="<<no_top_block
|
<<"no_top_block="<<no_top_block
|
||||||
|
|
|
@ -13,9 +13,9 @@ void setStoneLikeDiggingProperties(u8 material, float toughness)
|
||||||
DiggingProperties(true, 15.0*toughness, 0));
|
DiggingProperties(true, 15.0*toughness, 0));
|
||||||
|
|
||||||
g_material_properties[material].setDiggingProperties("WPick",
|
g_material_properties[material].setDiggingProperties("WPick",
|
||||||
DiggingProperties(true, 2.0*toughness, 65535./20.*toughness));
|
DiggingProperties(true, 1.5*toughness, 65535./20.*toughness));
|
||||||
g_material_properties[material].setDiggingProperties("STPick",
|
g_material_properties[material].setDiggingProperties("STPick",
|
||||||
DiggingProperties(true, 1.0*toughness, 65535./50.*toughness));
|
DiggingProperties(true, 0.7*toughness, 65535./60.*toughness));
|
||||||
|
|
||||||
/*g_material_properties[material].setDiggingProperties("MesePick",
|
/*g_material_properties[material].setDiggingProperties("MesePick",
|
||||||
DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
|
DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
|
||||||
|
@ -63,7 +63,7 @@ void initializeMaterialProperties()
|
||||||
for(u16 i=0; i<MATERIAL_PROPERTIES_COUNT; i++)
|
for(u16 i=0; i<MATERIAL_PROPERTIES_COUNT; i++)
|
||||||
{
|
{
|
||||||
g_material_properties[i].setDiggingProperties("MesePick",
|
g_material_properties[i].setDiggingProperties("MesePick",
|
||||||
DiggingProperties(true, 0.0, 65535./20.));
|
DiggingProperties(true, 0.0, 65535./1337));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_material_properties_initialized = true;
|
g_material_properties_initialized = true;
|
||||||
|
|
22
src/player.h
22
src/player.h
|
@ -97,6 +97,9 @@ public:
|
||||||
|
|
||||||
virtual void updateLight(u8 light_at_pos) {};
|
virtual void updateLight(u8 light_at_pos) {};
|
||||||
|
|
||||||
|
virtual bool isClientConnected() { return false; }
|
||||||
|
virtual void setClientConnected(bool) {}
|
||||||
|
|
||||||
bool touching_ground;
|
bool touching_ground;
|
||||||
bool in_water;
|
bool in_water;
|
||||||
|
|
||||||
|
@ -115,22 +118,35 @@ protected:
|
||||||
class ServerRemotePlayer : public Player
|
class ServerRemotePlayer : public Player
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerRemotePlayer()
|
ServerRemotePlayer(bool client_connected):
|
||||||
|
m_client_connected(client_connected)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~ServerRemotePlayer()
|
virtual ~ServerRemotePlayer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLocal() const
|
virtual bool isLocal() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void move(f32 dtime, Map &map)
|
virtual void move(f32 dtime, Map &map)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool isClientConnected()
|
||||||
|
{
|
||||||
|
return m_client_connected;
|
||||||
|
}
|
||||||
|
virtual void setClientConnected(bool client_connected)
|
||||||
|
{
|
||||||
|
m_client_connected = client_connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This
|
||||||
|
bool m_client_connected;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ void * EmergeThread::Thread()
|
||||||
|
|
||||||
//derr_server<<"EmergeThread::Thread(): running"<<std::endl;
|
//derr_server<<"EmergeThread::Thread(): running"<<std::endl;
|
||||||
|
|
||||||
//TimeTaker timer("block emerge", g_device);
|
//TimeTaker timer("block emerge");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Try to emerge it from somewhere.
|
Try to emerge it from somewhere.
|
||||||
|
@ -135,9 +135,14 @@ void * EmergeThread::Thread()
|
||||||
|
|
||||||
{//envlock
|
{//envlock
|
||||||
|
|
||||||
|
//TimeTaker envlockwaittimer("block emerge envlock wait time");
|
||||||
|
|
||||||
|
// 0-50ms
|
||||||
JMutexAutoLock envlock(m_server->m_env_mutex);
|
JMutexAutoLock envlock(m_server->m_env_mutex);
|
||||||
|
|
||||||
//TimeTaker timer("block emerge envlock", g_device);
|
//envlockwaittimer.stop();
|
||||||
|
|
||||||
|
//TimeTaker timer("block emerge (while env locked)");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
bool only_from_disk = false;
|
bool only_from_disk = false;
|
||||||
|
@ -209,8 +214,9 @@ void * EmergeThread::Thread()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*dstream<<"lighting "<<lighting_invalidated_blocks.size()
|
/*dstream<<"lighting "<<lighting_invalidated_blocks.size()
|
||||||
<<" blocks"<<std::endl;
|
<<" blocks"<<std::endl;*/
|
||||||
TimeTaker timer("** updateLighting", g_device);*/
|
|
||||||
|
//TimeTaker timer("** updateLighting", g_device);
|
||||||
|
|
||||||
// Update lighting without locking the environment mutex,
|
// Update lighting without locking the environment mutex,
|
||||||
// add modified blocks to changed blocks
|
// add modified blocks to changed blocks
|
||||||
|
@ -450,8 +456,8 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
|
||||||
|
|
||||||
bool generate = d <= d_max_gen;
|
bool generate = d <= d_max_gen;
|
||||||
|
|
||||||
// Limit the generating area vertically to half
|
// Limit the generating area vertically to 2/3
|
||||||
if(abs(p.Y - center.Y) > d_max_gen / 2)
|
if(abs(p.Y - center.Y) > d_max_gen - d_max_gen / 3)
|
||||||
generate = false;
|
generate = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2967,7 +2973,7 @@ void Server::handlePeerChange(PeerChange &c)
|
||||||
// The player shouldn't already exist
|
// The player shouldn't already exist
|
||||||
assert(player == NULL);
|
assert(player == NULL);
|
||||||
|
|
||||||
player = new ServerRemotePlayer();
|
player = new ServerRemotePlayer(true);
|
||||||
player->peer_id = c.peer_id;
|
player->peer_id = c.peer_id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue