Jump to content
Daerandin

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


Quote

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
Guest
This topic is now closed to further replies.

  • Similar Topics

    • Stronghold Legends Multiplayer

      Just seeing what interest there is on the site to play a Legends multiplayer game?

      in Stronghold Legends

    • Multiplayer Gaming Community Rules

      Members of the Mutiplayer Gaming Community are expected to behave in accordance with these rules at all times. Failure to do so or any breaches of these rules will result in you being thrown out of this subcommunity and not allowed back in again. Absolutely no personal attacks, nasty behaviour, taunting, baiting, jeering or insulting of others whatsoever either in game or on the site. Be respectful to others at all times. No cheating. Absolutely no use of trainers or other out of

      in Introduction & Announcements

    • Thinking of Joining the Multiplayer Gaming Community?

      If you are interested in joining the Multiplayer Gaming Community and taking part in field battles with users on the site, please make sure you have read and performed the following actions before requesting to join this club. Make sure you have completed to the best of your ability the information in your user profile under the 'Multiplayer information' heading. Other users will need this information to quickly find you and connect with you via the platform you are using. Make sure yo

      in Introduction & Announcements

    • Definitive Edition Multiplayer Games

      Hey guys,  Im the original £ûƒƒý from Stronghold Legends Multiplayer from around 15years ago. There was a small "professional" community and I would love to find some of the old players again and play with them some Definitive Edition, Legends or Crusader.  If you know me feel free to add my discord: gudrun69 Just using this post because it has many clicks haha If anyone has questions about the game... I can also help np

      in Stronghold Legends

    • 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

×
×
  • Create New...