Implementation of Dedicated Server in Isolation#498
Implementation of Dedicated Server in Isolation#498kuwacom wants to merge 15 commits intosmartcmd:mainfrom
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.
|
I hadn’t been merging upstream changes while implementing, so I’m in the middle of merging them now... |
# Conflicts: # Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp # Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp # Minecraft.Client/Windows64/Network/WinsockNetLayer.h
|
Some things have changed in the past day-ish, watch out for incompatibilities/redundant re-implementations of these:
|
|
So
|
Since 31881af56936aeef38ff322b975fd0 , `skinHud.swf` for 720 is not included in `MediaWindows64.arc`, the app crashes unless the virtual screen is set to HD.
|
It was partially affected by #495, but I was able to merge it without any issues. |
|
is it still only LAN multiplayer only? or can worlds be opened up to more people? |
|
It can be accessed from anywhere if you have a suitable network that can be accessed from the global internet (a network line that can open the specified TCP port). In short, it's a regular server app. |
|
oh damn. so i could run this on a vps? |
|
Yes, but since it still uses a lot of Windows API internally (to maintain compatibility), it requires a Windows system or a system that includes Windows API to run. I would like to eventually release a Linux version and put it into Docker. |
|
i mean, i've tried it on linux and it works fine. i could try and create a docker image if you'd like |
You can run it fine on Linux without a GUI launcher via umu |
seriously! |
|
wine also works really well. tried lutris and has similar results to umu |
|
Which one has a smaller image size? |
|
wine iirc |
|
Currently there are two approaches: the separated version (this pull request) and the The separated version modifies the world-saving logic and changes the startup logic, so integrating it into the client side would be a bit tricky. Alternatively, it would also be possible to keep both. |
|
Realistically speaking a completely separate Server executable should be our preferred way for this to work. The |
|
If we're planning to merge the separated server in the future, I was considering removing the |
Yeah |
|
Sorry, that’s not written in the description, but it’s still a dummy for now. |
Would it be possible to send the Dockerfile and docker-compose.yml? |
not using a docker image, which is surprising. i took your pr build and ran it on my vps. works REALLY well, minus the default server settings being awful (peaceful mode, no pvp etc) |
…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
ee9d630 to
b4eb98e
Compare
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.
|
There’s something I’m currently unsure about regarding these implementations. This may come down to differences in interpretation, but it feels quite odd to me. My interpretation is that If this interpretation is the majority view, I’d like to revert the change and modify it so that the world is written to disk as soon as it is created. |
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.
|
All comments and files must be in English and source code files must be in UTF-8, sorry. |
Got it. |
|
It didn’t feel right to me to put world-related GameRules in Some world-related settings are actually stored in the PNG thumbnail of the world, specifically in the https://github.com/kuwacom/Minecraft-LegacyConsoleEdition/blob/feature/dedicated-server/Minecraft.World/ConsoleSaveFileOriginal.cpp#L769 |
|
for those having issues while using a VPS and getting a display error, try this command: works fine for me |
wtf? We should probably change that lolll that’s crazy |
For Singleplayer, I don’t believe we should save the world unless a save has actually occurred, that’s how LCE has historically worked. On the server, it makes sense to save it as it’s generated since the server is not a singleplayer experience. However on the actual client it shouldn’t save unless we want to. Forcing the save on load/generate causes save spam with the DLCs |
That’s an error I didn’t encounter on WSL2 on Windows. |
It seems that this approach was simply easier given the filesystem constraints on the PS Vita and PS3. If this project is going to move toward being focused on general-purpose platforms, it might be better at some point to change the world file saving logic and design a new save format. |
I see, so that issue was occurring. In this Dedicated Server, the world file saving during initial world generation is implemented in a custom |
|
Sounds good. Also to verify, this doesn’t spawn a new console or anything? It just outputs to the console it was launched in? |
yes, for me it fails to start. but using this works just fine for me |
…in the classes to `server.properties`
|
Is there a lan discovery toggle option? |
Would it be better to have it? |
One question. I’ve added environment variables for the Xvfb configuration in the Docker / docker-compose setup. Would it work if they are changed there? |
For dedicated servers there’s not as much reason to have it on - it could even be potentially a security issue in a data center. It’s make sense to have a toggle to completely disable it |
|
That’s true. |





Description
This PR introduces a Windows64 Dedicated Server executable (
Minecraft.Server) and related runtime/build support.It enables headless hosting with configurable bind IP/port, world bootstrap via
server.properties.Minecraft.Clientchanges are intentionally minimal and limited to dedicated-server startup compatibility.#65
Changes
New Behavior
Minecraft.Server/Windows64/ServerMain.cppMinecraft.Server/Minecraft.Server.vcxproj(+ filters)ServerProperties(server.propertiesload/normalize/save forlevel-name/level-id)WorldManager(load existing world bylevel-id, fallback to create new world)ServerLogger(log levels:debug|info|warn|error)CMakeLists.txt: newMinecraftServertarget and post-build asset copycmake/CopyServerAssets.cmake: minimal required server assets onlyMinecraftConsoles.sln,COMPILE.md,.gitignoreupdates-port,-ip/-bind,-name,-seed,-loglevel,-helpMinecraft.Client Changes (Minimum Scope)
Only the following
Minecraft.Clientfiles were changed, strictly for dedicated-server bridge behavior:Minecraft.Client/MinecraftServer.hNetworkGameInitData::dedicatedNoLocalHostPlayer.Minecraft.Client/Common/Network/GameNetworkManager.cppClientConnectioncreation when hosting as dedicated server.Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cppMinecraft.Client/Windows64/Network/WinsockNetLayer.hHostGame(const char* bindIp, int port)overload.Minecraft.Client/Windows64/Network/WinsockNetLayer.cppHostGame(int port)as wrapper for compatibility.0.0.0.0(from loopback) for dedicated listening.