FoxAhead
Warlord
- Joined
- Sep 7, 2017
- Messages
- 207
User Interface Additions
for
Sid Meier's Civilization II
Multiplayer Gold Edition 5.4.0f (Patch 3)
Description
This program is a set of useful enhancements to the game interface and a set of different fixes and tweaks. 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.
Only version Multiplayer Gold Edition 5.4.0f (Patch 3) is supported (CIV2.EXE file size should be 2489344 bytes, preferably unmodified).
Tested on Windows 98 SE, Windows 7, Windows 10, Windows 11.
Features
- 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.
- Scrollbar was added to Activate Unit popup dialog with more than 9 units in stack.
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.
- 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.
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
- 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.
- Game turn added to the status sidebar.
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.
- Current research numbers are displayed in the Science Advisor for precise research control.
- Correct CD audio tracks looping and displaying play progress
- Game icon fix (visible in Alt+Tab popup)
- Resetting city name prompts, when restarting a new game without closing program
- Show buildings even with zero maintenance cost in Trade Advisor
- Scrollbar for supported units in the city window. And a number of total supported units.
- 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.
- No-CD patch included (note that this disables intro/wonders movies and High Council movies).
- Enable multiplayer for Windows 8, 10 (should also work on older OS).
Finally about socket buffers in multiplayer. All network part of the game resides in a separate library XDaemon.dll. That library uses Windows Sockets API (wsock32.dll) for organizing multiplayer game. Socket is endpoint for sending/receiving data. Socket has a lot of options and two of them are SO_RCVBUF and SO_SNDBUF. That is as MS online help states "The total per-socket buffer space reserved for receives/sends."
When opening socket with socket function all its options are initialized with defaults. It seems that for many years default values for SO_RCVBUF and SO_SNDBUF were no more than 0x2000 bytes. So programmers of XDaemon.dll didn't bothered about setting those options explicitly with setsockopt function hoping that it would be always the same. Also later in code they used getsockopt function to read SO_RCVBUF option and store it in 2-bytes variable for using later in data-receive loops.
But in Windows 8 and 10 the default value became 0x10000. And it doesn't fit in 2-bytes variable causing it to be zero and no data received at some point.
What I did is just added explicit call of setsockopt function for setting correct buffer sizes right after opening socket. I choose value of 0x2000 as it seems like game is somehow bound to this value.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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
- 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.
- Radio buttons hotkeys. Can speed up the selection of options using the keyboard.
- Quickinfo tooltips. Hover mouse over the city or units and hold Ctrl key.
- Made most advisors and lists vertically resizable.
- Advisors caption area increased to make it easier to move windows around.
- Better scrolling in Units List Popup: no flickering, adjusting scrollbar PageSize, keys navigation.
- Added Cancel button to city Change Production dialog - Esc is now Cancel.
- Added shields cost and maintenance in the city Change Production list.
- 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.
- 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.
- 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.
- 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/
restoring original Louis XIV and Joan of Arc leader portraits that were accidentally overwritten with Alexander and Hippolyta, and the furthest Throne Room wall that was overwritten with the second level.
- 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....
- 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.
- Added gold coins to the Foreign Minister.
- 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'.
- 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.
- Fix dye-copper demand bug. Due to uninitialized variable of number of roads there was very high demand quotients for dye and copper. More info on How Supply and Demand Lists Are Determine:
https://apolyton.net/forum/civiliza...47-how-supply-and-demand-lists-are-determined
- Better grayed sprites for units on sentry. Instead of a simple gray silhouette, the unit is displayed in gray halftones, which helps to better recognize the type of unit.
- Key 'U' now also loads (sets on Sentry) all ground units in stack. Pressing 'U' when there are no units on guard on the stack puts all ground units on that stack back on guard.
- New game default map zoom 1:1. Now, when starting a new game, the map zoom is set to 1:1 (level 0), regardless of the screen width (previously, if the screen width was more than 1000 pixels, the zoom was set to level 2).
- Finally fixed AI attitude calculation. Due to the uninitialized variable, every turn the attitude of the AI changed to the minimum, which made the AI very aggressive towards the player. This bug turned out to be so obvious that it was decided to completely remove the option to enable the fix. This bug is fixed by default without any options.
Unlike the previous version of the patch, which originated somewhere in the deep history of this forum, and which completely cut off the change in the attitude, now the calculation of the attitude should be performed as it was intended by the algorithm
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.
- reducing CPU usage when the application is idle (must be turned off for multiplayer)
- Retirement year
- Population limit
- Gold limit
- Map size limit
About limits.
Money has default limit of 30000. It is checked and clamped each turn. But it is stored in 4-byte signed variable so theoretically it could be up to 2147483647 (0x7FFFFFFF). I set it to half of that just in case. But you can change it in Options of launcher.
The same applies to population. The default limit is 32000 tens of thousands i.e. 320 millions. But again it is stored in 4-byte signed variable so theoretically it could be up to 2147483647 tens of thousands or 21 474 836 470 000. I set it to half of that just in case (changeable in Options). But in contrast to money, population is just a calculated value based on city sizes. Population is only displayed in some screens and no more. So this fix is just for esthetics reasons.
Map size by default is limited to 10000 tiles but is stored in 2-byte signed variable, so theoretical limit is 32767 (0x7FFF). Dimensions has default limit of 250 and could also be extended to 32767. But when you create such map which is too wide or too tall (for example 2*15000) it causes the game to crash mainly because of errors in little world map in the top right corner. So I put reasonable values of 511 and again you can experiment with them in Options.
Total units limit is another story. It is associated with memory allocation. Extending this limit will cause rewriting save/load procedures and would mean incompatibility of enhanced saves with the original game.
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
Usage
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.
Important: this is not a patcher, but a launcher. This means that the CIV2.EXE file remains unmodified, and all changes are made in the process's memory. Therefore, for these changes to work, the game must be launched through the launcher. To simplify this launch process, you can use the "Create shortcut..." button that will create a shortcut to quickly launch the game through the launcher.
Last edited by a moderator: