aboutsummaryrefslogtreecommitdiff
path: root/src/server.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Sounds: Various little improvements (#12486)SmallJoker2022-07-091-5/+1
| | | | | Use SimpleSoundSpec where reasonable (OpenAL) Ensure the sound IDs do not underflow or get overwritten -> loop in u16 Proper use of an enum.
* Re-order sound-related code (#12382)SmallJoker2022-06-201-13/+8
| | | | | | | | Dropped ServerSoundParams -> moved to ServerPlayingSound. This gets rid of the duplicated 'fade' and 'pitch' values on server-side where only one was used anyway. SimpleSoundSpec is the basic sound without positional information, hence 'loop' is included. Recursively added PROTOCOL_VERSION to most functions to reduce the versioning mess in the future. Per-type version numbers are kept for now as a safety rope in a special case.
* No damage effects on hp_max change (#11846)Lars Müller2022-06-111-2/+2
|
* Optimize Server::sendMetadataChanged a bitsfan52022-05-291-1/+1
| | | | The distance check also never worked as intended, now fixed.
* Add API function to invoke player respawnsfan52022-05-291-1/+2
| | | | closes #12272
* Fix hash implementation for SerializedBlockCachesfan52022-05-231-3/+2
|
* Use native packer to transfer globals into async env(s)sfan52022-05-101-2/+3
|
* Add more Prometheus metrics (#12274)sfan52022-05-091-2/+2
|
* Cache serialized mapblocks during sendingsfan52022-05-081-1/+13
| | | | | | | This reduces the (absolute) time spent in Server::SendBlocks() from 700ms to 300ms (relative) share of MapBlock::serialize() from 80% to 60% in a test setup with 10 players and many block changes
* Async environment for mods to do concurrent tasks (#11131)sfan52022-05-021-1/+7
|
* Refactor some Lua API functions in preparation for async envsfan52022-05-021-2/+1
|
* Clean up some auth packet handling related codesfan52022-04-281-4/+1
|
* Add API to control shadow intensity from the game/mod (#11944)x20482022-03-261-0/+4
| | | * Also Disable shadows when sun/moon is hidden. Fixes #11972.
* Don't call on_dieplayer callback two times (#11874)savilli2022-01-151-3/+3
|
* Use a database for mod storage (#11763)Jude Melton-Houghton2022-01-071-1/+10
|
* Clean up/improve some scriptapi error handling codesfan52021-09-101-0/+4
|
* Dynamic_Add_Media v2 (#11550)sfan52021-09-091-3/+19
|
* Server: properly delete ServerMap on interrupted startupsSmallJoker2021-02-051-0/+4
| | | | A static mod error (e.g. typo) would abort the initialization but never free ServerMap
* Drop wide/narrow conversion functionssfan52021-02-021-5/+3
| | | | | | | | | The only valid usecase for these is interfacing with OS APIs that want a locale/OS-specific multibyte encoding. But they weren't used for that anywhere, instead UTF-8 is pretty much assumed when it comes to that. Since these are only a potential source of bugs and do not fulfil their purpose at all, drop them entirely.
* Revise dynamic_add_media API to better accomodate future changessfan52021-02-011-1/+1
|
* Cache client IP in RemoteClient so it can always be retrieved (#10887)sfan52021-01-311-3/+12
| | | specifically: after the peer has already disappeared
* Settings: Proper priority hierarchySmallJoker2021-01-291-0/+1
| | | | | | | | | | | Remove old defaults system Introduce priority-based fallback list Use new functions for map_meta special functions Change groups to use end tags Unittest changes: * Adapt unittest to the new code * Compare Settings objects
* Remove dead code (#10845)rubenwardy2021-01-221-3/+0
|
* Minimap as HUD element with API controlPierre-Yves Rollo2020-10-041-0/+12
| | | | | | | Features: * Define Minimap available modes (surface/radar, scale) from Lua, using player:set_minimap_modes() * New HUD elements for displaying minimap with custom size and placing * New minimap mode for displaying a texture instead of the map
* Clean up server-side translations, remove global variable (#10075)rubenwardy2020-09-161-2/+5
|
* Properly handle mod-errors in on_shutdownDesour2020-08-241-1/+6
|
* Server pushing media at runtime (#9961)sfan52020-06-131-0/+4
|
* Cleanup of particle & particlespawner structures and code (#9893)sfan52020-05-221-33/+9
|
* Server class code cleanups (#9769)Loïc Blot2020-05-071-23/+10
| | | | | | | | | | | | | | | | | | | * Server::overrideDayNightRatio doesn't require to return bool There is no sense to sending null player, the caller should send a valid object * Server::init: make private & cleanup This function is always called before start() and loads some variables which can be loaded in constructor directly. Make it private and call it directly in start * Split Server inventory responsibility to a dedicated object This splits permit to found various historical issues: * duplicate lookups on player connection * sending inventory to non related player when a player connects * non friendly lookups on detached inventories ownership This reduce the detached inventory complexity and also increased the lookup performance in a quite interesting way for servers with thousands of inventories.
* Add MetricsBackend with prometheus counter supportLoic Blot2020-04-291-6/+15
|
* Add server side translations capability (#9733)EvidenceB Kidscode2020-04-251-1/+4
| | | | * Add server side translations capability
* serverpackethandler: Reduce pkt->getPeerId() invocations and more (#9689)HybridDog2020-04-181-1/+0
|
* set_sky improvements, set_sun, set_moon and set_starsJordach2020-03-051-6/+13
|
* Improve core.sound_play with ephemeral sounds and player exclusionsfan52020-02-011-2/+5
|
* Fix some reference counters (memleak) (#8981)SmallJoker2019-09-241-1/+1
| | | | | Fix some reference counters (memleak) Map::dispatchEvent: Allocation safety using references
* Add support for per-player FOV overrides and multipliersAnand S2019-09-191-5/+4
|
* Send ActiveObjects once right after Init2ANAND2019-09-141-1/+1
|
* Send cumulated inventory changes only each step (#8856)SmallJoker2019-09-091-2/+3
| | | | Applies to player and detached inventories
* Inventory: Send dirty lists where appropriate (#8742)SmallJoker2019-08-241-1/+1
| | | | | This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time. Raises protocol version to 38 to ensure correct backwards-compatible code.
* Implement adding velocity to player from Luasfan52019-08-101-0/+1
| | | | The intended usecase is knockback, but there's potential for more.
* Optimize string (mis)handling (#8128)Jozef Behran2019-05-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Optimize statbar drawing The texture name of the statbar is a string passed by value. That slows down the client and creates litter in the heap as the content of the string is allocated there. Convert the offending parameter to a const reference to avoid the performance hit. * Optimize texture cache There is an unnecessary temporary created when the texture path is being generated. This slows down the cache each time a new texture is encountered and it needs to be loaded into the cache. Additionally, the heap litter created by this unnecessary temporary is particularly troublesome here as the following code then piles another string (the resulting full path of the texture) on top of it, followed by the texture itself, which both are quite long term objects as they are subsequently inserted into the cache where they can remain for quite a while (especially if the texture turns out to be a common one like dirt, grass or stone). Use std::string.append to get rid of the temporary which solves both issues (speed and heap fragmentation). * Optimize animations in client Each time an animated node is updated, an unnecessary copy of the texture name is created, littering the heap with lots of fragments. This can be specifically troublesome when looking at oceans or large lava lakes as both of these nodes are usually animated (the lava animation is pretty visible). Convert the parameter of GenericCAO::updateTextures to a const reference to get rid of the unnecessary copy. There is a comment stating "std::string copy is mandatory as mod can be a class member and there is a swap on those class members ... do NOT pass by reference", reinforcing the belief that the unnecessary copy is in fact necessary. However one of the first things the code of the method does is to assign the parameter to its class member, creating another copy. By rearranging the code a little bit this "another copy" can then be used by the subsequent code, getting rid of the need to pass the parameter by value and thus saving that copying effort. * Optimize chat console history handling The GUIChatConsole::replaceAndAddToHistory was getting the line to work on by value which turns out to be unnecessary. Get rid of that unnecessary copy by converting the parameter to a const reference. * Optimize gui texture setting The code used to set the texture for GUI components was getting the name of the texture by value, creating unnecessary performance bottleneck for mods/games with heavily textured GUIs. Get rid of the bottleneck by passing the texture name as a const reference. * Optimize sound playing code in GUIEngine The GUIEngine's code receives the specification of the sound to be played by value, which turns out to be most likely a mistake as the underlying sound manager interface receives the same thing by reference. Convert the offending parameter to a const reference to get rid of the rather bulky copying effort and the associated performance hit. * Silence CLANG TIDY warnings for unit tests Change "std::string" to "const std::string &" to avoid an unnecessary local value copy, silencing the CLANG TIDY process. * Optimize formspec handling The "formspec prepend" parameter was passed to the formspec handling code by value, creating unnecessary copy of std::string and slowing down the game if mods add things like textured backgrounds for the player inventory and/or other forms. Get rid of that performance bottleneck by converting the parameter to a const reference. * Optimize hotbar image handling The code that sets the background images for the hotbar is getting the name of the image by value, creating an unnecessary std::string copying effort. Fix that by converting the relevant parameters to const references. * Optimize inventory deserialization The inventory manager deserialization code gets the serialized version of the inventory by value, slowing the server and the client down when there are inventory updates. This can get particularly troublesome with pipeworks which adds nodes that can mess around with inventories automatically or with mods that have mobs with inventories that actively use them. * Optimize texture scaling cache There is an io::path parameter passed by value in the procedure used to add images converted from textures, leading to slowdown when the image is not yet created and the conversion is thus needed. The performance hit is quite significant as io::path is similar to std::string so convert the parameter to a const reference to get rid of it. * Optimize translation file loader Use "std::string::append" when calculating the final index for the translation table to avoid unnecessary temporary strings. This speeds the translation file loader up significantly as std::string uses heap allocation which tends to be rather slow. Additionally, the heap is no longer being littered by these unnecessary string temporaries, increasing performance of code that gets executed after the translation file loader finishes. * Optimize server map saving When the directory structure for the world data is created during server map saving, an unnecessary value passing of the directory name slows things down. Remove that overhead by converting the offending parameter to a const reference.
* Force send a mapblock to a player (#8140)sofar2019-04-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Force send a mapblock to a player. Send a single mapblock to a specific remote player. This is badly needed for mods and games where players are teleported into terrain which may be not generated, loaded, or modified significantly since the last player visit. In all these cases, the player currently ends up in void, air, or inside blocks which not only looks bad, but has the effect that the player might end up falling and then the server needs to correct for the player position again later, which is a hack. The best solution is to send at least the single mapblock that the player will be teleported to. I've tested this with ITB which does this all the time, and I can see it functioning as expected (it even shows a half loaded entry hallway, as the further blocks aren't loaded yet). The parameter is a blockpos (table of x, y, z), not a regular pos. The function may return false if the call failed. This is most likely due to the target position not being generated or emerged yet, or another internal failure, such as the player not being initialized. * Always send mapblock on teleport or respawn. This avoids the need for mods to send a mapblock on teleport or respawn, since any call to `player:set_pos()` will pass this code.
* Optimize interaction distance checker (#8193)Jozef Behran2019-03-071-1/+1
| | | | | The "what" parameter is being passed by value, most likely by accident as the type is "const std::string". Convert it to a reference by adding the missing "&".
* Send only changed node metadata to clients instead of whole mapblock (#5268)SmallJoker2018-12-041-0/+3
| | | | | | | Includes newer style changes and fixes by est31 Improve the block position de-serialization Add type NodeMetadataMap
* Add core.remove_detached_inventory (#7684)SmallJoker2018-10-101-1/+3
| | | | Breaks backwards compatibility for good Bump protocol version
* Particles: Make collision with objects optional (#7682)Paramat2018-09-081-4/+4
| | | | | | Also set it to false for node dig particles, as they are often created and high in number. Improve particle documentation.
* Check node updates whether the blocks are known (#7568)SmallJoker2018-08-161-5/+5
| | | * Remove unused ignore_id
* Rename CSM flavours to restrictionsSmallJoker2018-06-261-4/+4
| | | | & Satisfy LINT
* Remove Server::m_ignore_map_edit_events (noop)Loic Blot2018-06-151-6/+0
|
* Server: move shutdown parts to a specific shutdown state object (#7437)Loïc Blot2018-06-131-7/+21
| | | | * Server: move shutdown parts to a specific shutdown state object