Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.8.0' into wip5.8.0-32
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Jun 20, 2024
2 parents 8a0a578 + c70f4ec commit 617f440
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 123 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt")
message(STATUS "Using user-provided IrrlichtMt at subdirectory 'lib/irrlichtmt'")
if(BUILD_CLIENT)
# tell IrrlichtMt to create a static library
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE)
#set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE)
add_subdirectory(lib/irrlichtmt EXCLUDE_FROM_ALL)
unset(BUILD_SHARED_LIBS CACHE)
#unset(BUILD_SHARED_LIBS CACHE)

if(NOT TARGET IrrlichtMt)
message(FATAL_ERROR "IrrlichtMt project is missing a CMake target?!")
Expand Down
2 changes: 1 addition & 1 deletion games/default
Submodule default updated 86 files
+0 −16 .github/workflows/build.yml
+13 −0 .github/workflows/luacheck.yml
+11 −0 .github/workflows/test.yml
+18 −4 README.md
+46 −0 game_api.txt
+15 −13 mods/beds/api.lua
+2 −2 mods/beds/beds.lua
+5 −4 mods/beds/functions.lua
+2 −2 mods/beds/locale/beds.eo.tr
+3 −3 mods/beds/locale/beds.ru.tr
+1 −1 mods/beds/mod.conf
+ mods/beds/textures/beds_transparent.png
+1 −1 mods/binoculars/locale/binoculars.ru.tr
+5 −5 mods/bones/locale/bones.ru.tr
+27 −18 mods/bucket/init.lua
+4 −4 mods/bucket/locale/bucket.eo.tr
+4 −4 mods/bucket/locale/bucket.ru.tr
+6 −2 mods/butterflies/init.lua
+3 −3 mods/butterflies/locale/butterflies.eo.tr
+3 −3 mods/butterflies/locale/butterflies.pt_BR.tr
+3 −3 mods/butterflies/locale/butterflies.ru.tr
+2 −1 mods/carts/cart_entity.lua
+2 −2 mods/carts/locale/carts.eo.tr
+1 −1 mods/carts/locale/carts.ru.tr
+1 −0 mods/creative/inventory.lua
+1 −1 mods/creative/locale/creative.ru.tr
+2 −1 mods/default/chests.lua
+16 −0 mods/default/init.lua
+157 −157 mods/default/locale/default.eo.tr
+172 −181 mods/default/locale/default.ru.tr
+0 −3 mods/default/mapgen.lua
+7 −9 mods/default/nodes.lua
+3 −4 mods/default/trees.lua
+12 −12 mods/doors/locale/doors.eo.tr
+15 −15 mods/doors/locale/doors.ru.tr
+5 −3 mods/dungeon_loot/mapgen.lua
+15 −15 mods/dye/locale/dye.eo.tr
+15 −15 mods/dye/locale/dye.ru.tr
+3 −1 mods/farming/api.lua
+18 −18 mods/farming/locale/farming.eo.tr
+19 −25 mods/farming/locale/farming.ru.tr
+2 −2 mods/fire/locale/fire.eo.tr
+2 −7 mods/fire/locale/fire.ru.tr
+5 −1 mods/fireflies/init.lua
+3 −3 mods/fireflies/locale/fireflies.eo.tr
+3 −3 mods/fireflies/locale/fireflies.ru.tr
+9 −9 mods/flowers/locale/flowers.eo.tr
+10 −10 mods/flowers/locale/flowers.ru.tr
+1 −1 mods/game_commands/locale/game_commands.ru.tr
+1 −1 mods/keys/locale/keys.eo.tr
+1 −1 mods/keys/locale/keys.ru.tr
+1 −1 mods/map/locale/map.eo.tr
+1 −1 mods/map/locale/map.ru.tr
+1 −1 mods/mobs_animal
+1 −1 mods/mobs_monster
+1 −1 mods/mobs_npc
+1 −1 mods/mobs_redo
+1 −1 mods/mobs_water
+1 −0 mods/mtg_craftguide/init.lua
+1 −1 mods/mtg_craftguide/locale/mtg_craftguide.eo.tr
+19 −19 mods/mtg_craftguide/locale/mtg_craftguide.ru.tr
+11 −4 mods/player_api/api.lua
+1 −1 mods/protector
+1 −1 mods/screwdriver/locale/screwdriver.ru.tr
+1 −1 mods/sethome/locale/sethome.ru.tr
+49 −0 mods/spawn/api.lua
+34 −60 mods/spawn/init.lua
+0 −1 mods/spawn/mod.conf
+144 −144 mods/stairs/locale/stairs.eo.tr
+144 −144 mods/stairs/locale/stairs.ru.tr
+3 −1 mods/tnt/init.lua
+1 −1 mods/tnt/locale/tnt.eo.tr
+2 −2 mods/tnt/locale/tnt.ru.tr
+7 −7 mods/vessels/locale/vessels.eo.tr
+7 −7 mods/vessels/locale/vessels.ru.tr
+3 −3 mods/walls/locale/walls.eo.tr
+3 −3 mods/walls/locale/walls.ru.tr
+32 −0 mods/weather/api.lua
+41 −53 mods/weather/init.lua
+15 −15 mods/wool/locale/wool.eo.tr
+15 −15 mods/wool/locale/wool.ru.tr
+5 −5 mods/xpanes/locale/xpanes.eo.tr
+5 −5 mods/xpanes/locale/xpanes.ru.tr
+2 −0 utils/test/minetest.conf
+19 −0 utils/test/run.sh
+7 −0 utils/test/world.mt
16 changes: 14 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,32 @@ if(NOT MSVC)
if(ENABLE_GPERF OR ENABLE_TCMALLOC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (NOT BUILD_SHARED_LIBS)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(TCMALLOC_LIBRARY NAMES tcmalloc_debug tcmalloc)
else()
find_library(TCMALLOC_LIBRARY NAMES tcmalloc tcmalloc_and_profiler)
endif()


if(ENABLE_GPERF)
find_library(PROFILER_LIBRARY NAMES profiler tcmalloc_and_profiler)
endif()

if (NOT BUILD_SHARED_LIBS)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif()

if (PROFILER_LIBRARY)
# set(PLATFORM_LIBS ${PLATFORM_LIBS} -Wl,--no-as-needed ${PROFILER_LIBRARY} -Wl,--as-needed)
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${PROFILER_LIBRARY})
endif()

