Dahlgren / arma-server-web-admin

Web based server manager for Arma
MIT License
124 stars 47 forks source link

Steam workshop mod names #69

Closed flexgrip closed 6 years ago

flexgrip commented 7 years ago

Hey Dahlgren,

I've setup a linux server using your feature/steam-workshop-mods branch. Everything went smoothly and looks good except for one thing.

Whenever you install a workshop mod, it downloads it into the steam directory and names it via the steam workshop id. So for instance, if you install "advanced rappelling", the mod installs into Steam/....107410/713709341 <-- the steam id of the mod

That would be fine, except when it launches, it feeds that directory name into the launch parameters. So when users try to join the server via the vanilla launcher, this is what they see.

Vanilla launcher screenshot

This happens on windows and linux.

As you can see, the launcher cannot associate the mod name with the ID. Some of the time it can, but we still don't want people being greeted with a list of 20 mods, all without names and only represented by numbers.

The way I got around this before was to symlink the workshop mods from 1234567 -> @ModName. Do you know of any way I can fix this? Otherwise I will have to keep my symlinks in sync with my game root.

Thanks for any help you can give me! 👍

flexgrip commented 7 years ago

Oh also, just for reference. If you ever look inside the arma 3 game directory on a standard install, you'll see a folder called !Workshop that is generated when you start the launcher. This folder contains named symlinks to all of the silly ID named folders. Not sure how the launcher does it.

After thinking about it with your launcher, I'm not sure how it would be possible to fix this without symlinks or renaming the folders. But renaming would break the update feature.

So unless you have a better idea, I'm thinking the best way would be to write a bash or Python script to symlink each folder into the arma 3 directory. But here is where it gets tricky. If you do that, your launcher will think there are two copies of the mods. So it would almost be better if the launcher symlinked the mods on the fly during launch . That way you'd only see one copy and they might show up in the launcher with the correct path/pretty names.

I dunno. This is like the last problem with your launcher that would make it the perfect tool for me. So my brain is going nuts thinking about a way to fix it :/

Dahlgren commented 7 years ago

Arma 3 Launcher server mod data should be based on meta.cpp in the root of the mod folder, not the folder name

https://community.bistudio.com/wiki/How_to_enable_Steam_Workshop_support_in_Server_Browser https://community.bistudio.com/wiki/meta.cpp

I'll have a look at it once I get home

ToasterBR commented 7 years ago

Exactly. I believe this is the way the standard Arma 3 Launcher builds the symlinks. It checks for meta.cpp and creates the simlink using the name property inside it.

flexgrip commented 7 years ago

The vanilla launcher builds the symlinked by just putting an @ symbol in front of the name.

flexgrip commented 7 years ago

Sorry Toastsr. I mis read. That's exactly what you were saying.

ToasterBR commented 7 years ago

No worries!

flexgrip commented 7 years ago

How does the arma launcher do it if there's no meta.cpp I wonder?

There's a tool I saw on Github written in VB (Windows only) that installs mods from the steam workshop. Gonna see how he renames and symlinks.

@Dahlgren I think I remember a post in a different issue thread where you mentioned you have all this and fallback data in the node modules you've written. Let us know if we can help.

Dahlgren commented 7 years ago

I tested with the same mod as you, 713709341 Advanced Rappelling, and it worked just fine for Windows Server at least. Nothing done except for downloading the mod through the web ui, no symlinks etc which should never be needed. Could be Linux bug perhaps?

workshop

Regarding missing meta.cpp, I think the best solution to solve both missing mods from manager and from connect dialog is to generate a dummy meta.cpp with id from the folder name. It should only be legacy mods which does not contain one. Not that hard to add either. Maybe even add a separate list in the manager with mods that lacks meta.cpp and a quick button to generate it from the folder name and looking up all metadata from the steam api.

flexgrip commented 7 years ago

What the heck? Are you sure you did it through the same branch? My Linux server I just built by hand. Installed Ubuntu, arma, node and your steam branch. And that's what I get out of the box.

I also can reproduce this on Windows.

Dahlgren commented 7 years ago

Is there a valid meta.cpp file in the steam workshop mod folder?

Reproduce as in "it works" or "it doesn't work"? 😁

flexgrip commented 7 years ago

Reproduce as in it does not work for me.

Yep, I just double checked. There is a meta.cpp file.

I did the same as you. Cloned your repo. Switched to the steam branch, set it up.

Then I made a server and searched for that mod. Installed it through the web interface... Nothing out of the ordinary.

I guess I can try playing with it. If you get bored this weekend, let me know and I can add your pub key so you can check it out on my server.

One question, I'm going to post something from the log. Maybe this might be the prob?

flexgrip commented 7 years ago
 5:03:50 SteamAPI initialization failed. Steam features won't be accessible!
 5:03:50 Cannot register unknown string STR_3DEN_CAMERA_NAME
 5:03:50 Initializing stats manager.
 5:03:50 Stats config disabled.
 5:03:50 sessionID: 84838ff2ad17c0a99c2a50e2d54e1ddb8088d221
Dahlgren commented 7 years ago

I'll setup a clean Linux server and give it a go

flexgrip commented 7 years ago

Keep in mind I used linux game server manager scripts to get it setup easily. Worked really well and your app bolts right on to all of its directories.

Here's a shot of what the mods looks like and some steam errors above.

Again though. This does the same thing to me with windows server too.

flexgrip commented 7 years ago

Did some more messing around with other apps that have workshop support. They all symlink from the ID number directories to another place with readable names. So I'm trying to figure out how the heck it's working for you without doing that.

Dahlgren commented 7 years ago

