I started by trying to add support for the Satisfactory Dedicated Server, so I created a module for it in routes::start, where the other game server impls are. I saw that the start module directory was starting to get big, so I moved its contents to a new module at crate::games. Because Satisfactory does not have any server variants, I initially implemented Variant for (), returning None in its fn detect, and used () as its variant. After testing it, I realised that detect returning None would make the server not runnable, since it’s supposed to detect if there is a server at a given path. I removed the impl for () and created a single variant enum instead. I implemented fn run by running FactoryServer.exe/FactoryServer.sh with the arg -unattended and fn server_info by inspecting the exe’s product_version. I was looking into how to gracefully stop a Satisfactory server, and realised that the GameServer trait does not require a fn stop to be defined, and that it had handled stopping in the routes::stop function, matching on the ServerType. I added fn stop to the GameServer trait, and moved the impls to the respective game impls. I also saw that in crate::tasks::shutdown, it only sent /stop (only working for Minecraft) and then force-killed the process. I replaced this with running the stop implementation. For Satisfactory, stop had to send SIGINT on Linux and CtrlC on Windows. I used libc::kill for Linux, and GenerateConsoleCtrlEvent for Windows. Since I already needed the crates libc and windows-sys for this, I replaced the existing force_kill implementation that ran CLI commands with libc::kill and TerminateProcess. Now that GameServer was fully implemented for Satisfactory, I tried starting the game. It opened a visible console window, even with different args. To make it run without a window, I looked into creation flags like CREATE_NO_WINDOW, but that didn’t work. The wiki said that to run the server as a service, I would have to use NSSM, but that requires administrator privileges. I then looked at Task Manager and saw that FactoryServer.exe seemed to only run FactoryServer-Win64-Shipping-Cmd.exe with the arguments FactoryGame -unattended. So, I ran it with those arguments, and the server would now start without creating a console window.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.