Wargus / wargus

Importer and scripts for Warcraft II: Tides of Darkness, the expansion Beyond the Dark Portal, and Aleonas Tales
GNU General Public License v2.0
357 stars 55 forks source link

Provide portable version of Wargus #339

Closed ner00 closed 3 years ago

ner00 commented 3 years ago

I would assume this to be a pretty straightforward process, but apparently not. After testing v2.2.4 without any trouble, I installed v3.0.0 and can't get it to run, this is the error message I get after running wargus.exe:

Stratagus failed to load game data. If you just launched the game without any arguments, this may indicate a bug with the extraction process. Please report this on https://github.com/Wargus/stratagus/issues/new, and please give details, including: operating system, installation path, username, kind of source CD. A possible solution is to remove the hidden folder "C:\Users\ner0\Documents\Stratagus/data.Wargus").

I've tried running startagus.exe with the -d argument: stratagus.exe -d "C:\Users\ner0\Documents\Stratagus\data.Wargus", but it doesn't open, I have a clue about why, but don't know how to solve this: https://gist.githubusercontent.com/ner00/b7585dc480f2b0d47bf092a47836b3d8/raw/110732ba79a9f09d2dfea199b5518a32812ad467/Stratagus%2520-%2520stderr.txt

Extraction process log: https://gist.githubusercontent.com/ner00/48c58ef5c3b0b6d1dc7e4b297ae909e0/raw/0dd0882185b11a77e39da18915adc1b799229605/wartool.txt

Wargus/stratagus is here: C:\Program Files (x86)\Wargus Data files are extracted here: C:\Users\ner0\Documents\Stratagus\data.Wargus OS is Windows 10 20H2 (x64)

As mentioned before, I had no issue with Wargus v2.2.4, not sure what's wrong that doesn't work with v3.0

ner00 commented 3 years ago

The way I "solved" the issue was to dump multiple sources of the game, because mine apparently wouldn't work on its own even though it's the original game. Then stratagus wasn't able to handle data path from a custom source folder, apparently due to wargus or stratagus base folder having some resources already, I had to mash everything together in the same folder for it to work

I don't know about other systems, but at least on Windows the way this is setup is horrible; it took me about 4 hours to get the game working and portable.

ner00 commented 3 years ago

v2.2.4 works well enough, this is insufferable..

timfel commented 3 years ago

Did you install wargus 3.0.0 over 2.2.4 directly? Because that doesn't work, 2.2.4 is so old that the upgrade process doesn't work. You have to manually delete the old installation (the uninstaller of that old version also didn't fully work)

ner00 commented 3 years ago

I never installed neither, I extracted them from inside the setups because I want them portable on a USB - no issue with v2.2.4 on that front. The same CD works fine with v2.2.4, but throws that error in v3.0.0 which I can't get past.

EDIT: I can now get past it by running Stratagus directly, seems there is a bug in Wargus.

As mentioned above, I got another copy somewhere on the web, which was also not working on its own but was able to get it to load mashing them both together. Honestly, the newer version is a nightmare to setup, not only due to the failure of using my original CD properly, but also due to Stratagus it seems.

Placing Wargus/Stratagus on a USB drive on v2.2.4 is a breeze, all files are loaded from the current directory where wargus/stratagus is being run from, the resources are neatly packed inside a data folder; in v3.0.0 it's not as simple. it first extracts everything to my Documents\Stratagus folder (of all places), inside a subfolder named data.Wargus. Now running v3.0.0 in portable USB is where it gets ugly and tricky:

I can get this to work, hardly, and the setup process looks like a downgrade from v2.2.4. I'm sure there are many improvements since, setup is not one of them, the opposite.

timfel commented 3 years ago

We're happy to accept contributions to make your use case work. Not using the installer is not supported, neither is running everything off a local folder. You're better off following our guide to compile stratagus and wargus yourself as the development setup will give you the flexibility you need.

ner00 commented 3 years ago

Not for nothing, but the installation has nothing to do with it. Everything behaves the same regardless, I just used that as an example to clarify that there wasn't any conflict between versions.

I also think that having strategus assume the working dir would be more beneficial in many ways, although that would be troublesome when the default install location is a system protected folder. I'm not sure why that even changed in the first place.

timfel commented 3 years ago

It changed exactly for that reason - we had multiple users that use machines with multiple users accounts, have Stratagus installed in a system folder, and want users to be able to extract game data, play, and do modding without giving everyone write permissions to the system installation folder. Add to that that today users really shouldn't have access to the default installation folders, and this new default is really the only way to go. This is also in line with how many other games do it these days, keeping mods and Savegames in the documents folder or in the AppData folder. And Wargus is really just a mod for Stratagus (and it cannot be any other way already for legal reasons), so the natural location is for it to not be in the program folder.

Of course it's possible to put everything in one folder, but it's not documented. As I said, if you watch the YouTube video that shows how to set up a development environment for stratagus, it is set up in a way to have everything locally under one folder. It would be easy to just remove the files you no longer need and zip the rest up

ner00 commented 3 years ago

Using that same consideration, maybe neither startagus nor wargus should default to install on a system folder, which requires elevated permissions in the first place (this from a Windows standpoint). Take for example Chrome or Firefox when installed at the user level, the binaries, settings, preferences all reside in the same user folder under the user profile.

I think that it would be nice to have a compromise that accommodates the current behavior but also allows for easy portability without having to install a development suite to accomplish it. Then stratagus and wargus could check for local folder permissions, and default to the current working dir for everything: extracted resources, user preferences, save data, debug logs.

It could even support a simple config file that, if located inside the same folder as the binaries, could point towards the paths defined in it. These are ideas that I can't really help with, I'm not much of a coder, I apologize.

Anyway, I got the gist of it, I can create a batch or bash script to use command line arguments pointing to the correct paths that I need, the only thing that doesn't seem to have an argument is stderr and stdout, those will always output to the default folder.

timfel commented 3 years ago

Hm. I guess the easiest would be to provide a separate package that is just a zip file where everything runs from inside the folder, and on first launch it extracts into that folder. I'll see if I find time to implement that for the next version

ner00 commented 3 years ago

That sounds like a good approach, but I was thinking if there isn't any simpler way than to build 2 versions of essentially the same software; although I might be making wrong assumptions.

My first doubt here is if this is restricted to Wargus, I would assume Stratagus has a similar role to play since it is stratagus that does not default to local execution save and debug log output.

On Wargus' side, I don't think it's an issue to have only a setup version which already allows to choose the destination path (plus, it's NSIS I think, can be unzipped if needed); I also see nothing wrong in extracting the game data to the current user location in Documents\Stratagus\data.Wargus - that's fine as far as I'm thinking. Stratagus on the other hand could have its behavior adjusted on condition.

