Commit Graph

67 Commits

Author SHA1 Message Date
sfan5 bc4ab8b99e General code refactoring/improvements in server, treegen and connection 2024-03-20 16:37:32 +01:00
sfan5 dfba79f8ff Split servermap.cpp/h off from map.cpp/h 2024-03-20 16:37:32 +01:00
sfan5 178943b4b7 Improve ServerEnvironment::getRemovedActiveObjects() in many ways 2024-03-20 16:37:32 +01:00
sfan5 8339594206 Handle static_save changes at runtime and between restarts 2024-03-17 15:55:24 +01:00
sfan5 ef0009aea7 Sort out server destruction order
fixes #14421
2024-03-17 15:55:24 +01:00
SmallJoker 32f68f35cf
Avoid packets getting sent to disconnected players (#14444)
Many functions expect RemotePlayer to have a valid peer ID,
this however is not the case immediately after disconnecting
where the object is still alive and pending for removal.

ServerEnvironment::getPlayer(const char *, bool) now only
returns players that are connected unless forced to.
2024-03-10 13:24:35 +01:00
Lars Müller bf52d1e624
Fix attached sounds stopping if objects are removed serverside (#14436)
Restores backwards compatibility for death sounds or other sounds that are not supposed to be "cut off" abruptly.

---------

Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: grorp <gregor.parzefall@posteo.de>
2024-03-06 20:36:02 +01:00
sfan5 5d8a22066c
Change how max_lag is calculated and reported (#14378)
-Change how max_lag is calculated and reported

- Cap singleplayer step at 60Hz

- Clarify dedicated_server_step
2024-02-26 20:46:57 +01:00
sfence 63a9853811
Remove attached sounds when the active object is removed (#14341) 2024-02-25 22:10:39 +00:00
SmallJoker e7dbd325d2
RemotePlayer: make peer ID always reflect the validity of PlayerSAO (#14317)
Upon disconnect, RemotePlayer still had a peer ID assigned even though
the PlayerSAO object was maked as gone (for removal). This commit makes
that the following always holds true:

	(!sao || sao->isGone()) === (peer_id == PEER_ID_INEXISTENT)
2024-02-02 22:13:24 +01:00
cx384 5958714309
Tool specific pointing and blocking pointable type (#13992) 2024-01-22 18:27:08 +01:00
lhofhansl c99196d363
Do not emerge blocks in the active_object_send_range_blocks range (#14152)
The active object range is about active objects (not blocks). Activate blocks (and hence any object "in" them) in the cone define by the active object range (and fov) when they are loaded (i.e. visible), otherwise ignore them.
2023-12-29 14:18:06 -08:00
SmallJoker a7e5456099
Server: avoid re-use of recent ParticleSpawner and Sound IDs (#14045)
This improves the reliability when removing and re-adding handles quickly.
Looping through the entire ID range avoids collisions caused by any race condition.
2023-11-29 21:10:19 +01:00
DS 11ec75c2ad
ActiveObjectMgr fixes (#13560) 2023-10-09 17:13:04 +02:00
Desour 8b73743baa Reduce number of recursively included headers
This should improve compilation speed.

Things changed:
* Prefer forward-declarations in headers.
* Move header-includes out of headers if possible.
* Move some functions definitions out of headers.
* Put some member variables into unique_ptrs (see Client).
2023-04-27 18:50:33 +02:00
Jude Melton-Houghton 5c248c2d7d Add callback on_mapblocks_changed 2022-12-24 08:24:59 -05:00
sfan5 37386b9c3c
Expose dtime_s to LBM handler 2022-12-04 12:35:14 +01:00
lhofhansl 1a045da0dd
Reduce active mgmt interval for a bit when a player joins. (#12925) 2022-11-10 15:25:38 -08:00
savilli 907dcdcf7b
Add unittests for item movement code (#11885) 2022-09-27 16:22:11 -04:00
sfan5 c1d03695d4 Minor code improvements around active block keeping 2022-05-29 14:00:19 +02:00
sfan5 ea74680df4 Immediately activate blocks when a player joins
issue: #10884
This makes it possible for objects to immediately be activated,
but doesn't guarantee it since blocks may still need be emerged.
2022-05-29 14:00:19 +02:00
sfan5 f5a8593b11
Add more Prometheus metrics (#12274) 2022-05-09 21:20:58 +02:00
sfence b10091be9b
Add min_y and max_y checks for Active Block Modifiers (ABM) (#11333)
This check can be used by ABM to reduce CPU usage.
2021-06-20 17:21:35 +02:00
SmallJoker c9144ae5e2
Add core.compare_block_status function (#11247)
Makes it possible to check the status of the mapblock in a future-extensible way.
2021-05-30 20:24:12 +02:00
rubenwardy 4c76239818
Remove dead code (#10845) 2021-01-22 15:09:26 +00:00
Elias Fleckenstein 9250b5205a
Add minetest.get_objects_in_area (#10668) 2020-12-29 16:50:09 +01:00
HybridDog 2f4037752b
Add minetest.get_artificial_light and minetest.get_natural_light (#5680)
Add more detailed light detection functions, a function to get the artificial light (torches) and a function to get the sunlight as seen by the player (you can specify timeofday).

Co-authored-by: rubenwardy <rw@rubenwardy.com>
2020-10-06 20:49:46 +02:00
rubenwardy 6e4d8de104 Revert "Verify database connection on interval (#9665)"
Fixes #10113

This reverts commit 5c588f89e7.
2020-07-07 17:50:52 +01:00
sfan5 471e567657 Value copy / allocation optimizations mostly in server, SAO and serialize code 2020-05-27 21:58:40 +02:00
sfan5 650168cada Fix Server triggering wrong errors if environment init fails 2020-05-07 22:02:22 +02:00
Loïc Blot e8ac5a31cf
Optimize get_objects_inside_radius calls (#9671)
* Optimize getObjectsInsideRadius calls

our previous implementation calls the ActiveObjectMgr to return ids and then lookup those ids in the same map and test each object
Instead now we call the global map to return the pointers directly and we ask filtering when building the list using lamba.

This drop double looping over ranges of active objects (and then filtered one) and drop x lookups on the map regarding the first call results
2020-04-16 08:25:48 +02:00
Loïc Blot 5c588f89e7
Verify database connection on interval (#9665) 2020-04-15 08:01:11 +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
sfan5 054c5dfaa3 scriptapi: Sort out ServerEnvironment / Environment distinction properly
The API implementation is shared between CSM and SSM.
Functions should retrieve a plain env when they do not
need any server-specific functions.
2020-04-11 13:12:51 +02:00
sfan5 0b8d3f99a5 Move core.get_connected_players() implementation to C++
Keeping the ObjectRefs around in a table isn't ideal and this allows
removing the somewhat nonsensical is_player_connected() added in 86ef7147.
2020-02-23 22:24:12 +01:00
Lars Hofhansl 0971a14a57 Improve ABM time budget handling. #8645 2019-07-07 23:23:00 -07:00
Loïc Blot 70672e1cb7
Force player save before kicking on player shutdown (#8157) 2019-02-03 09:11:45 +01:00
Loïc Blot eda35100b6
Add an activeobject manager to hold active objects (#7939)
* Add an activeobject manager to hold active objects
* Add unittests
2018-12-13 20:18:54 +01:00
Ben Deutsch 153fb211ac Replace auth.txt with SQLite auth database (#7279)
* Replace auth.txt with SQLite auth database
2018-08-05 13:13:38 +02:00
lhofhansl 94cd2bfeac Revert 6587 - Optimize entity-entity collision (#7539) 2018-07-08 21:30:55 +01:00
Vitaliy 528908a4c3 Optimize entity-entity collision (#6587)
* Add IrrLicht type aliases
* Add hash for IrrLicht vector
* Add object map
2018-04-03 08:23:46 +02:00
Loic Blot 95ce5583a9
ServerEnvironment::loadDefaultMeta: Loading default meta is only possible for ServerEnv itself 2018-03-16 08:52:42 +01:00
Loic Blot 12d1e4ff04 VoxelArea: add_{x,y,z,p} must be static
Fix some documentations issues
Use getNodeNoCheck(v3s16, ...) in some cases instead of getNodeNoCheck(x, y, z, ...)
2018-03-09 23:27:26 +01:00
Loic Blot 2c860a6a42 ServerEnvironment & StaticObject cleanups
* isFreeServerActiveObjectId is now part of ServerEnvironment
* getFreeServerActiveObjectId is now part of ServerEnvironment
* StaticObject constructor now take ServerActiveObject instead of type + string. This permits to remove a big string copy in some code parts
2018-03-09 23:27:26 +01:00
Lars Hofhansl fad263dec9 Revert "Add an active object step time budget #6721"
This reverts commit 9c669016d1.
See #6907
2018-01-12 23:47:39 -08:00
Dániel Juhász 2153965cf9 Line_of_sight: Improve using VoxelLineIterator
This commit rewrites line_of_sight with VoxelLineIterator.
Stepsize is no longer needed, the results will be always accurate.
2017-12-26 21:51:32 +00:00
Lars Hofhansl 9c669016d1 Add an active object step time budget #6721
This can be set via the active_object_interval option.
2017-12-06 12:21:54 -08:00
Lars Hofhansl 5a03b1f5f9 Optionally extend the active object in a players camera direction.
See #6667

By setting active_object_send_range_blocks > active_block_range a server admin
can allow clients to retrieve active objects futher out from the player at
relatively low cost to the server
(only objects in the players' view cone are considered).
2017-12-03 17:52:05 -08: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
sfan5 04839f233f ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
2017-09-15 12:19:01 +02:00