SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SHIII Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 11-28-10, 06:57 AM   #1
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 135
Uploads: 0


Default

@ALL (who are interested) : Good news:

1) I finally managed to get write access to EnvSim.act. That means, I can work with a counter and store some stuff, which could be important when measuring the length of a bad-weather period. Patched sh3.exe is not required.

2) Also, I found a way to force windspeed AND fog to good conditions. The trick is not to change windspeed variable itself directly, that didn't change fog. Instead, I found out that the random numbers generated influence not the absolute weather but the weather tendency. If the random number is +1, weather gets worse. storm, fog are the result in 2 of 3 cases (@Stiebler: the other missing case of these 3 cases is caused by a scrambler related to the counter at 0xDD02BC). When the random number is -1, weather gets better in most cases (not always, maybe also because of a scrambler, but not absolutely sure in this point).

So I can now realise a fix that:

1) Measures the length of the bad weather period, which could be identified

a) either only by the amount of fog, or,
b) by the amount of fog AND windspeed.

2) If the bad weather period is longer than a certain value (could be a constant or a randomly chosen value), I bypass the random generator and load some -1 instead (or allow only negative random values), and wait, until weather gets better. I am slightly optimistic now, that we can fix the weather bug (which I have never seen, bru-har-har!)


@Yoriyin I think, your patch will be done in the next 0-2 days.

h.sie
__________________
My Mediafire page: http://www.mediafire.com/hsie

Last edited by h.sie; 11-28-10 at 01:05 PM.
h.sie is offline   Reply With Quote
Old 11-28-10, 07:25 AM   #2
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 135
Uploads: 0


Default

Release: Bad Weather Fix - Yoryin special Edition

From the readme:

Weather Fix - Yoriyn Edition
----------------------------

Background
----------

Due to a serious bug, the sh3 weather sometimes sticks at high windspeeds with 15m/s and fog, rain and no visibility.

What does this mod do
---------------------
It simply reduces the weather changing period by a factor of 3, so that bad weather periods are shorter now. I don't know if now all problems are solved.

- Tested with WinXP/32Bit and Win7/64Bit.

- Should work with every version of sh3.exe

h.sie

Download: See my mediafire page, folder "Bad weather fix"
__________________
My Mediafire page: http://www.mediafire.com/hsie
h.sie is offline   Reply With Quote
Old 11-28-10, 02:22 PM   #3
NGT
Lieutenant
 
Join Date: Sep 2006
Posts: 262
Downloads: 319
Uploads: 3
Bad Weather Fix

Quote:
Originally Posted by h.sie View Post
Release: Bad Weather Fix - Yoryin special Edition

.................................................. .....................
Thank you very much, for all effort and time.

May I suggest to open a new thread for bad weather fix?

V 15 C is a work on SH3.exe for repair and flooding times and other values, and Bad Weather took an other way, is totally independent.

Discussions will be mixed, with answers one time for repairs, other time for weather.

Thanks, again

(sorry for bad English)
NGT is offline   Reply With Quote
Old 11-28-10, 07:27 AM   #4
Magic1111
Silent Hunter
 
Join Date: Sep 2008
Location: Germany - Sailing on U-96 in North Atlantic
Posts: 4,516
Downloads: 784
Uploads: 0


Default

Quote:
Originally Posted by h.sie View Post
@ALL (who are interested) : Good news:

1) I finally managed to get write access to EnvSim.act. That means, I can work with a counter and store some stuff, which could be important when measuring the length of a bad-weather period. Patched sh3.exe is not required.

2) Also, I found a way to force windspeed AND fog to good conditions. The trick is not to change windspeed variable itself directly, that didn't change fog. Instead, I found out that the random numbers generated influence not the absolute weather but the weather tendency. If the random number is +1, weather gets worse. storm, fog are the result in 2 of 3 cases (@Stiebler: the other missing case of these 3 cases is caused by a scrambler related to the counter at 0xDD02BC). When the random number is -1, weather gets better in most cases (not always, also because of a scrambler).

So I can now realise a fix that:

1) Measures the length of the bad weather period, which could be identified

