Log in

View Full Version : Are all random elements determined at the start of a patrol?


tater
05-31-07, 09:57 AM
<EDITED> People seem to have many "all or nothing" issues with stuff that should be random in game on a case by case basis. Could every random event determined by a "die roll" made at the beginning of a patrol. Anyone (a dev?) know if this is true?

There is a mod to make the US Mk14 torpedo less reliable than it is in the stock game. The problem is that it seems like the random elements of this might be globally true for all mk14s for the entire patrol.

For example: The gyro angle error rate for the torpedo is set to 5%. You'd expect that a single sub might have 1 such error on average per patrol given a load of 24 torpedos. Some are suggesting that they get every torpedo with such an error. That would imply that the gyro angle failure "roll of the dice" happened at the beginning of the patrol and then applies to every torpedo instead of rolling the dice every SHOT to see if that torpedo will fail.

Which is it?

If this was true, the same would be true of damage, etc. Ie: the random seed is used to create the explosion force for all torpedos for that patrol at the beginning, not a case by case basis. Some patrols you'd sink ships in 1 shot, others every single torp would be at the minimum end of the random range.

That would be really crappy, frankly. If your first hit did little damage, might as well go home and start a new patrol.

SteamWake
05-31-07, 10:03 AM
In a manner of speaking yes.

Computers cannot generate a rruely random number. It starts with a "seed" number then generates "random" numbers based upon that seed number. Where or when it gets those seed numbers is unknown.

If you get a bad seed the rng can be brutal.

tater
05-31-07, 10:15 AM
Yeah, there is a random seed for each patrol I have noticed.

So if DC damage is in a range from 10 to 50 (making up numbers), with an equal chance of each value, is the die roll deterministic based on the random seed? So if you have a bad seed ALL DCs will do 50, instead of just 2.5% doing 50, 2.5% doing 49, and so forth?

That would be truely horrid design IMO, so goofy it cannot be the way they did it.

That would mean that if a DD has a 2% chance of spotting you every minute, with a bad seed the die would be rolled at the beginning, and the DD would never see you after any number of tries because instead od having a shot at "rolling" a 1 or 2 every minute, it will have rolled "5" the beginning of the patrol, and you'd effectively be invisible until you do something only seen on a roll of 5% or better.

SteamWake
05-31-07, 10:21 AM
Yeah, there is a random seed for each patrol I have noticed.

So if DC damage is in a range from 10 to 50 (making up numbers), with an equal chance of each value, is the die roll deterministic based on the random seed? So if you have a bad seed ALL DCs will do 50, instead of just 2.5% doing 50, 2.5% doing 49, and so forth?

That would be truely horrid design IMO.

That would mean that if a DD has a 2% chance of spotting you every minute, with a bad seed the die would be rolled at the beginning, and the DD would never see you after any number of tries because instead od having a shot at "rolling" a 1 or 2 every minute, it will have rolled "5" the beginning of the patrol, and you'd effectively be invisible until you do something only seen on a roll of 5% or better.

Well there are alot of variables involved take that 2% chance to spot and surface next to it and it now has a 100% chance to spot you.

Run under that target at flank speed at periscope depth it has a good chance to "hear" you.

Run under that target in silent at 220 feet of water and it has a lot less of a chance to hear you.

There are many many variables its not like you flip a coin at the beginning of a campaign heads you win tails you die.

tater
05-31-07, 10:23 AM
Note that there are times when it makes sense, like the campaign layers. Ie: you have the roll for all the random layers happen the same way every time for a given seed. then with save games, etc, all you need is the date and time and the seed, and all the convoys, etc can be rebuilt en route.

For individual gun shots, torpedo explosions, torpedo errors, etc, it makes no sense at all since it would result in some patrols being hopeless (all torpedos doing min damage, all escorts seeing you optimally, all torpedos running deep and being duds, etc). Others might have the effect where some "novice" DDs should see you, but this patrol NONE see you. This would explain a lot, actually, if true.

tater
05-31-07, 10:27 AM
Lets say that running 200ft under a DD (no thermal layer) at flank has a 90% chance of being detected every 15 seconds.

Does the random seed I started my patrol with roll this "die" once for the entire patrol, or does the seed help generate a pseudo-random number every 15 seconds?

So in the example, if the "die" is rolled once, I will either ALWAYS be detected running 200ft deep at flank under a DD, or NEVER be detected running that way (for this entire patrol, every DD set to the same skill level).

If the die is rolled every 15 seconds, the seed is used to generate a pseudo-random number between 0-100 every 15 seconds, and I have a 90% chance of being detected each 15 seconds like I should.

VonBlade
05-31-07, 10:50 AM
It is possible to get true random numbers by creating a random sized grid of 3d space, firing a random atom from a random place at a random speed and after a random period of time with it bouncing about, finding where it is on the grid and using that number. It's complex, but does eliminate the seed problem.

Ok, it's not truly random (is anything?), but random enough for anything anyones going to use.

Uber Gruber
05-31-07, 10:52 AM
It would be usual coding practice to roll the "weighted" dice periodically rather than prior to patrol start. In your example then, every 15secs. It would be madness to roll the dice prior to patrol start in this example.

Uber Gruber
05-31-07, 10:55 AM
The only time i've ever encountered seed problems is when writing machine code and executing a random operation at exactly the same number of micro secs after code execution start.The result was always the same because the seed was being obtained from system clock.....but that was in the old days.

Nowadays, it is very easy to avoid seed problems and i'm sure the devs are aware of this, in fact i'll bet my house, my wife, my kids and our little dashhound called Colin on it.

tater
05-31-07, 11:07 AM
Yeah, I assume that it doesn't work the goofy way I suggested. I was just trying to figure out why some people have such totally different in game experiences—and in a very "all or nothing" way.

You either have pretty decent escorts to avoid, or they all ignore you even surfaced next to them. Some people can use the hardcore torpedo mod and see all kinds of failures, apparently at random, while others have the torpedo go off their aim 18 degrees every single shot.

I was looking for a reason this might be the case.

Uber Gruber
05-31-07, 11:53 AM
I certainly sympahise with the problems people are encountering. I use RFB 1.27 and have so far encountered no problems with Torpedoes, i actually hope I will soon because then I'd be able to start getting a handle on the problem.

That said, escorts are a complete joke for me so i'm certainly encountering AI issues here. My gut feeling is that these "effects" are the result of a combination of things rather than one or two parameters - its like the game engine mechanics is fighting with itself.

Example: lets say in a given coding instant, your Torpedo has a 10% chance of failure. But then some other parameter comes into play, from some other component of the game mechanics, and this parameter screws up the previous 10%....making it 90% for example.

It would be quite normal for these components work well on their own but not in combination with other components. If this is a case then its a code integration issue......which is, unfortunetly, a lot harder to isolate.

Fingers crossed that the devs can solve these issues.

tater
05-31-07, 12:03 PM
Ah, very true. Like people's similar situations but "state change" results might be as simple as 1/2 a knot of extra wind or something...

Classical Chaos.