{"__v":1,"_id":"554f09c6a8c1ae0d00c5bb93","category":{"__v":7,"_id":"550a4c2e42fff40d00ae6049","project":"543b9b0065bf840e00b473d5","version":"543b9b0065bf840e00b473d8","pages":["550a4d06492cbf0d00bbff79","550a870cb6fd572500a57a42","550d801711e8d00d00b80380","551e00f5a7e98017009e3ee4","551edb36c2d1ec1700b4261c","554f09c6a8c1ae0d00c5bb93","55b63d63f8105a2f00c34e33"],"reference":false,"createdAt":"2015-03-19T04:10:22.740Z","from_sync":false,"order":3,"slug":"units","title":"Units"},"project":"543b9b0065bf840e00b473d5","user":"543b9aa865bf840e00b473d1","version":{"__v":11,"_id":"543b9b0065bf840e00b473d8","project":"543b9b0065bf840e00b473d5","createdAt":"2014-10-13T09:27:28.467Z","releaseDate":"2014-10-13T09:27:28.467Z","categories":["543b9b0065bf840e00b473d9","543b9ef065bf840e00b473e0","54890012f291f61400c02d36","54890902f291f61400c02d3e","54890c43f291f61400c02d44","54890d71c178b40b00aa3086","5508125c0c4d8c19008a5f83","55094050961f17170070abbd","550945111c38c50d006118ad","550a4c2e42fff40d00ae6049","55221c074801a40d00a77610"],"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"createdAt":"2015-05-10T07:33:26.557Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"order":7,"body":"There are 2 kind of population\n- Building population\n- Units population\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Building Populations\"\n}\n[/block]\nEvery building max population is independent from each other!\nThe max population of every building is dependent on player level.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"cap_x_prereq\\n//shows the level needed to create x number of a type of buildings\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nFor example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GoldForge.cap_3_prereq == 9 \\n//This means that the player has to reach level 9 before creating the third gold forge.\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/JHWeMe0SAa43lx5R46se\",\n        \"popbonus.jpg\",\n        \"800\",\n        \"600\",\n        \"#3a3a3b\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Unit Populations\"\n}\n[/block]\nThe units (artifacts and summonables) are related to the SAME population, maxed based on buildings. It starts at 0.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"unit_max_pop = 0\\ncurrent_pop = 0\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/y9NcOqQ1SOe7ZC53ScVL\",\n        \"population-count.jpg\",\n        \"800\",\n        \"600\",\n        \"#cc8747\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Population cap\"\n}\n[/block]\nThere are 2 building demos included with the default kit which add population, one of them is the basic building that already exist in each game (the Wizard Academy)\n\nThese buildings are the only buildings with a value on these columns \"pop_bonus\", \"lev_2_pop_bonus\", lev_3_pop_bonus\n\npop_bonus is the bonus that grants the creation of a level 1 building\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"unit_max_pop += building.pop_bonus()\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nlev_2_pop_bonus and lev_3_pop_bonus are the bonus granted by the upgrade of the building to level 2 and 3\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"unit_max_pop += building.lev_2_pop_bonus()\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Current population\"\n}\n[/block]\nEvery units has a weight that count toward the reach of the max population.\nThis value is stored under the column \"pop_unit_weight\"\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"current_pop += unit.pop_unit_weight()\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/jcCI4BqRSRWcLzWPOVLk\",\n        \"popmax.jpg\",\n        \"800\",\n        \"600\",\n        \"#78a906\",\n        \"\"\n      ],\n      \"caption\": \"Total units\"\n    }\n  ]\n}\n[/block]\nIf the player has too many units he couldn't create any other ones until he free some space or until he creates new buildings to allow more population.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"if (current_pop >= unit_max_pop)\\n//Prevent player from creating more units since the cap was reached\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"population-types","type":"basic","title":"Population Types"}

Population Types


There are 2 kind of population - Building population - Units population [block:api-header] { "type": "basic", "title": "Building Populations" } [/block] Every building max population is independent from each other! The max population of every building is dependent on player level. [block:code] { "codes": [ { "code": "cap_x_prereq\n//shows the level needed to create x number of a type of buildings", "language": "csharp" } ] } [/block] For example: [block:code] { "codes": [ { "code": "GoldForge.cap_3_prereq == 9 \n//This means that the player has to reach level 9 before creating the third gold forge.", "language": "csharp" } ] } [/block] [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/JHWeMe0SAa43lx5R46se", "popbonus.jpg", "800", "600", "#3a3a3b", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Unit Populations" } [/block] The units (artifacts and summonables) are related to the SAME population, maxed based on buildings. It starts at 0. [block:code] { "codes": [ { "code": "unit_max_pop = 0\ncurrent_pop = 0", "language": "csharp" } ] } [/block] [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/y9NcOqQ1SOe7ZC53ScVL", "population-count.jpg", "800", "600", "#cc8747", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Population cap" } [/block] There are 2 building demos included with the default kit which add population, one of them is the basic building that already exist in each game (the Wizard Academy) These buildings are the only buildings with a value on these columns "pop_bonus", "lev_2_pop_bonus", lev_3_pop_bonus pop_bonus is the bonus that grants the creation of a level 1 building [block:code] { "codes": [ { "code": "unit_max_pop += building.pop_bonus()", "language": "csharp" } ] } [/block] lev_2_pop_bonus and lev_3_pop_bonus are the bonus granted by the upgrade of the building to level 2 and 3 [block:code] { "codes": [ { "code": "unit_max_pop += building.lev_2_pop_bonus()", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Current population" } [/block] Every units has a weight that count toward the reach of the max population. This value is stored under the column "pop_unit_weight" [block:code] { "codes": [ { "code": "current_pop += unit.pop_unit_weight()", "language": "csharp" } ] } [/block] [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/jcCI4BqRSRWcLzWPOVLk", "popmax.jpg", "800", "600", "#78a906", "" ], "caption": "Total units" } ] } [/block] If the player has too many units he couldn't create any other ones until he free some space or until he creates new buildings to allow more population. [block:code] { "codes": [ { "code": "if (current_pop >= unit_max_pop)\n//Prevent player from creating more units since the cap was reached", "language": "csharp" } ] } [/block]