SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SHIII Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=195)
-   -   Realism- and gameplay-related hardcode fixes for SH3.EXE (https://www.subsim.com/radioroom/showthread.php?t=174225)

h.sie 11-23-10 02:28 AM

Hi Magic,

I tested that EnvSim.act only with WinXP/32. It does not work in Win/64Bit. It shoud work with every sh3.exe. But be careful: Use a special SH3 installation for testing. And: the weather change periods are only 2 hours and less for demonstration purposes only. Not for serious play.

So if there are no more bugs in V15D, I'll release a "stable" Version this weekend after fixing the museum-bug which only appears when in museum.

In the next days I'll release a new EnvSim.act which will work with Win/64Bit.

h.sie

h.sie 11-23-10 02:54 AM

@Stiebler: I have an vague idea (that must be tested): If the tendency of the algorithm to produce bad weather is a slow process that slowly converges to bad weather patterns, I could force a "reset" to normal conditions by randomly/casually set the conditions back to "good" (no storm, no fog).

But first

1) I have to find out why EnvSim.act doesn't work in 64Bit OS.
2) I have to find the variable resposible for fog.

Magic1111 11-23-10 04:06 AM

Quote:

Originally Posted by h.sie (Post 1540107)
Hi Magic,

I tested that EnvSim.act only with WinXP/32. It does not work in Win/64Bit. It shoud work with every sh3.exe. But be careful: Use a special SH3 installation for testing. And: the weather change periods are only 2 hours and less for demonstration purposes only. Not for serious play.

So if there are no more bugs in V15D, I'll release a "stable" Version this weekend after fixing the museum-bug which only appears when in museum.

In the next days I'll release a new EnvSim.act which will work with Win/64Bit.

h.sie

Hi h.sie !

Many thanks for your Reply ! :yeah: Now all is cleared !

And that are very good news, that youŽll release in the next days new "stable" Versions from V15D AND EnvSim.act !!!! :up:

For me (and many other Users) is important, that EVERY MOD from you (and/or modded Files like EnvSim.act) work with Win7/64Bit too and we can play career with your MODs (not ONLY testing) ! ;)

Best regards,
Magic:salute:

Stiebler 11-23-10 04:29 AM

@H.sie:
Many thanks for the detailed reply above. I'll look into this as soon as possible.

One quick thought: maybe most problems could be resolved by setting the 'emphasis-factor' (or its associated random number) for wind speed to zero. Then redistribute the wind speed parameter between 0 and 15 m/s. Or use CherryHarbey's solution (below).

@CherryHarbey:
Quote:

or alternatively take two random numbers between 0 and 16 and multiply together. Maximum value will still be 256 and answer from the range 0 to 256 but skewed towards the lower end.
That is a very imaginative solution - many thanks also. Particularly since, improbable though it may appear, calm seas are actually more common than very stormy seas in mid-Atlantic (according to U-boat war diaries).

My concern would be the source of the random numbers, and how random the numbers would be if plucked in quick succession, at assembler speed, in a few adjacent lines of code. (Most random number generators rely on a time seed for their random algorithm; a few take numbers from a hardware generator that is involved in code or output processing, so results are pseudo-random).

Stiebler.

h.sie 11-23-10 05:03 AM

@Stiebler:

At EnvSim.act+0xDD61 you see the call for a routine which itself calls Random32(). There you see what happens. Of course this is pseudo-random but hopefully with a very long period since it's based on a 32bit-key. So it repeats the first time after 2^32 = 4G random numbers.

The problems I fear with simply damping down a factor are as follows:

1) The algorithm to calculate wind-speed is not simple and time-independent as I thought at first. It is not only

15*(RANDOM)+15 -> delimited to [0,449-15] and with -1<RANDOM<+1

This could be fixed by using this algorithm

7,5*(RANDOM)+7,5 with -1<RANDOM<+1

which does not even need to be delimited.

There seems to be a loop-back that considers older windspeeds for calculating the new ones. This closed loop also explains the tendency to converge to a certain value (15). An simple random algorithm without loop-back would never converge.

So if we change one factor we could change the whole loop-back behavior (and shred the whole algorithm).

2) As Hitman said, 15m/s is not the hightest windspeed and other people are there wanting higher waves. If we damp down that factor, windspeeds will be lower in average. I would not like that.


But let me first find out how to program for 64-Bit systems. DLL's and ACTs are loaded in a different way in 64 Bit OS, and obviously I made a mistake. If I don't find the cause of my error, there is no need to talk about algorithm.

And then it's important to find out how to manipulate clouds / fog.

And after that all we can test different algorithms to fix the weather.

Greetings,
h.sie

Stiebler 11-23-10 07:56 AM

@H.sie,

This information acknowledged with thanks.

You made a good point with:
Quote:

15*(RANDOM)+15 -> delimited to [0,449-15] and with -1<RANDOM<+1

This could be fixed by using this algorithm

7,5*(RANDOM)+7,5 with -1<RANDOM<+1
Don't forget that higher waves can be fixed elsewhere (I think in scene.dat) without needing higher wind speeds. Magic111 or Makman94 or OneLifeCrisis know better than me.

Keep up the good work! So far I have been unable to link the .act (or other dll) files to sh3.exe in my own disassembler. It is not a task I have ever needed previously.
[Edit: I have just discovered that Ollydbg2 does not function with 64-bit Windows.]

Stiebler.

Hitman 11-23-10 09:16 AM

To clarify some things, so that h.sie has it easier :):

- Wave size and style can be set in the scene.dat file

