Stronghold 2

Stronghold 2

View Stats:
Daerandin Jul 16, 2022 @ 10:07am
2
2
1
Multiplayer AI fix
UPDATED: Version 0.3: Does not require constant running as it overwrites game instructions in memory that disable AI.

UPDATED: Version 0.2: Automatic PID detection. No interaction is required anymore. Simply run this tool, then run Stronghold 2 Steam Edition.

I made a little tool that should let you enable AI for multiplayer. Current version should work very well. The tool works for both Windows and Linux.

I have prepared both 32-bit and 64-bit windows executables. The download page is probably a bit shoddy at the moment, and I might never make it look better. What I might do is improve a bit on the instructions, possibly add pictures as well. Especially for the compilation instructions, I want to encourage people to compile stuff on their own.

Windows download: https://www.questforgaming.com/stronghold2/

AUR package for Arch Linux: https://aur.archlinux.org/packages/sh2_mp_ai_enabler

The source is available on gitlab: https://gitlab.com/Daerandin/sh2_mp_ai_enabler
Last edited by Daerandin; Aug 13, 2022 @ 6:26am
< >
Showing 1-15 of 67 comments
Daerandin Jul 16, 2022 @ 3:24pm 
I have compiled an exe file of this for Windows, thankfully it's possible for me to do so from Linux and others have confirmed that it works. I could make it available for others to download directly, if people don't want to, or can't, compile the source code themselves.
wobbli Jul 16, 2022 @ 10:55pm 
You, Sir, are a genius... I confirm that this works on Windows using multiple starts of SH2.

Some comments on GitHub
Last edited by wobbli; Jul 16, 2022 @ 11:14pm
Daerandin Jul 17, 2022 @ 2:22am 
Thanks for the input, I've made some modifications that should hopefully eliminate compiler warnings/errors.
Mario Jul 17, 2022 @ 3:16am 
Oh, I would like to see how to do all this in the video, otherwise I don't understand all these codes)
Daerandin Jul 17, 2022 @ 3:33am 
In the coming week I can set up a download page for an already compiled 64-bit windows binary, so that people can just download and run it.
Mario Jul 17, 2022 @ 6:03am 
I look forward to:piglaugh:
wobbli Jul 17, 2022 @ 6:03pm 
I don't think you should try to make it a launcher - there's likely something in the Steam agreement against that.

I also think you should leave it as source for the user to build so that they can check it out prior to running on their systems - to be confident of what it is actually doing.

Note also that I was testing on a Windows 11 VM with all Anti-Virus capability turned off - I did not test any AV interaction.
Last edited by wobbli; Jul 17, 2022 @ 6:57pm
Atsuji-Chan Jul 18, 2022 @ 9:12pm 
please release as a launcher or side program, thank you.
Daerandin Jul 19, 2022 @ 6:30am 
I'm not going to make it a launcher. Even if there's no EULA violation in that, I still don't want to have this program interfere with the normal launch of the game. All this program is supposed to do is ensure you can add AI in multiplayer, and it does that by editing a single byte in memory.

The program is already working, but you need to compile the source code yourself. It should compile without issue in Visual Studio, thanks to wobbli helping me ironing out issues there.

Currently, the program requires a little bit of interaction. You start up Stronghold 2, then you Alt-TAB out of the game. Open the task manager to get the Stronghold 2 PID. Then launch this program, and input the PID. The rest is handled automatically. I do have plans to let the program find the PID automatically, but I want to do a few other things first.

I do agree with wobbli that people should ideally compile the software themselves, but I also suspect a lot of people will simply avoid using it if they can't just download a .exe file. Besides, it's better that I provide an "official" download, rather than some other random person deciding to distribute executables if there is no official alternative. Besides, the option to simply compile the source code will always be there.

I should have a dedicated download page ready at some point during this week. But by all means, anyone interested in trying it already just look up information on how to compile C code on windows.
Loaf Cat Jul 19, 2022 @ 1:32pm 
Got it working. Very very nice job.

I haven't tested yet, but my concern is the AI fail to target all players properly. Has anyone checked if AI work as expected?
Last edited by Loaf Cat; Jul 20, 2022 @ 2:36am
Atsuji-Chan Jul 19, 2022 @ 7:01pm 
hey there sorry for the noob question, I did a little bit of looking into getting this working. Im trying to follow YT tutorials to learn to _compile. I'm in windows, and installed MinGW to compile. In CMD I enter "gcc main.c msfunc.c os_wrapper.c" command but it spits back an error. is there more configuration needed? am I missing a step? Thanks for the help smart people.
Loaf Cat Jul 20, 2022 @ 2:27am 
Originally posted by Atsuji-Chan:
hey there sorry for the noob question, I did a little bit of looking into getting this working. Im trying to follow YT tutorials to learn to _compile. I'm in windows, and installed MinGW to compile. In CMD I enter "gcc main.c msfunc.c os_wrapper.c" command but it spits back an error. is there more configuration needed? am I missing a step? Thanks for the help smart people.

Admittedly, not totally familiar with this, and this isn't how I did it. I used Virtual Studio, which is...workable.

There's a written tutorial available here for Visual Studio: https://docs.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=msvc-170

In short, install Visual Studios Basic Tools. Install the add-on that adds relevant libraries.

Run the development command prompt. Set the directory to the src folder using the "cd" command. Then input "cl main.c ms_funcs.c os_wrapper.c".

If all is installed correctly, this will output 3 compiled files as well as a .exe. The .exe can be moved anywhere as everything is compiled within it. Run the application whenever you want to use it and follow the instructions.
Last edited by Loaf Cat; Jul 20, 2022 @ 3:19am
Daerandin Jul 20, 2022 @ 3:11am 
Originally posted by Atsuji-Chan:
hey there sorry for the noob question, I did a little bit of looking into getting this working. Im trying to follow YT tutorials to learn to _compile. I'm in windows, and installed MinGW to compile. In CMD I enter "gcc main.c msfunc.c os_wrapper.c" command but it spits back an error. is there more configuration needed? am I missing a step? Thanks for the help smart people.

In order to know exactly what is wrong I would need to see the exact error message.

Working off a few assumptions here: If you already have 'cd' into the src directory for the source code, then the only error is that you misspelled the name of one of the source files.

MinGW would be my tool of choice for compiling C programs on windows, but I find software like VS to be over-engineered and unnecessarily complicated. I was exposed to it many years ago and I still have not recovered.
Daerandin Jul 20, 2022 @ 3:19am 
I do want to say that I'm happy people are trying to compile it themselves. I can help with MingW or MSYS2 as they are basically Linux tools ported to Windows. Other tools like Visual Studio are not exactly my cup of tea.
Loaf Cat Jul 20, 2022 @ 3:21am 
Originally posted by Daerandin:
I do want to say that I'm happy people are trying to compile it themselves. I can help with MingW or MSYS2 as they are basically Linux tools ported to Windows. Other tools like Visual Studio are not exactly my cup of tea.

Yeah, Virtual Studio works fine for something like this when it's installed, but my god is it tedious to set up. It's also a pretty large install given that I'm only using it to compile a few files.

I know a few people from the official Discord have asked for a compiled version that they can download. I think for the reason you said previously that it may be worth doing so yourself before unofficial ones release, which will be fairly hellish for us to monitor!
< >
Showing 1-15 of 67 comments
Per page: 1530 50