Page MenuHomeWildfire Games

Move Wild Lake biome specifics to a JSON file
Needs ReviewPublic

Authored by smiley on Oct 30 2018, 5:49 PM.

Details

Reviewers
elexis
FeXoR
Summary

wild_lake places a lot entities which are decided based on the biome. This diff moves those definitions to a JSON file which should make extension and maintenance easier. Would also get rid of two objects which were basically doing the same thing.
It also moves the camp entities to the JSON file. Celts in India just doesn't feel right. However, the entity changes are not yet included.

Unsupported biome error fix based upon JeHathor's patch at P140

Test Plan

End result would not be changed at all. However, mapgen would differ from the current script due to the pickRandom()

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6420
Build 10635: Vulcan BuildJenkins
Build 10634: arc lint + arc unit

Event Timeline

smiley created this revision.Oct 30 2018, 5:49 PM
Owners added a subscriber: Restricted Owners Package.Oct 30 2018, 5:49 PM
smiley added inline comments.Oct 30 2018, 5:50 PM
binaries/data/mods/public/maps/random/wild_lake.js
555

forgot the break

Vulcan added a subscriber: Vulcan.Oct 30 2018, 5:52 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'bench'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 216| 216| 	"overlap": 0,
| 217| 217| 	"fence": readyWallElement("other/fence_long", "gaia"),
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219|    |-	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
|    | 219|+	"bench": { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"indent"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 216| 216| 	"overlap": 0,
| 217| 217| 	"fence": readyWallElement("other/fence_long", "gaia"),
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219|    |-	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
|    | 219|+	"bench":     { "angle": Math.PI / 2, "length": 1.5, "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"bend"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 216| 216| 	"overlap": 0,
| 217| 217| 	"fence": readyWallElement("other/fence_long", "gaia"),
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219|    |-	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
|    | 219|+	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0, "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'foodBin'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 217| 217| 	"fence": readyWallElement("other/fence_long", "gaia"),
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220|    |-	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
|    | 220|+	"foodBin": { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"indent"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 217| 217| 	"fence": readyWallElement("other/fence_long", "gaia"),
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220|    |-	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
|    | 220|+	"foodBin":   { "angle": Math.PI / 2, "length": 1.5, "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"bend"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 217| 217| 	"fence": readyWallElement("other/fence_long", "gaia"),
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220|    |-	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
|    | 220|+	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0, "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'animal'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221|    |-	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
|    | 221|+	"animal": { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
| 224| 224| 
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"length"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221|    |-	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
|    | 221|+	"animal":    { "angle": 0, "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
| 224| 224| 
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"indent"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 218| 218| 	"fence_short": readyWallElement("other/fence_short", "gaia"),
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221|    |-	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
|    | 221|+	"animal":    { "angle": 0,           "length": 0, "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222| 222| 	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
| 224| 224| 
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"length"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222|    |-	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
|    | 222|+	"farmstead": { "angle": Math.PI, "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
| 224| 224| 
| 225| 225| let fences = [
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"indent"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222|    |-	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
|    | 222|+	"farmstead": { "angle": Math.PI,     "length": 0, "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
| 224| 224| 
| 225| 225| let fences = [
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before '"bend"'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 219| 219| 	"bench":     { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "other/bench" },
| 220| 220| 	"foodBin":   { "angle": Math.PI / 2, "length": 1.5,  "indent": 0,    "bend": 0, "templateName": "gaia/treasure/food_bin" },
| 221| 221| 	"animal":    { "angle": 0,           "length": 0,    "indent": 0.75, "bend": 0, "templateName": biomeSpecific.farmEntities.animal },
| 222|    |-	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3,   "bend": 0, "templateName": biomeSpecific.farmEntities.building }
|    | 222|+	"farmstead": { "angle": Math.PI,     "length": 0,    "indent": -3, "bend": 0, "templateName": biomeSpecific.farmEntities.building }
| 223| 223| };
| 224| 224| 
| 225| 225| let fences = [
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 0 tabs but found 1 space.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 352| 352| /**
| 353| 353|  * Base terrain shape generation and settings
| 354| 354|  */
| 355|    |- // Height range by map size
|    | 355|+// Height range by map size
| 356| 356| let heightScale = (g_Map.size + 256) / 768 / 4;
| 357| 357| let heightRange = { "min": MIN_HEIGHT * heightScale, "max": MAX_HEIGHT * heightScale };
| 358| 358| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 376| 376| 	[medH, medH, medH, medH, medH, medH],
| 377| 377| ];
| 378| 378| if (g_Map.size < 256)
| 379|    |-{
|    | 379|+
| 380| 380| 	initialHeightmap = [
| 381| 381| 		[medH, medH, medH, medH, medH],
| 382| 382| 		[medH, medH, medH, medH, medH],
| 384| 384| 		[medH, medH, medH, medH, medH],
| 385| 385| 		[medH, medH, medH, medH, medH]
| 386| 386| 	];
| 387|    |-}
|    | 387|+
| 388| 388| if (g_Map.size >= 384)
| 389| 389| {
| 390| 390| 	initialHeightmap = [
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 386| 386| 	];
| 387| 387| }
| 388| 388| if (g_Map.size >= 384)
| 389|    |-{
|    | 389|+
| 390| 390| 	initialHeightmap = [
| 391| 391| 		[medH, medH, medH, medH, medH, medH, medH, medH],
| 392| 392| 		[medH, medH, medH, medH, medH, medH, medH, medH],
| 397| 397| 		[medH, medH, medH, medH, medH, medH, medH, medH],
| 398| 398| 		[medH, medH, medH, medH, medH, medH, medH, medH],
| 399| 399| 	];
| 400|    |-}
|    | 400|+
| 401| 401| 
| 402| 402| setBaseTerrainDiamondSquare(heightRange.min, heightRange.max, initialHeightmap, 0.8);
| 403| 403| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'min'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 428| 428| 	heightSeaGroundAdjusted + 7/8 * (heightRange.max - heightSeaGroundAdjusted), // 6 Lower forest border
| 429| 429| 	heightRange.max // 7 Forest
| 430| 430| ];
| 431|    |-let playerHeightRange = { "min" : heighLimits[3], "max" : heighLimits[4] };
|    | 431|+let playerHeightRange = { "min": heighLimits[3], "max" : heighLimits[4] };
| 432| 432| let resourceSpotHeightRange = { "min" : (heighLimits[2] + heighLimits[3]) / 2, "max" : (heighLimits[4] + heighLimits[5]) / 2 };
| 433| 433| let playerHeight = (playerHeightRange.min + playerHeightRange.max) / 2; // Average player height
| 434| 434| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'max'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 428| 428| 	heightSeaGroundAdjusted + 7/8 * (heightRange.max - heightSeaGroundAdjusted), // 6 Lower forest border
| 429| 429| 	heightRange.max // 7 Forest
| 430| 430| ];
| 431|    |-let playerHeightRange = { "min" : heighLimits[3], "max" : heighLimits[4] };
|    | 431|+let playerHeightRange = { "min" : heighLimits[3], "max": heighLimits[4] };
| 432| 432| let resourceSpotHeightRange = { "min" : (heighLimits[2] + heighLimits[3]) / 2, "max" : (heighLimits[4] + heighLimits[5]) / 2 };
| 433| 433| let playerHeight = (playerHeightRange.min + playerHeightRange.max) / 2; // Average player height
| 434| 434| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'min'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 429| 429| 	heightRange.max // 7 Forest
| 430| 430| ];
| 431| 431| let playerHeightRange = { "min" : heighLimits[3], "max" : heighLimits[4] };
| 432|    |-let resourceSpotHeightRange = { "min" : (heighLimits[2] + heighLimits[3]) / 2, "max" : (heighLimits[4] + heighLimits[5]) / 2 };
|    | 432|+let resourceSpotHeightRange = { "min": (heighLimits[2] + heighLimits[3]) / 2, "max" : (heighLimits[4] + heighLimits[5]) / 2 };
| 433| 433| let playerHeight = (playerHeightRange.min + playerHeightRange.max) / 2; // Average player height
| 434| 434| 
| 435| 435| g_Map.log("Chosing starting locations");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'max'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/maps/random/wild_lake.js
| 429| 429| 	heightRange.max // 7 Forest
| 430| 430| ];
| 431| 431| let playerHeightRange = { "min" : heighLimits[3], "max" : heighLimits[4] };
| 432|    |-let resourceSpotHeightRange = { "min" : (heighLimits[2] + heighLimits[3]) / 2, "max" : (heighLimits[4] + heighLimits[5]) / 2 };
|    | 432|+let resourceSpotHeightRange = { "min" : (heighLimits[2] + heighLimits[3]) / 2, "max": (heighLimits[4] + heighLimits[5]) / 2 };
| 433| 433| let playerHeight = (playerHeightRange.min + playerHeightRange.max) / 2; // Average player height
| 434| 434| 
| 435| 435| g_Map.log("Chosing starting locations");

binaries/data/mods/public/maps/random/wild_lake.js
| 184| »   groveActors·=·[g_Decoratives.grass,·g_Decoratives.rockMedium,·g_Decoratives.bushMedium],·groveTileClass·=·undefined,
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'groveActors' is already declared in the upper scope.

binaries/data/mods/public/maps/random/wild_lake.js
| 546| »   switch(choice)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/maps/random/wild_lake.js
| 555| »   »   placeGrove(resourceSpots[i]);
|    | [NORMAL] JSHintBear:
|    | Expected a 'break' statement before 'case'.

Link to build: https://jenkins.wildfiregames.com/job/differential/758/display/redirect

elexis added inline comments.Oct 30 2018, 7:44 PM
binaries/data/mods/public/maps/random/wild_lake.js
22

The randomization should be done in the gamesetup, it's a fallback to a random biome if there is a new biome used?
Would it be less wrong to place no entities instead of the wrong entities?
Should it show an error message regardless?

190

why is this hardcoded here and not in the biome files?

202

sounds good (I hope we dont get a messy directory, might need to look for a new directory structure if there are too many helper files eventually)

220

move those over too. on space biome benches might need to be different.

265

same

572

I'm not a fan of switch statements, usually the same is nicer off with using objects and keys.
The hardcoded numbers and the modulo operator could be abstracted with a pickRandom.
It could be pickRandom([() => { statement1; }, ...]) with the last item being conditional

elexis retitled this revision from Move biome specific entities to a JSON file to Move Wild Lake biome specifics to a JSON file.Oct 30 2018, 7:44 PM
smiley added inline comments.Oct 31 2018, 4:42 AM
binaries/data/mods/public/maps/random/wild_lake.js
22

It is a fallback if the selected biome doesnt have defined entries.

One could always place Romans. They were everywhere. Apart from that, not really sure.

A warning probably. Then at least a person who adds a new biome would be informed that somethings not right.

FeXoR added a comment.EditedNov 9 2018, 2:36 PM

Yea, adding a warning or at least log when biomes are missing definitions.
Otherwise I'm all for it.
Change civs for the biomes at your liking (replacing e.g. Celts in India ;p).

EDIT: (Fallback to Romans sounds OK in general but won't solve the issue if the selected mods don't have them)

FeXoR added a comment.EditedFri, Nov 23, 7:17 PM

I find less files easier to maintain then multiple files BTW.
Also this biome is not meant to be unique to this map.

EDIT: There are two sane ways to go IMO:

  1. Extend the generic biomes to have all that is needed by all maps that uses biomes.
  2. Let maps extend the biomes (like it was when I wrote this map) and place the default biome's entities in case the chosen biome isn't in the mod this map is in (meaning not inside the map!).

The original issues are:

  • Mod support is quite basic
  • Mods don't tend to account for everything that the main game supports
  • This map has a few extensions that are relatively new like camps and farms (We should decide wether or not to add those to biomes or remove them from the map)

However, it is no alternative to go against the generic biome system by defining map specific biomes! In that case make the map not use the biome system.

The way I see it, this is not a biome at all. This is just defining entities based on the biome. I do not think these should be put in to the biome files for the reason. The next such map may not want to have Romans in the Alpine biome. So, I think that keeping this as part of the map would be best.

In D1660#66565, @smiley wrote:

The way I see it, this is not a biome at all.

Then don't pot it into a biome file.

This is just defining entities based on the biome.

...which is exactly what a biome does (alongside terrain textures and actors).

I do not think these should be put in to the biome files for the reason.

I can't follow that reasoning (see above). However, removing the camps and farms would be an alternative clean solution (though maybe not desired).

The next such map may not want to have Romans in the Alpine biome.

...and another map may not want to use that base texture for that specific biome. That's always a possibility. Also I'm absolutely fine with changing the entities.

So, I think that keeping this as part of the map would be best.

Could do. But then:

I just wouldn't expect mods to work with every part of the public mod if not checking for references of the changed parts in the entire public mod. (Seems like common sense to me) though it somewhat defies the "easy to mod" idea)

I am sorry I happened to see what's really done here just yesterday :/

(We should decide wether or not to add those to biomes or remove them from the map)

Why are those the only two options? As said, these are things *based* upon the selected mod. Not the biome itself. What would happen in “new_map” which want to do something extra like ponds or something if the selected biome was “xyz.json”. Sure, we could add the function to the core or let the map extend it.
In this case, the buildings were a nice addition. And most likely, they would be map specific. So we could either;

  • Do nothing and keep a bunch of related data seperately in the map.
  • Take all those data, combine them and make one nice json file.

...and another map may not want to use that base texture for that specific biome

At that point, isnt it a different biome in technical sense? When a map want to do something like that, they are already using a new map specifc biome regardless of how the script does it. Change enough, and you have to something like gulf_of_bothnia or fields_of_meroe.

I find less files easier to maintain then multiple files BTW.

In particular for Hellas typos when refering from JS to JSON were a bit painful.
The same argument is also often given for JS files, but there are also advantages to splitting things into different files (logical grouping, preventing fragmentation, etc).

perhaps "wild_lake_biome_specifics.json" -> "wild_lake_camps.json"

Dunno what the biome discussion is about, this isn't a biome, nor does it claim to be a biome, but it extends the existing biomes, which I think only these two maps currently do.
Moving it to the generic biomes would be reasonable if the entity choices are really generic, but it seems more like something tuned for this map.

binaries/data/mods/public/maps/random/wild_lake.js
189

Hack alert, parse the template, get it from the JS object or don't use the civ

190

some civs might not have outposts but other templates

215

g_WallStyles.sheepThing =

222

(bit nitpicking, the number 3 relates to the obstruction size of the building I suppose)

binaries/data/mods/public/maps/random/wild_lake_biome_specifics.json
3

(Not sure if this is more common: "mercenaryCampEntities":\n [ )

14

Perhaps mercenaryCampTemplates

43

{\n
,\n

85

{ "foo": "bar" } (spaces)

88

,\n

smiley added inline comments.Sun, Nov 25, 10:40 AM
binaries/data/mods/public/maps/random/wild_lake.js
189

Would be fixed when moving the outpost.

222

Could be. But, it could just as well be an unrelated number which was more aesthetically nice.

binaries/data/mods/public/maps/random/wild_lake_biome_specifics.json
14

Does make more sense.

FeXoR added a comment.Sun, Nov 25, 2:04 PM

Dunno what the biome discussion is about, this isn't a biome, nor does it claim to be a biome, but it extends the existing biomes, which I think only these two maps currently do.

why is this hardcoded here and not in the biome files?

As said I'm either for:

  • Extending the biomes for the maps (if we think that this would be useful for maps to come, IMO true for mercenary camps, not sure about farms and outposts)
  • Leave the extensions in the maps because they are map specific (if we think they are unique to those maps)

But what we do now is add map specific files scattered across different paths which I think we should avoid (and I don't see a benefit in doing so).

That's what this is about.

Take all those data, combine them and make one nice json file.

Absolutely! And the files that gather those biome specifics are in the "generic" folder (why ever not in biomes right away). So, extend those as said above I gave as option.

binaries/data/mods/public/maps/random/wild_lake.js
22

I'm for fallback and warn.

215

Those are farms including fences and benches that are available in templates/other (and where available in wallStyles["other"] and that's how it IMO should be)...
However, in the scope of this patch I'd use "farm" for that's what this wallStyle is used to place in the end.

220

If in a wallset template I agree the bench length value is not fitting very well.
However, in this wallStyle it is (and has to) match the length of a fence part together with the food treasure or the fortress will not be closes.

222

While it has to do something with the obstruction (that number must be greater than) it's not equal.
Obstruction radius/half width + specific value might be fitting better though (if farms happen to have very different sizes for different civs), yes.

While I do agree that the current directory structure is messy (especially the map specific biomes in rmbiome), I dont see a particular issue with this approach. We do the same thing for heightmaps, triggerscripts and pmp files.
But I suppose the object could be moved in to the script. Would not really change anything.

FeXoR added a comment.Sun, Nov 25, 5:17 PM

We could avoid spreading map related files over different directories by granting maps directories and put all related files there.
(This is what I would understand what @elexis called "logically grouped". Group what is only used by one map into that folder including e.g. the map-preview. There are other possible logical groupings orc..)

+1 for that. But thats a lot of new directories. We got a lot of skirmish+scenario maps as well.

FeXoR added a comment.EditedSun, Nov 25, 6:49 PM

I agree. My intention is just to clarify if we can find something we all agree on so we can aim for that.
And this decision has some impact on this ticket that's why I'm bringing this up.
What's you thought in this, @elexis ?

EDIT: Would be nice if .zip files would also be supported