- You can set a wave size and style for each m/s wind speed, from zero to whatever you want, so you would see waves change as wind speed increases/decreases with each 1 m/s change

- In the game there are currently only 4 sizes of waves, for 0 wind speed, small (4-8 m/s), medium (9-14 m/s) and hard wind speed (15 m/s). Most environmental mods have changed waves size, but in general keep that number of possible waves.

- 15 m/s waves in the game are actually storm waves and would appear in real life only with much stronger winds. But somehow the game has the maximum at 15 m/s, and hence that's the speed where you get the biggest waves.

So, in general, we can provide "playable" waves even with 15 m/s winds in the game simply by reducing the size of them, as f.e. Manos has already done with his environmental mod.

So where's the problem?

The problem is double:

A) Wind speed tends to stick high, as you already know

B) The game's logarythm seems to have strong winds associated with fog and rain, and that together makes the game almost unplayable. There is a parameter in scene dat for "Randomwind" that relates windspeed and rain. Wether it adds a certain wind speed when rain appears, or makes rain appear when wind goes over the set speed, it's difficult to say. It could also be altogether broken.

But it's a fact that overall softer wind speeds will mean more sunny days and less fog & rain.

To sum up, if you simply manage to have the average wind speed decrease in the algorythm, we will have the biggest part of the weather problem solved, both because we will get rid of "permanent storm" situations, and because in general fog and rain (Which make the game unplayable many times) will appear less often. It is not as important to have "realistic" wind speeds (i.e. wind speeds of more than the game's current limit of 15 m/s) as to have a more logical distribution of wind speed along the days in a patrol.

h.sie 11-23-10 09:30 AM

@Hitman. Now I understand why you always talk about manipulating windspeed instead of fog.

That means I don't even need to manipulate fog, it's sufficient to manipulate windspeed, because it affects fog. I'll give that a try, because I have already successfully manipulated windspeed in the debugger (not yet by patch code).

Ok, now I have to find out how to program 64bit-compatible .act files. Let's hope I find a solution.

Then we can discuss about how exactly modify windspeed (algorithm).

Question: What if I find out how to directly modify fog/clouds? Would that be better than indirectly modify them by reduced windspeed???

h.sie

h.sie 11-23-10 10:05 AM

@Stiebler: I am able to run OlliDbg2 on Win7/64Bit. It automatically loads all dll's and .act's at program start and you just have to set the breakpoints as I described above.

h.sie

Stiebler 11-23-10 12:23 PM

@H.sie:

1. I agree completely with Hitman that wind speed is the critical issue, even before you identified a bug in the wind-speed algorithm.

2. Therefore it would be safer not to alter fog and rain settings until the natural wind fix is tried first.

3. Many thanks for the information about Ollidbg2 with Windows-7/64-bit. I took my pessimistic view from the download page for this disassembler, so I haven't actually tried it.

4. I believe I understand now how to see envsim.act file in my own disassembler (IDA PRO plus), so I can try that too (both tomorrow).

Wish me luck. I think I'm going to need it!

Stiebler.

Hitman 11-23-10 02:37 PM

Quote:

Question: What if I find out how to directly modify fog/clouds? Would that be better than indirectly modify them by reduced windspeed???
I agree with Stiebler. Wind is the critical issue, and following the spirit of what your work is about, let's do fewer and effective changes instead of complicating things too much. First we must try with a simple fix to windspeed and test, as well as get feedback from the thousands of people who will be able to use it (ACT file will work also for the starforce versions).

If later we see the need and oportunity to tweak something else, then we can talk about it. But in general, the less you change, the easier it will be to keep everything under control. :up:

[EDIT]

Probably the best thing will be a combination of more frequent weather changes and a tendency for lower wind speeds in the algorythm. That should allow the complicated pattern created by the Devs for seasons/zone weather changes to work much better.

h.sie 11-23-10 05:22 PM

In the meantine I made a new version of EnvSim.act which ran on XP/32 and Win7/64 without problem. Can be used with unpatched sh3.exe.

Only fix so far: Weather change period reduced by a factor of 20.

I suggest to go to the bridge or external cam and set TC=128x. (Normally max. TC on bridge is 32x, but this value can be changed using SH3Cmdr: "When in 3D views").

Then you can see the fast weather changes.

This is for demonstration purposes only.

Use on your own risk.

Can be downloaded from my mediafire page, Folder "Testing".

Tomorrow I'll start to implement a very simple algorithm in which I try to disturb the windspeed tendency to converge to 15m/s

h.sie

Madox58 11-23-10 08:26 PM

What software do you use for your work at this point?
:hmmm:

h.sie 11-24-10 01:49 AM

@privateer: A little bit with OlliDbg and mainly with a tool that has been developed in my company - not freely available.

@Stiebler: I think the author of OlliDbg meant that OlliDbg won't run in 64-BIt mode, but it (obviously) can debug 32-bit applications. I had no problems so far.

h.sie 11-24-10 01:59 AM

My idea for a first very simple algorithm is as follows:

Windspeeds between 0 and 14 are not touched, because they are (hopefully) distributed homogenuously.

But if New_Windspeed==15, then, by a certain chance of, let's say, A=50% this is not changed. But with the remaining chance of (1-A)=50% a new windspeed between B=5 and C=14 is randomly generated. That should at least disturb most of the long periods of bad weather, although, there remains (statistically) a little chance for very long periods, what I think is not unrealistic.

If that works in principle, one can fine-adjust A, B, C.

What I don't know is: how low must the windspeed been chosen in order to guarrantee that bad weather ends or at least will be reduced?



h.sie


All times are GMT -5. The time now is 07:39 AM.

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