oweals/minetest.git
7 years agoCode modernization: subfolders (#6283)
Loïc Blot [Sat, 19 Aug 2017 20:23:47 +0000 (22:23 +0200)]
Code modernization: subfolders (#6283)

* Code modernization: subfolders

Modernize various code on subfolders client, network, script, threading, unittests, util

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Make connection.cpp readable in a pointed place + typo

7 years agoCode modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)
Loïc Blot [Sat, 19 Aug 2017 12:25:35 +0000 (14:25 +0200)]
Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)

* Code modernization: src/p*, src/q*, src/r*, src/s* (partial)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Spelling: vertice -> vertex

7 years agoCode modernization: src/n*, src/o* (#6280)
Loïc Blot [Sat, 19 Aug 2017 09:30:46 +0000 (11:30 +0200)]
Code modernization: src/n*, src/o* (#6280)

* Code modernization: src/n*, src/o*

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* remove unused IWritableNodeDefManager::clone()
* C++ STL header style
* Pointer constness in some functions

7 years agoGenericCAO: Fix light position for non-players, remove deprecated initialisation...
SmallJoker [Sat, 19 Aug 2017 09:30:09 +0000 (11:30 +0200)]
GenericCAO: Fix light position for non-players, remove deprecated initialisation code (#6281)

7 years agoServerMap saving: cleanups (#6274)
Loïc Blot [Sat, 19 Aug 2017 09:29:46 +0000 (11:29 +0200)]
ServerMap saving: cleanups (#6274)

* remove sector meta loading/saving from files which targets dead code (differs_from_disk is always empty)
* this remove empty ServerMapSector and ClientMapSector, remove MapSector childs

7 years agoItemCAO removal (#6279)
Loïc Blot [Sat, 19 Aug 2017 07:30:43 +0000 (09:30 +0200)]
ItemCAO removal (#6279)

This object is from 0.3 era and was never used since 0.4.X and GenericCAO usage

7 years agoCode modernization: src/m* (part 3)
Loic Blot [Sat, 19 Aug 2017 07:29:55 +0000 (09:29 +0200)]
Code modernization: src/m* (part 3)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* remove some unused headers in some cpp variable

7 years agoCode modernization: src/m* (part 2)
Loic Blot [Sat, 19 Aug 2017 07:12:54 +0000 (09:12 +0200)]
Code modernization: src/m* (part 2)

* empty function
* default constructor/destructor
* remove unused Map::emergeSector(a,b)
* for range-based loops
* migrate a dirs[7] table to direction tables
* remove various old unused function

7 years agoBanmanager: Move 'creating' message from warningstream to infostream (#6277)
Paramat [Sat, 19 Aug 2017 06:06:22 +0000 (07:06 +0100)]
Banmanager: Move 'creating' message from warningstream to infostream (#6277)

7 years agoMake world creation menu automatically generate a random world name (#6257)
lisacvuk [Fri, 18 Aug 2017 17:39:44 +0000 (19:39 +0200)]
Make world creation menu automatically generate a random world name (#6257)

* Make world creation menu automatically generate a name.

* Name is now initialy empty, and generated if player tries to create a world without a name.

7 years agoOptimize headers (part 2) (#6272)
Loïc Blot [Fri, 18 Aug 2017 17:25:07 +0000 (19:25 +0200)]
Optimize headers (part 2) (#6272)

* Optimize headers (part 2)

* less debug.h in headers
* less remoteplayer.h for everybody

* Cleanup (part 2)

* camera.h: mesh.h
* mapgen.h: mapnode.h
* serverenvironment.h: mapblock.h
* nodedef.h: shader.h

7 years agoModernize various files (src/m*) (#6267)
Loïc Blot [Fri, 18 Aug 2017 16:18:25 +0000 (18:18 +0200)]
Modernize various files (src/m*) (#6267)

* Modernize various files (src/m*)

* range-based for loops
* code style
* C++ headers instead of C headers
* Default operators
* empty function

Thanks to clang-tidy

7 years agoserver.cpp: unroll setting when sending mapblocks (#6265)
Loïc Blot [Fri, 18 Aug 2017 10:17:30 +0000 (12:17 +0200)]
server.cpp: unroll setting when sending mapblocks (#6265)

* server.cpp: unroll setting when sending mapblocks

* Improve a little bit performance when sending mapblocks massively
* Use a range based for
* Code style fixes

7 years agoAdd missing ctime include (#6269)
adrido [Fri, 18 Aug 2017 10:17:19 +0000 (12:17 +0200)]
Add missing ctime include (#6269)

7 years agoChange README to Markdown format, add LICENSE.txt (#6244)
rubenwardy [Fri, 18 Aug 2017 08:47:40 +0000 (09:47 +0100)]
Change README to Markdown format, add LICENSE.txt (#6244)

7 years agoModernize various files (src/k*, src/l*)
Loic Blot [Fri, 18 Aug 2017 06:21:01 +0000 (08:21 +0200)]
Modernize various files (src/k*, src/l*)

* range-based for loops
* code style
* C++ headers instead of C headers
* Default operators

7 years agoModernize various files (part 2)
Loic Blot [Fri, 18 Aug 2017 06:07:59 +0000 (08:07 +0200)]
Modernize various files (part 2)

* range-based for loops
* emplace_back instead of push_back
* code style
* C++ headers instead of C headers
* Default operators
* empty stl function

7 years agoModernize various files
Loic Blot [Fri, 18 Aug 2017 05:44:42 +0000 (07:44 +0200)]
Modernize various files

* range-based for loops
* emplace_back instead of push_back
* code style
* C++ headers instead of C headers
* Default operators
* empty stl function

7 years agoModernize src/c* src/d* and src/e* files (#6263)
Loïc Blot [Thu, 17 Aug 2017 21:02:50 +0000 (23:02 +0200)]
Modernize src/c* src/d* and src/e* files (#6263)

* Modernize src/c* src/d* and src/e* files

* default operator
* redundant init
* delete default constructors on CraftDefinition childs (never used)
* fix some missing init values
* const ref fix reported by clang-tidy
* ranged-based for loops
* simple conditions & returns
* empty stl function instead of size
* emplace_back stl function instead of push_back + construct temp obj
* auto for some iterators
* code style fixes
* c++ stl headers instead of C stl headers (stdio.h -> cstdio)

7 years agoC++ modernize: Pragma once (#6264)
Loïc Blot [Thu, 17 Aug 2017 20:19:39 +0000 (22:19 +0200)]
C++ modernize: Pragma once (#6264)

* Migrate cpp headers to pragma once

7 years agoclientobject, clouds, collision, clientsimpleobject: code modernization (#6260)
Loïc Blot [Thu, 17 Aug 2017 18:23:54 +0000 (20:23 +0200)]
clientobject, clouds, collision, clientsimpleobject: code modernization (#6260)

* clientobject, clouds, collision, clientsimpleobject: code modernization

* use range-based for loops
* simplify some tests
* various code style fixes
* use emplace_back instead of push_back when necessary
* use auto on some iterators
* use default operator when needed
* unroll v3s16 creation on collisionMoveSimple

7 years agoReduce dedicated server step to 0.09 (#6252)
Loïc Blot [Thu, 17 Aug 2017 17:16:02 +0000 (19:16 +0200)]
Reduce dedicated server step to 0.09 (#6252)

Minetest performance improvement has been huge since months, server step reduction will permit to handle client events a little bit faster without too many penalty costs due to core engine

7 years agoTypo fix in compat code from commit 1d8d01074fdb52946f81110bebf1d001185b394b
Loic Blot [Thu, 17 Aug 2017 17:15:12 +0000 (19:15 +0200)]
Typo fix in compat code from commit 1d8d01074fdb52946f81110bebf1d001185b394b

7 years agoclientmap, clientmedia: code modernization
Loic Blot [Thu, 17 Aug 2017 06:26:52 +0000 (08:26 +0200)]
clientmap, clientmedia: code modernization

* use range-based for loops
* simplify some tests
* various code style fixes
* remove debugprint in ClientMap::getBackgroundBrightness, debug code was not intended to be there
* remove unused fields in MapDrawControl
* use emplace_back instead of push_back when necessary

7 years agol_server, clientenvironment, clientiface: code modernization
Loic Blot [Thu, 17 Aug 2017 06:11:39 +0000 (08:11 +0200)]
l_server, clientenvironment, clientiface: code modernization

* use range-based for loops
* use refs on some exceptions & one setter

7 years agoNew lighting curve (#5279)
Vitaliy [Wed, 16 Aug 2017 22:23:20 +0000 (01:23 +0300)]
New lighting curve (#5279)

* New lighting curve

* Make polynomial lighting curve

* Update default lighting settings

7 years agoClientInterface: add a function to verify (correctly) if user limit was reached ...
Loïc Blot [Wed, 16 Aug 2017 21:48:29 +0000 (23:48 +0200)]
ClientInterface: add a function to verify (correctly) if user limit was reached (#6258)

* ClientInterface: add a function to verify (correctly) if user limit was reached

CS_HelloSent is a better indicator of active slots than CS_Created, which are session objects created after init packet reception

Switch existing checks to ClientInterface::isUserLimitReached()

Use range-based for loop for getClientIds() used function too

This will fix #6254 (not the memory overhead if init is flooded)

7 years agoCleanup various headers to reduce compilation times (#6255)
Loïc Blot [Wed, 16 Aug 2017 20:11:45 +0000 (22:11 +0200)]
Cleanup various headers to reduce compilation times (#6255)

* Cleanup various headers to reduce compilation times

7 years agoclient.cpp: modernize code
Loic Blot [Wed, 16 Aug 2017 06:53:52 +0000 (08:53 +0200)]
client.cpp: modernize code

* Range based for loops
* Empty operator on stl containers

7 years agocavegen.cpp, chat.cpp: modernize code
Loic Blot [Wed, 16 Aug 2017 06:26:04 +0000 (08:26 +0200)]
cavegen.cpp, chat.cpp: modernize code

7 years agoModernize client code (#6250)
Loïc Blot [Tue, 15 Aug 2017 18:30:30 +0000 (20:30 +0200)]
Modernize client code (#6250)

* Various code style fixes
* Use range based for loops
* Use empty instead of empty objects
* Use C++11 default keyword for trivial constructors and destructors
* Drop some useless casts
* Use emplace_back instead of push_back to improve performance of some vectors push

7 years agobab.cpp: code modernization
Loic Blot [Tue, 15 Aug 2017 07:39:58 +0000 (09:39 +0200)]
bab.cpp: code modernization

* Use for range based loops
* Simplify some tests
* Code style fixes

7 years agoserver.cpp: code modernization
Loic Blot [Tue, 15 Aug 2017 07:30:31 +0000 (09:30 +0200)]
server.cpp: code modernization

* Use more for range based loops
* Simplify some tests
* Code style fixes
* connection.h: better PeerChange constructor instead of creating uninitalized object and then affect variables

7 years agoLint fix on localplayer.h
Loic Blot [Tue, 15 Aug 2017 07:15:04 +0000 (09:15 +0200)]
Lint fix on localplayer.h

7 years agoAdvanced settings: Re-organise mapgen settings for ease of use
paramat [Sun, 13 Aug 2017 18:01:04 +0000 (19:01 +0100)]
Advanced settings: Re-organise mapgen settings for ease of use

Add a comment about the auto-generated minetest.conf.example possibly
appearing in the bin folder.

7 years agoMake dropped items colorable
Dániel Juhász [Sat, 24 Jun 2017 16:58:01 +0000 (18:58 +0200)]
Make dropped items colorable

7 years agoL-system: Fix leaves cutting through stems
Hybrid Dog [Mon, 5 Jun 2017 16:52:34 +0000 (18:52 +0200)]
L-system: Fix leaves cutting through stems

7 years agoPlayer::getSpeed/setSpeed use const refs
Loic Blot [Mon, 14 Aug 2017 08:56:06 +0000 (10:56 +0200)]
Player::getSpeed/setSpeed use const refs

7 years agoPlayer class: disable copy
Loic Blot [Mon, 14 Aug 2017 08:52:59 +0000 (10:52 +0200)]
Player class: disable copy

7 years agoVarious server.cpp cleanups
Loic Blot [Sun, 13 Aug 2017 23:06:12 +0000 (01:06 +0200)]
Various server.cpp cleanups

* Modernize many for loops
* Use constness on many loops
* use empty function on many strings tests
* various code style fixes

7 years agoServer::AsyncRunStep + Server::sendAddNode: modernize code
Loic Blot [Sun, 13 Aug 2017 22:44:45 +0000 (00:44 +0200)]
Server::AsyncRunStep + Server::sendAddNode: modernize code

* Use various modern for loops
* Make some loop iterator constants, whereas there weren't
* Use empty on some size() > 0 tests
* Various little codestyle fixes
* Fix an hidden scope variable in Server::SendBlockNoLock

7 years agoLocalPlayer::accelerateHorizontal: cleanups
Loic Blot [Sun, 13 Aug 2017 21:08:17 +0000 (23:08 +0200)]
LocalPlayer::accelerateHorizontal: cleanups

* Properly use v3f default constructor
* v3f d_wanted = target_speed - m_speed; and d_wanted = target_speed * 0.1f - m_speed * 0.1f; can be factorized to d_wanted = (target_speed - m_speed) * 0.1f; => d_wanted *= 0.1f;

7 years agoCleanup LocalPlayer::applyControl
Loic Blot [Sun, 13 Aug 2017 21:02:32 +0000 (23:02 +0200)]
Cleanup LocalPlayer::applyControl

* Use Environment interface instead of ClientEnvironemnt
* Don't create slippery variable and then re-affect it
* itemgroup_get return a int, properly test != 0 to be clearer

7 years agoAdd slippery group for nodes (players/items slide)
Wuzzy [Fri, 11 Aug 2017 19:16:09 +0000 (21:16 +0200)]
Add slippery group for nodes (players/items slide)

7 years agoTrigger on_rightclick regardless on the formspec meta field
SmallJoker [Thu, 10 Aug 2017 07:41:56 +0000 (09:41 +0200)]
Trigger on_rightclick regardless on the formspec meta field

Document behaviour for older clients.

7 years agoAdd short description for disabled texture packs
Wuzzy [Sat, 5 Nov 2016 17:58:00 +0000 (18:58 +0100)]
Add short description for disabled texture packs

7 years agoChange “Use” key name to “Special”
TeTpaAka [Sat, 29 Jul 2017 17:24:10 +0000 (19:24 +0200)]
Change “Use” key name to “Special”

7 years agoFull viewing range key message clarified
Fixer [Wed, 9 Aug 2017 10:50:16 +0000 (13:50 +0300)]
Full viewing range key message clarified

To make it sound less confusing to players

7 years agoRemove cloud_height setting
Ben Deutsch [Fri, 4 Aug 2017 03:58:10 +0000 (05:58 +0200)]
Remove cloud_height setting

With the cloud API, the cloud_height setting has become obsolete
and replaceable by a mod. It, and supporting code, can be
removed.

7 years agoAbort if static_spawnpoint is an invalid setting instead of just giving an error log
Hybrid Dog [Sat, 12 Aug 2017 10:11:28 +0000 (12:11 +0200)]
Abort if static_spawnpoint is an invalid setting instead of just giving an error log

7 years agoMgv5: Make spawn position search more reliable
paramat [Wed, 9 Aug 2017 13:23:30 +0000 (14:23 +0100)]
Mgv5: Make spawn position search more reliable

7 years agoServerEnvironment::step: modernize loops 4182/head
Loic Blot [Fri, 11 Aug 2017 07:57:27 +0000 (09:57 +0200)]
ServerEnvironment::step: modernize loops

Use various ranged-based for loops in ServerEnvironment::step
Also set ServerObject::getBasePosition const to be compliant
ServerEnvironment::deleteParticleSpawner: use a const iterator

7 years agoMgv7: Raise spawn point by 1 node for no mountain case
paramat [Mon, 7 Aug 2017 05:35:34 +0000 (06:35 +0100)]
Mgv7: Raise spawn point by 1 node for no mountain case

7 years agoStep height: Add as a player object property
paramat [Sun, 6 Aug 2017 02:57:34 +0000 (03:57 +0100)]
Step height: Add as a player object property

Add settable player step height using the existing object property.
Breaks compatibility with old clients, add to protocol version 35.

7 years agoMinimap: Leaner minimap arrow makes it easier to see the direction
Jens Rottmann [Sat, 5 Aug 2017 15:34:41 +0000 (17:34 +0200)]
Minimap: Leaner minimap arrow makes it easier to see the direction

The arrow symbolizing the player in the square minimap looks almost like a
triangle, making it a bit hard to see which direction it is currently
pointing in when in a hurry.

Redraw it leaner, pointier. Colors unchanged.

7 years agoKey change menu: Expose more keys
Wuzzy [Tue, 25 Jul 2017 16:56:45 +0000 (18:56 +0200)]
Key change menu: Expose more keys

7 years agoFix error not printed to console when no name is provided
Juozas [Wed, 9 Aug 2017 01:04:06 +0000 (04:04 +0300)]
Fix error not printed to console when no name is provided

When minetest is launched, if there was no nameprovided in
configuration or parameters, the game would not show any error in
console. if the --go parameter was also prowided, the game would
exit without an error. This is undesired behavior, so this merged
commit add the missing function that displays the missing error
message in console.

7 years agoUpdate credits (#6228)
Zeno- [Tue, 8 Aug 2017 14:11:41 +0000 (00:11 +1000)]
Update credits (#6228)

7 years agoSingleplayer: Pause game in the key change dialog
SmallJoker [Mon, 7 Aug 2017 12:53:58 +0000 (14:53 +0200)]
Singleplayer: Pause game in the key change dialog
Fixes #6201. @t0ny2 pointed to the right place. Thanks!

7 years agoStart off newly generated worlds early at sunrise, 5:15am (#6211)
JRottm [Sat, 5 Aug 2017 19:08:21 +0000 (21:08 +0200)]
Start off newly generated worlds early at sunrise, 5:15am (#6211)

Gives starting singleplayer games this subtle "dawn of a new world" feel.
I would have set it even earlier (up to 4:45am), but I was worried that in
some pre-existing games the player could be overwhelmed by hostile
mobs right at the start, seriously changing gameplay.

It's just the default, individual games should be able to override it, and
for public servers it's irrelevant anyway, because only the first player to
set foot in the world will notice, and that's usually the server admin.

7 years agoAdd tiny Y offset in collisionMoveSimple() to tweak performance
Jens Rottmann [Fri, 4 Aug 2017 23:42:39 +0000 (01:42 +0200)]
Add tiny Y offset in collisionMoveSimple() to tweak performance

Another small general problem: the player is always standing exactly on the
bondary between 2 nodes e.g. Y=1.5 is exactly between nodes Y=1 and Y=2.
floatToInt() and myround() will round +/-n.5 always 'outwards' to +/-(n+1),
which means they behave differently depending on where you are: they round
upwards above sea level and downwards when underground. This inconsistency
comes from the way the coordinates are calculated, independent of the
specific C++ code.

The result is a tiny bit of lost performance when moving underground,
because 1 node level more than necessary is checked for collisions. This can
be amended by adding a tiny offset to minpos_f.Y, like @paramat suggested.
This is not an elegant solution, but still better than wasting CPU.

7 years agoFix player coordinate rounding in collisionMoveSimple() (#6197)
Jens Rottmann [Fri, 4 Aug 2017 19:48:32 +0000 (21:48 +0200)]
Fix player coordinate rounding in collisionMoveSimple() (#6197)

To determine the area (nodes) where a player movement took place
collisionMoveSimple() first took the old/new player coordinates and rounded
them to integers, then added the player character's collision box and
implicitely rounded the result. This has 2 problems:

Rounding the position and the box seperately, then adding the resulting
integers means you get twice the rounding error. And implicit rounding
always rounds towards 0.0, unlike floatToInt(), which rounds towards the
closest integer.

Previous (simplified) behavior: round(pos)+(int)box, for example player at
Y=0.9, body is 1.75m high: round(0.9)+(int)1.75 = 1+1 = 2.
==> A character's height of 1.75m always got rounded down to 1m, its width
of +/-0.3 even became 0.

Fixed by adding the floats first, then rounding properly: round(pos+box) =
round(0.9+1.75) = round(2.65) = 3.

7 years agoSort box corners correctly
Thomas--S [Thu, 13 Apr 2017 13:45:12 +0000 (15:45 +0200)]
Sort box corners correctly

7 years agoUpdate minetest.conf.example for keymap_slot*
Wuzzy [Tue, 1 Aug 2017 02:05:06 +0000 (04:05 +0200)]
Update minetest.conf.example for keymap_slot*

7 years agoFix crash when using --go in command line
Juozas Pocius [Wed, 2 Aug 2017 13:40:38 +0000 (16:40 +0300)]
Fix crash when using --go in command line

7 years agoDungeons: Use biome 'node_stone' if normal stone types not detected
paramat [Fri, 28 Jul 2017 02:31:11 +0000 (03:31 +0100)]
Dungeons: Use biome 'node_stone' if normal stone types not detected

Construct dungeons from the node defined as biome 'node_stone' if
'mapgen_stone', 'mapgen_desert_stone' and 'mapgen_sandstone' are not
detected.
Feature long-intended by kwolekr/hmmmm and present in code as a TODO.

7 years agoGenericCAO: Fix dark model below y = 0
paramat [Wed, 26 Jul 2017 18:46:29 +0000 (19:46 +0100)]
GenericCAO: Fix dark model below y = 0

Move point at which light is sampled up to 0.5 nodes above foot level,
to avoid that point sometimes passing into the node below causing the
model to go dark.

7 years agoDarkness detection: Reduce chance of false positives darkening the skybox
Lars Hofhansl [Sat, 22 Jul 2017 19:44:15 +0000 (12:44 -0700)]
Darkness detection: Reduce chance of false positives darkening the skybox

The getBackgroundBrightness() function detects darkness in the view direction
to decide when to make the skybox dark. The volume checked was too narrow and
missed the left and right edges of the view, too easily causing a dark skybox.

Widen the checked volume to match a FOV of 72 degrees and a 16:9 aspect ratio
game window.

7 years agoMake direct item selection keys freely bindable
Wuzzy [Sun, 18 Dec 2016 22:34:52 +0000 (23:34 +0100)]
Make direct item selection keys freely bindable

7 years agoMove the nametag back to the top of the player (#6179)
TeTpaAka [Sat, 29 Jul 2017 17:24:10 +0000 (19:24 +0200)]
Move the nametag back to the top of the player (#6179)

read the actual height of the collisionbox

7 years agoNoise: Prevent unittest crash caused by division by zero
SmallJoker [Sat, 29 Jul 2017 17:01:14 +0000 (19:01 +0200)]
Noise: Prevent unittest crash caused by division by zero

7 years agoRevert "Noise::perlinMap2D,3D: replace a loop init with a single memset call"
Loïc Blot [Thu, 27 Jul 2017 15:12:18 +0000 (17:12 +0200)]
Revert "Noise::perlinMap2D,3D: replace a loop init with a single memset call"

This reverts commit bc1654feedc90caa8c26328ca6f0fc59fbe5b76c.

7 years agoFix a warning introduced by 4eb59aeeb2f2b535f4eb2a1608189bb03098454e
Loïc Blot [Thu, 27 Jul 2017 14:55:32 +0000 (16:55 +0200)]
Fix a warning introduced by 4eb59aeeb2f2b535f4eb2a1608189bb03098454e

7 years agoAdd LuaEntity on_death callback (#6177)
Loïc Blot [Thu, 27 Jul 2017 09:32:35 +0000 (11:32 +0200)]
Add LuaEntity on_death callback (#6177)

Add LuaEntity on_death callback

This fixes #5474

7 years agoRename previous_was_found to previous_exists
Loic Blot [Thu, 27 Jul 2017 05:36:46 +0000 (07:36 +0200)]
Rename previous_was_found to previous_exists

7 years agoMapBlock::actuallyUpdateDayNightDiff(): little performance optimization
Loic Blot [Wed, 26 Jul 2017 21:50:53 +0000 (23:50 +0200)]
MapBlock::actuallyUpdateDayNightDiff(): little performance optimization

don't check isLightDayNightEq if checked on previous node

7 years agocompressZlib: don't use a SharedBuffer but a raw u8 * pointer
Loic Blot [Wed, 26 Jul 2017 21:37:44 +0000 (23:37 +0200)]
compressZlib: don't use a SharedBuffer but a raw u8 * pointer

Remove usage of the SharedBuffer in zlib compression which has two problems:
* We copied the whole memory block to compress it (not good with mapblocks)
* We copied sometimes strings to SharedBuffer to SharedBuffer (2nd time)

Use this method in MapNode::serializeBulk + optimize serialization but merging 3 identical loops in a single loop

7 years agoMassive performance improvement on correctBlockNodeIds
Loic Blot [Wed, 26 Jul 2017 20:54:55 +0000 (22:54 +0200)]
Massive performance improvement on correctBlockNodeIds

correctBlockNodeIds does 2 lookups for each loaded node, one to translate DB ID to name and a second to translate name to real ID. Name to real ID is very consumming if done on every node. As mapblocks are in most cases composed of many identical adjacent nodes, cache previous source and destination id and use them on the next node to prevent any lookup on those maps.

This reduce the function load from 15% of my CPU usage to ~0.7%, on the test, calls was reduced from 2.5M lookups to 42k lookups, it's a huge performance gain

7 years agoNoise::perlinMap2D,3D: replace a loop init with a single memset call
Loic Blot [Wed, 26 Jul 2017 22:24:14 +0000 (00:24 +0200)]
Noise::perlinMap2D,3D: replace a loop init with a single memset call

7 years agoRemove one unused variable in Server::Receive function
Loic Blot [Wed, 26 Jul 2017 22:16:20 +0000 (00:16 +0200)]
Remove one unused variable in Server::Receive function

7 years agoRemove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cpp
Loic Blot [Wed, 26 Jul 2017 21:11:46 +0000 (23:11 +0200)]
Remove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cpp

7 years agoTileLayer: use shared_ptr for FrameSpec vector (#6171)
Loïc Blot [Wed, 26 Jul 2017 18:12:48 +0000 (20:12 +0200)]
TileLayer: use shared_ptr for FrameSpec vector (#6171)

* TileLayer: use shared_ptr for vector framespec
This reduce memory copy of TileLayer from (4 to 16) * FrameSpec where FrameSpec = (sizeof(int) + 3 * sizeof(ptr)) to int + sizeof(ptr)

Callgrind difference

Before: https://lut.im/RGkiJqQb8T/LeQIEXpAuRzfl7gd.png\ f
After: https://lut.im/bcqmwee1xu/cTwtptY5tRuS9lp0.png

* Fix one push_back to use vector::emplace_back & optimize inclusions

7 years agoVoxelManip cleanups (const ref, const move) + function removal (#6169)
Loïc Blot [Wed, 26 Jul 2017 05:35:09 +0000 (07:35 +0200)]
VoxelManip cleanups (const ref, const move) + function removal (#6169)

* VoxelManip cleanups (const ref, const move) permitting to improve a little bit performance

* VoxelArea: precalculate extent (performance enhancement)

This permits to reduce extend high cost to zero and drop many v3s16 object creation/removal to calculate extent
It rebalance the client thread update to updateFastFaceRow instead of MapBlockMesh generation
This will also benefits to mapgen

7 years agoCreate_schematic documentation: Update for per-node force-place
paramat [Tue, 25 Jul 2017 23:13:36 +0000 (00:13 +0100)]
Create_schematic documentation: Update for per-node force-place

The probability list has to also encode per-node force-place.

7 years agoMgv7: Add 'mount_zero_level' parameter
paramat [Mon, 24 Jul 2017 21:50:42 +0000 (22:50 +0100)]
Mgv7: Add 'mount_zero_level' parameter

Allows setting of the mountain 'zero level' (y where density gradient is zero).

It is easy to vertically shift smooth terrain by editing noise parameter 'offset',
but vertically shifting mountain terrain was complex and imprecise, involving
making a calculation based on an average of the mountain height parameter.

7 years agoMove MapEditEventAreaIgnorer to emerge.cpp
Loic Blot [Tue, 25 Jul 2017 06:39:42 +0000 (08:39 +0200)]
Move MapEditEventAreaIgnorer to emerge.cpp

It's only used in emerge threads and it's a local object, don't expose it to the whole Minetest

7 years agoNetwork protocol: Document settable player collisionbox (#6168)
Paramat [Tue, 25 Jul 2017 05:32:44 +0000 (06:32 +0100)]
Network protocol: Document settable player collisionbox (#6168)

7 years agoClouds API: change speed from 'y' to 'z', ColorSpecs in Lua docs (#6164)
Ben Deutsch [Mon, 24 Jul 2017 16:04:00 +0000 (18:04 +0200)]
Clouds API: change speed from 'y' to 'z', ColorSpecs in Lua docs (#6164)

7 years agoLBM: use range based for and fixed a loop variable overloading in applyLBMs
Loic Blot [Mon, 24 Jul 2017 06:26:19 +0000 (08:26 +0200)]
LBM: use range based for and fixed a loop variable overloading in applyLBMs

7 years agoMgv7: Add option to repeat surface biomes in floatlands
paramat [Thu, 13 Jul 2017 20:03:16 +0000 (21:03 +0100)]
Mgv7: Add option to repeat surface biomes in floatlands

7 years agoPlayer collisionbox: Make settable
TeTpaAka [Fri, 29 May 2015 18:30:55 +0000 (20:30 +0200)]
Player collisionbox: Make settable

Breaks compatibility with old clients.

7 years agoIn-cloud fog: Strengthen effect when small view range is used
Lars Hofhansl [Mon, 10 Jul 2017 13:43:06 +0000 (06:43 -0700)]
In-cloud fog: Strengthen effect when small view range is used

Ensure in-cloud fog is always stronger than outside-of-cloud-fog even when
using a small view range.
Also limit in-cloud fog range to a maximum of 32 nodes to keep it fairly
strong when using a large view range.

7 years agoWindow size: use 1024x600 to avoid a smaller UI
paramat [Mon, 17 Jul 2017 20:19:46 +0000 (21:19 +0100)]
Window size: use 1024x600 to avoid a smaller UI

The change from 800x600 to 1024x576 (16:9) was a reduction in height which caused
user interface to become smaller.
Continue to use width 1024 as it is a common small screen width.

7 years ago[CSM] Add flavour limits controlled by server (#5930)
Loïc Blot [Tue, 18 Jul 2017 19:39:55 +0000 (21:39 +0200)]
[CSM] Add flavour limits controlled by server (#5930)

* [CSM] Add flavour limits controlled by server

Server send flavour limits to client permitting to disable or limit some Lua calls

* Add limits for reading nodedefs and itemdefs

* flavour: Add lookup node limits

* Merge get_node_or_nil into get_node.

Sending fake node doesn't make sense in CSM, just return nil if node is not available for any reason

* Add node range customization when noderange flavour is enabled (default 8 nodes)

* Limit nodes range & disable chat message sending by default

* Bump protocol version

7 years agoCopy lua51.dll (luajit) to bindir (#6148)
adrido [Tue, 18 Jul 2017 19:29:23 +0000 (21:29 +0200)]
Copy lua51.dll (luajit) to bindir (#6148)

7 years agoLBM content mapping map doesn't need to be ordered, use std::unordered_map
Loic Blot [Tue, 18 Jul 2017 06:23:37 +0000 (08:23 +0200)]
LBM content mapping map doesn't need to be ordered, use std::unordered_map

Also rename helper to lbm_map instead of container_map

7 years agoVery little performance fix on correctBlockNodeIds
Loic Blot [Tue, 18 Jul 2017 06:18:13 +0000 (08:18 +0200)]
Very little performance fix on correctBlockNodeIds

+ C++11 codestyle

7 years agoMgfractal: Improve spawning behaviour
paramat [Mon, 17 Jul 2017 16:27:35 +0000 (17:27 +0100)]
Mgfractal: Improve spawning behaviour

Spawn player 1 node higher to avoid spawning waist-deep in a possible
biome 'dust' node, such as tundra snowblock.
Tune default offset to spawn players in a more interesting location on the
mandelbrot sets, on a raised area that looks like a spawn platform.
Tune julia parameters to help avoid spawn search failing, especially for
fractal 6.

7 years agoMesh generation: Fix performance regression caused by 'plantlike_rooted' PR
number Zero [Sun, 16 Jul 2017 20:43:01 +0000 (23:43 +0300)]
Mesh generation: Fix performance regression caused by 'plantlike_rooted' PR

Regression caused by ef285b2815962a7a01791059ed984cb12fdba4dd

7 years agoChat: Move chat text down to not overlap 3rd line of debug text (#6145)
Paramat [Mon, 17 Jul 2017 11:53:14 +0000 (12:53 +0100)]
Chat: Move chat text down to not overlap 3rd line of debug text (#6145)