if (TCMALLOC_LIBRARY)
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${TCMALLOC_LIBRARY})
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${TCMALLOC_LIBRARY})
set(OTHER_FLAGS "${OTHER_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
endif()

Expand Down Expand Up @@ -377,6 +387,7 @@ if(ENABLE_LEVELDB)
set(SNAPPY_BUILD_TESTS 0 CACHE INTERNAL "")
set(SNAPPY_BUILD_BENCHMARKS 0 CACHE INTERNAL "")
set(SNAPPY_INSTALL 0 CACHE INTERNAL "")
set(HAVE_TCMALLOC 0 CACHE INTERNAL "")

add_subdirectory(${PROJECT_SOURCE_DIR}/external/snappy)
set(SNAPPY_LIBRARY snappy)
Expand Down Expand Up @@ -712,7 +723,8 @@ endif()
#add_subdirectory(external/TinyTIFF/src)
#set(TINYTIFF_LIRARY TinyTIFF)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/libtiff/CMakeLists.txt)
option(ENABLE_TIFF "Enable tiff (feotiff for mapgen earth)" 1)
if(ENABLE_TIFF AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/libtiff/CMakeLists.txt)
set(tiff-tools 0 CACHE INTERNAL "")
set(tiff-tests 0 CACHE INTERNAL "")
set(tiff-docs 0 CACHE INTERNAL "")
Expand Down
3 changes: 2 additions & 1 deletion src/client/activeobjectmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ void ActiveObjectMgr::removeObject(u16 id)
return;
}

m_active_objects_deleted.emplace_back(obj);

//std::unique_ptr<ClientActiveObject> obj = std::move(it->second);
m_active_objects.erase(id);

obj->removeFromScene(true);

m_active_objects_deleted.emplace_back(std::move(obj));
}

// clang-format on
Expand Down
12 changes: 7 additions & 5 deletions src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,12 @@ void Client::step(float dtime)
TimeTaker timer_step("Client: Replace updated meshes");

int num_processed_meshes = 0;
auto end_ms = porting::getTimeMs() + 10;
auto end_ms = porting::getTimeMs() + 5;
std::vector<v3bpos_t> blocks_to_ack;

auto qsize = m_mesh_update_manager->m_queue_out.size();
if (qsize > 1000)
end_ms += 100;
end_ms += 30;

bool force_update_shadows = false;
MeshUpdateResult r;
Expand Down Expand Up @@ -1719,13 +1719,15 @@ void Client::addNode(v3pos_t p, MapNode n, bool remove_metadata, int fast)
catch(InvalidPositionException &e) {
}

if (p.getDistanceFrom(floatToInt(m_env.getLocalPlayer()->getPosition(), BS)) > MAP_BLOCKSIZE*2)
const auto disance = p.getDistanceFrom(floatToInt(m_env.getLocalPlayer()->getPosition(), BS));
if (disance > MAP_BLOCKSIZE*2)
return;

addUpdateMeshTaskForNode(p, true);
addUpdateMeshTaskForNode(p, true, disance <= MAP_BLOCKSIZE);
modified_blocks.erase(getNodeBlockPos(p));