I should probably add installing and updating Arma to the manager as well so you don't need other scripts then ;)

I hope I'll have some time to test on Linux tonight

flexgrip commented 7 years ago

Cool, thanks man!

flexgrip commented 7 years ago

I wrote a quick python script to symlink the workshop mods into the arma directory. But does the steam-workshop branch no longer support manually installed mods? If I put a mod into the arma server directory it doesn't seem to pull them up anymore.

(really hoping you can reproduce my problem so I don't have to do all this janky stuff to get things working. 🤞 )

flexgrip commented 7 years ago

Any luck here? I can switch branches to master, symlink the mods and they show up fine in the vanilla launcher. Switch to the steam branch, they look good in your tool, but show up as numbers in the launcher.

I may have found a workaround without trying to mash code from the master branch. Just running two instances of your tool. One on each branch. Use one to manage the mods and the other to select the mods and launch the server (with my python symlinker in between) :)

Dahlgren commented 7 years ago

Sorry, barely been home for a week 😞

flexgrip commented 7 years ago

No prob. Just checking in. Hope I'm not bothering you. For now I'm just running two instances of the node app :)

It looks like when I'm using the master or pw6-optional branch, it's using the mod.cpp => name attribute in the launcher. I need to try changing the name in that file to confirm that's what its using. But for some reason, when using the mods from the workshop branch, it's still using 123456789 as the name. Almost as if it either can't read the mod.cpp or can't identify it by folder name. Symlinking fixes the prob though.

Dahlgren commented 7 years ago

I've tested on Linux now, it's definitely something related to the Linux server version. It craps out if you feed it an absolute path. It resolves the id from the path or something but fails to read any mod files including the pbos.

flexgrip commented 7 years ago

Yep. And thanks for checking it out. I've discovered two things.

  1. It does not like the 123456789 folder paths. But does work if you switch back to master branch and symlink 123456789 -> @mod_name inside the root directory of arma 3 server. I'm going to test copying the 1234...9 mod into the root directory to see if that works from there. Maybe Linux arma 3 only likes mods in its root directory.

  2. It does not like spaces in the mod folder names. I think it is not wrapping the mod params properly or the spaces are being treated as a delimiter because if I try to launch with "@mod name", the logs are trying to load the directory "@mod". Once I took the spaces put in my Python symlinker scripts, everything worked fine.

I'll test it right now actually. #1 I mean.

Dahlgren commented 7 years ago

There is this old issue which might be related, https://web.archive.org/web/20160827140431/http://dev.withsix.com/issues/23261

flexgrip commented 7 years ago

Looks very similar. Unfortunately, cygwin just took a crap on me. So I'm re-installing all of that now so I can work on this linux server.

Would it be hard to add back in the feature that checks for mods in both the steam directory and the root server directory?

flexgrip commented 7 years ago

Ok, so I loaded cba from the steam directory named "45081499". It showed up as " 45081499" in the arma 3 launcher like I reported above ^.

Then I copied it to the server root and it works fine!

So somehow, the mere fact of loading the mods from outside the arma 3 directory screws everything up. Or maybe because it's an absolute path instead of a relative one? Either way, it can be solved by symlinks. But not sure if there is a nice way to permanently solve it within your app :(

flexgrip commented 7 years ago

I wonder if they would show up in the launcher correctly if you tried the trick from the post you mentioned above @Dahlgren. //absolute/path/to/mod/123456789 with the double slash.

Dahlgren commented 7 years ago

With /home/arma/arma3/ as CWD,

$ strace -f /home/arma/arma3/arma3server -mod="/home/arma/steamworkshop/steamapps/workshop/content/107410/450814997;/home/arma/steamworkshop/steamapps/workshop/content/107410/826911897" 2>&1 | grep steamworkshop
execve("/home/arma/arma3/arma3server", ["/home/arma/arma3/arma3server", "-mod=/home/arma/steamworkshop/s"...], [/* 18 vars */]) = 0
[pid  1408] access("/home/arma/steamworkshop/steamapps/workshop/content/107410/826911897", R_OK|W_OK) = 0
[pid  1409] open("/home/arma/steamworkshop/steamapps/workshop/content/107410/826911897/mod.cpp", O_RDONLY) = 4
[pid  1408] access("/home/arma/arma3//home/arma/steamworkshop/steamapps/workshop/content/107410/826911897", R_OK|W_OK) = -1 ENOENT (No such file or directory)
[pid  1408] access("/home/arma/steamworkshop/steamapps/workshop/content/107410/450814997", R_OK|W_OK) = 0
[pid  1409] open("/home/arma/steamworkshop/steamapps/workshop/content/107410/450814997/mod.cpp", O_RDONLY) = 5
[pid  1408] access("/home/arma/arma3//home/arma/steamworkshop/steamapps/workshop/content/107410/450814997", R_OK|W_OK) = -1 ENOENT (No such file or directory)

It appends the absolute path onto the CWD path for some of the fs calls

flexgrip commented 7 years ago

I'm not sure I follow. Are you saying the library itself appends the mod path, so we can't just try adding a leading slash?

flexgrip commented 7 years ago

Oh you mean arma3server binary is doing that...

Dahlgren commented 7 years ago

I guess this won't be fixed in the near future by BIS so I'll do some magic to work around it

Dahlgren commented 7 years ago

I have a working solution now at least, just need to add some error handlers and it should be good to go

Dahlgren commented 7 years ago

Linux fix added to steam workshop branch, please test and verify. Works fine for me on a clean Linux server at least

flexgrip commented 6 years ago

This has been fixed. Just have to be sure mods have meta.cpp and mod.cpp. You can close this ticket :) Thanks 👍