Civilization II MGE User Interface Additions (CIV2UIA)

Discussion in 'Civ2 - Technical Support' started by FoxAhead, Oct 18, 2017.

  1. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    Hi!

    I am glad to present you my new program. This time it is a set of useful enhancements to the game interface and a set of different fixes and tweaks.

    Description


    It is not a patch but launcher which means that the CIV2.EXE file will remain untouched. It uses DLL Injection technique to provide changes to the code on the fly.

    At the beginning of the project provided features were primarily aimed at improving the interface and displaying game data, but in no case on changing vanilla game rules or restrictions. But later the project gained additional features fixing some bugs and even tweaking game rules. Some of the improvements were taken from civ2patch project.

    So far only version Multiplayer Gold Edition 5.4.0f (Patch 3) is supported.
    Tested on Windows 98 SE, Windows 7 x64, Windows 10 x64.

    Features


    Here is what was implemented.
    1. First of all, it is support for the mouse wheel and middle button. Scrolling works in all sorts of lists. Scrolling the wheel while mouse pointer is over the specialists in city window changes specialists in both directions. Taxes can be changed in Shift-T window: just hover mouse pointer over corresponding bar and scroll the wheel. Also holding Ctrl while scrolling will zoom map in and out. Ctrl + middle button sets normal zoom level. Clicking with middle button on map centers map on that spot. Also map can be panned with middle mouse button.

    2. Scrollbar was added to Activate Unit popup dialog with more than 9 units in stack.
      upload_2017-10-19_5-40-12.png
      Now you can select any unit in stack even beyond limit of 9 units. You can scroll the list with the mouse wheel or by clicking on the scrollbar.

    3. For Settlers and Engineers internal work counter is shown over the unit sprite. This means that you can see how much work is exactly accumulated in unit. This and previous feature are very useful for rush terraforming.
      upload_2017-10-19_5-38-5.png
      For more information about how this counter works see links:
      https://forums.civfanatics.com/threads/90129/
      https://apolyton.net/forum/civiliza...ilization-ii/31110-info-settlers-engineers-gl

    4. Click-bounds of specialists sprites were corrected in city screen. In the original game, if you click as it seems almost to the center of the sprite, then the adjacent one on the right changes. This is especially noticeable in large cities.

    5. Game turn added to the status sidebar.
      upload_2017-10-19_5-39-12.png
      This is useful for making a decision about the beginning of the revolution according to the rules of the Oedo years. Revolution starts when the number of the turn is a multiple of four.

    6. Current research numbers are displayed in the Science Advisor for precise research control.
      upload_2017-10-19_5-41-37.png

    7. Correct CD audio tracks looping and displaying play progress
      CDAudioTrackProgress.png

    8. Game icon fix (visible in Alt+Tab popup)

    9. Resetting city name prompts, when restarting a new game without closing program

    10. Show buildings even with zero maintenance cost in Trade Advisor
      upload_2018-9-3_1-54-54.png

    11. Scrollbar for supported units in the city window. And a number of total supported units.
      upload_2018-9-3_1-53-10.png

    12. 64-bit patch included. Exactly the same version as here:
      https://forums.civfanatics.com/threads/civilization-ii-64-bit-editbox-patcher.622154/
      This means correct work of all input fields.

    13. No-CD patch included (note that this disables intro/wonders movies and High Council movies).

    14. Enable multiplayer for Windows 8, 10 (should also work on older OS).
    15. Option for enabling Simultaneous moves in multiplayer. This is the same as writing 'Simultaneous=1' string to the CIV.INI file. With this option enabled, the multiplayer feature 'Humans Move Units at the Same Time' should be available when setting up a new multiplayer game.

    16. Sort supported units list.
      Sorting order is: role 5 (Settlers, Engineers) is first, then attacking units ordered by domain (ground, air sea), descending by defense, descending by attack and then the rest by ID.

    17. Reset Engineer's order after passing its work to coworker. If there is already a worker in the tile, then when adding a new one, he takes the work counter for himself, and the order of the previous one is additionally reset. Thus, there should be only one worker with an order in a cell. This simplifies rush terraforming, as it eliminates the need to wake up the unit each time. Refer to point 3 for more information.

    18. Don't break unit movement on ZOC (zone of control). If unit has 'Go To' order, it doesn't stop when entering ZOC. Of course, the ZOC rule still applies. Originally, this behavior was applied only for role 7 units (Caravan, Freight). Be careful with this option, the unit will only stop when it breaks the ZOC rule or runs out of movement points. That is, for example, a unit directed at an enemy city will continuously try to enter it, attacking the defenders. Or attack an enemy unit suddenly emerging from the fog of war.

    19. Tweak units rotation algorithm. Originally, units ordered with 'Wait' command receives special Wait flag; when switching to the next unit, it is searched for as the closest one without a Wait flag; if nothing is found, then all these flags are cleared and searched again. With this option, when manually activating an unit it clears the flag for all units of this stack, and vice versa sets it for all the rest. Also store activation position for later switching to nearby units. All this should build alternative convenient sequence for units rotation.

    20. Reset MoveIteration before start moving to prevent wrong warning. This fixes the incorrect 'Long Unit Move' warning that was caused by a non-resetting movement counter.

    21. Set focus to City window when opened from Advisor and back to Advisor when closed. Originally, the focus stayed on the Advisor window, so none of the City hotkeys worked, and pressing Esc closed the Advisor instead of the City window.

    22. Celebrating city in yellow color instead of white in Attitude Advisor (F4). So it's more noticeable now. And food surplus/shortage icon if city has it

    23. Indicating attitude in the city window. Texts below citizen sprites are colored as in Attitude Advisor. This helps to immediately see the effect of the used specialists.

    24. Radio buttons hotkeys. Can speed up the selection of options using the keyboard.

    25. Quickinfo tooltips. Hover mouse over the city or units and hold Ctrl key.

    26. Made most advisors and lists vertically resizable.

    27. Advisors caption area increased to make it easier to move windows around.

    28. Better scrolling in Units List Popup: no flickering, adjusting scrollbar PageSize, keys navigation.

    29. Added Cancel button to city Change Production dialog - Esc is now Cancel.

    30. Added shields cost and maintenance in the city Change Production list.

    31. Enhanced City Status advisor. Added total cities number and more icons. Cities can be sorted by size, name, food, shields, trade or production type. Clicking on production item directly will bring up the change production dialog.

    32. Mass change specialists in City window. Hover mouse over specialist, hold Shift key and scroll mouse wheel - this changes all specialists at once. Shift-clicking on specialist change others to the same one.

    33. Suppress simple GAME.TXT popups. The list of popup names could be set in the UIA Settings (Menu - UI Additions - Settings... - List...). These popups will be shown in the map overlay instead, eliminating the annoying need to click 'OK' button.

    34. Include fix for mk.dll (229.gif, 250.gif) and pv.dll (105.gif). As here:
      https://forums.civfanatics.com/resources/corrected-dlls-for-mge.24259/
      This fix is applied automatically based on GIF size comparisons. If mk.dll and pv.dll are modded, the fix will not be applied.

    35. Color correction. If the game seems too dull or too bright for you, then this can be corrected without editing the GIF palettes. This and some other options can be set in Menu - UI Additions - Settings....

    36. Mass move units of the same type with Shift+RightClick. With unit activated hold Shift and Right-Click on the destination square. All units of the same type capable of moving (with move points, not fortified, not on sentry etc.) will be ordered to move.

    37. Added gold coins to the Foreign Minister.

    38. Two new View-menu items: 'Arrange Windows S' and 'Arrange Windows L'. They differ in slightly smaller and larger dimensions of the side panel compared to the standard option 'Arrange Windows'.

    39. PathLines for city trade routes and unit movement.
      With city selected (right-click on it to place blinking white cursor) and Shift pressed moving mouse around will draw the path along which qualified road or railroad should be built to get permanent trade bonus. Moving mouse over this same city will draw all (up to three) existing trade routes. More details about qualified roads here:
      https://apolyton.net/forum/miscellaneous/archives/civ2-strategy-archive-aa/104062-trade-roads-–-determination-of-the-bonus-road-and-railroad-connection
      With the active unit selected and Shift pressed, moving the mouse will draw a predictable path based on your knowledge of the world map (existing units and terrain improvements). That is, when drawing a path, hidden foreign units, cities or roads are not taken into account.

    Some experimental features that could change some original game rules or limitations without a guarantee of stability:
    • Change total units limit from default 2048. Don't use numbers greater than 32767. Saves with number of units greater than default should be loaded only with this patch.
    Also some enhancements from civ2patch project included:
    and patches that affect some game rules and limitations:
    • AI hostility
    • Retirement year
    • Population limit
    • Gold limit
    • Map size limit

    Download and source code


    As usual it is all open source. You can check it at GitHub.
    https://github.com/FoxAhead/Civ2-UI-Additions/releases/latest
    Unzip 2 files to game's folder:
    1) Civ2UIA.dll
    2) Civ2UIALauncher.exe
    Run Civ2UIALauncher.exe.
    Click Play.
    If all is correct then game will start and launcher will close.
    This launcher will search for CIV2.EXE and CIV2UIA.DLL in its current folder and try to set all paths automatically. If you unzip these two files elsewhere then you have to provide correct paths to game and DLL. Also you can click "Create shortcut..." to create shortcut to launch game with UI Additions.
     
    Last edited: May 31, 2022
  2. catalin72

    catalin72 Prince

    Joined:
    Oct 31, 2008
    Messages:
    466
    Gender:
    Male
    Location:
    Romania
    Hello.I have Windows 7 32b and starting the launcher I have this error:

    Features added:
    - Mouse wheel support wherever possible
    - Ability to choose any unit in stack beyond limit of 9
    - Work counter for Settlers/Engineers is displayed
    - Click-bounds of specialists sprites corrected in city screen
    - Number of the game turn is displayed
    - Current research numbers are displayed in Science Advisor
    - 64 bit patch included
    This launcher will search for CIV2.EXE and CIV2UIA.DLL in its current folder and try to set all paths
    automatically.
    You can create shortcut to start game immediately. All selected paths are saved in shortcut.
    Game version Multiplayer Gold Edition 5.4.0f (Patch 3) supported only.
    BytesWritten 269
    Error: Dll not loaded
    Maybe need that DLL in system32 or system?
     
  3. DaringPaw

    DaringPaw Chieftain

    Joined:
    Sep 6, 2016
    Messages:
    35
    You do not address any of the network or connection issues for playing multiplayer games on Win 8 or Win 10. Does the game run on Win 8 or Win 10 with your patch and allow network connections? As far as I noticed, Civ 2 MGE MP did not work because of connection issues, moste likely because Win 8 and Win 10 might have different network adapter priority settings or management. Could you address this issue in your next launcher version, too, please? Or did you already, but didnt mention it? Or does Multiplayer mode work for you under Win 8 or Win 10 anyway? If so, please explain, how? Thank you a lot for this nice peace of work anyway.
     
  4. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    catalin72, I tried very hard to reproduce your situation. Tested on several machines with Windows 7 (32 and 64 bit) but all is working fine.
    However, I added more checks in the game launch code, which may clarify the reason for the DLL not loading.
    You can try please download this new version 1.1 (build 42) and provide feedback.
    No, you don't have to put Civ2UIA.dll to the system's folders. Just put this two files next to CIV2.EXE and all must be fine. In addition, once you received such a message "Dll not loaded", it means that all files were detected correctly and start sequence was initialized.
    Launcher starts civ2.exe process, injects little code that must load DLL and then waits 5 seconds for response from DLL. This error message means that after 5 seconds no response was received.
    I can assume several reasons for this error. First, try to execute launcher "As administrator". Second, check logs of your antivirus/firewall software: may be it is preventing such little hacking actions as writing to process memory.
    Also I remember having bad experience with MS Game Explorer (GameUX.dll) interfering with old games like civ2.exe. When you run old game then this Game Explorer starts additional process rundll32.exe trying to connect Internet, and if it can't then this process hangs forever.
    If nothing helps then zip and send me your civ2.exe.

    DaringPaw, no, sorry, this is another big challenge for me. I did not touch any network part of the game and I believe it is much harder.
    Yes my patch (launcher) works at Windows 10 (tested on VMware) but it doesn't offer solution for multiplayer game issues. I' aware of patch from deeves (aka vinceho?) that does this.
    https://forums.civfanatics.com/threads/help-test-multiplayer-on-windows-8-10.572280/
    https://forums.civfanatics.com/threads/mge-civ-2-patch-project.570939/
    Did that Civ2 Patch Project works for you? May be later I will have time and courage to study this topic.
     
  5. catalin72

    catalin72 Prince

    Joined:
    Oct 31, 2008
    Messages:
    466
    Gender:
    Male
    Location:
    Romania
    Thank you for your efforts.Using my XP(32b) from a partition,no problems,I played few turns.In Windows 7(32b),without anti-virus and running launcher as administrator(before version 42 I used too these), now I have this message:

    BytesRead 512
    BytesWritten 269
    Error: Dll not loaded
     
  6. DaringPaw

    DaringPaw Chieftain

    Joined:
    Sep 6, 2016
    Messages:
    35
    Helllo FoxAhead, thank you for your reply. As I wrote in the other thread, the patch didnt work for me. I worked around all issues (including network connection issues) by installing an Oracle Virtual Box, running Windows XP + SP3 and some Intel Driver Package on it. It worked perfectly well. But it would be of course much more convenient to be able to just install and play Civ 2 MGE MP on Win 10 64 bit systems (if it doesnt crash, like it used to on 64 bit systems, when certain notifications popped up, e.g.). Well, would be awesome to see your launcher address the network connection issues Civ 2 MGE MP is facing on Win 8 and Win 10 systems, while also addressing those of 64 bit systems. That would be the perfect solution. Though I dont expect you to do this or that you will do this soon. So I will just stick with my workaround. But thank you for your great peace of work. Its one more step into the direction of a totally functioning Civ 2 MGE MP under Win 8 / Win 10 - and the other features are quite helpful. Great work!

    Oh, one more question comes to my mind: Does your launcher allow the use of the "unlimited patch"? Or some ai tweaks like "non-hostile ai patch"? I am not sure if I will use your patch just because of its additional practical features, since I think the advantages of the "unlimited patch" or the "non-hostile patch" might outweight the advantages of the practical features your launcher adds. Maybe you can also integrate or addess the issues the "unlimited patch" and the "non-hostile patch" address with your launcher? That would be great, too.

    Thank you again and all the best for you!
     
  7. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    catalin72,
    thank you for your patience. This error does not give me rest. I fixed one potential place which could lead to this behavior. Could you kindly try again (v1.2 build 43)? If it does not help then I have to look at your civ2.exe - drop it somewhere on filesharing service.


    DaringPaw
    ,
    I knew this question will come sooner or later. As I mentioned my goal was to not change vanilla rules and limitations. Mostly because changing limits is more than just changing few bytes in memory. For example, you cant change more than 16 specialists in city because their state is stored in double word (32 bits). And actually those beyond 16 are "dummy" and don't affect any calculations. If you want to change this limit you have to find a way to store specialists data somewhere beyond this 32 bits and to find all places in exe-file that are using this data and patch them too. You cant just insert some extra bytes because all addresses are fixed and compiled. Also you have to patch code for saving and loading and that means incompatibility with the original game. And also that means deviating from original game rules because more than 16 specialist will bring you surplus (imagine SSC with 50 scientists).
    But despite my thoughts I'm totally agree with you that it would be nice to compile all those enhancements in one place. And since Civ2 Patch Project is open source I think it should be easy to adapt those features in my project.
     
  8. DaringPaw

    DaringPaw Chieftain

    Joined:
    Sep 6, 2016
    Messages:
    35
    Hello FoxAhead, thank you for your answer, again! It sounds at least like we could be somewhat confident that you will do it sooner or later. The "unlimited patch" doesnt address the specialists in cities, in fact it changes only very view things, i.e. individual and total limit of gold, cities and units (if I havent forgot anything), since computer memory is not an issue for Civ 2 anymore. Though the unlimited patch introduces a minor launcher itself as well. Hence, I was wondering if it is compatible with your launcher, too. It also offers an option like "no cd" and works for Test of Time, too. Maybe there were a few other options, but I do not remember them straight from the back of my head. But the important changes address only the individual and total limit of gold, cities and units, maybe even the upper limit of map size. Cheers!
     
  9. catalin72

    catalin72 Prince

    Joined:
    Oct 31, 2008
    Messages:
    466
    Gender:
    Male
    Location:
    Romania
    Hello.With 43,too,same error:
    BytesRead 512
    BytesWritten 269
    Error: Dll not loaded
    This is my exe,uploaded in MEGA:
    https://mega.nz/#!x4lCCALL!LQu40zU-NFXR7LGpEAdqsaNufDPUZxnbp2QgmE7G0i0
     
  10. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    catalin72,
    Thank you for feedback! I looked at your civ2.exe and it is totally OK.
    The problem could be in GameUX and compatibility system.
    Try the folowing:
    Rename (or copy) civ2.exe to something like civ2_.exe.
    Then start launcher and choose manually this new file by clicking "Browse..." on the right of input field for "Game".
    Click Play.
    If this workaround works then the problem is in GameUX system. Renaming civ2.exe fools this system and starts game straight away.
    To ease launching game with UI Additions and not choosing every time new path to civ2_.exe you can create shorcut by clicking button "Create shortcut...". You should do this after choosing path. All paths selected will be saved in created LNK-file. Then you can just run this LNK.
     
  11. catalin72

    catalin72 Prince

    Joined:
    Oct 31, 2008
    Messages:
    466
    Gender:
    Male
    Location:
    Romania
    Good idea! :) It's OK now,thanks!
     
  12. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    catalin72,
    I received another feedback that problem could be because of too little timeout for 5 seconds of waiting DLL to load. I released new version (1.3 build 44) with timeout set to 20 seconds and it helped other users without any renaming tricks. You could try this new version too.
     
  13. DaringPaw

    DaringPaw Chieftain

    Joined:
    Sep 6, 2016
    Messages:
    35
    Cant your workaround be used to start with Civ 2 with a modified exe or even the unlimited patch?
     
  14. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    If I understood you correctly, you want to use my launcher to start already somehow patched/modified civ2.exe? I did not test it but I believe it should work as soon as civ2.exe is of correct version (5.4.0f Patch3) and has correct size of 2489344 bytes. I believe that my in-memory patches should not interfere with other changes in EXE like cd-patch, limits changes.
    Speaking of Civ2 Patch Project from deeves, it has the same technique of in-memory patching without changing EXE. So if you are saying about starting these two launchers together - no it is impossible.
    They are just two different projects built using different languages. But since Civ2PP is open source I could study work of deeves and adapt his solutions to my project.
     
    Last edited: Nov 11, 2017
  15. DaringPaw

    DaringPaw Chieftain

    Joined:
    Sep 6, 2016
    Messages:
    35
    Ok, as soon as I have installed everything again, I will test it - I mean the first option, you mentioned: Using some modified Civ2.exe. I did not refer to the Patch of deeves, though. To make this perfectly clear. Thx.

    For future development I really suggest focussing on Win 10 multiplayer network connection issues, and integrating it all in one patch or launcher, i.e. better ai attitude calculation, unlimited cities, gold, units totally and individuallly, 64 bit patch, etc.
     
  16. catalin72

    catalin72 Prince

    Joined:
    Oct 31, 2008
    Messages:
    466
    Gender:
    Male
    Location:
    Romania
    Yes,OK too for me.Thank you!
     
  17. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    Hi!
    New version 1.5 (build 52) is out.
    Added:
    correct CD audio tracks looping and displaying play progress (since Vista there is a bug: cd-tracks just ended without starting next track),
    map panning with middle mouse button,
    no-CD patch,
    little fix for game icon in Alt+Tab popup.
    Added some features from civ2patch project: AI hostility, retirement year, population, money, map size limits.
    All options can be set and switched in launcher.

    Updated first post.

    Download:
    https://github.com/FoxAhead/Civ2-UI-Additions/releases/tag/v1.5
     
    Thorvald of Lym likes this.
  18. Lord_Hill

    Lord_Hill Chieftain

    Joined:
    May 10, 2004
    Messages:
    41
    Location:
    London, UK
    Just wanted to chime in and say thanks for making this. Previously, I was using mastermind's patch, the Civ II unlimited patch and a separate AI aggression patch just to get this working on Windows 7, which was a bit of a pain. Much cleaner to just have all of that functionality in a single patch and the UI improvements are nice to have. No issues/bugs to report so far. I think you've got the right idea adding features from the various other patches floating around, perhaps the fix to stop the game hogging an entire CPU would be a good one to take a look at (he says despite having 0 knowledge of how difficult that would be!).
     
  19. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    Lord_Hill,
    thank you! I'm glad that this project turned out to be useful for someone. It's very motivating!

    As you requested, fix for limiting CPU usage was adapted from civ2patch project.

    New version 1.6 (build 54) is released.

    Download:
    https://github.com/FoxAhead/Civ2-UI-Additions/releases/tag/v1.6
     
    Thorvald of Lym likes this.
  20. FoxAhead

    FoxAhead Warlord

    Joined:
    Sep 7, 2017
    Messages:
    135
    Gender:
    Male
    Hi!

    New version 1.7 (build 56) released.
    This time I managed to fix multiplayer game for Windows 8 and 10. Older OS must work also.
    The problem was in new big default value for socket buffer length of 0x10000 bytes. The multiplayer fix restricts this value back to the old default 0x2000 value that the game expects.
    I tested multiplayer on VM and was able to play several turns between Win98, Win7 and Win10. All seems to work correctly.

    Please test and provide some feedback if possible.

    Download:
    https://github.com/FoxAhead/Civ2-UI-Additions/releases/tag/v1.7
     
    Last edited: Nov 25, 2017
    Thorvald of Lym likes this.

Share This Page