a) either only by the amount of fog, or,
b) by the amount of fog AND windspeed.

2) If the bad weather period is longer than a certain value (could be a constant or a randomly chosen value), I bypass the random generator and load some -1 instead, and wait, until weather gets better. I am slightly optimistic now, that we can fix the weather bug (which I have never seen, bru-har-har!)


@Yoriyin I think, your patch will be done in the next 0-2 days.

h.sie
Hi h.sie !

Wonderful news !

When do you plan to release your mod / the files ?

Best regards,
Magic
__________________
Magic1111 is offline   Reply With Quote
Old 11-28-10, 07:43 AM   #5
Yoriyn
Planesman
 
Join Date: Jan 2008
Location: Control room
Posts: 181
Downloads: 154
Uploads: 0
Default

Thank you, I starting tests now.

After first tests I can say weather changing intervals in my SH3 is 10h:40min. So it is perfect exacly what I expect. Now I'm starting longer tests to check weather behavior.

Great job
__________________
Oblt.zS. Kurt Hanke, commander of U-83 (Type VIIB) in WaW 5.
Patrol 1 - at sea : 5 ships - 10095 BRT

My filefront mods link
To Battle Station order mod for SH3 and more

Last edited by Yoriyn; 11-28-10 at 08:13 AM.
Yoriyn is offline   Reply With Quote
Old 11-28-10, 12:43 PM   #6
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 135
Uploads: 0


Default

@Yoriyn: In the arctic sea weather changes more often, hopefully not too often now.

@Magic1111: I don't know. days? weeks?

@LGN1: One has to differ between the, say "current_weather" and, say, "current_end_weather". the second is what's calculated every weather period (20-40h), the first then slowly fits to the second during the time. but only the second is considered for the calculation of a new weather, that means it doesn't matter if the first has already fitted to the second or not. We have to discuss about the weather period. I asked earlier, but only got 1 answer: factor 3. I don't know what e.g. Hitman and Stiebler are thinking about that.

@ALL: The released Fix "Yoriyn edition" is not my final fix, it's just a quick fix for those who want shorter weather periods without any changes to the weather algorithm.

There will follow my fix I described above and perhaps, if necessary, a Stiebler's edition containing Stieber's approach to fix the weather bug.

h.sie
__________________
My Mediafire page: http://www.mediafire.com/hsie

Last edited by h.sie; 11-28-10 at 01:08 PM.
h.sie is offline   Reply With Quote
Old 11-28-10, 01:10 PM   #7
LGN1
Ace of the Deep
 
Join Date: Mar 2006
Posts: 1,135
Downloads: 147
Uploads: 12
Default

Hi h.sie,

