jweigelt / swbf2admin

Star Wars Battlefront II (2005) server management application
GNU General Public License v3.0
51 stars 18 forks source link

Hosting using Steam version of the game #26

Open IsaMorphic opened 4 years ago

IsaMorphic commented 4 years ago

Hello! I have been spending some time today trying to get the most recent release of SWBFAdmin working with the Steam release of the game, and it doesn't appear to be working. I have configured the server as per the README, and changed the ServerType in ./cfg/core.xml to Steam. I also set the ServerPath variable to the game's installation directory and copied the contents of ./server to the GameData subdirectory.
Shown here is the output to the console window from when I attempted to start the server via WebAdmin:

[11/29/2019 1:46:53 PM] INFO  | [COR] Starting SWBF2Admin v1.2.0.0 LeKeks, Yoni, AsLan ...
[11/29/2019 1:46:53 PM] INFO  | [COR] Config OK.
[11/29/2019 1:46:54 PM] INFO  | [SQL] Database OK.
[11/29/2019 1:46:54 PM] INFO  | [WEB] WebAdmin started at 'http://localhost:8080/'
[11/29/2019 1:47:03 PM] INFO  | [AUDIT] Yodadude2003 ([::1]:57172) modified game settings
[11/29/2019 1:47:06 PM] INFO  | [AUDIT] Yodadude2003 ([::1]:57172) modified game settings
[11/29/2019 1:47:08 PM] INFO  | [AUDIT] Yodadude2003 ([::1]:57172) started the server
[11/29/2019 1:47:08 PM] INFO  | Launching server with args ''
[11/29/2019 1:47:14 PM] INFO  | Steam Launcher closed. Trying to attach to the server process.
[11/29/2019 1:47:15 PM] INFO  | Found running server process '' (13064), re-attaching...
[11/29/2019 1:47:19 PM] WARN  | Server has crashed.
[11/29/2019 1:47:19 PM] INFO  | Automatic restart is enabled. Restarting server...
[11/29/2019 1:47:19 PM] INFO  | Launching server with args ''
[11/29/2019 1:47:24 PM] INFO  | Steam Launcher closed. Trying to attach to the server process.
[11/29/2019 1:47:25 PM] WARN  | Can't access BattlefrontII process #28296 (Object reference not set to an instance of an object.)
[11/29/2019 1:47:26 PM] INFO  | Found running server process '' (28296), re-attaching...
[11/29/2019 1:47:30 PM] WARN  | Server has crashed.
[11/29/2019 1:47:30 PM] INFO  | Automatic restart is enabled. Restarting server...
[11/29/2019 1:47:30 PM] INFO  | Launching server with args ''
[11/29/2019 1:47:35 PM] INFO  | Steam Launcher closed. Trying to attach to the server process.
[11/29/2019 1:47:36 PM] INFO  | Found running server process '' (29904), re-attaching...
[11/29/2019 1:47:40 PM] WARN  | Server has crashed.
[11/29/2019 1:47:40 PM] INFO  | Automatic restart is enabled. Restarting server...
[11/29/2019 1:47:40 PM] INFO  | Launching server with args ''
[11/29/2019 1:47:45 PM] INFO  | Steam Launcher closed. Trying to attach to the server process.
[11/29/2019 1:47:47 PM] INFO  | Found running server process '' (23204), re-attaching...
[11/29/2019 1:47:51 PM] WARN  | Server has crashed.
[11/29/2019 1:47:51 PM] INFO  | Automatic restart is enabled. Restarting server...
[11/29/2019 1:47:51 PM] INFO  | Launching server with args ''
[11/29/2019 1:47:56 PM] INFO  | Steam Launcher closed. Trying to attach to the server process.
[11/29/2019 1:47:57 PM] INFO  | Found running server process '' (27628), re-attaching...

The moment the game launches, it immediately crashes and SWBFAdmin tries to launch it again.
The game also leaves a brief log.txt file in the GameData directory, containing this line: bind failed with error %u It also appears that in the source code for RconServer, some of the OFFSET_{insert-name-here} definitions are missing for Steam in bf2server.h.
This leaves me with a couple questions:

Thanks, Yodadude2003

jweigelt commented 4 years ago

Hi very nice report you wrote there, sorry for taking a while to respond :) Unfortunately the Steam Version (Steam Version as in actually using the Steam Client for hosting) is not supported at the moment.

The reasoning behind this is that the GOG version is generally better suited for hosting. Servers running that version are also visible for Steam users and have the added benefit that they allow running multiple instances. Also steam requires setting fixed launch parameters to prevent that command line validation popup from showing up.

I believe that the last release that supported the Steam Client was 1.0.4. I'd strongly advise gainst using that version though as it introduces a very messy way of keeping the server alive that has long been deprecated (running D3D, using Windows session loading via RDP and other naughty things).

The technical reason why the Steam Client is not supported at the moment is, as you correctly identified, that the RconServer project does not contain instruction offsets for the Steam version. These offsets are used to patch various bugs in the game process that would normally prevent it from hosting a standalone server. Without the patches the server can not run at all.

Finding these offsets is not too difficult (once the bugs were identified properly) but would take a bit of time. I might give it a look some time but since this is only a hobby project I unfortunately can't promise anything.

IsaMorphic commented 4 years ago

Heyo, Thanks for the swift and detailed response.
I did try to use the 1.0.4 version, but as you have already noted the way that version was prone to failure (I could never get the RconServer to bind properly). I thank you for your time and I hope that this wonderful little project continues to grow and improve.
May the force be with you.

IsaMorphic commented 4 years ago

Heyo, I figured I'd actually reopen this issue, as supporting the Steam version is still desirable and I'm still interested in using this software. I'd like to here what your current stance on this is, and whether this can be made a priority.
Thanks in advance, Yodadude2003

jweigelt commented 4 years ago

Experimental (untested) steam support was re-added in https://github.com/jweigelt/swbf2admin/commit/ad84c96e1fac13bbace7e6c483e050b57c03031c.

If you are interested you can check out the steam-testing branch.

To enable Steam mode, modify core.xml:

<ServerType>Steam</ServerType>

Adjust the game's command line using the Steam client:

/win /norender /nosound /autonet dedicated /resolution 640 480
IsaMorphic commented 4 years ago

Sounds great! I'll check it out as soon as I can and get back to you once I do.

IsaMorphic commented 4 years ago

So, good news! I just compiled and tested the "steam-testing" branch. It appears that the process attaches successfully and Rcon binds and logs in properly.

However, I am not able to see the server when I run the game on a different machine (with a different steam account of course). I'm assuming this has to do with port forwarding of some sort that I haven't taken the time to do.

Let me know if you suspect a different issue is at play.

On that note, I don't believe its very practical for me at this moment to run a dedicated server, as that would require me to purchase yet another copy of the game and run it on a different machine. I looked into potentially using Sandboxie, but something like that would take a lot of time and troubleshooting to setup, not to mention the (unlikely) possibility of being banned for using software like that.

Despite this, I'll keep the issue open in case I change my mind or if someone else has something to add.

Sincerely, Yodadude2003