-
Notifications
You must be signed in to change notification settings - Fork 14
2. Create cultures, districts and buildings
Learn about the stuff that it takes to create proper prefabs for the city simulation. This guide refers mostly to the asset folder in the TutorialDynamicCities Module
This is the most important asset for a city, as it is the backbone of every settlement.
- buildingNeedPerZone: How much m^2 each population unit demands for a specific zone.
- growthRate: The amount of population unit the city gains with each population update. Can be set to zero if you want to use a custom model. Further reference: 3. Population and City Growth
- availableBuildings: Which buildings are available for this culture to spawn. It matches with the string specified in the building name field.
- residentialZones: This field tells the system what population capacity is available, though that is more of an experimental feature at the moment and thus is set very high in order to prevent interference with the normal city growth.
The example in the tutorial module shows what is needed to get a proper culture.prefab:
{
"Culture" : {
"name" : "develop clan",
"buildingNeedPerZone" : {"GOVERNMENTAL" : 1, "CLERICAL" : 1, "RESIDENTIAL" : 12, "COMMERCIAL" : 6},
"growthRate" : 500,
"availableBuildings" : ["Marketplace", "House", "SimpleChurch", "Testbuilding", "Townhall"],
"residentialZones" : ["RESIDENTIAL"]
}
}
They encompass a certain area in which only buildings of a white-listed zones are able to spawn.
- color: used for the minimap overlay to visualize where the district is.
- zones: Buildings can spawn in that district if they match one of the here specified zones.
The examples in the tutorial module give a sufficient idea on how they look:
{
"DistrictType" : {
"name" : "residential",
"color" : 435324,
"zones" : ["RESIDENTIAL"]
}
}
Buildings can be the most complex prefabs currently. They can contain a a list of templates and generators at the same time.
- name: The building's name. Multiple buildings can have the same name; Important for the building whitelist in the culture component.
- zone: The zone tells the system what type the building is and in what districts it fits. This also matches with the
buildingNeedPerZone
field in the culture and thus determines the demand for this building. - templateNames: The path in which to find the building template. Multiple templates can be assigned to one building.
- generatorNames: The names of the generators which should be used for this building. Link to generator registry.
- minSize / maxSize: Stating the (x, z) length range of a valid parcel for this building (in north-south orientation).
- isEntity: This will enable the system to send an event on it's spawn when set to true, hence you can retrieve all additional components.
In the tutorial module a MarketSubscriberComponent
is added, which gets linked to the settlement inventory upon catching the spawn-event.
{
"GenericBuilding" : {
"name" : "blacksmith",
"templateNames" : ["TutorialDynamicCity:smithyTemplate"],
"zone" : "COMMERCIAL",
"minSize" : [14, 14],
"maxSize" : [17, 17],
"isEntity" : true
},
"MarketSubscriber" : {
"production" : {"StructuralResources:Barrel" : 2},
"productionInterval" : 500,
"consumption" : {"Core:plank" : 16},
"consumptionInterval" : 500
}
}
To keep things simple, zones are not really created as an individual prefab or class. Instead they work exclusively per string matching. They should be case insensitive. The intention of zones is to have a classification system for buildings, like defining a residential or commercial building.