thanks for the explanation. I am not sure what the effect of an interval change would be so I would rather not change the interval too much if not necessary. Maybe reduce it a bit so that after loading a save game the weather changes earlier (if it's too short, I guess, the weather will be 'locked' again because there is no time to adjust )

I guess if you can avoid the long fog periods without changing the interval I would be conservative and follow your rule: Don't change too much. Maybe a factor of 1.5 or max. 2.

Anyway, I am quite happy with the weather at the moment, so I might not be the right person to answer

Cheers, LGN1
LGN1 is offline   Reply With Quote
Old 11-28-10, 02:50 PM   #8
Magic1111
Silent Hunter
 
Join Date: Sep 2008
Location: Germany - Sailing on U-96 in North Atlantic
Posts: 4,516
Downloads: 784
Uploads: 0


Default

Quote:
Originally Posted by h.sie View Post

@Magic1111: I don't know. days? weeks?

h.sie
Hi !

Okay, I know, please let your time !

And now I´ll test the Bad Weather Fix Special Edition !

Best regards,
Magic
__________________
Magic1111 is offline   Reply With Quote
Old 11-28-10, 04:01 PM   #9
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,235
Downloads: 29
Uploads: 4


Default

@H.sie:
I have now a working version of envsim.act with one of my new ideas for reducing the windspeed.

The principle is very simple - since the root of the windspeed problem lies in the fact that the winds can often exceed 15 m/s internally, and are then limited to a maximum 15 m/s, it seemed like a good idea simply to remove 15 m/s from any windspeeds that exceed 15 m/s. Thus we retain the original random value before it overflowed.

I have attached the new code to the end of the envsim.act file main block, starting at location envsim.act + 149CDh, and, after a lot of checking with the debugger, and a subsequent series of short patrols, the code seems to work. There is one defect, which I could fix easily: I have not applied the minimum limit after subtracting the 15 m/s. This is just the test version.

Preliminary tests around the Azores at tc=2048 (well known to intensify bad weather):
No windspeeds of 15 m/s have persisted for more than one or two weather changes (statistically, this behaviour is as expected). Little fog and heavy rain either - I still think the fog and rain are primarily tied to windspeed - but I have had fog and heavy rain at 7-9 m/s on a couple of occasions.

I would call that good weather behaviour.

I haven't used my own counter-limiter idea because, like you, I found it hard to create a safe, free variable. (Congratulations, by the way, on your announcement that you have succeeded in that task.)

One thing that mystifies me, though:
I'm using your recommended Ollydbg2 disassembler for this. When I save the amended file to 'envsim2.act', and then detach the debugger, and close down SH3; and then I start SH3 up again, it is apparent that SH3 is now using 'envsim2.act' as its new file, not the original 'envsim.act' file. This is easily tested, just by moving the original envsim.act file to a different folder, when SH3 functions properly. Also, if the running SH3.exe is now attached to Ollydbg2 again, this confirms in the debugger that file envsim2.act is the active file.

Of course, I could easily alter this behaviour by re-saving envsim2.act (from Ollydbg2) as envsim.act again. But how is SH3.exe retaining knowledge of this change?

Thanks for your notifications to me above in your other posts. (I was away for the weekend.)

@NGT:
I agree with your suggestion that H.sie's weather and repair fixes should be separated, for ease of reading.

Stiebler.
Stiebler is offline   Reply With Quote
Old 11-28-10, 05:08 PM   #10
h.sie
Admiral
 
Join Date: Jul 2008
Posts: 2,192
Downloads: 135
Uploads: 0


Default

@Stiebler: Great news. So I save the time for programming your idea and can concentrate on my own idea. So three different approaches to fix the weather bug are better than none!

1) Reduce weather period by a factor of 3
2) Subtract 15m/s from values > 15m/s
3) Force good weather after long bad weather periods.

I agree, this weather issue is worth a new thread. So this will be my last answer regarding weather in this thread.

Some words:

1) I would not dare such a deep intervention in the algorithm as you did, but that's only my "intention", not knowledge, and I may be wrong. So I'll restrict on a fix that is only active when long bad weather occurs, because I like the sh3 weather from what I've seen so far. Hope, "your" weather isn't too good now.

2) I could give you a unmodded EnvSim.act but with code section write-enabled. So you can store values. But if you store data, I suggest to use relative pointers instead of absolute, because in WinVista and later the DLLs and ACTs can be loaded to different memory locations every time the game is started. So static pointers may work on your sytem, but possibly not on others. This was the reason for the CTDs on Win7/64 in my earlier fixes.

3) Maybe as a programmer you know that already, but let me in spite of that say what could lead to sometimes non-obvious side-effects: In my first patches I was not 100% accurate by reconstructing the state of the CPU and FPU after the patch. FPU registers, FPU stack pointer, CPU registers and CPU stack pointer should look the same before and after your patch. otherwise side-effects are possible (example: crew fatigued instantly when snorkelling, because I forgot to reconstruct FPU registers and so a wrong value was taken to calculate fatigue).

4) Yes, funny, SH3.exe seems to load all files it can find in that directory, it seems not related to the filename. Same behaviuor in the library folder, where I renamed an old Materials.dat to Materials_old.dat but this file was loaded anyhow. It's related to sh3.exe, not OllliDbg.

Greetings.
h.sie
__________________
My Mediafire page: http://www.mediafire.com/hsie

Last edited by h.sie; 11-28-10 at 05:40 PM.
h.sie is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 1995- 2026 Subsim®
"Subsim" is a registered trademark, all rights reserved.