11-25-2014, 07:39 PM
Though I have notice some clumping of pc's at times when I tested all of this before the game started. I'm not really doing anything that special in the code for determining pc placement on the map. Perhaps on a bigger map, it'll have a smoother distribution but on a map of 26 x 26 areas (676 total areas), 10 regions (approx 68 areas per region), there may be some clumping of pc's.
If you're a math wiz, let me know if there is a better way than the following:
Step 1: randomly roll # of cities/towns/villages
Step 2: randomly roll pc position within region (out of the 68 areas in a given region)
Step 3: if pc already exist at that position (or Fire of the Void location), roll position in region again
Step 4: randomly roll unusual encounter locations on the entire map (skipping pc's and the volcano)
I'm using the standard Java random number generator routine (java.util.Random class). It's initial seed to generate the random number sequence is based on the current timestamp in milliseconds from Jan 1, 1970, so each time I call it, it gives me a different numbered sequence which in turn has a different list of randomly generated numbers.
I've tried playing around with two different versions of this in the code: (1) refreshing the initial seed before processing each pop center in the region, or (2) using the same initial seed and calling the next iteration in the numbered sequence (so there's only one initial call for Java to generate it's sequence of random numbers), but they both have just about the same results (with clumping being involved).
I haven't looked at Fall of Rome java code yet but I can't imagine how many different ways there are in handling the above steps for this...
If you're a math wiz, let me know if there is a better way than the following:
Step 1: randomly roll # of cities/towns/villages
Step 2: randomly roll pc position within region (out of the 68 areas in a given region)
Step 3: if pc already exist at that position (or Fire of the Void location), roll position in region again
Step 4: randomly roll unusual encounter locations on the entire map (skipping pc's and the volcano)
I'm using the standard Java random number generator routine (java.util.Random class). It's initial seed to generate the random number sequence is based on the current timestamp in milliseconds from Jan 1, 1970, so each time I call it, it gives me a different numbered sequence which in turn has a different list of randomly generated numbers.
I've tried playing around with two different versions of this in the code: (1) refreshing the initial seed before processing each pop center in the region, or (2) using the same initial seed and calling the next iteration in the numbered sequence (so there's only one initial call for Java to generate it's sequence of random numbers), but they both have just about the same results (with clumping being involved).
I haven't looked at Fall of Rome java code yet but I can't imagine how many different ways there are in handling the above steps for this...