Fix DedicatedServer several issues#1266
Conversation
- Introduced `ServerMain.cpp` for the dedicated server logic, handling command-line arguments, server initialization, and network management. - Created `postbuild_server.ps1` script for post-build tasks, including copying necessary resources and DLLs for the dedicated server. - Added `CopyServerAssets.cmake` to manage the copying of server assets during the build process, ensuring required files are available for the dedicated server. - Defined project filters in `Minecraft.Server.vcxproj.filters` for better organization of server-related files.
- Introduced ServerLogger for logging startup steps and world I/O operations. - Implemented ServerProperties for loading and saving server configuration from `server.properties`. - Added WorldManager to handle world loading and creation based on server properties. - Updated ServerMain to integrate server properties loading and world management. - Enhanced project files to include new source and header files for the server components.
# Conflicts: # Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp # Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp # Minecraft.Client/Windows64/Network/WinsockNetLayer.h
Since 31881af56936aeef38ff322b975fd0 , `skinHud.swf` for 720 is not included in `MediaWindows64.arc`, the app crashes unless the virtual screen is set to HD.
…erver # Conflicts: # .gitignore # CMakeLists.txt # Minecraft.Client/Common/Network/GameNetworkManager.cpp
…ing sources - remove stale Windows64 Miles (mss64) link/copy references from server build - add Common/Filesystem/Filesystem.cpp to Minecraft.Server.vcxproj - add Windows64/PostProcesser.cpp to Minecraft.Server.vcxproj - fix unresolved externals (PostProcesser::*, FileExists) in dedicated server build
Since the crash caused by the 720p `skinHud.swf` not being included in `MediaWindows64.arc` has been resolved, switching back to 720p to reduce resource usage.
add with entrypoint and build scripts
…ft-LegacyConsoleEdition into feature/dedicated-server
on the server side, I fixed the behavior introduced after commit aadb511, where newly created worlds are intentionally not saved to disk immediately.
…in the classes to `server.properties`
LAN-Discovery, which isn’t needed in server mode and could potentially be a security risk, has also been disabled(only server mode).
- Integrated linenoise library for line editing and completion in the server console. - Updated ServerLogger to handle external writes safely during logging. - Modified ServerMain to initialize and manage the ServerCli for command input. - The implementation is separate from everything else, so it doesn't affect anything else. - The command input section and execution section are separated into threads.
Like most command line tools, it highlights predictions in gray.
Unified the scattered utility functions.
…down race Before this change, server/host shutdown closed sockets directly in ServerConnection::stop(), which bypassed the normal disconnect flow. As a result, clients could be dropped without receiving a proper DisconnectPacket during stop/kill/world-close paths. Also, WinsockNetLayer::Shutdown() could destroy synchronization objects while host-side recv threads were still exiting, causing a crash in RecvThreadProc (access violation on world close in host mode).
- Add client-side host disconnect handling in CPlatformNetworkManagerStub::DoWork() for _WINDOWS64. - When in QNET_STATE_GAME_PLAY as a non-host and WinsockNetLayer::IsConnected() becomes false, trigger g_NetworkManager.HandleDisconnect(false) to enter the normal disconnect/UI flow. - Use m_bLeaveGameOnTick as a one-shot guard to prevent repeated disconnect handling while the link remains down. - Reset m_bLeaveGameOnTick on LeaveGame(), HostGame(), and JoinGame() to avoid stale state across sessions.
Conflict resolution summary: - .gitignore: kept dedicated-server-specific ignore entries (tmp*/, _server_asset_probe/, server-data/) and also kept main-side entries (*.user, /out). - Minecraft.Client/Common/Network/GameNetworkManager.cpp: kept int64_t seed from main and preserved dedicatedNoLocalHostPlayer logic from dedicated-server. - Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp: preserved dedicated-server shutdown flow and also included main-side cleanup for s_smallIdToSocketLock.
Moved file operations to `utils`.
…P bans - add Access frontend that publishes thread-safe ban manager snapshots for dedicated server use - add BanManager storage for banned-players.json and banned-ips.json with load/save/update flows - add persistent player and IP ban checks during dedicated server connection handling - add UTF-8 BOM-safe JSON parsing and shared file helpers backed by nlohmann/json - add Unicode-safe ban file read/write and safer atomic replacement behavior on Windows - add active-ban snapshot APIs and expiry-aware filtering for expires metadata - add RAII-based dedicated access shutdown handling during server startup and teardown
- As a side effect, saving has become faster!
…ub Container Registry
Add random seed picker for newly created worlds
As the number of commands has increased and become harder to navigate, each command has been organized into separate folders.
Support for the stream (file stdin) required when attaching a tty to a Docker container on Linux.
Most of these commands are executed using the command dispatcher implemented on the `Minecraft.World` side. When registering them with the dispatcher, the sender uses a permission-enabled configuration that treats the CLI as a player. - default game. - enchant - experience. - give - kill(currently, getting a permission error for some reason) - time - weather. - update tp & gamemode command
# Conflicts: # Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp
…tion Added the following anti-cheat measures and add spawn protection to `server.properties`. - instant break - speed - reach
Wait for Xvfb to be fully ready before starting.
Fix flight, entity ids, chunk loading speeds, and autosave ui for dedi removal
# Conflicts: # docker/dedicated-server/entrypoint.sh
|
Please excuse the poor appearance due to creating a pull request before merging the latest information from main. |
|
The issue when starting Docker should probably be fixed as soon as possible. |
|
your README put the docker stuff way at the top for some reason. please use the current public order to avoid conflicts. merging this |
|
also in the future, we should switch to using a runtime global like IsDedicated() instead of preprocessor checks IMO |
Thank you for the corrections. |
Description
This PR contains small follow-up fixes that were not fully included in #498.
Changes
allow-flightserver config in non-debug builds.DISPLAYformat.Previous Behavior
allow-flightcould be unintentionally forced totrueoutside actual debug runtime conditions.__debugbreak) on dedicated.Failed to create window instance.Root Cause
memsetlength used element count bytes instead of total byte size.New Behavior
allow-flightnow follows server config unless true debug conditions are met.Fix Implementation
Minecraft.Client/MinecraftServer.cppMinecraft.Client/ServerPlayer.cppmemsetsize for removal flags.Minecraft.World/Entity.cppEntity::getSmallId()when 0..2047 pool is exhausted.Minecraft.World/Level.hLEVEL_CHUNKS_TO_UPDATE_MAXfor dedicated builds.docker/dedicated-server/entrypoint.shwait_for_xvfb_ready()with process/socket checks, timeout, and log dump./tmp/.X11-unix/X*and/tmp/.X*-lockbefore startup.DISPLAYis already provided.AI Use Disclosure
No
For translating and compiling messages