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 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 05-14-13, 05:23 AM   #1921
volodya61
Ocean Warrior
 
volodya61's Avatar
 
Join Date: Feb 2012
Location: Rostov-on-Don, local time GMT+4
Posts: 3,292
Downloads: 374
Uploads: 0


Default

Quote:
Originally Posted by Gillian81 View Post
Question regarding patching.
Is it advisable to first disable al my mods, before patching, and then after patching enable all my mods again? Or doesn't it really matter?
It doesn't matter..

Quote:
Originally Posted by Gillian81 View Post
Also do I still have to edit the menu.txt manually with the follwing:
If wolfpack patch is enabled then yes..
__________________
.
Where does human stupidity end?

.


El sueño de la razón produce monstruos © - and for some people awakening will be cruel
volodya61 is offline   Reply With Quote
Old 05-14-13, 07:02 AM   #1922
Gillian81
Watch
 
Join Date: Sep 2010
Posts: 20
Downloads: 12
Uploads: 0
Default

Quote:
Originally Posted by volodya61 View Post
It doesn't matter..



If wolfpack patch is enabled then yes..
Thanks!
Gillian81 is offline   Reply With Quote
Old 05-14-13, 07:59 AM   #1923
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
v1.0.94.0 released. See post #1

...

If the unit is the same unit as last time and difference between distance to contact now and before < 500m (a variable in the patch file) then it returns last randomized distance else returns new randomized distance.
Thank you TDW

