Jump to content

Multiplayer Ai Fix

Recommended Posts

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 by Lord_Chris

Share this post

Link to post
Share on other sites

 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.

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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).


The fields have eyes, and the woods have ears.

⁠— Geoffrey Chaucer, The Canterbury Tales: The Knight's Tale

Useful Articles

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.

  • Similar Topics

    • Multiplayer Game Stronghold 3

      Hello everyone, I would like to start here a new topic about playing a Stronghold 3 multiplayer game. I very much like this game, and try to contact people through Steam, and now currently here as well. Please let me know here, or on Steam. My name on Steam is Hollokiraly. Best regards. 

      in Stronghold 3

    • Stronghold 1 Multiplayer Discord Server

      Hello, this is a message for anyone interested with Stronghold HD(Not Crusader) multiplayer scene specifically.We are a group of passionate Stronghold players each of us having likely sinked over 10 thousands of hours into playing the old game, and have mastered almost every inch of it, be that economics or arts of warfare. Some of us came back from the past days from the early times of this game's youth, there where it all began, on Gamespy Arcade having great legacy to this day, and others bec

      in Stronghold 1

    • AI in Multiplayer-solution for non-steam version - tested with v1.4.1

      AI in multiplayer - if you're still looking for "Stronghold 2 Manager"... For those of you that want AI back in the multiplayer so you can do co-op and can't find a solution, read on. The AI in multiplayer was removed from the non-steam version some time ago via a patch I believe. There was a solution using so-called "Stronghold2 Manager" some time back but that always showed up having viral content and was hard to find (and you had to trust...). I found this source code (Mod edit: link removed)

      in Stronghold 2

    • Multiplayer tutorials for Stronghold 1

      Hey, guys. A friend of mine from Steam likes playing Stronghold 1. He's pretty good at it, and because very few online players know how to play more efficiently - me included, he has started making videos. Those are videos of his multiplayer games, but he has made some nice multiplayer tutorials as well! This is one of his videos.   And this one is a tutorial.   I know, some of us don't even want to play "in the most efficient way", but to know more is definitely better! Yes, there are many

      in Stronghold 1

    • Stronghold legends multiplayer crashing

      ?So about a month ago I posted a topic about stronghold 2 crashing in the middle of multiplayer game and so, me and my friends suddenly got interested in stronghold legends. Even though we played it multiple times, we never got to finish it. It either crashes to the main menu or it crashes to the desktop displaying a message that the game has stopped working. As steam doesn?t function as it should in Iran, we were left with no choice but to keep playing the game via Gameranger. If there?s anythi

      in Stronghold Legends

  • Create New...