Troubleshooting Server Issues

Having problems downloading player maps in battle?

The kit is already setup to use our demo server scripts for Server Save, Server Load, Battles, and Campaign features, but you need a license code to activate these features. Otherwise, you will see the download file corrupted message below that says "License code not added to the Gamemanager or downloaded file corrupted."

286

Click on image to view larger. See this error message when trying the battle feature? Follow the instructions below to add your license code.

Use your license code when testing with the City Building Kit demo server

📘

Did you purchase through the Unity Asset Store?

Contact us today at help at citybuildingkit.com to retreieve your City Building Kit license code for your purchase.

  1. Are you using an unedited copy of the City Building Kit when testing with our demo servers? Server Save, Server Load, Battles, and Campaign only work with our demo servers before your game changes.

This is because the demo servers return default demo campaign, enemy player, and player village save files using the original prefab and game settings. If you change any of the game elements with your own prefab or XML data, the demo server will return save files that differ from your game settings which will cause a crash. We recommend you download the

  1. You must enter your license code into the City Building Kit Game scene SaveLoadWWW and Map01 scene SaveLoadBattle inspectors.

Steps, for fixing Server Save / Server Load:

  1. Open Game.unity scene
  2. In Game Manager, select SaveLoadWWW
  3. Type your License Code on the right side Inspector and save. (See screenshot below)
981

Click on image to view larger. Add the license code to Game > GameManager > SaveLoadWWW

Steps For Fixing PvP Battles and Campaign Download Errors:

  1. Open Map01.scene
  2. In Game Manager, select SaveLoadBattle
  3. Type your License Code on the right side Inspector and save. (See screenshot below)

Now you should be able to run the scene again and download a sample map successfully from the preconfigured CityBuildingKit.com server.

979

Click on image to view larger. Add the license code to Map01 > Game Manager > SaveLoadBattle

Testing with your own website

By default, the CityBuildingKit.com demo server will return 1 of 3 sample enemy player maps. If you experiment with Server Load, it will download the same pre-designed base every time for testing. These are configured with the kit's default buildings.

If you begin making changes to your game such as new buildings or units, use the server scripts on your own domain or else crashes could occur when the demo server provides default kit enemy player map data.

Login to the Download Center at CityBuildingKit.com to to get a copy of the easy-to-install Online Server Sync scripts for your own website. Then repeat the instructions above for the License Code but change the http://citybuildingkit.com Server Address seen in the screenshots above to where you uploaded the Server scripts like http://yoursite.com/pvp/

📘

What type of server do I need?

The scripts are designed in PHP. For development you can use something as simple as a normal web host or VPS. This would work fine even for a simple game launch.

For large production games hosting over 100,000 player data files, we recommend switching from your development VPS to hosting the scripts and player data using a combination of Amazon S3 for low-cost storage, CloudFront for fast worldwide delivery, and EC2 instances for the PHP scripting. No database is necessary unless you wish to update the server scripts.

Download corrupt error troubleshooting

By default, newly installed server scripts and a fresh copy of the City Building Kit will not come with any problems. But if you do encounter any download corrupt errors when testing on your own website server scripts we've identified two possible causes.

You want to debug both the Player save files that are returned from the server and the following two scripts in the Scripts/Save folder:

ScriptTroubleshooting
SaveLoadWWW.csTroubleshoot for download corrupt errors when doing server load for player bases
SaveLoadBattle.csTroubleshoot for download corrupt battle errors

Download corrupt errors caused by player data returned

For Player data corrupt errors, When testing on your server, make sure no extra line returns are added by your server. We've noticed during development testing that player save files can be incorrectly returned with extra line returns like this example:

###StartofFile###

###PosStruct###

Weapon,ArcherTower,136,2,-128,-724

Weapon,ArcherTower,137,2,1024,90.5

Building,Vault,138,3,-1024,0

Building,Vault,139,3,0,724

Building,Summon,140,3,0,0

###GridStruct###

WoodFence,WoodFenceNE,93,22,16

WoodFence,WoodFenceNE,94,22,17

WoodFence,WoodFenceNE,95,22,18

