Implementation Dynamic Cities

Cpt. Crispy Crunchy

Member
Contributor
Name: Dynamic Cities
Summary: This module will introduce settlement which will grow over time. An underlying population simulation will be used to calculated the number of buildings per type needed. It will serve as a foundation for a market with which players can interact and influence city development.

For concrete building instantiation the method from https://github.com/Terasology/Cities is used at the moment. However I already made some preparations to implement https://github.com/Terasology/StructureTemplates later on, so that both methods can be used in conjunction. So if you're the builder type you could already prepare some cool looking building templates as I'll need some production buildings to get the economy visualized. Most needed would be some farm / food production buildings. Alternatively I would appreciate some building generation a la Cities module aswell if you like to rather code than build :D.
Curator: Cpt. Crispy Crunchy
Location: https://github.com/Terasology/DynamicCities

Todo list:
  • Implement districts based on K-Means
  • Remove trees safely from building spots
  • Place buildings based on a simple growth algorithm.
  • Implement structured templates
  • Add resource and production buildings
  • Base growth rate additionally on available resources
  • Add roads inner and outer city roads
Features:
-City placement based on actual resources and surface attributes: Currently it looks for a low standard deviation of height and a lot of grass, but this is easily extensible.
-Some test buildings spawned



There isn't too much to see yet, as there were tons of technical stuff which had to be taken care of at first. However some of it could also be useful for other projects:
  • region entity tiles: Save stuff from facets which would be destroyed otherwise
  • region loading grid: Stores information about the loading state of region entities. It is also used for cleanup of no longer used region entities.
  • Spawn the buildings from Cities with the worldprovider. Priorly it was spawned through facets and rasterizers at worldgeneration.
  • Flatten the surface in the rectangular shape (which uses sampling of terrain height)
 
Last edited:

Cpt. Crispy Crunchy

Member
Contributor
Major update v. 0.2.0:

A lot has changed since the last month and I hope to give a more or less complete changelist here.

New features:

  • Structured Template support: buildings can be instantiated using a structured template.
  • Building types are .prefabs now: Their attributes (min/max size, zone (which type the building, e.g. residential), generators (structured template names or cities generators or even both at the same time!)
  • Cross-module spawn module support: A building spawned with templates can have additional generators (e.g. for fences) and vice-versa.
  • Districts: Randomly generated areas within a city which restrict building to a certain set of zones for that district type. They even scale with the needs for zones defined by the city culture! District types are defined as a prefab.
  • Minimap support: New buildings will update the minimap but most of all the districts are visualized as a transparent layer on top of the original map.
  • Cultures: Every city gets a culture now. Cultures are defined as prefabs and have a certain set of available buildings and needs for those.
  • Population simulation: Buildings are spawned based on the current size of the population and the need for the respective building type defined in the culture.
  • Added a player tracker to prevent buildings from being spawned while a player occupies the place
Additionally, there were a lot of bug fixes which increased stability of the overall system. Also unloading/loading works for currently relevant features now.

Next up, the market system will be implemented. This has gotten a lot easier now as buildings are based on prefabs and can therefore be easily modified to get additional production / resource requirements etc.

If you have any question on how something works, feel free to ask :).
I'll try to set up a wiki in time to provide an easy start creating your own cities.

As this system is very generic and could be used for a lot of possible gameplay types I'm always open to hear your ideas on how this could develop! :)

Ah and thanks @Skaldarnar for this screenie:

 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
It all sounds awesome! MORE! :D

A really nice tutorial to go with it would be great, akin to the TutorialWorldGeneration, describing each feature in a small chapter with good examples :)
 

Cpt. Crispy Crunchy

Member
Contributor
Thanks! :). Yep I'll try to reserve some time for that @Cervator, as last week of GSOC should be used for documenting the work while evaluations happen. So I guess that would be a good time frame to set up some tutorials for DynamicCities and the newly created Economy module :)
 
Top