your work is very much appreciated here, but I have a little remark (hope you don't mind)
Is there any particular reason for your new code to compare the distance changed with the fixed value of 500 m, ? I liked more the method you had described yesterday, where distance changed was compared with variable amount (see quote below), because it would have made mathematically sure that consecuitive range estimations decreased for closing targets and increased for targets moving away. Moreover, it would have made range estimations to be recalculated more often for close targets (smaller variable amount) than for far ones, which seems pretty realistic to me

Quote:
Originally Posted by TheDarkWraith View Post
...If the distance changed >= variable amount then calculate new random distance. If distance changed < variable amount return last random distance calculated...

Quote:
Originally Posted by volodya61 View Post
Sorry, I don't want to annoy you but.. what about Gap's question - can we hope to get rid of the perfect automatic ship recognition every time we asked our WO even at the night or with the heavy fog?

Please
I got to second Volodya's seconding of my request...
gap is offline   Reply With Quote
Old 05-14-13, 08:29 AM   #1924
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
Thank you TDW

your work is very much appreciated here, but I have a little remark (hope you don't mind)
Is there any particular reason for your new code to compare the distance changed with the fixed value of 500 m, ? I liked more the method you had described yesterday, where distance changed was compared with variable amount (see quote below), because it would have made mathematically sure that consecuitive range estimations decreased for closing targets and increased for targets moving away. Moreover, it would have made range estimations to be recalculated more often for close targets (smaller variable amount) than for far ones, which seems pretty realistic to me
By variable amount I meant the variable's value as defined in the patch file. What I've coded in does what I meant: ABS(distance before - distance now) > variable defined in patch file then recalc random distance else return old random distance. This will ensure new random distances are calculated for closing or moving away contacts.
TheDarkWraith is offline   Reply With Quote
Old 05-14-13, 08:37 AM   #1925
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
By variable amount I meant the variable's value as defined in the patch file. What I've coded in does what I meant: ABS(distance before - distance now) > variable defined in patch file then recalc random distance else return old random distance. This will ensure new random distances are calculated for closing or moving away contacts.
Okay, sorry for misunderstanding you

I didn't get that 500 m was just an example; I thought that it was a fixed variable (wich is a contradiction in terms)
gap is offline   Reply With Quote
Old 05-14-13, 08:54 AM   #1926
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
Okay, sorry for misunderstanding you

I didn't get that 500 m was just an example; I thought that it was a fixed variable (wich is a contradiction in terms)
The variable in the patch file is a fixed amount: 500m. In programming terms a variable is some value in a program statement that can change. For example:
a + b = c. Those all can be considered variables for a program.

It's a variable because one can change it in the patch file to whatever they want (I guess you could consider it a constant since the code doesn't change the value read in). I have it defaulting to 500m.

What kind of calculation are you thinking about to make this variable ever changing in the game
TheDarkWraith is offline   Reply With Quote
Old 05-14-13, 09:50 AM   #1927
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
What kind of calculation are you thinking about to make this variable ever changing in the game
I think you are currently reading the maximum amount of randomization (i.e. maximum ± error) from an array of datas where weather, range, and crew experience are taken into account. Isn't it?

I thought it was quite logical comparing the distance changed for every consecutive range estimation with the aforementioned value multiplied by two: if the unit moved from its original position by a distance wich is lesser than the maximum error x 2, it wouldn't make sense re-estimating its range. If it travelled by a longer distance, then a new range estimation is calculated. The threshold of maximum error x 2, would ensure that the two ranges of error are not overlapping. On graph:



ME = maximum ± error in range estimation
P1 = previous position (first range estimation)
P2 = next position at which a new range estimation is calculated
RS1 = random space 1 (P1 ± ME)
RS2 = random space 2 (P2 ± ME)

In the worst case, the second range estimation would return the same randomized range as the first estimation (P1 + ME = P2 - ME), but not a smaller one (the ship is moving away).
gap is offline   Reply With Quote
Old 05-14-13, 11:07 AM   #1928
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

quick addition: my previous example supposed that maximum error didn't change from first to second range estimation, thus the threshold of 2 x maximum error. Nonetheless, we should take into account the fact that the maximum allowed amount of error can change, as consequence of the fact that our target is closing or moving away. A more general rule for deciding wether to calculate a new range estimation, or using the previous one should be:

if DC < ME1 + ME2 then return last randomized range, else calculate new estimation

were:

DC = distance changed
ME1 = maximum allowed error for the last randomized range
ME2 = current maximum allowed error

P.S: another cool feature, would be rounding the randomized ranges returned by the WO:

estimated ranges ≤ 10,000m rounded to the closest thousand (i.e: 11,000, 16,000, etc.)
estimated ranges > 10,000m and ≤ 1,000m ronded to the closest hundred (i.e. 1,500, 3,200, etc.)
estimated ranges > 1,000m rounded to the closest ten (i.e: 950, 580, etc.)

Last edited by gap; 05-14-13 at 11:24 AM.
gap is offline   Reply With Quote
Old 05-14-13, 12:20 PM   #1929
Txema
中国水兵
 
Join Date: Mar 2005
Location: Basque Country
Posts: 283
Downloads: 366
Uploads: 0
Default

Gap, TheDarkWraith,

Very nice discussion and very nice patch for SH5.

Thank you !!!


Txema
Txema is offline   Reply With Quote
Old 05-14-13, 01:08 PM   #1930
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
quick addition: my previous example supposed that maximum error didn't change from first to second range estimation, thus the threshold of 2 x maximum error. Nonetheless, we should take into account the fact that the maximum allowed amount of error can change, as consequence of the fact that our target is closing or moving away. A more general rule for deciding wether to calculate a new range estimation, or using the previous one should be:

if DC < ME1 + ME2 then return last randomized range, else calculate new estimation

were:

DC = distance changed
ME1 = maximum allowed error for the last randomized range
ME2 = current maximum allowed error

P.S: another cool feature, would be rounding the randomized ranges returned by the WO:

estimated ranges ≤ 10,000m rounded to the closest thousand (i.e: 11,000, 16,000, etc.)
estimated ranges > 10,000m and ≤ 1,000m ronded to the closest hundred (i.e. 1,500, 3,200, etc.)
estimated ranges > 1,000m rounded to the closest ten (i.e: 950, 580, etc.)
I think you're not understanding how the new code for this works:

player asks for nearest visual contact
code hooks into place in existing code before the new visual contact distance is displayed
code calculates new distance taking into account player sub's crew level, max error allowed, and weather data
code checks to see if player has asked for nearest visual contact before and existing code used current unit to get distance from
if current unit was used:
take old true distance and subtract new true distance
compare that result to variable (constant) defined in patch file (500m)
if before then return old random value calculated
if after then return new random value (distance) calculated above

if current unit wasn't used:
store pointer to current unit
store current unit's true distance
store current unit's random distance
return new random value (distance)

Now what you were suggesting about using error distance X 2 isn't going to work as you think. The reason being the error distance calculated can be any % of the true distance (+ or -). It all depends on what the max error % defined in patch file is AND what the table of values for the weather data is defined in the patch file. It's possible that this error % can be > 50% - it all depends on how the random numbers turn out and what the data defined in patch file is and what crew level the player has. That is why I set a variable (constant) in patch file to compare ABS(current true distance - previous true distance) to. If this result is > 500m then calculate new random distance. If <= 500m then return previous random distance. This way you are guaranteed to get a new random distance every 500m change in distance. This 500m can be changed to whatever value the player feels like via editing the patch file. I think 500m is reasonable and it doesn't make the code very complex.

Your 'another cool feature' idea would be very easy to implement. I'll update the code for this tonight. What I'll do is define 3 new variables in the patch file to handle this. That way the end-user can change when the rounding starts for each type (round to thousands, round to hundreds, and round to tens).
TheDarkWraith is offline   Reply With Quote
Old 05-14-13, 02:43 PM   #1931
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
I think you're not understanding how the new code for this works:

player asks for nearest visual contact
code hooks into place in existing code before the new visual contact distance is displayed
code calculates new distance taking into account player sub's crew level, max error allowed, and weather data
code checks to see if player has asked for nearest visual contact before and existing code used current unit to get distance from
if current unit was used:
take old true distance and subtract new true distance
compare that result to variable (constant) defined in patch file (500m)
if before then return old random value calculated
if after then return new random value (distance) calculated above

if current unit wasn't used:
store pointer to current unit
store current unit's true distance
store current unit's random distance
return new random value (distance)
That was clear enough

Quote:
Originally Posted by TheDarkWraith View Post
Now what you were suggesting about using error distance X 2 isn't going to work as you think. The reason being the error distance calculated can be any % of the true distance (+ or -). It all depends on what the max error % defined in patch file is AND what the table of values for the weather data is defined in the patch file. It's possible that this error % can be > 50% - it all depends on how the random numbers turn out and what the data defined in patch file is and what crew level the player has.
This is also clear

Quote:
Originally Posted by TheDarkWraith View Post
That is why I set a variable (constant) in patch file to compare ABS(current true distance - previous true distance) to. If this result is > 500m then calculate new random distance. If <= 500m then return previous random distance. This way you are guaranteed to get a new random distance every 500m change in distance. This 500m can be changed to whatever value the player feels like via editing the patch file. I think 500m is reasonable and it doesn't make the code very complex.
Your 500m variable won't avoid the possibility of a second range estimation that is smaller than the first one, though the target is moving away, or conversely a bigger second range estimation for closing targets. This would be true for any max error (max error % defined in patch file x true distance) bigger than 250m, which -I suppose- would be a common result for long range targets. Notice that I am not saying that silly range reportings would necessarily happen (applied error can be much smaller than max error, again I am aware of it ), but you can't ignore the fact that there would be a chance of this happening as high as longer is target's range (bigger true distance), as worse are weather conditions and as worse is crew experience (bigger max error %, hence higher random chance of a big error % being applied).

Now try to imagine a closing target being report 5,000m away, then 5,100m away, then 4,400m, then again 4,600. The modifications to your code that I am suggesting would get rid of this chace, and would also make range estimations to be "adjusted" lesser frequently when the closest target is far away, when the fog is heavier, or when crew experience is low.

I hope you got my point this time. If not, I am sorry but with my limited English I can't explain it better than this

Quote:
Originally Posted by TheDarkWraith View Post
Your 'another cool feature' idea would be very easy to implement. I'll update the code for this tonight. What I'll do is define 3 new variables in the patch file to handle this. That way the end-user can change when the rounding starts for each type (round to thousands, round to hundreds, and round to tens).
Okay

Last edited by gap; 05-14-13 at 03:02 PM.
gap is offline   Reply With Quote
Old 05-14-13, 03:57 PM   #1932
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
v1.0.92.0 released. See post #1

Starting with v1.0.92.0 Added a new patch to the SH5.exe that randomizes the nearest visual contact's distance returned. This new patch will take your sub's crew veterency level into account.

If you're curious to know how the distance gets randomized:

(1.0 - (sub's crew veterency level / 4)) * random number in range (0.0-1.0) - this is var1

max % error (0.1 or 10%) * random number in range (0.0-1.0) - this is var2

var3 = var1 + var2

nearest contact visual distance * var3 = var4

random number rolled to see if var4 becomes a negative number or not

nearest contact visual distance + var4 = new nearest contact visual distance

As you can see from the formula the greater the distance the contact is away the larger the error in distance that can be reported
Just tested my "theory" with the numbers you have stated in the above post, but var1 multiplied by 0.1, so that perc error is ±20% in the worst case. I have put them on a spreadsheet with independent random functions for each variable.

For a veterancy level of 0, true ranges of 10,000, 9,500, 9,000, 8,500, 8,000 m, your functions returned the following results ("out of place" ranges in orange):

test#1: 9,185; 9,951; 8470; 9,160; 8,860
test#2: 9,044; 10,048; 9,801; 9,101; 8,649
test#3: 10,642; 8,268; 8,911; 8,927; 7,329
test#4: 10,778; 9,214; 8,850; 8,412; 8,402
test#5: 9,030; 8,773; 8,766; 8,598; 7,829

Indeed, I didn't select in any way the results, but I have just listed here the first 5 sets of numbers generated by the spreadsheet.

As you can see, there's a significant probability of illogical range estimations being generated
gap is offline   Reply With Quote
Old 05-14-13, 06:28 PM   #1933
BigWalleye
Sea Lord
 
Join Date: Jul 2012
Location: On the Eye-lond, mon!
Posts: 1,973
Downloads: 465
Uploads: 0


Default

TDW, when you can clear your inbox, I have a PM for you.
BigWalleye is offline   Reply With Quote
Old 05-15-13, 12:39 AM   #1934
Targor Avelany
Ace of the Deep
 
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 1,183
Downloads: 225
Uploads: 0


Default

Just on a side note, as I'm not sure where else to put this:

recently was not able to switch the locations to launch the game: not sure where the UPlay takes the location of the sh5.exe anymore. Annoys the heck out of me, as I used to having 3 different folders specifically, so I have 1 to play, 1 to mess around/mod/test things and 1 with clear non-modded set up. Now, no matter what I change the settings in the registry to (either by had or with my little SH5 Switch or with TDW's Validator) it always launching the original installation.

Just extremely annoys me. So far, trying to trace it down is not working, as I am still figuring out the olydbg, so just decided to throw it out there.

p.s. matters not whether the TDW's patcher activated or not.
Targor Avelany is offline   Reply With Quote
Old 05-15-13, 11:17 AM   #1935
Sartoris
Captain
 
Join Date: May 2011
Posts: 489
Downloads: 106
Uploads: 0
Default

I've been out of the loop recently, so I don't entirely understand the latest changes. If I remember correctly, the aim of the v1.0.94.0 patch is to randomize the distance the game returns when you ask for range. Does this mean that the game gives you a completely random number (e.g. the ship is 5000 meters away, and the game says it's 14000 meters away), or is the number approximate (e.g. the game says it's 5000 meters away even though the ship is 5500 meters away)?

What I mean is, can the game be relied upon to give a range report that is somewhat accurate, or is it now wildly inaccurate to remove the annoying advantage of being given a precise report?
Sartoris is offline   Reply With Quote
Reply


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 10:14 PM.


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.