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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 05-14-13, 01:08 PM   #11
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
 

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 11:09 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.