Jump to content

Internal Game Modification & Format Deciphering (Support/Discussion)

Recommended Posts

Hello all,

Stronghold 2 is definitely an aged game, but has a flare to it I haven't been able to shake since I first played it around 2005-2006. However, after starting it back up again recently in the past month I thought it was time to dig deeper into what makes this game work and how we can get more out of it.

First, my background is a back-end low-level (closer to machine language than languages like Python - I work with C++ and such) programmer. I love binary data (especially binary files) and figuring out how things work.


So what's this about?

To begin, I'd like to say that I've already taken some cracks at analyzing the map files. I'm sure we're all aware there was an old Java program that could "unlock" maps that were created by Firefly themselves.?

Kill Barclay, Impossible Anyone?

While it may not be totally impossible, it has game breaking bugs that make it unplayable. So I wanted to edit the map. Oh no, it wasn't editable (like all Firefly authored maps). This was the map that started me on a journey to look through the file structure and really see what we can start tackling.?

This problem, however, was pretty simple (And for staff/management, I apologize for being new but I'd love to write tutorials on how to modify things like this for personal use - but I'm not entirely sure what constitutes 'quality article guidelines' to submit one).?

The map files have a "header" at the top with an author chunk. This has a certain amount of bytes in typical header format. Once removed, the game's map editor will show it when choosing a map to edit. But that isn't all.?Stronghold 2 does not have proper access (or it refuses to, I'm not entirely sure yet) to the typical Program Files installation directory and cannot load the map even though it shows it as available to be loaded. You must first move this map file (or rather, make a copy of it) to the Maps folder in your Documents/My Games/Stronghold 2

I have since edited this Firefly custom War map to be bug-free and properly playable.

However, that is just a story. I would like to know of any information anyone else has gathered on Stronghold 2's internals and see where we, as a community, can go with this.

My next project is to be able to change hard-coded limits on peasants, troops, etc; and then move on to disabling features like Gong/Rats/Crime in Kingmakers.

Share this post

Link to post
Share on other sites

Hello, nox7 - and Welcome to Stronghold Nation!


You obviously made some important observations about SH2 which may (or may not be known). As for submitting Tutorials and related Articles, please feel free to submit these - providing you follow our Guidelines for ''Submitting Articles''. They are Posted on The Site and are quite easy to follow. Upon approval by Staff, they will be posted to our Library for everyone to enjoy and learn.


Again welcome and we look forward to your future input and participation!



Crusader 1307

Share this post

Link to post
Share on other sites

Hi @nox7, welcome to the site!


Yes, I've noticed before about the header of the file..... it contains basic things such as the map type, i.e. Kingmaker and a few of the more basic settings and configuration of the map. In regards to the Program Files directory the game struggles reading maps from there because it's considered a protected directory in Windows. Which is why you need admin privileges to do things there. That's why the game struggles there.


As @Crusader1307 pointed out, we'd love to have some of your tutorials on the site :) If you want you can PM them to me and I'll get them up there for you. Also if you like you could upload your bug-free version to our downloads section.... I'm sure many of our members would enjoy that being there.


Finally, in relation to hard-coded limits, I'm not sure there's much that can be done on that front I'm afraid. Although you may be able to accomplish some of it as you sound more experienced in this field than myself. I've come to find that most of the configurable info (appears) to be hard-coded in the exe file.


Have a good Christmas :)


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

Hello ^^ I try to reverse engineering Stronghold map format for same goals: changes rules/use firefly scripts in campaigns or cutscenes, customize the games, generate maps, ...., and understand how maps are saved.

I was trying to understand how it works. You can find what I have actually found here. Nothing big, it's principally metadata. For now its not ad its just really in form on a tutorial, what I actually achieved to parse.


It would be really good to parse (not all, i have no big experience in reverse engineering, but I learn), and maybe we can find some of "redondancy" like the begin will be hard, and then a bit easier (maybe? i can go wrong it's just assumptions that can be unfounded)


I don't know if much of the data can be get and how much we can alter it outside the rule of the game, because some things may be hardcoded into the executable.


Can be interesting ^^



EDITED by @Mathew Steel

Reason: formatting and updated with correct link.

Edited by Spy

Share this post

Link to post
Share on other sites

Hi, @Spy. I've updated your most recent post to contain the link to your wiki article. To clarify, the advertising rule is in place to prevent people gaining monetary gain from advertising on the site, or to prevent spam and irrelevant content being posted. As your wiki article is beneficial to the greater community and there is no monetary gain to be made from it, it does not fall under advertising.


In future, for similar things, just post the link. Making users go through the effort of decoding a Base64 code is a lot of effort and is far more concerning than a readable link :P


Nice job on the article though!

- Tom

"Gofyn wyf am galon hapus, calon onest, calon l?n."

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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

    • Economic Game: Calanais

      Hey folks, I've just completed the stand-alone economic mission, Calanais! It's something of a grind - you cannot grow or buy food apart from hops and ale, and there are no trees. You are constantly assailed by bandits. Your only economic recourse is to sell stone, keep your peasants drunk and religious, and tax them. The aim is to gain (and maintain for a period) a large population (118 at normal difficulty). The early stages of the game in particular are tricky. The bandits will

      in Stronghold 1

    • Stronghold 2 Manager is here! Possible to play MP game with bots

      I have good news! :) One of the original fans of the mod sent the installation file. :) This is where you can download it from, but be aware, it is likely that your antivirus will detect it as a troyan. I believe that this is nothing harmful, and I will try it later. Right now I don't have the other PC of mine here, but I will have it tomorrow, so I will try it then.   Another issue is that they said it works with 1.3.1 version, so I am unsure whether this is going to with 1.4.1 version, but we

      in Stronghold 2

    • Binary format of Stronghold and Crusader maps

      Is there any information available about the binary structure of maps for Stronghold 1 or Crusader, besides instructions on how to change the troops color?   I'm going to try to create a program for generating map templates (custom sizes, custom starting height, perhaps even landscape from heightmap). However, I have absolutely no experience in analyzing binary files, so any relevant information could save me a lot of work.

      in Volunteer Work

    • Game crashing in the middle of it

      I?ve eventually found some people to play with and the first few weeks everything was OK. But last night it just kept crashing in the middle of the game. It didn?t happen once, twice or even trice but it happened 4 times. The 4th time we just har to give up. Even though we turned off firewall it kept crashing. Any sort of help is appreciated.   I?m using game ranger btw.

      in Stronghold 2

  • Create New...