Daerandin 16 Posted July 27, 2022 (edited) A couple of weeks ago I decided to start looking how AI can be enabled for Stronghold 2 multiplayer. I know there are some tools that works for the older versions before the Steam Edition, but I quite like the higher resolution support of the Steam Edition so I decided to figure it out. It took me quite some time to first of all learn how to analyze the game memory as it was running, and then find what I was looking for. There is a specific 1 byte variable in the game memory, this variable is always set to 1, except when you host a multiplayer game. Then the game sets it to 0. As soon as you leave the hobby you hosted, the game switches it back to 1. When this variable is 1, you can see and click on the button for adding AI in the kingmaker/multiplayer screen. When the variable is 0, this button is not present. The address for this part of memory varies between game launches, but there is a pointer to this memory region at a static location. The pointer is always at an offset of 0x00EC5F28. At this address, you read a 4 byte value, then you add an offset of 0xD28 to this value, and you will always land at the correct address for enabling AI in multiplayer. I then wrote a small little program to simplify the process. This tool of mine does not touch any game files, so there are no modifications to the game. All it does it overwrite a single byte in the game memory while it is running, so you can add AI when you host a multiplayer game. TL;DR I figured out and made a tool that lets you add AI to Stronghold 2 multiplayer. I set up a sort of official download page: <link removed> The full source code is available here: <link removed> The precompiled executable you can get from the download page requires a little bit of interaction. You will need to input the Stronghold 2 PID (process ID) before it can start working. You get the PID from the Task Manager while Stronghold 2 is running. If you compile the newest source code, then the program will find the PID automatically. I have not updated the download page with this newer version, because I was hoping that some more people would test it. I use Linux, and can only test Windows stuff virtualized, and I would prefer to have some feedback. But if I don't get anymore feedback, I'll probably just update the download anyway in a couple of days. EDIT: If you want to help, compile the newest source in Visual Studio and let me know if there are any warnings/errors when compiling. Also, maybe I'm just dumb, but I can't figure out how to make this url's into clickable links in this post editor. Edited July 28, 2022 by Lord_Chris 0 Share this post Link to post Share on other sites
Daerandin 16 Posted July 28, 2022 I got some testing done from people on the Steam forums, so I released the updated version. The official download page has the new version which you simply start and leave running. Then you start Stronghold 2 and you can add AI opponents when you host a multiplayer game. Note that only the game host should be running this. 0 Share this post Link to post Share on other sites
EaglePrince 261 Posted July 28, 2022 Hi @ Daerandin , welcome to Stronghold Nation! I've made your links clickable. We have a WYSIWYG editor here, so we need to select the text, click the Link button from the toolbar, and then past the link in the designated textbox. Those are great news! I'm glad you found people to test it out, so you could share the better version with everybody right away! By the way, do you know if the testers from Steam face any issues? I remember the old Stronghold 2 AI Manager (the tool for AI in multiplayer) was getting detected as a Troyan, even though it wasn't that. Another thing that would be interesting to know is whether the AI in multiplayer acts as usually in singleplayer, or are there any differences? With the old AI Manager, when you fight against an AI in a multiplayer game, the AI would not be able to build siege engines. He was always missing something, I'm not sure, but I think he wouldn't build siege camps. And they weren't sending their attacks in waves, as they should, but they were sending their troops in columns. That way it was way much easier to defend against those AI's. We were writing here many times how it would be awesome for Firefly to introduce multiplayer to Stronghold 2. It's really a pity they've never done it. I was hoping so much they they would make it while they were working on the Steam Edition. 0 Stronghold Crusader faces and shields Stronghold Europe website Share this post Link to post Share on other sites
Lord_Chris 284 Posted July 28, 2022 Admirable and interesting as your intentions may be @ Daerandin , this form of software is essentially a trainer, in that it's injecting code into the game memory while the game is playing. That means that this discussion is contrary to the site rules. We've had a number of similar topics in the past about these applications, and unfortunately, it wouldn't be fair to those users if this topic now remained open. I'm therefore closing the thread, but feel free to PM me with any questions you may have on the site rules. You're more than welcome to begin other discussions/share mods that don't modify the game memory or any of the compiled game files (.exe, .dll etc). 0 Quote The fields have eyes, and the woods have ears. — Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale Useful Articles Stronghold Legends Trails & Walkthroughs Scripting Invasions & Using Invasion Markers Extracting Audio Assets from Stronghold 3 Locking/Unlocking Stronghold Crusader 2 Maps Share this post Link to post Share on other sites