{"__v":17,"_id":"550c312a5fdefb19003d1201","category":{"__v":8,"_id":"543b9ef065bf840e00b473e0","project":"543b9b0065bf840e00b473d5","version":"543b9b0065bf840e00b473d8","pages":["543b9f11b1479b1400c42f58","548a78adb77bb70b00ac8c10","55082e75c79a211900a8de1b","55083e4e31eeba2d00d66a2d","550bfa9022ccb01700a79466","550c312a5fdefb19003d1201","554f015d1bc7d20d00458588","554f03de1bc7d20d0045858c"],"reference":false,"createdAt":"2014-10-13T09:44:16.284Z","from_sync":false,"order":4,"slug":"pvp-battles","title":"PvP Battles"},"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-03-20T14:39:38.420Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"order":4,"body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"To create a single player campaign, you'll need the Complete Kit which is [available here](https://www.citybuildingkit.com/#pricing)\",\n  \"title\": \"Campaign Requires the Complete Kit\"\n}\n[/block]\nPopular mobile games like Clash of Clans or Castle Clash include a single-player campaign which involves stealing resources from goblin villages or dungeons. This gameplay follows the PvP format, but instead of loading player villages, premade campaign villages are loaded from the game server.\n\nThe following instructions will walk you through creating a proof-of-concept for single-player campaign.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Design the Maps\"\n}\n[/block]\nTo setup a proof-of-concept for campaign, first, prepare a series of campaign villages for user's to battle. To do this, open the game on your device or in Unity and build each village. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/NW1nnwBBTIylzYUgBxfE\",\n        \"design-map.jpg\",\n        \"800\",\n        \"600\",\n        \"\",\n        \"\"\n      ],\n      \"caption\": \"Design the campaign villages\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Upload to Your Server\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Setup the Server Software First\",\n  \"body\": \"Follow the server software documentation first to update the save scripts in the kit to save to your own server. Otherwise your map will be saved on our demo server.\"\n}\n[/block]\nWhen you have completed your campaign village for players to battle, save your village locally by pressing Local Save in Settings, then press Server Save. When the in-game operations console says your upload is complete, write down the filename it saved and proceed to the next step.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/dgJNbgTHTa29rS3nReFf\",\n        \"server-save.jpg\",\n        \"800\",\n        \"600\",\n        \"#354e65\",\n        \"\"\n      ],\n      \"caption\": \"Save each village on the Server\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Save Your Village Data\"\n}\n[/block]\nGo to your server and check for the map filename in your maps directory with the demo software script. If you use the demo administration page included with the server software, it's easy to refresh the page and see which is the new map. Right click and save this map file.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/1wft3FKaQ9aFMPLIantD\",\n        \"save-server-text.jpg\",\n        \"800\",\n        \"600\",\n        \"#4d3122\",\n        \"\"\n      ],\n      \"caption\": \"Download the campaign map source\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. Repeat Steps 1-3 Until You Finish All Campaign Maps\"\n}\n[/block]\nNow that you've saved your map file, put it in a safe place and press the exit button in settings to close the app permanently. Repeat the steps above to create all the single-player campaign maps you want. When you're done, move on to step 5.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Reference: Map File Example\"\n}\n[/block]\nHere's an example of our sandbox village map included in the game demo.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"###StartofFile###\\n###Buildings###\\nAcademy,7,1536,633.5\\nBarrel,5,2304,181\\nBarrel,6,128,452.5\\nBarrel,20,1792,-181\\nChessboard,8,640,1357.5\\nClassroom,10,-384,995.5\\nClassroom,9,-384,90.5\\nForge,0,-512,-543\\nForge,17,-1536,-543\\nForge,18,-1024,-905\\nForge,23,-1024,-181\\nGenerator,1,896,-1176.5\\nGenerator,2,1408,-814.5\\nGenerator,4,896,-452.5\\nGenerator,19,384,-814.5\\nGlobe,11,-384,1719.5\\nSummon,13,-1408,995.5\\nSummon,22,-384,-1719.5\\nToolhouse,12,-1536,90.5\\nVault,3,128,-1357.5\\nVault,16,-2304,-362\\nWorkshop,14,-1920,633.5\\nWorkshop,15,-2560,181\\n###Grass###\\n3,0,-512,-543\\n3,1,896,-1176.5\\n3,2,1408,-814.5\\n3,3,128,-1357.5\\n3,4,896,-452.5\\n3,5,2304,181\\n3,6,128,452.5\\n4,7,1536,633.5\\n3,8,640,1357.5\\n3,9,-384,90.5\\n3,10,-384,995.5\\n3,11,-384,1719.5\\n2,12,-1536,90.5\\n3,13,-1408,995.5\\n3,14,-1920,633.5\\n3,15,-2560,181\\n3,16,-2304,-362\\n3,17,-1536,-543\\n3,18,-1024,-905\\n3,19,384,-814.5\\n3,20,1792,-181\\n3,21,-896,633.5\\n3,22,-384,-1719.5\\n3,23,-1024,-181\\n###Construction###\\nClassroom,21,2,0,0,-896,633.5\\n###BuildingIndex###\\n23\\n0.00,0\\n0,0,0,0,0,0,0,0,0,0,0,0\\n0,0,0,0,0,0,0,0,0,0,0,0\\n0,0,0,0,0,0,0,0,0,0,0,0\\n###Stats###\\n4060,7,1,19147.1,21416.02,34,64504,48421,70,0.2,0.2,True,True,True,True\\n03/20/2015 18:11:56\\n###EndofFile###\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"5. Upload a Copy of the Server Software\"\n}\n[/block]\nOnce you have your collected all the village maps you want to include in your single player campaign, put them in a folder called \"maps\" and then upload a separate copy of the demo server software to your server, for example www.yoursite.com/campaign\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"6. Progress Checkpoint: Test Campaign Using the Competitions Menu\"\n}\n[/block]\n**Complete Kit Instructions** - Where you added your license code (see Installation license code section) is where you can change the URL for your files. By default, the City Building Kit PvP scripts include a set for campaign already. Just change the URLs for both Files Address and Match Address variable to the campaign copies.\n\n**Pro Kit Instructions** - Edit **SaveLoadBattle.cs** and replace the server script links with your campaign server script links.) Run the Game.unity scene, build a few units, and then open competitions and start a battle. One of your campaign villages should load. If you're happy, you can stop here. Otherwise continue on for a few more customizations.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/hSfz2Cc6R3izALSuN6bB\",\n        \"test-competitions.jpg\",\n        \"800\",\n        \"600\",\n        \"#7dac29\",\n        \"\"\n      ],\n      \"caption\": \"Open the competitions menu after you've edited SaveLoadBattle.cs\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"6. Remove Randomization in the Server Software\"\n}\n[/block]\nWe can remove the random map delivery and force one particular map. In the server software demo, edit the **get_random_map** section where it loads the random filename, and force it to load one particular map. (See the reference notes inside the server software script)\n\nAgain, test competitions in the game and you should now get the same campaign village every time you load and retreat. There are a few different choices you can go from now, see Further Development for your next options.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Further Development\"\n}\n[/block]\nThe above walkthrough shows how easy it is to make a proof-of-concept single player campaign by using a secondary copy of the server software to deliver maps in a sequential order to the user.\n\nTo mimic gameplay like Clash of Clans, you'll need to design a new menu in the UI and script a new setting in SaveLoadMap.cs to track the last campaign they've completed. \n\nHowever what Clash of Clans did is just one of **5 different single player campaigns methods** you can create easily with the server software demo and the City-Building Strategy Kit. These five options include:\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Random Village\",\n    \"1-0\": \"Daily Challenge\",\n    \"2-0\": \"Level Village\",\n    \"3-0\": \"Top Player Village\",\n    \"3-1\": \"Instead of delivering maps you designed, feature your top players. Upload like the daily challenge.\",\n    \"2-1\": \"Increasing difficulty, depending on whether the user can defeat the previous level.\",\n    \"4-0\": \"Sandbox Village\",\n    \"4-1\": \"Use the single-player campaign as a sandbox to let users try out troops on a sample map.\",\n    \"1-1\": \"Let players challenge the Map-of-the-day from 31 that you choose.\",\n    \"0-1\": \"Let the player battle a random map each time. No changes necessary to the server software.\",\n    \"h-0\": \"Types\",\n    \"h-1\": \"Description\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]","excerpt":"Instructions to develop your own mobile strategy campaign proof-of-concept.","slug":"pve-single-player-campaign","type":"basic","title":"PvE - Single Player Campaign"}

PvE - Single Player Campaign

Instructions to develop your own mobile strategy campaign proof-of-concept.

[block:callout] { "type": "success", "body": "To create a single player campaign, you'll need the Complete Kit which is [available here](https://www.citybuildingkit.com/#pricing)", "title": "Campaign Requires the Complete Kit" } [/block] Popular mobile games like Clash of Clans or Castle Clash include a single-player campaign which involves stealing resources from goblin villages or dungeons. This gameplay follows the PvP format, but instead of loading player villages, premade campaign villages are loaded from the game server. The following instructions will walk you through creating a proof-of-concept for single-player campaign. [block:api-header] { "type": "basic", "title": "1. Design the Maps" } [/block] To setup a proof-of-concept for campaign, first, prepare a series of campaign villages for user's to battle. To do this, open the game on your device or in Unity and build each village. [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/NW1nnwBBTIylzYUgBxfE", "design-map.jpg", "800", "600", "", "" ], "caption": "Design the campaign villages" } ] } [/block] [block:api-header] { "type": "basic", "title": "2. Upload to Your Server" } [/block] [block:callout] { "type": "warning", "title": "Setup the Server Software First", "body": "Follow the server software documentation first to update the save scripts in the kit to save to your own server. Otherwise your map will be saved on our demo server." } [/block] When you have completed your campaign village for players to battle, save your village locally by pressing Local Save in Settings, then press Server Save. When the in-game operations console says your upload is complete, write down the filename it saved and proceed to the next step. [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/dgJNbgTHTa29rS3nReFf", "server-save.jpg", "800", "600", "#354e65", "" ], "caption": "Save each village on the Server" } ] } [/block] [block:api-header] { "type": "basic", "title": "3. Save Your Village Data" } [/block] Go to your server and check for the map filename in your maps directory with the demo software script. If you use the demo administration page included with the server software, it's easy to refresh the page and see which is the new map. Right click and save this map file. [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/1wft3FKaQ9aFMPLIantD", "save-server-text.jpg", "800", "600", "#4d3122", "" ], "caption": "Download the campaign map source" } ] } [/block] [block:api-header] { "type": "basic", "title": "4. Repeat Steps 1-3 Until You Finish All Campaign Maps" } [/block] Now that you've saved your map file, put it in a safe place and press the exit button in settings to close the app permanently. Repeat the steps above to create all the single-player campaign maps you want. When you're done, move on to step 5. [block:api-header] { "type": "basic", "title": "Reference: Map File Example" } [/block] Here's an example of our sandbox village map included in the game demo. [block:code] { "codes": [ { "code": "###StartofFile###\n###Buildings###\nAcademy,7,1536,633.5\nBarrel,5,2304,181\nBarrel,6,128,452.5\nBarrel,20,1792,-181\nChessboard,8,640,1357.5\nClassroom,10,-384,995.5\nClassroom,9,-384,90.5\nForge,0,-512,-543\nForge,17,-1536,-543\nForge,18,-1024,-905\nForge,23,-1024,-181\nGenerator,1,896,-1176.5\nGenerator,2,1408,-814.5\nGenerator,4,896,-452.5\nGenerator,19,384,-814.5\nGlobe,11,-384,1719.5\nSummon,13,-1408,995.5\nSummon,22,-384,-1719.5\nToolhouse,12,-1536,90.5\nVault,3,128,-1357.5\nVault,16,-2304,-362\nWorkshop,14,-1920,633.5\nWorkshop,15,-2560,181\n###Grass###\n3,0,-512,-543\n3,1,896,-1176.5\n3,2,1408,-814.5\n3,3,128,-1357.5\n3,4,896,-452.5\n3,5,2304,181\n3,6,128,452.5\n4,7,1536,633.5\n3,8,640,1357.5\n3,9,-384,90.5\n3,10,-384,995.5\n3,11,-384,1719.5\n2,12,-1536,90.5\n3,13,-1408,995.5\n3,14,-1920,633.5\n3,15,-2560,181\n3,16,-2304,-362\n3,17,-1536,-543\n3,18,-1024,-905\n3,19,384,-814.5\n3,20,1792,-181\n3,21,-896,633.5\n3,22,-384,-1719.5\n3,23,-1024,-181\n###Construction###\nClassroom,21,2,0,0,-896,633.5\n###BuildingIndex###\n23\n0.00,0\n0,0,0,0,0,0,0,0,0,0,0,0\n0,0,0,0,0,0,0,0,0,0,0,0\n0,0,0,0,0,0,0,0,0,0,0,0\n###Stats###\n4060,7,1,19147.1,21416.02,34,64504,48421,70,0.2,0.2,True,True,True,True\n03/20/2015 18:11:56\n###EndofFile###", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "5. Upload a Copy of the Server Software" } [/block] Once you have your collected all the village maps you want to include in your single player campaign, put them in a folder called "maps" and then upload a separate copy of the demo server software to your server, for example www.yoursite.com/campaign [block:api-header] { "type": "basic", "title": "6. Progress Checkpoint: Test Campaign Using the Competitions Menu" } [/block] **Complete Kit Instructions** - Where you added your license code (see Installation license code section) is where you can change the URL for your files. By default, the City Building Kit PvP scripts include a set for campaign already. Just change the URLs for both Files Address and Match Address variable to the campaign copies. **Pro Kit Instructions** - Edit **SaveLoadBattle.cs** and replace the server script links with your campaign server script links.) Run the Game.unity scene, build a few units, and then open competitions and start a battle. One of your campaign villages should load. If you're happy, you can stop here. Otherwise continue on for a few more customizations. [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/hSfz2Cc6R3izALSuN6bB", "test-competitions.jpg", "800", "600", "#7dac29", "" ], "caption": "Open the competitions menu after you've edited SaveLoadBattle.cs" } ] } [/block] [block:api-header] { "type": "basic", "title": "6. Remove Randomization in the Server Software" } [/block] We can remove the random map delivery and force one particular map. In the server software demo, edit the **get_random_map** section where it loads the random filename, and force it to load one particular map. (See the reference notes inside the server software script) Again, test competitions in the game and you should now get the same campaign village every time you load and retreat. There are a few different choices you can go from now, see Further Development for your next options. [block:api-header] { "type": "basic", "title": "Further Development" } [/block] The above walkthrough shows how easy it is to make a proof-of-concept single player campaign by using a secondary copy of the server software to deliver maps in a sequential order to the user. To mimic gameplay like Clash of Clans, you'll need to design a new menu in the UI and script a new setting in SaveLoadMap.cs to track the last campaign they've completed. However what Clash of Clans did is just one of **5 different single player campaigns methods** you can create easily with the server software demo and the City-Building Strategy Kit. These five options include: [block:parameters] { "data": { "0-0": "Random Village", "1-0": "Daily Challenge", "2-0": "Level Village", "3-0": "Top Player Village", "3-1": "Instead of delivering maps you designed, feature your top players. Upload like the daily challenge.", "2-1": "Increasing difficulty, depending on whether the user can defeat the previous level.", "4-0": "Sandbox Village", "4-1": "Use the single-player campaign as a sandbox to let users try out troops on a sample map.", "1-1": "Let players challenge the Map-of-the-day from 31 that you choose.", "0-1": "Let the player battle a random map each time. No changes necessary to the server software.", "h-0": "Types", "h-1": "Description" }, "cols": 2, "rows": 5 } [/block]