Giter Club home page Giter Club logo

cities's Introduction

Cities

A module that creates roads, settlements, etc. procedurally from random numbers.

image1

This module contains a world generator City Worlds that creates grassland terrain based on random noise. This terrain is populated with randomly generated settlements of different sizes.

Setup

To see what it looks like, just add the module to your Terasology installation using

gradlew fetchModuleCities

When the game starts, create a new world using the City Worlds generator and ... explore !

Overview

The world is partitioned into square-shaped Sectors. For every sector, up to three suitable locations for settlements are determined. Long-distance roads are added to connect them in a pair-wise manner. Then, lots (and smaller streets) are created around the center. Finally, buildings and city furniture are generated.

Basically, every part of this module can be separated into three distinct parts:

  • A world entity definition, such as RomanesqueChurch, that contains all information on a particual model (size, height, windows, roof type, and so on). This is basically a POJO.

  • A generator that creates different instances of RomanesqueChurch based on random numbers.

  • A rasterizer that converts RomanesqueChurch instances into blocks. This is often a composite of several other rasterizers and a 3D brush.

Contributing

Actually, this is the fun part and it's really easy to do. Just create your own triple of entitiy definition, entity generation and entity rasterization to add a new element to the world.

image2

Debugging

There is a terrain generator BoundaryGenerator that creates a grid along sector and chunks borders (using magenta and black blocks).

You can also use the main method in this class to view the generated world in a 2D top-down perspective:

org.terasology.testing.SwingTest

Acknowledgements

We would like to thank D. Gilbert of Object Refinery Limited and Armin Joachimsmeyer for their friendly support.

Literature Overview

  • Introduction to Shape and Shape GrammerShape[Stiny 75/78/80] Mathematical foundation on how to use rules to replace a shape with another

  • Introduction to Urban Simulation[WaddellUlfarsson] tbd

  • Procedural 3D Modeling of Cityscape[Middelhoff05]: Three distinct simulation types: L-Systems, agent-based and stochastic.

  • Grammar-based L-Systems with extensions (ParishMüller01) L-Systems with self-intersection detection

  • Interactive Geometric Simulation of 4D Cities[Weber+08] Based on [ParishMüller01], but more sophisticated.

  • Modeling the Appearance and Behaviour of Urban Spaces[Vanegas+09] Nice survey on Roads, Buildings, Land Use and Rendering.

  • Procedural Modeling of Land Use In Cities[Lechner+05] Uses 2D agent-based simulation with SimCity3000 vis.

  • Konzeption & Realisierung eines prozeduralen Ansatzes zur Erzeugung von Gebäuden (Janusch, 2007) tbd

License

This module is licensed under the Apache 2.0 License.

cities's People

Contributors

msteiger avatar cervator avatar josharias avatar gooeyhub avatar flo avatar shartte avatar skaldarnar avatar

Watchers

James Cloos avatar  avatar Milan Ender avatar

cities's Issues

District-Based City Generation

Determine district count per size and per type
Port K-Means method to determine districts
Create a district type assigning chain to assure to stay in range of determined district type count
Reassign the type to parcels based on district
Define the city boundary as the farthest parcel away from the center.

Commercial District Generation

Determine commercial building count based on resource availability and cultural preference.

When a district is commercial, assign type based on a probability which is modified by the already built commercial buildings of that type and the maximal need of that.
->Chain the parcels together and calculate one after one to assure to stay within the building count needs.

Region Tiles

Separate each region into smaller tiles and count resources and flatness to have an easy time assigning settlement spots and resource building spots.

Society & Population

Implement a society class which will keep track of the population for each city and change it according
to resource availability and growth models.

Attributes:
-Population Count
-Resources
-Health

Add a culture class which determines specific needs for buildings etc.

Attributes:
-residence space per person
-commercial/production space per person
-government/military space per person
-special space per person (religious, cultural, parks, plazas etc.)
-maximum and minimum size for commercial and residential buildings
-resource needs per person per resource
-city walls: at which population size will walls be built
-productivity for each resource: modifies how much resources per resourcebuildingspace will be processed

Make use of Prefab System for cultures!

Add a CultureManager which registers cultures from the asset folder.

Add the possibility to add plugins to the population growth. ->Total population growth would then be the sum of std. growth and all plugins

Procedural Quest Generation

Use templates to define quests with sector specific features.
E.g. search for a Creature in the forest with the name XXX.
Then spawn the creature in this forest.

Spawn some random NPCs in cities or at resource buildings as questgiver.

Modules to use:

-Tasks
-Dialogs

Market Creation

Add a currency.
Add a value for each product and resource based on availability and need for each settlement.
Add a GUI and enable player interaction.

Cross-module support for StructuredTemplates X Cities

It now possible to add templates and generators from cities to the same building prefab!
A possible use-case would be to creating a fence through generators around a template building which will automatically encompass the whole parcel.

Extend Sector-Usage

Use the Contour-Tracer and namegenerator to extract certain terrain features and name them. Such as forests, lakes and mountains.
Store them in a Sector Entity to keep track on everything in a certain region. Also add the settlement entity to the encompassing sector.

This needs some further discussion.

Outer-City Road Generation

For city connections, the already implemented system can be used but may has to be modified slightly for the entity-based settlement generation process.

Resource buildings in the outskirts can be connected to those roads by the already defined methods.

Update Building Spot Availability

Currently only the corners of a parcel is checked for obstruction (whether or not it is above sea-level).
->Additionally, check the corners for their height distribution and call it obstructed when a certain variance threshold is reached.

Added a roughness facet which stores the std. deviation of the surface height per cell.

Resource Building Generation

Create an agent and rule interface.
Rules:
Those will tell agents which data is relevant, e.g.: Look for flatness value or tree count in a certain region tile, search-radius,city-distance and so on. They should be separated into conditions and values.
Agents:
First the agent looks at a tile and checks if all conditions are satisfied and then assign a value based on the value-rules.
Afterwards the agent searches for the maximal/minimum value tile which then will be our building spot.

Inner-City Road Generation

Add small roads between the buildings to get a believable road network.
Add for each parcel network nodes at its corners and one or more door nodes.

Then district nodes will be calculated by building density to ensure that bigger buildings will have a higher chance of being near a district road.
A weighted middle node will be calculated between the center of the district and the center of density.
Assign it to the nearest building node.
Connect district nodes along by following the buildingnodes.
Finally, connect front doors to the district roads.

Entity-Based Settlements

Instead of using the entity system only for citynames as it is the status quo, use it to control the development of the city:
Store references to buildings, roads, population and everything else relevant here.
Receive relevant events which can affect city development.
Order changes in certain time intervals from here:

  • Population change
  • Resource change
  • Building development
  • ...

Upon creation, build initial buildings from here.
-> Modify Worldgenerator to spawn only the settlement-entity and its initial population/society

District overlay for Minimap module

@CptCrispyCrunchy commented on Thu Jul 21 2016

An overlay was created to visualize the different district types on the minimap. It is a transparent layer on top of the standard view.
The district color is defined in the district-type prefab.

There was a bug where this information was lost after unloading/loading but this is already resolved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.