![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
|
|||||||||
![]() |
|
|
Thread Tools | Display Modes |
|
|
05-14-13, 08:29 AM
|
#1 | |
|
Black Magic
![]() |
Quote:
|
|
|
|
05-14-13, 08:37 AM
|
#2 | |
|
Navy Seal
![]() Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
|
Quote:
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)
|
|
|
|
05-14-13, 08:54 AM
|
#3 | |
|
Black Magic
![]() |
Quote:
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
|
|
|
|
05-14-13, 09:50 AM
|
#4 | |
|
Navy Seal
![]() Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
|
Quote:
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). |
|
|
|
05-14-13, 11:07 AM
|
#5 |
|
Navy Seal
![]() Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
|
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. |
|
|
05-14-13, 12:20 PM
|
#6 |
|
中国水兵
![]() Join Date: Mar 2005
Location: Basque Country
Posts: 283
Downloads: 366
Uploads: 0
|
Gap, TheDarkWraith,
Very nice discussion and very nice patch for SH5. Thank you !!! ![]() Txema |
|
|
05-14-13, 01:08 PM
|
#7 | |
|
Black Magic
![]() |
Quote:
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). |
|
|
|
05-14-13, 02:43 PM
|
#8 | ||||
|
Navy Seal
![]() Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
|
Quote:
![]() Quote:
![]() Quote:
), 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:
Last edited by gap; 05-14-13 at 03:02 PM. |
||||
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
