Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/belgian_uplands.js
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | while (!goodStartPositionsFound) | ||||
{ | { | ||||
// Get some random start location derivations. NOTE: Itterating over all possible derivations is just to much (valid points ** numPlayers) | // Get some random start location derivations. NOTE: Itterating over all possible derivations is just to much (valid points ** numPlayers) | ||||
var maxTries = 100000; // floor(800000 / (Math.pow(numPlayers, 2) / 2)); | var maxTries = 100000; // floor(800000 / (Math.pow(numPlayers, 2) / 2)); | ||||
var possibleDerivations = []; | var possibleDerivations = []; | ||||
for (var i = 0; i < maxTries; i++) | for (var i = 0; i < maxTries; i++) | ||||
{ | { | ||||
var vector = []; | var vector = []; | ||||
for (var p = 0; p < numPlayers; p++) | for (var p = 0; p < numPlayers; p++) | ||||
vector.push(randInt(possibleStartPositions.length)); | vector.push(randIntExclusive(0, possibleStartPositions.length)); | ||||
possibleDerivations.push(vector); | possibleDerivations.push(vector); | ||||
} | } | ||||
// Choose the start location derivation with the greatest minimum distance between players | // Choose the start location derivation with the greatest minimum distance between players | ||||
var maxMinDist = 0; | var maxMinDist = 0; | ||||
for (var d = 0; d < possibleDerivations.length; d++) | for (var d = 0; d < possibleDerivations.length; d++) | ||||
{ | { | ||||
var minDist = 2 * mapSize; | var minDist = 2 * mapSize; | ||||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator