It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Hi there,

I had some time to fool around in the S4 code and I wanted to know what is causing
these desync problems with Settlers IV when playing multiplayer games with AI Players.
I was able to track down an aria in the SettlersIV\exe\economyai.dll which seems
to disturb the S4 AI more and more until it causes the desync.

Usually, with saving the game from time to time, you could to keep the AI "on track"
but you never knew for how long it would last.
If you do the change (see attache picture) in the economyai.dll ,of course AFTER making a backup of it,
you can force the AI to keep stable.
(some long time tests with 3 PCs with 3 AI Player, no desync.)

Of course you do the mod on your own risk and you need to know how to use a hex editor.
Further all Players need the same modded economyai.dll

Although I've not noticed any abnormal behaviour of the economy AI after the mod,
there might be a slight chance that it influences gameplay on single player maps or scripted maps when those scripts would rely on the AI's timing behaviour.
But i don't have the time to test them all.

Edit:
Due to bad reliability of this hack attempt and upcoming renewed versions of S4, this modification is obsolete now.
At the moment, only the Blue Byte Guys may be able to fix this desync bug for good.

TC,
morphy
Post edited January 17, 2019 by xmorphyx
avatar
xmorphyx: ...
Dude, thank you very much for this.
I never played S4, yet, but I appreciate all the work you put into this.
I also hardly play it myself.
But the desync problem bugged me since the first S4 online Games
as the multiplayer handling seems to make a good job trying to keep the game syncron.
It also worked with the Settler Limit mod by the way.
It doesn't solve the Fatal errors the game gets sometimes also without
this mod.

tc,
morphy
Hello xmorphyx hope you are good.

This is brilliant, literally cannot wait to test out an MP map. This is insane, beyond world class.

So many questions to ask you regarding how in all that's glory did you achieve this?

Edit.

I really don't know if I've made a mistake here but I edited the dll 3 times and it seems that the Ai don't build towers to expand? They just seem to build a few woodcutters and stonecutters and that seems to be it?

For testing I loaded up a random map on multiplayer with 4 players, 2 teams, with me and one Ai on team 1' and two Ai on team 2'

I could then see the Ai teammate building, but then after 10 mins they stop? Even the enemy Ai team did exactly the same?

May I ask when you tested this edit did you see the Ai build towers and create soldier units by any chance?

Thankyou for your time and hope to speak soon.
Post edited March 10, 2018 by JOHNB007
Hi JOHN007,

Thanks for testing!
The behavior of your AI is strange as on my testmaps the did build towers next to each other
and were also fighting.
You wrote that you edited the dll 3 times.
I guess you have overwritten the same dll with the original one to repeat the mod.
Can you repeat your test with the original dll if the AI is behaving normal after that?
Was it a conflict mode game?

TC,
morphy
avatar
xmorphyx: Hi JOHN007,

Thanks for testing!
The behavior of your AI is strange as on my testmaps the did build towers next to each other
and were also fighting.
You wrote that you edited the dll 3 times.
I guess you have overwritten the same dll with the original one to repeat the mod.
Can you repeat your test with the original dll if the AI is behaving normal after that?
Was it a conflict mode game?

TC,
morphy
Hi!,
i also tried the change to the dll and noticed that
the ai didnt build towers or other buildings beside woodcutters and stonecutters.
Hi,
Oh man i can confirm that there is still an issue.
Thanks guys for your testing.
I made so many tests with prebuilt maps (towers already built etc.) and let big armys fighting each other for serveral hours
that i dind't notice that the AI actually stopped land expanding. :(
Thats kinda embrassing. I need to have a look at it asap.

TC,
morphy
Hi,
thanks a lot for trying to fix this.
Just curious what did the switch to 00 mean.
Are you using a decompiler to get the actual code back?
Hi,

If your are interested in some detailes, have a look on the attached pic.
(I try to explain the POI in the economyai.dll there as "compact" as possible. :) )

Edit: removed old mod description as it's obsolete.

TC,
morphy
Post edited March 18, 2018 by xmorphyx
Hello xmorphyx thankyou for the quick reply.

Such a shame the Ai don't expand, the parameters look complicated indeed. May I ask is the edited parameter some kind of 'tickrate' for the Ai? I don't fully understand how this works?

Maybe we could analyze the Settlers 3 exe and see if the same parameter is applied somehow?

Also I don't understand why Bluebyte wont provide any information seeing as they have the source code, they don't reply back to emails regarding any mention of The Settlers, its a shame.

I have a theory for the crashes in S4, have you by any chance applied a Large Address Aware flag on the S4.exe?

You can use CFF Explorer to apply the parameter to allow the exe to use more than 2GB ram.

It results in solid 60FPS ingame and I haven't had any crashes even on large maps with huge armies.

Thankyou for your time and hope to speak soon.
Hi JOHNB007,

If you want you can try the new desync fix mod (also see first post).
This one won't stop the AI player from expanding land.
Further there won't be random extra calculations in the economyai.dll which caused
the desync after a while. (The first mod had influence at this point indirectly.)

I will for sure have a look at the CFF Explorer. Thanks for pointing that out.

Edit:
If i set your mentioned memory flag with CFF Explorer , S4 becomes incompatible to DXGL
which i need to run S4 on Win10.
You will get the typical DirectX Error. So i changed the flag back.

TC,
morphy
Attachments:
Post edited March 18, 2018 by xmorphyx
Hi xmorphyx,

again thanks for putting effort into this problem.
I tried a game today with the new mod.
Unfortunately it desynced after an hour.
We saved barely every 20 minutes if that is a problem.
Hi,
Ok i had no issues several hours.
-You made sure that your economyai.dll only hast the new mod and the same modded dll is used by all Players?
-If you are using the settler limit mod on S4_main.exe, do all Player have the same mod?
-In case you are using the memory > 2G flag, try to disable it.
-Can you please give me the map and playercount you were using?

I also saved serveral times but had no problems.

Thanks!
TC,
morphy
Post edited March 18, 2018 by xmorphyx
Hi

- You made sure that your economyai.dll only hast the new mod and the same modded dll is used by all Players?
Yes
- if you are using the settler limit mod on S4_main.exe, do all Player have the same mod?
no mod
- In case you are using the memory > 2G flag, try to disable it.
not used
- Can you please give me the map and playercount you were using?
we played a random generated map 6 players, 4 ai

After we saved more often, it got pretty stable then.
Ai seems to work fine.

Thanks a lot
barti
Hello Xmorphyx hope you are well.

You mentioned about DXGL having issues with the LAA flag on the S4.exe? That's really strange but I've found another program to run Settlers IV on Windows 10 its call DxWnD:

https://sourceforge.net/projects/dxwnd/

Maybe this program could allow the LAA parameter for 4GB?

Regarding the modified Dll. This is fantastic news that you've discovered these parameters, nothing short of genius. Were going into test mode with the modified economy Dll, modified Ai limit, LAA 4GB, HD resolution fix, this is going to be insane.

I'll report back ASAP thankyou once again Xmorphyx!

Hope to speak soon.

John.