for (const auto &modified_block : modified_blocks) {
addUpdateMeshTaskWithEdge(modified_block.first, false, true);
addUpdateMeshTaskWithEdge(modified_block.first, false, false);
}
}

Expand Down
24 changes: 20 additions & 4 deletions src/client/clientmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ void MapDrawControl::fm_init()
{
g_settings->getS32NoEx("farmesh", farmesh);
g_settings->getS32NoEx("lodmesh", lodmesh);
static const auto headless_optimize = g_settings->getBool("headless_optimize");
if (headless_optimize)
lodmesh = 0;

fov_want = fov = g_settings->getFloat("fov");
}

Expand Down Expand Up @@ -901,16 +905,21 @@ void ClientMap::updateDrawListFm(float dtime, unsigned int max_cycle_ms)
Ignore if mesh doesn't exist
*/
{
if((!mesh && smesh_size < 0) || mesh_step != mesh->lod_step) {
if ((!mesh && smesh_size < 0) || mesh_step != mesh->lod_step) {
blocks_in_range_without_mesh++;
if (m_mesh_queued < maxq || range <= 1) {
const auto bts = block->getTimestamp();
if (block->mesh_requested_timestamp < bts) {
block->mesh_requested_timestamp = bts;
m_client->addUpdateMeshTask(bp, false);
++m_mesh_queued;
}
}
if (!mesh)
continue;
}
if(mesh_step == mesh->lod_step && block->getTimestamp() <= mesh->timestamp && !smesh_size) {
if (mesh_step == mesh->lod_step &&
block->getTimestamp() <= mesh->timestamp && !smesh_size) {
++blocks_in_range_without_mesh;
continue;
}
Expand Down Expand Up @@ -1025,10 +1034,17 @@ void ClientMap::updateDrawListFm(float dtime, unsigned int max_cycle_ms)
continue;
*/

if (mesh_step != mesh->lod_step && smesh_size < 0 && (m_mesh_queued < maxq*1.2 || range <= 2)) {
if (mesh_step != mesh->lod_step && smesh_size < 0 &&
(m_mesh_queued < maxq * 1.2 || range <= 2)) {
m_client->addUpdateMeshTask(bp);
++m_mesh_queued;
} else if (block->getTimestamp() > mesh->timestamp + (smesh_size ? 0 : range >= 1 ? 60 : 5) && (m_mesh_queued < maxq*1.5 || range <= 2)) {
} else if (const auto bts = block->getTimestamp();
bts != BLOCK_TIMESTAMP_UNDEFINED &&
block->getTimestamp() > mesh->timestamp + (smesh_size ? 0
: range >= 1
? 60
: 5) &&
(m_mesh_queued < maxq * 1.5 || range <= 2)) {
if (mesh_step > 1)
m_client->addUpdateMeshTask(bp);
else
Expand Down
1 change: 0 additions & 1 deletion src/client/fm_farmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ void FarMesh::makeFarBlock(const v3bpos_t &blockpos)
const auto lock = std::lock_guard(block->far_mutex);
if (!block->getFarMesh(step)) {
MeshMakeData mdat(m_client, false, 0, step, &farcontainer);
mdat.block = block.get();
mdat.m_blockpos = blockpos_actual;
auto mbmsh = std::make_shared<MapBlockMesh>(&mdat, m_camera_offset);
block->setFarMesh(mbmsh, m_client->m_uptime);
Expand Down
21 changes: 0 additions & 21 deletions src/client/mapblock_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,6 @@ MeshMakeData::MeshMakeData(Client *client, bool use_shaders,
fscale(pow(2, far_step + lod_step))
{}

bool MeshMakeData::fill_data()
{
if (filled)
return filled;

if (!block)
block = m_client->m_env.getClientMap().getBlockNoCreateNoEx(m_blockpos);

if (!block)
return filled;
filled = true;
timestamp = block->getTimestamp();

return filled;
}


void MeshMakeData::fillBlockDataBegin(const v3bpos_t &blockpos)
{
m_blockpos = blockpos;
Expand Down Expand Up @@ -697,10 +680,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3pos_t camera_offset):
m_enable_shaders = data->m_use_shaders;
m_enable_vbo = g_settings->getBool("enable_vbo");

if (!data->fill_data()) {
return;
}

v3bpos_t bp = data->m_blockpos;
// Only generate minimap mapblocks at even coordinates.
if (fscale<=1) // || !data->block->getMesh())
Expand Down
6 changes: 0 additions & 6 deletions src/client/mapblock_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ struct MeshMakeData
int range = 1;
bool no_draw = false;
unsigned int timestamp = 0;
MapBlock * block = nullptr;
//Map & map;
//MapDrawControl& draw_control;
bool debug = false;
bool filled = false;
void fill(MapBlock *block_);
bool fill_data();

explicit MeshMakeData(Client *client, bool use_shaders
, int lod_step = 0
Expand Down
10 changes: 9 additions & 1 deletion src/client/mesh_generator_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ void MeshUpdateQueue::fillDataFromMapBlocks(QueuedMeshUpdate *q)
if (block) {
auto lock = block->lock_shared_rec();
data->fillBlockData(pos, block->getData());

if (const auto bts = block->getTimestamp();
bts != BLOCK_TIMESTAMP_UNDEFINED) {
data->timestamp = std::max(data->timestamp, bts);
}
} else {
data->fillBlockData(pos, block_placeholder.data);
}
Expand Down Expand Up @@ -264,6 +269,7 @@ void MeshUpdateWorkerThread::doUpdate()

MeshUpdateManager::MeshUpdateManager(Client *client):
m_queue_in(client)
, m_queue_in_urgent(client)
{
int number_of_threads = rangelim(g_settings->getS32("mesh_generation_threads"), 0, 8);

Expand All @@ -277,6 +283,8 @@ MeshUpdateManager::MeshUpdateManager(Client *client):

for (int i = 0; i < number_of_threads; i++)
m_workers.push_back(std::make_unique<MeshUpdateWorkerThread>(&m_queue_in, this, &m_camera_offset));

m_workers.push_back(std::make_unique<MeshUpdateWorkerThread>(&m_queue_in_urgent, this, &m_camera_offset));
}

void MeshUpdateManager::updateBlock(Map *map, v3bpos_t p, bool ack_block_to_server,
Expand All @@ -285,7 +293,7 @@ void MeshUpdateManager::updateBlock(Map *map, v3bpos_t p, bool ack_block_to_serv
static thread_local const bool many_neighbors =
g_settings->getBool("smooth_lighting")
&& !g_settings->getFlag("performance_tradeoffs");
if (!m_queue_in.addBlock(map, p, ack_block_to_server, urgent)) {
if (!(urgent ? m_queue_in_urgent : m_queue_in).addBlock(map, p, ack_block_to_server, urgent)) {
warningstream << "Update requested for non-existent block at ("
<< p.X << ", " << p.Y << ", " << p.Z << ")" << std::endl;
return;
Expand Down
1 change: 1 addition & 0 deletions src/client/mesh_generator_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class MeshUpdateManager


MeshUpdateQueue m_queue_in;
MeshUpdateQueue m_queue_in_urgent;

public:
MutexedQueue<MeshUpdateResult> m_queue_out;
Expand Down
1 change: 1 addition & 0 deletions src/cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#cmakedefine01 MINETEST_TRANSPORT
#cmakedefine01 STATIC_BUILD
#cmakedefine01 USE_ENET
#cmakedefine01 USE_GPERF
#cmakedefine01 USE_ICONV
#cmakedefine01 USE_IPV4_DEFAULT
#cmakedefine01 USE_MANDELBULBER
Expand Down
2 changes: 1 addition & 1 deletion src/external/snappy
Submodule snappy updated 3 files
+1 −1 CMakeLists.txt
+26 −0 snappy.cc
+17 −5 snappy.h
1 change: 1 addition & 0 deletions src/mapblock.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ class MapBlock
MapBlock::mesh_type getFarMesh(int step);
void setFarMesh(const MapBlock::mesh_type & rmesh, uint32_t time);
std::mutex far_mutex;
u32 mesh_requested_timestamp = 0;
#endif
//===

Expand Down
21 changes: 18 additions & 3 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,6 @@ void Server::start()
std::cerr << line << std::endl;
}



// == fm:
actionstream << "\033[1mfree\033[1;33mminer \033[1;36mv" << g_version_hash
<< "\033[0m \t"
#if ENABLE_THREADS
Expand All @@ -652,6 +649,24 @@ void Server::start()
#ifndef NDEBUG
<< " debug \t"
#endif
#if USE_GPERF
<< " gperf \t"
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
<< " asan \t"
#endif
#endif
#if defined(__has_feature)
#if __has_feature(thread_sanitizer)
<< " tsan \t"
#endif
#endif
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
<< " msan \t"
#endif
#endif
#if USE_MULTI
<< " multi: \t"
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ const char *g_build_info =
#if ENABLE_THREADS
"\n" "ENABLE_THREADS"
#endif
#if USE_GPERF
"\n" "USE_GPERF"
#endif
#if USE_MULTI
"\n" "USE_MULTI"
#endif
Expand Down
Binary file removed textures/base/pack/menu_header.png
Binary file not shown.
Loading

0 comments on commit 617f440

Please sign in to comment.