Discussion in 'Civ2 - Technical Support' started by FoxAhead, Oct 18, 2017.
Good work.Your test was using Hamachi or directly IP,Network game or Internet game?
I tested in VMWare. I don't have plain Windows 10, so I just put several virtual machines including Windows 10 in one virtual network. That way I was able to play several turns of NETWORK TCP/IP game between three virtual machines. Directly without using Hamachi.
OK,thank you for the response and try.Unfortunately,now multiplayer using different computers works just with Hamachi,Evolve,maybe other gaming networks,I tested in Tunngle,a Civ III room.When I will have a partner using VB with Windows 10 will write here the result,if we can play.
Thx! This is awesome! Are you on Steam? If so please add me! My nickname on Steam is also: DaringPaw.
I have set up a group in honor for Civ 2 MGE and your great effort that made it only possible! Please join there as guest of honor.
If you have a paypal or patreon please tell me your details, so I can send some money to you. This is just great!
Can you tell me how you exctly changed or set the AI attitude/hostility? There are 2 approaches at least.
What did you change in regards to the population money and map size limits?
Are there changes to overall unit limits too? Upper limit of total and individual civ's number of units can be an issue in multiplayer games, too.
And could you finally explain what this buffer value prevented or does, so a layman can understand, please?
For me that was actually the most important change and intersts me the most, since multiplayer is the best mode in this game for me. Thank you so much!
This is so freaking awesome! You are just great!
We will make some stresstest in some serious games soon and will let you know how your awesome programm works.
I started with Daring using Windows 10 a game with Hamachi,we played before he using VB,now without VB,result was positive,we can connect and play.Will start other game these days with many turns to see if will be crashes.Great work!
Thanks for adding the CPU throttling feature, good luck with sorting out multiplayer.
Hi Lord_Hill, excuse me, but what do you mean "good luck with sorting out multiplayer". Just as FoxAhead stated and as far as Catalin and I tested it, the multiplayer is working under all actual Windows OS by now using the launcher of FoxAhead. If you would like to play with us, you are welcome - just like anyone else is - to add me on Steam (http://steamcommunity.com/id/DaringPaw/) and/or join our group (http://steamcommunity.com/groups/CivIIMGEFans). Would be great to see you there!
I'm glad that my fix helped you to launch multiplayer on Win10!
If you want to donate then try this link:
I never received any donations and didn't plan to become rich with that, but that would be an interesting experience.
Regarding details about different patches.
Can't tell any details about AI hostility because I just copied what deeves did in civ2patch project hoping it will work. All I can tell that this fix just prevents call of some function that receives 3 parameters. This function likely changes attitude and its parameters could be named something like that: CivilizationA, CivilizationB, DeltaAttitude. So it seems that this call was redundant. For example because of wrong DeltaAttitude parameter. And that call caused degradation of relationships every turn.
Also I can say that I did not investigate this code deeply because I do not consider the hostile attitude of computer as a mistake. I played a lot on King difficulty and get used to that. May be on Deity difficulty it really becomes ridiculous.
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. That is what was done in ToTPP - Test Of Time Patch Project. That was really big masterpiece which gave almost new standard of playing ToT! Unfortunately the source code of that project is not open.
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.
That was easy to copy. Thanks to deeves and his open-source civ2patch project.
Regarding multiplayer, it seems like it working. Still no bugs reported.
Hey Fox, thanks for your reply!
Will donate something soon. Thx.
I also made you member of honor in our small group. Thx for joining!
Thx for your explanations! I always thought it would be because of Win 8 + 10 network adapter settings, but this was a wrong assumption. Didnt think that the problem would be inherent to Civ 2 code. Great that this is solved!
@AI attitude/hostility: For some or even a lot of players this was an issue, because ai seemed to be somewhat irrational or its behavior seemed to be absurd to some degree. Hence the community developed basically TWO different options/patches to solve this issue:
(1) The one by Deeves, which you just mentioned.
(2) The other one by Skyer1, which is mentioned here: https://forums.civfanatics.com/threads/ai-attitude-change.154251/
> I think this could be found here in the past, though the link doesnt work anymore: http://patchesgames.blogspot.de/2009/06/civilization-2-mge-ai-no-hostility.html
> I think I have this attitude.exe on some mirror somewhere, if you want it.
(3) Several links to both options/patches are also mentioned here: https://forums.civfanatics.com/threads/mge-diplomacy-ai-attitude-patch.573000/
I think I tied and used both of them, and one was actually slightly better than the other. One was too friendly or the ai attitude just didnt change by any means, which is not plausible either. I think the one by Skyer actually was slightly better, because he aimed for an ai attitude similar to Civ 1 and the ai attittude was more flexible than with the Deeves patch.
Could you check and compare both patches again maybe? And implement the Skyer1 ai attitude modification as an option as well. Like either no change to ai attitude (vanilla version), Deeves ai attitude changes or Skyer1 ai attitude changes? If you need it and cannot find it, I can also send you the Skyer1 ai attitude patch via email. Just let me know. Would be great to see this being implemented as well Thanks a lot!
Good news:I played with a friend from Russia using Tunngle 3 hours,no crashes.
I received donations from both of you. Thank you very much!
I looked at AI-Attitude patches. The one I got from here:
from the first post. It was already patched Civ2.exe. That file has 3 places patched. And first two places are very strange because they break the game. First place break functionality of finding cities. And second patched place breaks message in city window when you try to sell Palace. I don't believe that these places are good for patching AI attitude. And the third place is actually AI attitude patch. But it is exactly the same as by deeves. It just replaces call of function that changes attitude with eight NOPs (No OPeration commands represented by machine code 0x90).
Next file called Skyer_Civ2_MGE_Aggro_AI_Fix.rar I got from here
It contains patcher attitude.exe. I used it and this time only third mentioned place in Civ2.exe was patched. But again it is exactly the same - with eight NOPs.
And another file Civ2MGEattitude.zip from here
contains the same attitude.exe as previous one.
May be this files are outdated and there exists some new more advanced version? Or may be deeves' patch is the right one?
If you have some other files then drop it somewhere on filesharing service. I'll take a look at them too.
In order to figure it out by myself, I need to play several games. But that could take some time.
Hi FoxAhead, I just allowed myself to send you an email at your hotmail address included in your paypal link. I hope this is ok and it worked. Please let me know. I think thats the last inspiration I have for you concerning this project, since all the patches I know to this date of must be covered by your previous work, our forum
messages and finally by this email. I think, if you go throu these few patches and see if there is anything new and maybe integrate it into your launcher, everything patch that already existed would be covered and contained by your launcher patch - which would be so awesome! Ok thank you once more for your great work! Keep it up! Cheers!
And as for my small donation: You are highly welcome and deserve even more of it!
No, still did not receive any email from you. Please, try again. Or may be some filesharing service would work? I remember catalin72 used mega.nz.
Ok. I just gave it another try. Please tell me, if you received anything. If not, I will find another solution. Thanks.
Finally, we managed to forward files.
Concerning AI-patches I saw nothing new. Except that there was some civ2.exe files with the size equal 2304000 bytes. It was saying (in Options title) that it is "Civilization II Multiplayer Gold 5.4.0f Multiplayer 26-March-99 Patch 3". In the same time I always thought that true MGE actual version has size 2489344 bytes. That version I have and it is also says the same "Civilization II Multiplayer Gold 5.4.0f Multiplayer 26-March-99 Patch 3". That was completely odd and I started to investigate.
It seems that smaller one (23...) comes from Cedric patch
But this smaller version lacks of Scenario editor (Menu-Editor) and there are only two lines of credits (Menu-Civilopedia-About Civilzation II). So I assume that it is some sort of pre-MGE version whereas larger one comes from official update
(the same as https://forums.civfanatics.com/resources/ultimate-classic-collection-uk-v1-3-patch.60/)
And this is really true full version of MGE with Scenario Editor and four line of credits (+Fantastic Worlds and Conflicts in Civilzation).
I still don't know where Cedric got his version of that "pre-MGE" so maybe someone could enlighten me.
So again about AI-patches. Smaller patched versions of civ2.exe are really broken because they are patched by attitude.exe at fixed address which is correct only for larger version.
For example I run "civ2 (sane AI) x64.exe" and when I hit Next Turn it crashes as I expected.
So lets assume from this point that we are talking in this thread only about civ2.exe with the size 2489344 bytes. And still I don't see any new about AI-attitude. There is only one patch for me - replacing the call of attitude-changing function with eight NOPs (aka preventing its call). Perhaps this is a very subjective feeling about computer's attitude, and even with this patch it depends on several other circumstances.
Well, fine, thanks you so far. As far as I remember, there were actually two different AI patches. I think one fixed the ai to be less "moody" and stay at the same attitude towards the player for longer time. The other one made the ai much more friendly, I guess. But I dont remember exactly. Maybe they just have different names, but change the ai attitude the same way. If you cannot find any differences, just leave it like this. Its great already! Thank you very much! Hope we can play a game together soon. Cheers!
I play GOTM197 using your patch and attitude changes are available,like in Civ II Classic 200 turns AI non hostile,to 1750 AD.So,it works.
Edit:I removed saves attached,I forgot,that GOTM is not closed,I sent saves to your mail adress from up.
New version 1.8 (build 58).
This time it fixes minor bug with city names pointed by Frankincense.
Now when you start new game without exiting Civilization II MGE program city names should start from the beginning of the list.
Another minor fix is that option for retirement year is now turned off by default. This was done so as not to confuse players who are not aware of this option. Especially when playing GOTM. Option is off by default only if you did not already run launcher and file Civ2UIALauncher.ini was not created. Otherwise options from Civ2UIALauncher.ini take priority. Just check 'Options' button.
FoxAhead, I want to thank you for the work you're doing!
I own two civ 2 discs, the original 1996 and the 2000 gold disc (I received buying a sound card) but I couldn't get them to work on my pc anymore so I use this link - https://gamesnostalgia.com/en/game/sid-meiers-civilization-ii
This link has the Civ 2 gold edition, but I can't get this fantastic update working! ... I assume it's MGE complete so you haven't coded it yet, but do you intend to code the other versions?
Also, it's great that you're getting support for this from the board! I will too!
I downloaded game from your link and checked the files. It is indeed MGE-version. It is exact version that is civ2uia is intended for. I launched the game through civ2uia launcher and it works good.
So could you supply more details what is not working for you? What have you tried? Are there some error messages?
Separate names with a comma.