Emperor: Rise of the Middle Kingdom

File information

Last updated

Original upload

Created by

XJDHDR

Uploaded by

XJDHDR

Virus scan

Some manually verified files

Tags for this mod

About this mod

Program that lets you change the resolution Emperor runs at as well as apply specific patches.

Requirements
Permissions and credits
Changelogs
Donations
Program's readme: https://xjdhdr.gitlab.io/my_creations/Impressions_Resolution_Customiser/Emperor_Resolution_Customiser.html


With the wide variety of screen sizes and resolutions available, it is important for a game to be able to give the player options. This is especially required for LCD monitors in that running a game outside it's native resolution creates a blurry image. By default, Emperor only allow you to choose between two resolutions: 800x600 and 1024x768. Though this was manageable at the time due to these being the most common resolutions used then, screens have since gotten bigger and denser. The switch to LCD further caused issues due to their blurring images that run outside their native resolutions, as well as the adoption of widescreen aspect ratios meaning that 4:3 resolutions are stretched and distorted.

This started to change on the 5th of February, 2012 when a Widescreen Gaming Forum member named JackFuste uploaded copies of Pharaoh's EXE that he had modified to run on a few widescreen resolutions. From there, he went on to upload a number of packs and fixes containing edits for all 4 of the Impressions Studios' 2D City Building strategy games to run on a number of common resolutions and whatever resolutions users requested. While a massive improvement over the default options, the main issue was that Jack was for the most part the only one making these fixes and any resolution not already available had to be requested. Another thing that can be seen is that he became better at modifying the resolutions over time, ultimately adding some fixes to the UI in his latest mods that weren't present in earlier versions. This meant that his fixes as they stand have varying levels of quality and some resolution options simply never had fixes created.

A small area of progress here came from another Widescreen Gaming Forum member named Mario who, on the 4th of September, 2018, uploaded his own modifications for Zeus and Emperor that came with a guide describing how he created his fixes. With this guide, it was now easier for people to create their own fixes.

And that is where this project comes in. This program gives you the ability to change what resolution the game runs at. It does so by modifying the 1024x768 option so that it will instead run the game at the resolution you specified. It also resizes various elements of the game's UI to fit the new resolution. To do this, this resolution customiser needs an unmodified copy of the game's EXE. Once done, it will create a modified copy of that EXE that you can drop into the location you installed the game. In short, this utility will give you a modified copy of Emperor's EXE that will run at the resolution you specified and which has all of the fixes that are present in the last EXEs Jack released.

You can optionally apply two additional patches to the game as well. The first is a fix for the inability to switch the game into windowed mode if you have customised the game's resolution. The second is for an optional increase to the maximum number of sprites that can exist on a game's map at once to 2x the original limit.

Finally, this program can also automatically resize the game's background images to fit the new resolution.


FAQ
Is this open source? What language did you use?
  • Yes, it is. I have placed the source code under a Modified BSD 4-Clause license and you can find it on GitHub. The language used is C#.

What versions of Emperor are supported?
  • Currently, only the GOG, and English CD versions published by both Sierra and Sold Out are supported. I would like to add support for more versions but to do so, I need to know where I can find them.

How fast is this program?
  • Patching just the EXE without resizing any images: Instantaneous. The program finishes pretty much right after clinking the button.
  • Patching the EXE and resizing images: During the testing phase, this took around 3 seconds. However, after I added multithreading to the image processing stage, the process takes around half a second on my PC (1st gen Ryzen 5 at stock speeds).

I tried to use this and saw an error that says, "Emperor.exe was not recognised. Only the following unmodified distributions and languages are currently supported: ..."
  • This means that you tried to modify a version of Emperor that my program doesn't recognise. In order to apply the required changes, I have to add and modify code to Emperor's EXE. To do this, I need to know exactly where the required changes need to be made. If my program applies it's changes to the wrong offsets in the EXE, it will cause problems. Due to this, I opted for a whitelist approach to figuring out where the changes need to be made. The program will only work if the Emperor.exe is recognised.

What limits are there to the resolutions this program can set?
  • One big limit is the maximum resolution. The size of the city viewport is determined by two multipliers that are fed into formulae to determine what size they are drawn to. Both of these are signed 8-bit numbers which means that they can reach a maximum of 127. This means that the maximum size of the game's usable UI (meaning the city viewport, top menubar and right sidebar) is 10384x2560. That said, I have configured the program to allow a higher resolution than this, where any gaps created by larger numbers will be filled in by a background. I have set these to be 2x larger so that the usable part of the game's window will never be less than 25%.
  • So in short, the maximum resolution you can set is 20768x5120, with the game's usable UI being limited to 10384x2560 and will be drawn in the top-left corner of the window if smaller than the overall resolution.
  • Besides this, your selected resolution also needs to be at least 800x600, as the game is not designed to be displayed on a resolution smaller than this.
  • The width component also needs to be divisible by 4, as major visual bugs happen if this is not the case.

I used this utility and the game's resolution didn't change.
  • This is most likely because your game is still configured to run at 800x600. There are two resolution options in the game: 800x600 and the 1024x768 option, which is patched by this program to use the resolution values you supplied. The setting in the game's Display menu can be patched by this program to display the new resolution values instead of 1024x768, if you selected the option to patch the game's EmperorText.eng file.
  • There are four ways you can choose to do this:
  • Automatic way: One of the optional downloads is My Emperor INF. Download and copy the contents into your Emperor folder.
  • Semi-automated way: Another optional download is Display option patcher scripts. Drop the appropriate script into your Emperor folder then run it.
  • Manual way: Launch the game, load a map then open the "Options->Display" menu then choose the "1024x768" option.
  • Manual and hard way: Open "Emperor.inf" in the folder you installed Emperor using a hex editor and look at the 17th byte. If it's value is equal to "1" or "2", change it to "3".

