Commit Graph

93 Commits

Author SHA1 Message Date
sfan5 123370f2ee Sanitize lang_code and full_version received from client
fixes #14262
2024-03-24 20:25:49 +00:00
sfan5 c3114132d3
Improve readability and infos in verbose log (#13828) 2023-09-22 18:41:10 +02:00
lhofhansl 869df17ddf
Server enforcement for fog_distance (#13448) to block cheating (#13643)
This enforces the fog_distance (if set) at the server, so that a hacked client could not cheat and retrieve blocks beyond the set distance.
2023-07-06 09:36:46 -07:00
sfan5 442d5fc75c Add unit tests for isBlockInSight() 2023-06-26 22:51:49 +02:00
lhofhansl a8ec6092e2
Load blocks and objects behind player when in third-persion front-view (#13431) 2023-05-29 10:26:42 -07:00
lhofhansl 48fc286a95
Restart map-send cycle if visible blocks are soon to be unloaded. (#13277)
* Restart map-send cycle if visible blocks are soon to be unloaded.
* Reset completion timer when camera or position changed.

Co-authored-by: sfan5 <sfan5@live.de>
2023-03-30 09:19:13 -07:00
lhofhansl 1f0d042377
Reduce server CPU consumed by occlusion culling. (#13260)
Cache blocks already occluded at a specific distance. The RemoteClient typically visits the same distance multiple time - especially at larger distances, so this saves significant CPU from recalculating the occlusion state of blocks.
2023-03-05 21:33:41 -08:00
lhofhansl dcf6a6a67b
Log server map send cycle time. (#13259)
* Measure server map send time per player.
2023-03-03 17:41:30 -08:00
lhofhansl fbbdae93ee
Fix for #13255: Check if client has a block even if the server has unloaded it. (#13256) 2023-02-27 09:57:03 -08:00
lhofhansl fe3ea090d1
Don't expire blocks visible to the client. (#13255) 2023-02-26 14:18:18 -08:00
Jude Melton-Houghton 8f996e4a7c Remove unused MapBlock functionality 2022-10-09 13:43:48 -04:00
sfan5 a65f6f07f3 Clean up some auth packet handling related code 2022-04-28 20:05:26 +02:00
sfan5 00f71c3b9d Fix password changing getting stuck if wrong password is entered once 2022-04-28 19:55:36 +02:00
SmallJoker ecc6f4ba25
Remove a few unused functions reported by callcatcher (#11658) 2021-10-12 20:12:20 +02:00
sfan5 f0bad0e2ba
Reserve vectors before pushing and other code quality changes (#11161) 2021-04-05 13:38:31 +02:00
sfan5 112a6adb10
Cache client IP in RemoteClient so it can always be retrieved (#10887)
specifically: after the peer has already disappeared
2021-01-31 20:36:47 +01:00
Lars 8c1871fa2c Revert #10495 and simplify. 2020-11-07 08:51:10 -08:00
Lars 39213bd00a Slight simplification and optimization of RemoteClient. 2020-11-03 16:23:47 -08:00
Lars 68cd93b865 Avoid resending near blocks unnecessarily. 2020-10-27 12:08:44 -07:00
Lars f43d1cfa81 Rely on max_simultaneous_block_sends_per_client to limit blocks sent to the client. 2020-10-13 19:39:43 -07:00
Jordan Snelling 3068853e8a
Add First Person Attachments (#10360)
Fixes some other third person camera specific attachments.
Implements a single new flag for entities to be forced visible in first person mode.
Old mods do not need to be updated to use the new flag and are fully backwards compatible.
2020-10-04 15:10:34 +02:00
sfan5 5430770b68 Fix constant re-queueing of emerges that will always be unsuccessful 2020-05-24 11:48:33 +02:00
Loic Blot 5146086a64 Drop content_sao.{cpp,h}
Move LuaEntitySAO to a new dedicated file
Drop TestSAO (useless object)
Drop the old static startup initialized SAO factory, which was pretty useless.
This factory was using a std::map for 2 elements, now just use a simple condition owned by ServerEnvironment, which will be lightweight, that will also drop a one time useful test on each LuaEntitySAO creation. This should reduce server load on massive SAO creation
2020-04-11 16:07:17 +02:00
Loic Blot 894a34aef4 Move PlayerSAO to dedicated files 2020-04-11 16:07:17 +02:00
SmallJoker d73e458db6
ClientInterface: Use recursive mutex to prevent freeze in on_newplayer() (#8808) 2019-08-17 13:27:28 +02:00
CoderForTheBetter faa358e797 Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)
* Adds Lua methods 'set_rotation()' and 'get_rotation'. Also changed some method names to be more clear. Instead of an f32 being sent over network for yaw, now a v3f is sent for rotation on xyz axes. Perserved Lua method set_yaw/setyaw so that old mods still work, other wise to set yaw they would need to switch to set_rotation(0, yaw, 0).
2018-11-28 09:38:50 +01:00
Lars Hofhansl ba7cf30df9 Reduce block load glitches
See #7542
This reduces glitches in deep water and underground caves.
2018-07-12 00:54:00 -07:00
lhofhansl 03edcafdda Zoom: Correctly verify client passed zoom at the server (#7526)
Fixes generation of distant world when not zooming in creative mode
(in creative mode zoom FOV is 15 degrees).
2018-07-03 00:16:17 +01:00
Lars Hofhansl a1868e8f6c Use server's zoom fov for distant world loading. 2018-05-15 18:49:11 -07:00
Paramat 28813702d6
FOV: Raise lower limit to avoid zoom-loading of distant world (#7234)
In the client, raise lower limit from 30 to 45 degrees, to avoid server
seeing this as a zoom and loading world beyond the server-set limit.
Add minimum in settingtypes.txt and enforce lower limit when set using
minetest.conf.

In the server, distrust the client-sent FOV if below the heuristic zoom
threshold and use the player object property 'zoom_fov' to check it, to
protect against hacked clients.
2018-04-15 21:56:05 +01:00
Loic Blot 6036f865cb Drop less performant Server::setBlockNotSent for ClientInterface::markBlockposAsNotSent 2018-03-09 23:27:26 +01:00
Lars Hofhansl f4fedfed07 Turn off verbose info message introduced accidentally with ae9b1aa 2017-11-29 22:55:37 -08:00
Lars Hofhansl ae9b1aa177 Allow zoom to actually show more data.
This allows the client to retrieve blocks at a greater distance
from the server, thus allowing for a real zoom.
2017-11-15 22:03:58 -08:00
Lars Hofhansl 0732bf73a4 Reduce server FOV with forward speed
This causes blocks in front of the player to be rendered sooner and
blocks in the periphal view (that would soon be out of view) a bit later.
Overall this leads to smoother rendering as the player is moving around.
2017-10-25 23:13:06 -07:00
Lars Hofhansl cdedaac5e2 Set range of blocks to retrieve per roundtrip to 2.
This is a small, partial revert of #6483, which had set this to 1.
2017-10-19 09:47:58 -07:00
lhofhansl 6bab695479 Cache server config settings. (#6530)
* Cache server config settings.
2017-10-15 09:32:17 +02:00
Lars Hofhansl b97b9a550f Retrieve a small cone of blocks in the direction of the players velocity.
This helps retrieving the right set of blocks when the player is falling,
traveling on cart, or in general traveling in a direction different from
the view direction.
2017-10-13 20:43:58 -07:00
Loic Blot 27eeb3581f
Fix some forgotten u16 -> session_t in ad7daf7b52 2017-09-27 23:48:12 +02:00
Loïc Blot ad7daf7b52 Add session_t typedef + remove unused functions (#6470)
* Add session_t typedef + remove unused functions

u16 peer_id is used everywhere, to be more consistent and permit some evolutions on this type in the future (i'm working on a PoC), uniformize u16 peer_id to SessionId peer_id
2017-09-27 19:47:36 +02:00
SmallJoker 5e141ac920 Network: Fix logging into older worlds with base64 hashes 2017-09-12 20:26:03 +02:00
SmallJoker ee9a442ecc Network: Remove large parts of deprecated legacy code (#6404)
Also remove the setting 'send_pre_v25_init'
Keep old enum entries for obsolete commands
2017-09-12 19:48:09 +02:00
Loïc Blot bd6b90359c Remove DSTACK support (#6346)
Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
2017-08-30 08:09:41 +02:00
Loïc Blot c7160cb629 Network cleanup (#6302)
* Cleanup network headers

* Move peerhandler to a specific header to reduce compilation times
* Move socket.cpp/h to network folder

* More work

* Network code cleanups

* Move socket.{cpp,h} to network folder
* Move Address object to network/address.{cpp,h}
* Move network exceptions to network/networkexceptions.h
* Client: use unique_ptr for Connection
* Server/ClientIface: use shared_ptr for Connection

* Format fixes

* Remove socket.cpp socket.h from clang-format whitelist

* Also fix NetworkPacket code style & make it under clang-format
2017-08-24 08:28:54 +02:00
Loïc Blot ae9b5e0098 Modernize code: very last fixes (#6290)
Last modernization fixes
2017-08-20 19:37:29 +02:00
Loïc Blot 1d8d01074f 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)
2017-08-16 23:48:29 +02:00
Loïc Blot 85511a642f Cleanup various headers to reduce compilation times (#6255)
* Cleanup various headers to reduce compilation times
2017-08-16 22:11:45 +02:00
Loic Blot 3eb9ff555f
Player::getSpeed/setSpeed use const refs 2017-08-14 10:56:06 +02:00
Loïc Blot 7ddf67aa14 Chat protocol rewrite (#5117)
* New TOCLIENT_CHAT_MESSAGE packet

* Rename old packet to TOCLIENT_CHAT_MESSAGE_OLD for compat
* Handle TOCLIENT_CHAT_MESSAGE new structure client side
* Client chat queue should use a specific object
* SendChatMessage: use the right packet depending on protocol version (not complete yet)
* Add chatmessage(type) objects and handle them client side (partially)
* Use ChatMessage instead of std::wstring server side

* Update with timestamp support
2017-07-16 10:47:31 +02:00
Loïc Blot 8f7785771b Cpp11 initializers 2 (#5999)
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +02:00
Loïc Blot a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00