summaryrefslogtreecommitdiff
path: root/src/server.h
Commit message (Collapse)AuthorAge
* Server: properly delete ServerMap on interrupted startupsSmallJoker2021-02-05
| | | | A static mod error (e.g. typo) would abort the initialization but never free ServerMap
* Drop wide/narrow conversion functionssfan52021-02-02
| | | | | | | | | 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-01
|
* Cache client IP in RemoteClient so it can always be retrieved (#10887)sfan52021-01-31
| | | specifically: after the peer has already disappeared
* Settings: Proper priority hierarchySmallJoker2021-01-29
| | | | | | | | | | | 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-22
|
* Minimap as HUD element with API controlPierre-Yves Rollo2020-10-04
| | | | | | | 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-16
|
* Properly handle mod-errors in on_shutdownDesour2020-08-24
|
* Server pushing media at runtime (#9961)sfan52020-06-13
|
* Cleanup of particle & particlespawner structures and code (#9893)sfan52020-05-22
|
* Server class code cleanups (#9769)Loïc Blot2020-05-07
| | | | | | | | | | | | | | | | | | | * 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-29
|
* Add server side translations capability (#9733)EvidenceB Kidscode2020-04-25
| | | | * Add server side translations capability
* serverpackethandler: Reduce pkt->getPeerId() invocations and more (#9689)HybridDog2020-04-18
|
* set_sky improvements, set_sun, set_moon and set_starsJordach2020-03-05
|
* Improve core.sound_play with ephemeral sounds and player exclusionsfan52020-02-01
|
* Fix some reference counters (memleak) (#8981)SmallJoker2019-09-24
| | | | | Fix some reference counters (memleak) Map::dispatchEvent: Allocation safety using references
* Add support for per-player FOV overrides and multipliersAnand S2019-09-19
|
* Send ActiveObjects once right after Init2ANAND2019-09-14
|
* Send cumulated inventory changes only each step (#8856)SmallJoker2019-09-09
| | | | Applies to player and detached inventories
* Inventory: Send dirty lists where appropriate (#8742)SmallJoker2019-08-24
| | | | | 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-10
| | | | The intended usecase is knockback, but there's potential for more.
* Optimize string (mis)handling (#8128)Jozef Behran2019-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-07
| | | | | 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-04
| | | | | | | 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-10
| | | | Breaks backwards compatibility for good Bump protocol version
* Particles: Make collision with objects optional (#7682)Paramat2018-09-08
| | | | | | 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-16
| | | * Remove unused ignore_id
* Rename CSM flavours to restrictionsSmallJoker2018-06-26
| | | | & Satisfy LINT
* Remove Server::m_ignore_map_edit_events (noop)Loic Blot2018-06-15
|
* Server: move shutdown parts to a specific shutdown state object (#7437)Loïc Blot2018-06-13
| | | | * Server: move shutdown parts to a specific shutdown state object
* Add online content repositoryrubenwardy2018-04-19
| | | | Replaces mods and texture pack tabs with a single content tab
* Client eventmanager refactor (#7179)Loïc Blot2018-03-30
| | | | | | | | | | | | | | | | | | | | | * Drop EventManager from GameDef & do some client cleanups * EventManager is only used by Client. Don't expose it on Server & GameDef for nothing * Drop Client::event() in favor of direct calls to getEventManager * Cleanup some event put from new + put to put(new) * MtEvent: add Type(u8) enum * This will enhance event performance & ensure stricter type * Drop MtEvent::checkIs (unused) * clang-tidy reported fixes * Code style * Move event_manager.h to the client directory as it's only used by client Add EventManager unittests + switch to unordered_map as order is not important here Drop a unused function
* Add reasons to on_dieplayer and on_hpchangeAndrew Ward2018-03-28
|
* Add formspec theming using prepended stringsAndrew Ward2018-03-28
|
* Drop Server::m_enable_rollback_recording it's only used in server constructorLoic Blot2018-03-16
|
* Forgot to remove obsolete Server::m_modsLoic Blot2018-03-16
|
* Server: delegate mod management & config to ServerModConfiguration (#7131)Loïc Blot2018-03-16
| | | | | | | | * Server: delegate mod management & config to ServerModConfiguration (rename it to ServerModManager) * Use c++11 range based loops * Add unittests + experimental/default mod as a test case to permit testing mod loading in future tests
* Drop unused Server::m_ignore_map_edit_events_peer_idLoic Blot2018-03-09
|
* Drop less performant Server::setBlockNotSent for ↵Loic Blot2018-03-09
| | | | ClientInterface::markBlockposAsNotSent
* Cleanup & bugfixLoic Blot2018-03-08
| | | | | | | | * ObjectRef::set_local_animation: fix wrong lua return (should push a boolean, currently returns nil) * ObjectRef::set_eye_offset: fix wrong lua return (should push a boolean, currently returns nil) * Fix various Server functions which depends on RemotePlayer objet and return true/false when player object is nil whereas it's a caller implementation error. Change those bool functions to void and add sanitize_check call instead. Current callers are always checking player object validity * Optimize Server::setClouds : use CloudParams object ref instead of attribute deserialization from structure & perform RemotePlayer::setCloudParams directly in server class like many other calls * Optimize Server::SendCloudParams: use CloudParams object ref instead of deserialized attributes
* Cleanup: drop Server::hudGetHotbarSelectedImage()Loic Blot2018-03-08
| | | | Call directly accessible RemotePlayer::getHotbarSelectedImage() from server api
* Cleanup: drop Server::hudGetHotbarImage()Loic Blot2018-03-08
| | | | Call directly accessible RemotePlayer::getHotbarImage() from server api & make it const ref
* Cleanup: drop Server::hudGetHotbarItemcount()Loic Blot2018-03-08
| | | | Call directly accessible RemotePlayer::getHotbarItemcount() from server api
* Mitigate formspec exploits by verifying that the formspec was shown to the ↵red-0012018-02-18
| | | | | user by the server. (#6878) This doesn't check the fields in anyway whatsoever so it should only be seen as a way to mitigate exploits, a last line of defense to make it harder to exploit bugs in mods, not as a reason to not do all the usually checks.
* Node definition manager refactor (#7016)Dániel Juhász2018-02-10
| | | | | | | | | * Rename IWritableNodeDefManager to NodeDefManager * Make INodeDefManager functions const * Use "const *NodeDefManager" instead of "*INodeDefManager" * Remove unused INodeDefManager class * Merge NodeDefManager and CNodeDefManager * Document NodeDefManager
* Inventory: Restrict access from too far awaySmallJoker2017-11-24
|
* Server: affect bind_addr on constructor instead of start() (#6474)Loïc Blot2017-09-28
| | | bind_addr is already ready when using constructor as we read is.IPv6 from it, instead pass the whole address