The game crashes if I try open the world map.
  • This is almost always caused by the game trying to load a world map image that is too small to fit inside the viewport.
  • The program's "Resize Images" option creates map images that are the correct size. So the solution is to let the program create such images and then copy them into Emperor's DATA folder.

I'm using the GOG version of the game and building animations are static or don't show up.
  • There appears to be an incompatibility between the game and an overlay or something that the GOG Galaxy client adds to the game's process, causing the above problem.
  • To solve this, run the game's executable directly and do not launch it through the Galaxy client.
  • If the above doesn't work, try exit the Galaxy client in question before running the game directly.

I'm not running the game through the Steam/Galaxy client and animations are still static or don't show up.
I tried your suggestion above and animations are still static or don't show up.
  • Another quirk in the game is that it uses a counter maintained by Windows to track how animations should play. This counter continuously ticks upwards for as long as you have your PC running. Once the counter reaches a high enough value, Emperor is unable to correctly read its value.
  • To solve this, restart your PC if it has benn running for a long time. This resets the counter's value.
  • Finally, if this doesn't work, other software that adds overlays to a game (e.g. MSI Afterburner, EVGA Precision, Shadowplay, etc.) could also cause this same issue. If you're using such software, try to disable the overlay, add an exception for Emperor and/or close the program in question.

The game's window extends beyond the screen's edges.
Menus and buttons don't work properly because their activation points don't line up with their graphics.
  • This is because you're running the game on a High DPI screen and Windows scaled the game to compensate.
  • To solve this, download and install the Emperor manifest found under my download page's Optional files section.
  • If the above doesn't work, disable the DPI scaling compatibility option. To do so, right-click on Emperor.exe. Switch to the Compatibility tab. Then click on Change high DPI settings. Then, tick the Override high DPI scaling behaviour. Scaling performed by: option. Then select the Application option in the drop box. Then click on OK for every menu. If any options are greyed out, click on the Change settings for all users button under the Compatibility tab.

What are the files you have under the "Misc" section?
  • The first is my old widescreen fixes pack that I used to have on Sourceforge before I created this utility. It contains all of the modified EXEs I could find for Emperor that JackFuste created as well as a bunch of docs, files and helper scripts that I created which make it easier to get the game setup after installing a widescreen fix.
  • The second is an archive containing all of the widescreen fixes created by JackFuste that I've managed to find, and which are what I used to create my old widescreen pack.
  • The third is the widescreen fix that Mario created and uploaded to the WSGF post I mentioned above which has subsequently become unavailable due to changes made on the website, which included deleting all files uploaded there.
  • These three files are provided as-is with no support whatsoever from me. I consider all of these uploads depreciated by my utility and have mainly uploaded them to preserve their history. You might need to download the widescreen fixes pack if you are using a version of the game that is not currently supported by my utility. Otherwise, you should be using my Resolution Customiser instead of any of these.

I have an unrecognised version of the game. Can you please add support for it?
  • Yes, I am willing to add support for other versions of the game. There are three conditions though:
  • First, I am only willing to add support for fully patched copies of the game (i.e. v1.0.1.0). Digital distributions of the game are already patched. If you're using a CD version, you can download the relevant patch from here.
  • Next, the game's EXE must not be modified in any way. In particular, I will not add support for no-CD patches under any circumstances. If you are using one, remove it. If you are using some other type of modification to the EXE, I recommend providing this resolution customiser an unmodified copy of the game then re-apply your modifications to the modified EXE that this program creates. If this modification is good, you could even suggest that it be added to my program.
  • Finally, I need to know where I can find this version of the game. This is because I need to be able to take a look at the game's files to find out at what offsets they need to be modified and test the modifications.

Why don't you support no-CD patches?
  • The biggest reason is because these patches are used to facilitate piracy, which is both immoral and damages PC gaming. People who disagree will reply with excuses like: "I only pirate games to try them out", "games are too expensive", "I would never have paid to begin with", "game devs are greedy", "DRM is useless", "only paying customers suffer from DRM" and so on. To those people: Don't bother! I've heard all of those ad-hoc excuses, and none of them stand up to scrutiny.
  • Next, even if we remove that aspect from the discussion, there is no way I can know what exactly was changed in the EXE to remove the copy protection or what bugs and incompatibilities this removal potentially caused. Additionally, there could be any number of variations of these patches where different groups would remove the copy protection in their own way, leading to different code layouts and hence, different offsets that would need to be found.
  • In short, the only legitimate reason I can see for using a no-CD patch is if the copy protection has stopped working on modern PCs, meaning that the game can't be played at all without one. This is not the case as far as I'm aware. If you are desperate to play this game without any DRM present, the only way I'm willing to support is to buy the GOG version.

The display menu option for selecting my resolution still says "1024x768".
  • This is only a cosmetic issue. Selecting this option will run the game at your chosen resolution despite what that text says. The utility has an option to correct this issue. If you have the Patch EmperorText.eng option ticked, and have a copy of EmperorText.eng next to Emperor.exe, the program will modify the menu option to show the correct resolution numbers. Therefore, the only reason you should have this problem is that you either didn't provide a EmperorText.eng to patch, or you deselected the option.


Donations
While I don't expect any payments for my mods and have no plans to charge anything for them, any donations will be greatly appreciated. Please see my readme above for ways you can do so, including "free" methods.