WoodFence,WoodFenceNE,96,22,19

WoodFence,WoodFenceNE,97,22,20

WoodFence,WoodFenceNE,98,22,21

WoodFence,WoodFenceNE,99,22,22

WoodFence,WoodFenceNE,100,22,23

WoodFence,WoodFenceNE,101,22,15

WoodFence,WoodFenceNE,102,22,14

###Construction###

###Removables###

TreeC,0,0,2,10

TreeC,1,0,2,13

TreeD,2,0,2,26

TreeC,3,0,4,12

ClamC,4,0,4,13

###RemovableTimers###

###Numerics###

140,135,137

0.00,0

0,0,0,0,0,0,0,0,0,0

0,0,0,0,0,0,0,0,0,0

0,0,0,0,0,0,0,0,0,0

###Stats###

140,683,1,0,0,100,93700,96700,2,505000,500000,5,True,True,True,True,True

11/10/2016 9:47:10 PM

###EndofFile###

Or if you try editing the scripts to output the information in Google Chrome on new lines, returned player save files will end up looking like this example below.

###StartofFile###<br>
###PosStruct###<br>
Weapon,ArcherTower,136,2,-128,-724<br>
Weapon,ArcherTower,137,2,1024,90.5<br>
Building,Vault,138,3,-1024,0<br>
Building,Vault,139,3,0,724<br>
Building,Summon,140,3,0,0<br>
###GridStruct###<br>
WoodFence,WoodFenceNE,93,22,16<br>
WoodFence,WoodFenceNE,94,22,17<br>
WoodFence,WoodFenceNE,95,22,18<br>
WoodFence,WoodFenceNE,96,22,19<br>
WoodFence,WoodFenceNE,97,22,20<br>
WoodFence,WoodFenceNE,98,22,21<br>
WoodFence,WoodFenceNE,99,22,22<br>
WoodFence,WoodFenceNE,100,22,23<br>
WoodFence,WoodFenceNE,101,22,15<br>
WoodFence,WoodFenceNE,102,22,14<br>
###Construction###<br>
###Removables###<br>
TreeC,0,0,2,10<br>
TreeC,1,0,2,13<br>
TreeD,2,0,2,26<br>
TreeC,3,0,4,12<br>
ClamC,4,0,4,13<br>
###RemovableTimers###<br>
###Numerics###<br>
140,135,137<br>
0.00,0<br>
0,0,0,0,0,0,0,0,0,0<br>
0,0,0,0,0,0,0,0,0,0<br>
0,0,0,0,0,0,0,0,0,0<br>
###Stats###<br>
140,683,1,0,0,100,93700,96700,2,505000,500000,5,True,True,True,True,True<br>
11/10/2016 9:47:10 PM<br>
###EndofFile###<br>

A correct save file is returned by the server scripts we've designed to use neither extra line returns or HTML formatting. See this example:

###StartofFile###
###PosStruct###
Weapon,ArcherTower,136,2,-128,-724
Weapon,ArcherTower,137,2,1024,90.5
Building,Vault,138,3,-1024,0
Building,Vault,139,3,0,724
Building,Summon,140,3,0,0
###GridStruct###
WoodFence,WoodFenceNE,93,22,16
WoodFence,WoodFenceNE,94,22,17
WoodFence,WoodFenceNE,95,22,18
WoodFence,WoodFenceNE,96,22,19
WoodFence,WoodFenceNE,97,22,20
WoodFence,WoodFenceNE,98,22,21
WoodFence,WoodFenceNE,99,22,22
WoodFence,WoodFenceNE,100,22,23
WoodFence,WoodFenceNE,101,22,15
WoodFence,WoodFenceNE,102,22,14
###Construction###
###Removables###
TreeC,0,0,2,10
TreeC,1,0,2,13
TreeD,2,0,2,26
TreeC,3,0,4,12
ClamC,4,0,4,13
###RemovableTimers###
###Numerics###
140,135,137
0.00,0
0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
###Stats###
140,683,1,0,0,100,93700,96700,2,505000,500000,5,True,True,True,True,True
11/10/2016 9:47:10 PM
###EndofFile###