![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
|
|||||||||
|
|
Thread Tools | Display Modes |
05-14-13, 01:08 PM
|
#11 | |
|
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). |
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