For example, if the game data is moved to the same folder as wargus/stratagus binaries, it could then be assumed that the user intention is for a portable "mode". Stratagus should then check if the user has write permissions over the current folder and if he indeed has then save settings/preferences/savegames/debug/logs in the current folder; else, if the user does not have write permissions, just carry on as usual - read the resources from the local folder but write save settings/preferences/savegames/debug/logs to the user dir Documents\Stratagus\

I don't know if this approach would be too confusing and hard to implement on other OSes, on Windows I would assume not and at first glance it seems to be a good alternative to maintaining different variants (local/portable). I may be forgetting something which makes this a very bad idea though.

timfel commented 3 years ago

Portable and global installer are now built nightly and will be released as 3.1

johndoe71rus commented 10 months ago

Let me continue the topic. If my case is offtopic here, I'll start a new issue. Successfully built Stratagus and Wargus from git, 3.3.3 version. Extracted the data and launched wargus. then I copied ~/.local/share/stratagus/data.Wargus/ to another computer and tried running the same version from git. I received the same message "Stratagus failed to load game data. If you just launched the game without any arguments, ... ". Suggests you delete data.Wargus and do the extraction again. the user on both computers is the same. OS lubuntu 22.04

timfel commented 10 months ago

@johndoe71rus To make the build portable on Linux, make an AppImage. They are built on every commit here: https://github.com/Wargus/stratagus/actions/workflows/appimage.yml. If you click on the latest jobs, you will see the built AppImages in the Artifacts section, e.g. here: https://github.com/Wargus/stratagus/actions/runs/6914620571

Those AppImages work as you would expect, including creating <appimagename>.data, <appimagename>.config and <appimagename>.home folders next to them, and then that entire combination is portable.

(see also https://github.com/AppImage/AppImageKit#special-directories)

johndoe71rus commented 10 months ago

Thank you. I was trying to find AppImage. Do I still need to extract the data for the AppImage again? I can't use data.Wargus that already exists

johndoe71rus commented 10 months ago

i create all three folders wargus-x86_64.AppImage.home, wargus-x86_64.AppImage.data, wargus-x86_64.AppImage.config run wargus-x86_64.AppImage form .../actions/runs/6914620571 successfull extract data from setup_warcraft_ii_2.02v4(28734).exe but next run wargus-x86_64.AppImage i get the same error screen-2023-11-19-21-02-58

timfel commented 10 months ago

@johndoe71rus looks like maybe master is just broken. maybe @Jarod42 hasn't tested clean install+extract+run wargus in a while

timfel commented 10 months ago

the error suggests some change to lua globals so either stratagus got broken, or wargus didn't get adapted to some intentional change

Jarod42 commented 10 months ago

I didn't change wargus, just stratagus engine. error in path might be possible though...