well, I converted Biomes to have a class instead of a series of arrays. Limited testing has been done but it works

This commit is contained in:
Zoltan 2019-11-09 01:48:01 -08:00
parent 7a06e0bdd4
commit d9df7c2f15
10 changed files with 144 additions and 96 deletions

83
main.js
View file

@ -96,6 +96,47 @@ fogging.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("hei
scaleBar.on("mousemove", () => tip("Click to open Units Editor"));
legend.on("mousemove", () => tip("Drag to change the position. Click to hide the legend")).on("click", () => clearLegend());
class Icons {
constructor(iconList = {}, density = 0){
this.density = density;
this.probability = [];
for(var item in iconList) {
if ( iconList.hasOwnProperty(item) ) { // Safety
for( var i=0; i<iconList[item]; i++ ) {
this.probability.push(item);
}
}
}
}
}
class Biome {
constructor(name, color, habitability, icons = new Icons(), cost = 50){
this.name = name;
this.color = color;
this.habitability = habitability;
this.icons = icons;
this.cost = cost;
this.resetStatistics();
}
resetStatistics(){
this.cells = 0;
this.area = 0;
this.rural = 0;
this.urban = 0;
}
addCell(cell, cells){
this.cells += 1;
this.area += cells.area[cell];
this.rural += cells.pop[cell];
if (cells.burg[cell]) this.urban += pack.burgs[cells.burg[cell]].population;
}
}
// main data variables
let grid = {}; // initial grapg based on jittered square grid and data
let pack = {}; // packed graph and data
@ -287,12 +328,29 @@ function findBurgForMFCG(params) {
// apply default biomes data
function applyDefaultBiomesSystem() {
const name = ["Marine","Hot desert","Cold desert","Savanna","Grassland","Tropical seasonal forest","Temperate deciduous forest","Tropical rainforest","Temperate rainforest","Taiga","Tundra","Glacier","Wetland"];
const color = ["#53679f","#fbe79f","#b5b887","#d2d082","#c8d68f","#b6d95d","#29bc56","#7dcb35","#409c43","#4b6b32","#96784b","#d5e7eb","#0b9131"];
const habitability = [0,2,5,20,30,50,100,80,90,10,2,0,12];
const iconsDensity = [0,3,2,120,120,120,120,150,150,100,5,0,150];
const icons = [{},{dune:3, cactus:6, deadTree:1},{dune:9, deadTree:1},{acacia:1, grass:9},{grass:1},{acacia:8, palm:1},{deciduous:1},{acacia:5, palm:3, deciduous:1, swamp:1},{deciduous:6, swamp:1},{conifer:1},{grass:1},{},{swamp:1}];
const cost = [10,200,150,60,50,70,70,80,90,80,100,255,150]; // biome movement cost
const biomeList = [
new Biome ("Marine", "#53679f", 0, new Icons({}, 0), 10),
new Biome ("Hot desert", "#fbe79f", 2, new Icons({dune:3, cactus:6, deadTree:1}, 3), 200),
new Biome ("Cold desert", "#b5b887", 5, new Icons({dune:9, deadTree:1}, 2), 150),
new Biome ("Savanna", "#d2d082", 20, new Icons({acacia:1, grass:9}, 120), 60),
new Biome ("Grassland", "#c8d68f", 30, new Icons({grass:1}, 120), 50),
new Biome ("Tropical seasonal forest", "#b6d95d", 50, new Icons({acacia:8, palm:1}, 120), 70),
new Biome ("Temperate deciduous forest", "#29bc56", 100, new Icons({deciduous:1}, 120), 70),
new Biome ("Tropical rainforest", "#7dcb35", 80, new Icons({acacia:5, palm:3, deciduous:1, swamp:1}, 150), 80),
new Biome ("Temperate rainforest", "#409c43", 90, new Icons({deciduous:6, swamp:1}, 150), 90),
new Biome ("Taiga", "#4b6b32", 10, new Icons({conifer:1}, 100), 80),
new Biome ("Tundra", "#96784b", 2, new Icons({grass:1}, 5), 100),
new Biome ("Glacier", "#d5e7eb", 0, new Icons({}, 0), 255),
new Biome ("Wetland", "#0b9131", 12, new Icons({swamp:1}, 150), 150),
];
//it is occasionally useful to have the "ID" be in the object
biomeList.forEach((e, i) => {e.id = i;});
const MARINE = 0;
const PERMAFROST = 11;
const WETLANDS = 12;
const biomesMartix = [
// hot ↔ cold; dry ↕ wet
new Uint8Array([1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]),
@ -302,16 +360,7 @@ function applyDefaultBiomesSystem() {
new Uint8Array([7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,10,10,10])
];
// parse icons weighted array into a simple array
for (let i=0; i < icons.length; i++) {
const parsed = [];
for (const icon in icons[i]) {
for (let j = 0; j < icons[i][icon]; j++) {parsed.push(icon);}
}
icons[i] = parsed;
}
return {i:d3.range(0, name.length), name, color, biomesMartix, habitability, iconsDensity, icons, cost};
return {biomeList, biomesMartix};
}
function showWelcomeMessage() {
@ -1110,7 +1159,7 @@ function rankCells() {
const areaMean = d3.mean(cells.area); // to adjust population by cell area
for (const i of cells.i) {
let s = +biomesData.habitability[cells.biome[i]]; // base suitability derived from biome habitability
let s = +biomesData.biomeList[cells.biome[i]].habitability; // base suitability derived from biome habitability
if (!s) continue; // uninhabitable biomes has 0 suitability
s += normalize(cells.fl[i] + cells.conf[i], flMean, flMax) * 250; // big rivers and confluences are valued
s -= (cells.h[i] - 50) / 5; // low elevation is valued, high is not;

View file

@ -293,9 +293,9 @@
function getBiomeCost(b, biome, type) {
if (b === biome) return 10; // tiny penalty for native biome
if (type === "Hunting") return biomesData.cost[biome] * 2; // non-native biome penalty for hunters
if (type === "Nomadic" && biome > 4 && biome < 10) return biomesData.cost[biome] * 3; // forest biome penalty for nomads
return biomesData.cost[biome]; // general non-native biome penalty
if (type === "Hunting") return biomesData.biomeList[biome].cost * 2; // non-native biome penalty for hunters
if (type === "Nomadic" && biome > 4 && biome < 10) return biomesData.biomeList[biome].cost * 3; // forest biome penalty for nomads
return biomesData.biomeList[biome].cost; // general non-native biome penalty
}
function getHeightCost(f, h, type) {

View file

@ -392,9 +392,9 @@
function getBiomeCost(c, biome, type) {
if (cells.biome[pack.cultures[c].center] === biome) return 10; // tiny penalty for native biome
if (type === "Hunting") return biomesData.cost[biome] * 5; // non-native biome penalty for hunters
if (type === "Nomadic" && biome > 4 && biome < 10) return biomesData.cost[biome] * 10; // forest biome penalty for nomads
return biomesData.cost[biome] * 2; // general non-native biome penalty
if (type === "Hunting") return biomesData.biomeList[biome].cost * 5; // non-native biome penalty for hunters
if (type === "Nomadic" && biome > 4 && biome < 10) return biomesData.biomeList[biome].cost * 10; // forest biome penalty for nomads
return biomesData.biomeList[biome].cost * 2; // general non-native biome penalty
}
function getHeightCost(i, h, type) {

View file

@ -18,7 +18,7 @@
if (height < 20) continue; // no icons on water
if (cells.r[i]) continue; // no icons on rivers
const b = cells.biome[i];
if (height < 50 && biomesData.iconsDensity[b] === 0) continue; // no icons for this biome
if (height < 50 && biomesData.biomeList[b].icons.density === 0) continue; // no icons for this biome
const polygon = getPackPolygon(i);
const x = d3.extent(polygon, p => p[0]), y = d3.extent(polygon, p => p[1]);
const e = [Math.ceil(x[0]), Math.ceil(y[0]), Math.floor(x[1]), Math.floor(y[1])]; // polygon box
@ -26,14 +26,14 @@
if (height < 50) placeBiomeIcons(i, b); else placeReliefIcons(i);
function placeBiomeIcons() {
const iconsDensity = biomesData.iconsDensity[b] / 100;
const iconsDensity = biomesData.biomeList[b].icons.density / 100;
const radius = 2 / iconsDensity / density;
if (Math.random() > iconsDensity * 10) return;
for (const [cx, cy] of poissonDiscSampler(e[0], e[1], e[2], e[3], radius)) {
if (!d3.polygonContains(polygon, [cx, cy])) continue;
let h = rn((4 + Math.random()) * size, 2);
const icon = getBiomeIcon(i, biomesData.icons[b]);
const icon = getBiomeIcon(i, biomesData.biomeList[b].icons.probability);
if (icon === "#relief-grass-1") h *= 1.3;
relief.push({i: icon, x: rn(cx-h, 2), y: rn(cy-h, 2), s: h*2});
}

View file

@ -212,7 +212,7 @@
const cultureCost = c !== cells.culture[e] ? 10 : 0;
const stateCost = s !== cells.state[e] ? 10 : 0;
const biomeCost = cells.road[e] ? 1 : biomesData.cost[cells.biome[e]];
const biomeCost = cells.road[e] ? 1 : biomesData.biomeList[cells.biome[e]].cost;
const populationCost = Math.max(rn(popCost - cells.pop[e]), 0);
const heightCost = Math.max(cells.h[e], 20) - 20;
const waterCost = cells.h[e] < 20 ? cells.road[e] ? 50 : 1000 : 0;
@ -248,7 +248,7 @@
cells.c[n].forEach(function(e) {
const religionCost = cells.religion[e] === b ? 0 : 2000;
const biomeCost = cells.road[e] ? 0 : biomesData.cost[cells.biome[e]];
const biomeCost = cells.road[e] ? 0 : biomesData.biomeList[cells.biome[e]].cost;
const heightCost = Math.max(cells.h[e], 20) - 20;
const waterCost = cells.h[e] < 20 ? cells.road[e] ? 50 : 1000 : 0;
const totalCost = p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(religions[r].expansionism, .1);

View file

@ -173,7 +173,7 @@
for (const c of cells.c[n]) {
if (cells.h[c] < 20) continue; // ignore water cells
const stateChangeCost = cells.state && cells.state[c] !== cells.state[n] ? 400 : 0; // trails tend to lay within the same state
const habitedCost = Math.max(100 - biomesData.habitability[cells.biome[c]], 0); // routes tend to lay within populated areas
const habitedCost = Math.max(100 - biomesData.biomeList[cells.biome[c]].habitability, 0); // routes tend to lay within populated areas
const heightChangeCost = Math.abs(cells.h[c] - cells.h[n]) * 10; // routes tend to avoid elevation changes
const cellCoast = 10 + stateChangeCost + habitedCost + heightChangeCost;
const totalCost = p + (cells.road[c] || cells.burg[c] ? cellCoast / 3 : cellCoast);

View file

@ -231,7 +231,8 @@ function getMapData() {
temperaturePoleOutput.value, precOutput.value, JSON.stringify(winds),
mapName.value].join("|");
const coords = JSON.stringify(mapCoordinates);
const biomes = [biomesData.color, biomesData.habitability, biomesData.name].join("|");
const b = biomesData.biomeList
const biomes = [b.map(i => i.color), b.map(i => i.habitability), b.map(i => i.name)].join("|");
const notesData = JSON.stringify(notes);
// set transform values to default
@ -583,18 +584,30 @@ function parseLoadedData(data) {
if (data[4]) notes = JSON.parse(data[4]);
const biomes = data[3].split("|");
biomesData = applyDefaultBiomesSystem();
biomesData.color = biomes[0].split(",");
biomesData.habitability = biomes[1].split(",").map(h => +h);
biomesData.name = biomes[2].split(",");
_biomesData = applyDefaultBiomesSystem();
// push custom biomes if any
for (let i=biomesData.i.length; i < biomesData.name.length; i++) {
biomesData.i.push(biomesData.i.length);
biomesData.iconsDensity.push(0);
biomesData.icons.push([]);
biomesData.cost.push(50);
const colorsList = biomes[0].split(",");
const habitabilityList = biomes[1].split(",").map(h => +h);
const namesList = biomes[2].split(",");
biomesData = [];
for (let i = 0; i < namesList.length; i++){
const name = namesList[i];
const color = colorsList[i];
const habitability = habitabilityList[i];
let icons;
if (i < _biomesData.biomeList.length){
icons = _biomesData.biomeList[i].icons;
cost = _biomesData.biomeList[i].cost;
}
else{
icons = new Icons({}, 0);
cost = 50;
}
biomesData.push(new Biome(name, color, habitability, icons, cost));
}
}()
void function replaceSVG() {
@ -811,9 +824,7 @@ function parseLoadedData(data) {
});
// 1.0 added new biome - Wetland
biomesData.name.push("Wetland");
biomesData.color.push("#0b9131");
biomesData.habitability.push(12);
biomesData.biomeList.push("Wetland", "#0b9131", 12);
}
if (version < 1.1) {

View file

@ -54,51 +54,46 @@ function editBiomes() {
function biomesCollectStatistics() {
const cells = pack.cells;
const array = new Uint8Array(biomesData.i.length);
biomesData.cells = Array.from(array);
biomesData.area = Array.from(array);
biomesData.rural = Array.from(array);
biomesData.urban = Array.from(array);
biomesData.biomeList.forEach((biome) => {
biome.resetStatistics();
});
for (const i of cells.i) {
if (cells.h[i] < 20) continue;
const b = cells.biome[i];
biomesData.cells[b] += 1;
biomesData.area[b] += cells.area[i];
biomesData.rural[b] += cells.pop[i];
if (cells.burg[i]) biomesData.urban[b] += pack.burgs[cells.burg[i]].population;
biomesData.biomeList[cells.biome[i]].addCell(i, cells);
}
}
function biomesEditorAddLines() {
const unit = areaUnit.value === "square" ? " " + distanceUnitInput.value + "²" : " " + areaUnit.value;
const b = biomesData;
const l = biomesData.biomeList;
let lines = "", totalArea = 0, totalPopulation = 0;;
for (const i of b.i) {
if (!i || biomesData.name[i] === "removed") continue; // ignore water and removed biomes
const area = b.area[i] * distanceScaleInput.value ** 2;
const rural = b.rural[i] * populationRate.value;
const urban = b.urban[i] * populationRate.value * urbanization.value;
for (const b of l) {
if (!b.id || b.name === "removed") continue; // ignore water and removed biomes
const area = b.area * distanceScaleInput.value ** 2;
const rural = b.rural * populationRate.value;
const urban = b.urban * populationRate.value * urbanization.value;
const population = rn(rural + urban);
const populationTip = `Total population: ${si(population)}; Rural population: ${si(rural)}; Urban population: ${si(urban)}`;
totalArea += area;
totalPopulation += population;
lines += `<div class="states biomes" data-id="${i}" data-name="${b.name[i]}" data-habitability="${b.habitability[i]}"
data-cells=${b.cells[i]} data-area=${area} data-population=${population} data-color=${b.color[i]}>
<svg data-tip="Biomes fill style. Click to change" width=".9em" height=".9em" style="margin-bottom:-1px"><rect x="0" y="0" width="100%" height="100%" fill="${b.color[i]}" class="zoneFill"></svg>
<input data-tip="Biome name. Click and type to change" class="biomeName" value="${b.name[i]}" autocorrect="off" spellcheck="false">
lines += `<div class="states biomes" data-id="${b.id}" data-name="${b.name}" data-habitability="${b.habitability}"
data-cells=${b.cells} data-area=${area} data-population=${population} data-color=${b.color}>
<svg data-tip="Biomes fill style. Click to change" width=".9em" height=".9em" style="margin-bottom:-1px"><rect x="0" y="0" width="100%" height="100%" fill="${b.color}" class="zoneFill"></svg>
<input data-tip="Biome name. Click and type to change" class="biomeName" value="${b.name}" autocorrect="off" spellcheck="false">
<span data-tip="Biome habitability percent" class="hide">%</span>
<input data-tip="Biome habitability percent. Click and set new value to change" type="number" min=0 max=9999 class="biomeHabitability hide" value=${b.habitability[i]}>
<input data-tip="Biome habitability percent. Click and set new value to change" type="number" min=0 max=9999 class="biomeHabitability hide" value=${b.habitability}>
<span data-tip="Cells count" class="icon-check-empty hide"></span>
<div data-tip="Cells count" class="biomeCells hide">${b.cells[i]}</div>
<div data-tip="Cells count" class="biomeCells hide">${b.cells}</div>
<span data-tip="Biome area" style="padding-right: 4px" class="icon-map-o hide"></span>
<div data-tip="Biome area" class="biomeArea hide">${si(area) + unit}</div>
<span data-tip="${populationTip}" class="icon-male hide"></span>
<div data-tip="${populationTip}" class="biomePopulation hide">${si(population)}</div>
<span data-tip="Open Wikipedia articale about the biome" class="icon-info-circled pointer hide"></span>
${i>12 && !b.cells[i] ? '<span data-tip="Remove the custom biome" class="icon-trash-empty hide"></span>' : ''}
${b.id>12 && !b.cells ? '<span data-tip="Remove the custom biome" class="icon-trash-empty hide"></span>' : ''}
</div>`;
}
body.innerHTML = lines;
@ -129,7 +124,7 @@ function editBiomes() {
function biomeHighlightOff(event) {
if (customization === 6) return;
const biome = +event.target.dataset.id;
const color = biomesData.color[biome];
const color = biomesData.biomeList[biome].color;
biomes.select("#biome"+biome).transition().attr("stroke-width", .7).attr("stroke", color);
}
@ -139,7 +134,7 @@ function editBiomes() {
const callback = function(fill) {
el.setAttribute("fill", fill);
biomesData.color[biome] = fill;
biomesData.biomeList[biome].color = fill;
biomes.select("#biome"+biome).attr("fill", fill).attr("stroke", fill);
}
@ -149,18 +144,18 @@ function editBiomes() {
function biomeChangeName(el) {
const biome = +el.parentNode.dataset.id;
el.parentNode.dataset.name = el.value;
biomesData.name[biome] = el.value;
biomesData.biomeList[biome].name = el.value;
}
function biomeChangeHabitability(el) {
const biome = +el.parentNode.dataset.id;
const failed = isNaN(+el.value) || +el.value < 0 || +el.value > 9999;
if (failed) {
el.value = biomesData.habitability[biome];
el.value = biomesData.biomeList[biome].habitability;
tip("Please provide a valid number in range 0-9999", false, "error");
return;
}
biomesData.habitability[biome] = +el.value;
biomesData.biomeList[biome].habitability = +el.value;
el.parentNode.dataset.habitability = el.value;
recalculatePopulation();
refreshBiomesEditor();
@ -191,7 +186,10 @@ function editBiomes() {
function toggleLegend() {
if (legend.selectAll("*").size()) {clearLegend(); return;}; // hide legend
const d = biomesData;
const data = Array.from(d.i).filter(i => d.cells[i]).sort((a, b) => d.area[b] - d.area[a]).map(i => [i, d.color[i], d.name[i]]);
const data = Array.from(d.biomeList) //shallow copy existing array
.filter(i => i.cells) //remove biomes with 0 cells
.sort((a, b) => b.area - a.area) //sort by size
.map(i => [i.id, i.color, i.name]); //return index, color, and name
drawLegend("Biomes", data);
}
@ -214,28 +212,18 @@ function editBiomes() {
}
function addCustomBiome() {
const b = biomesData, i = biomesData.i.length;
b.i.push(i);
b.color.push(getRandomColor());
b.habitability.push(50);
b.name.push("Custom");
b.iconsDensity.push(0);
b.icons.push([]);
b.cost.push(50);
b.rural.push(0);
b.urban.push(0);
b.cells.push(0);
b.area.push(0);
const b = biomesData.biomeList, i = b.length;
b.push(new Biome("Custom", getRandomColor(), 50))
b[i].id = i; //don't forget the ID!
const unit = areaUnit.value === "square" ? " " + distanceUnitInput.value + "²" : " " + areaUnit.value;
const line = `<div class="states biomes" data-id="${i}" data-name="${b.name[i]}" data-habitability=${b.habitability[i]} data-cells=0 data-area=0 data-population=0 data-color=${b.color[i]}>
<svg data-tip="Biomes fill style. Click to change" width=".9em" height=".9em" style="margin-bottom:-1px"><rect x="0" y="0" width="100%" height="100%" fill="${b.color[i]}" class="zoneFill"></svg>
<input data-tip="Biome name. Click and type to change" class="biomeName" value="${b.name[i]}" autocorrect="off" spellcheck="false">
const line = `<div class="states biomes" data-id="${b[i].id}" data-name="${b[i].name}" data-habitability=${b[i].habitability} data-cells=0 data-area=0 data-population=0 data-color=${b[i].color}>
<svg data-tip="Biomes fill style. Click to change" width=".9em" height=".9em" style="margin-bottom:-1px"><rect x="0" y="0" width="100%" height="100%" fill="${b[i].color}" class="zoneFill"></svg>
<input data-tip="Biome name. Click and type to change" class="biomeName" value="${b[i].name}" autocorrect="off" spellcheck="false">
<span data-tip="Biome habitability percent" class="hide">%</span>
<input data-tip="Biome habitability percent. Click and set new value to change" type="number" min=0 max=9999 step=1 class="biomeHabitability hide" value=${b.habitability[i]}>
<input data-tip="Biome habitability percent. Click and set new value to change" type="number" min=0 max=9999 step=1 class="biomeHabitability hide" value=${b[i].habitability}>
<span data-tip="Cells count" class="icon-check-empty hide"></span>
<div data-tip="Cells count" class="biomeCells hide">${b.cells[i]}</div>
<div data-tip="Cells count" class="biomeCells hide">${b[i].cells}</div>
<span data-tip="Biome area" style="padding-right: 4px" class="icon-map-o hide"></span>
<div data-tip="Biome area" class="biomeArea hide">0 ${unit}</div>
<span data-tip="Total population: 0" class="icon-male hide"></span>
@ -251,7 +239,7 @@ function editBiomes() {
function removeCustomBiome(el) {
const biome = +el.parentNode.dataset.id;
el.parentNode.remove();
biomesData.name[biome] = "removed";
biomesData.biomeList[biome].name = "removed";
biomesFooterBiomes.innerHTML = +biomesFooterBiomes.innerHTML - 1;
}
@ -337,7 +325,7 @@ function editBiomes() {
const selected = body.querySelector("div.selected");
const biomeNew = selected.dataset.id;
const color = biomesData.color[biomeNew];
const color = biomesData.biomeList[biomeNew].color;
selection.forEach(function(i) {
const exists = temp.select("polygon[data-cell='"+i+"']");

View file

@ -104,7 +104,7 @@ function showMapTooltip(point, e, i, g) {
if (layerIsOn("togglePrec") && land) tip("Annual Precipitation: "+ getFriendlyPrecipitation(i)); else
if (layerIsOn("togglePopulation")) tip(getPopulationTip(i)); else
if (layerIsOn("toggleTemp")) tip("Temperature: " + convertTemperature(grid.cells.temp[g])); else
if (layerIsOn("toggleBiomes") && pack.cells.biome[i]) tip("Biome: " + biomesData.name[pack.cells.biome[i]]); else
if (layerIsOn("toggleBiomes") && pack.cells.biome[i]) tip("Biome: " + biomesData.biomeList[pack.cells.biome[i]].name); else
if (layerIsOn("toggleReligions") && pack.cells.religion[i]) {
const religion = pack.religions[pack.cells.religion[i]];
const type = religion.type === "Cult" || religion.type == "Heresy" ? religion.type : religion.type + " religion";
@ -146,7 +146,7 @@ function updateCellInfo(point, i, g) {
infoBurg.innerHTML = cells.burg[i] ? pack.burgs[cells.burg[i]].name + " (" + cells.burg[i] + ")" : "no";
const f = cells.f[i];
infoFeature.innerHTML = f ? pack.features[f].group + " (" + f + ")" : "n/a";
infoBiome.innerHTML = biomesData.name[cells.biome[i]];
infoBiome.innerHTML = biomesData.biomeList[cells.biome[i]].name;
}
// get user-friendly (real-world) height value from map data

View file

@ -333,7 +333,7 @@ function drawBiomes() {
biomes.selectAll("path").remove();
const cells = pack.cells, vertices = pack.vertices, n = cells.i.length;
const used = new Uint8Array(cells.i.length);
const paths = new Array(biomesData.i.length).fill("");
const paths = new Array(biomesData.biomeList.length).fill("");
for (const i of cells.i) {
if (!cells.biome[i]) continue; // no need to mark water
@ -350,7 +350,7 @@ function drawBiomes() {
paths.forEach(function(d, i) {
if (d.length < 10) return;
biomes.append("path").attr("d", d).attr("fill", biomesData.color[i]).attr("stroke", biomesData.color[i]).attr("id", "biome"+i);
biomes.append("path").attr("d", d).attr("fill", biomesData.biomeList[i].color).attr("stroke", biomesData.biomeList[i].color).attr("id", "biome"+i);
});
// connect vertices to chain