Extra Builder Houses

👍

Reminder - Keep Daily Backups

When working on a strategy game with a kit as big as the Complete Kit - always keep a working daily backup! Save yourself the trouble of rolling-back changes and losing work.

What are builders?

Free-to-play city building games usually use time-delay construction. Each project under construction consumes one "builder". In the City Building Kit we call these dobbits. When you're finish with the construction the dobbit is returned to your Stats for use on another construction project.

Every player starts with one builder. You can edit this easily in the Game Manager > Stats Inspector.

The following is a screenshot example of one of the construction projects - you'll recognize a lot of the elements used in usual free to play strategy games (the timer, progress bar, animation builder character, and the button to accelerate the build construction for one crystal gem. (This value increases based on the time remaining - for more details about this, read the In

570

Builder construction project. Click to view larger.

By limiting the number of concurrent building projects the player can construct at once - you enable a revenue model by selling In-App Purchases for extra builders, allowing players to construct their city faster than free players.

That's what builders are - a form of currency that is reusable and incentivizes players to spend real money in your game to progress faster. See the below screenshot for where their available builders is equal to 0 because of the one construction project in progress in the image.

900

One construction project. Click to view larger.

Until the construction clock shown above the project finishes, the player will not be able to create any new construction projects unless they purchase a second builder. The clock appears above any construction project like seen in the image below.

900

Construction clock remaining time. Click to view larger.

Alternatively, other than purchasing a second builder you can press the Finish now crystal gem button next to every construction project to pay the cost in crystal gems and complete the project instantly returning your builder immediately so you can make something else.

900

Gem finish now button. Click to view larger.

As these rare crystal gems are not free, players have to spend real money to get them. For more details about crystal gems and other In-App Purchases, please see the Shop Menu > In-App Purchase documentation page.

What are builder houses?

Builder houses are just like any normal building except they carry a special quality of adding one additional builder to your HUD.

851

Builder house. Click to view larger.

As you can see in the above screenshot, we've built one builder house. So the total builders we can use in our game is now two, as you see in the HUD excerpt in the following screenshot.

851

Builder HUD. Click to view larger.

Where can players purchase builder houses?

In the resources section of the store, we've put the Dobbit Toolhouse example with a rare currency price of 25 gems. Each one of these toolhouses grants the player another builder (code references below)

743

Dobbit toolhouse in the store. Click to view larger.

Where to find the builder house in the store menu in Unity?

Open the game scene hierarchy and locate the ScrollView in Canvas > ModalsWindows > ShopWindows > ShopGroup > StorePanel > BottomGroup > Content > Content. Look at the below screenshot.

403

UIAnchor element. Click to view larger.

Where are the prefabs?

All of the game object prefabs are set in the ScriptableObjects at the path Assets/CityBuildingKit/Resources/Assets/
For example take a look at the BuildingCategory.asset file below :

625

Game scene Game Manager > SaveLoadMap

In addition, you will want to look at GameManager > Creators > BuildingCreator (dobbit toolhouse prefab is also there) This is discussed in the Buildings > Part 2: Customize Menus section of the documentation. Prefabs are used by the creator for construction.

GameManager > Creators > BuildingCreator

In the GameManager > Creators > BuildingCreator we have the list of game object prefabs used by the creator in addition to certain build settings used by the Scripts/Creators/BaseCreator.cs script. Let's describe these below. But first, here's how to open the BuildingCreator Inspector

273

Game scene Game Manager

365

Builder hut structure prefab in the BuildingCreator

In the Inspector you'll notice a few arrays, here's a description of each one. It's the same for every type of game object you can build in the game except for the RemovableCreator (removables are not for players to construct but rather remove -- see Player Removable Objects doc for details)

Array TitleDescription
Structure PfThe structure prefab.
Grass Pf1x1 to 5x5 dark green grass collider grid prefabs list. These you don't have to edit, they are shared by all structures in the game based on their grid size.
Construction PfUnder construction prefab list. There's 3 different sizes of this for 1x1 to 3x3 grid size construction projects.
Grass TypesSize of this array matches the the Structure Pf array size. We tell which Grass Pf element to use with each structure. Depends on structure size whether they take 1x1 (Grass Pf element 0) like a wall segment or 3x3 (Grass Pf element 2) like the large gold vault. Tatami is the only object that takes grass collider 5x5 ( Grass Pf Element 4).
Construction TypesArray size matches Structure Pf. Like grass types, we match the construction prefab grid size too. Since there's 3 different sizes of construction prefabs, this ranges from values 0 to 2. By default, we set most structures to use the 3x size.
Pivot CorrectionsArray size matches Structure Pf. Odd size grid structures (1x1 and 3x3) need a pivot correction so they don't appear accidentally off-center, taking more grid space than necessary. Pivot Correction does this.
Is ArrayArray size matches Structure Pf. If set to 1, uses the row making field builder for construction instead of the usual construction. The only objects that use this are the wall segments that let you pick a start and end point and automatically constructs a repeating row of the structure between the points.
Is InstantArray size matches Structure Pf. For items you set TimeToBuild to 0 (instant build) in the SO, you also want to set the elements Is Instant boolean to 1 in this array. The only objects that use this in the demo are the wall segments.

SO item Example of a Builder House (Dobbit Toolhouse)

Here's an example of the builder toolhouse element from Assets/CityBuildingKit/Resources/Assets/BuildingsCategory.asset used by the centralized creator script Scripts/Creators/BaseCreator.cs

625

How does the toolhouse add an extra builder?

The SO doesn't show you any signs of how this adds extra builders because it's in the Scripts/Creators/ConstructionSelector.cs ProgressBarUpdate() function. This section runs when the building has completed construction, and depending on the structureType variable, it assigns special qualities to the player stats.

if(structureType=="Toolhouse")										
{
  // Adds one extra builder to the player's stats
	((Stats)stats).dobbits += 1;
 
}
else if(structureType=="Tatami")									
{	
  //increases total unit housing storage in Stats	
	((Stats)stats).maxHousing += storageAdd;
}
else if(structureType=="Forge")
{ //assigns notification above for harvesting resources
	isProductionBuilding = true;			
}
else if(structureType=="Generator")
{	//assigns notification above for harvesting resources
	isProductionBuilding = true;							
}

else if(structureType=="Barrel")									
{	//increases total storage in Stats																	
	((Stats)stats).maxMana += storageAdd;
}
else if(structureType=="Vault")
{	//increases total storage in Stats																	
	((Stats)stats).maxGold += storageAdd;
}

For example, Toolhouse assign one extra builder (called dobbits) to the stats like this:

((Stats)stats).dobbits += 1;

That's really all you need to do. When you save your game the next time, the Scripts/Save/SaveLoadMap.cs script will automatically save all stats variables, which includes the dobbit to the Player file carrying this purchase forward for the next time the game is loaded.

Can I remove builders or offer extra time limited builders?

If you would like to remove the builder, for example sell time limited builders - then you'll want to do the reverse and subtract one dobbit when your timer function expires like this:

((Stats)stats).dobbits -= 1;