Implementation of Dedicated Server in Isolation#498
Implementation of Dedicated Server in Isolation#498kuwacom wants to merge 65 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) |
|
Are you using the latest build and the Docker Compose YAML? Previously, it only used key event–driven input via the Windows API, but I recently added FileSystem |
|
I am using the latest release that came out 4 hours ago, and also yes other commands and text input does not respond as well. What option do you need to enable when starting to use the stdin support? |
|
Oh forgot to mention I am using the latest yaml as well as I pulled the PR within the last few hours. |
The option is already included in the latest YAML. |
|
Oh wait no! I figured it out by reading your commit. By setting the SERVER_CLI_INPUT_MODE environment variable to true, it enables the input! Sorry about that, I should've read the yaml file before posting. |
|
Oh sorry I guess I misunderstood how it works. Strange though that it's not working out of the box, seems like it's returning false by default for some reason. |
|
Ok if you saw my last comment, forget it. I hadn't attached my tty to the docker container so of course it didn't work 😅. I'm not sure why this is happening. |
…tion Added the following anti-cheat measures and add spawn protection to `server.properties`. - instant break - speed - reach
Implemented basic minimum anti-cheat measures.(this video introduces instant break) There still seem to be other areas that could be improved. anti-cheat.mp4 |
|
If you pull the latest image then commands work, so I think this might have been it. There is still a bug where the output will overlap what you are typing though |
Here's a video to show what I mean: |
This is currently expected, as the display control is not working properly. |
|
I’m considering integrating this into Please also perform at least basic verification in advance. The additional features that were previously added in this repository (such as the C# plugin and MS Auth) will be separated into their own branches and submitted again as pull requests. The same approach will be used for other additional features as well. |
|
I’m fully behind reviewing and merging this if you think it’s ready. Just switch it off draft and I’ll give it a once over |
ok, please |
Ah okay I see, well good to know. It's a little annoying but I can deal with it. I'd rather have working commands than nothing. But btw shouldn't you change the image that gets pulled in the docker compose yaml to the nightly one instead of the test one? |
|
Oh wait I guess if it's potentially getting merged soon then that will just be handled after its merged since a new image will be made on the main repo. So nvm. |
You're right— I'll commit the fixes for this. |
|
I put a message about it in the discord 👍 |
|
Ok there seems to be a new issue, for some reason after a while it starts giving the error Here's a video: |
|
Ok hold on now it's working again? Not sure what happened but I think it might have to do with the |
|
Okay from further testing it seems like if I try to edit server.properties in any way it causes that error to happen. Not sure why that is but I'm guessing it's something in entrypoint.sh. I'm going to try find what it is. |
|
So I tested a bit and if I edit server.properties inside the server-data folder while the server is running, it'll launch properly if I restart the container. But if I stop the server and try to edit server.properties and then start the container it gives that error until I delete the server.properties file and restart it. |







Description
This PR introduces a Windows64 dedicated server executable (
Minecraft.Server) and expands the dedicated-server runtime/build pipeline.Compared to the initial pull request description, the following features have been newly added:
server.propertiessupport (including LAN advertise and host options),level-id,Minecraft.Clientchanges remain focused on dedicated-server bridge compatibility.#65
Changes
Dedicated Server Executable / Startup
Minecraft.Server/Windows64/ServerMain.cppMinecraft.Server/Minecraft.Server.vcxproj(+ filters)server.propertiesdefaults,level-id/level-name,-port,-ip/-bind,-name,-maxplayers,-seed,-loglevel,-helpserver.properties, it can also be integrated into fully autonomous deployment systems like Kubernetes.Dedicated Runtime Modules
ServerProperties(defaulting, normalization, persistence for dedicated options)WorldManager(load existing world bylevel-id, fallback by name, or create new world)ServerLogger(debug|info|warn|error)Minecraft.Server/Common/StringUtilsInteractive Server Console
ServerCli,ServerCliInput,ServerCliParser,ServerCliEngine,ServerCliRegistryhelp(?)stoplisttp(teleport)gamemode(gm)survival|creative|s|c|0|1).Minecraft.Client Bridge Changes (Dedicated Compatibility Scope)
Only dedicated-server compatibility behavior was changed in client networking paths:
Minecraft.Client/MinecraftServer.hNetworkGameInitData::dedicatedNoLocalHostPlayer.Minecraft.Client/Common/Network/GameNetworkManager.cppClientConnectioncreation.Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpplan-advertise).Minecraft.Client/Windows64/Network/WinsockNetLayer.h/.cppBuild / Tooling / Docs
CMakeLists.txt:MinecraftServertarget + post-build asset copycmake/CopyServerAssets.cmake: minimal dedicated runtime asset copyMinecraftConsoles.slnCOMPILE.md.gitignoredocker/dedicated-server/Dockerfiledocker/dedicated-server/entrypoint.shdocker-compose.dedicated-server.ymldocker-build-dedicated-server.shstart-dedicated-server.shREADME.mddedicated Docker section