GithubHelp home page GithubHelp logo

dynamiccities's Introduction

Dynamic City Generation

Introduces growing cities with distingushiable districts and a population simulation. It supports building generators from cities module and structured template. For a full feature list and a modder guide see the wiki. This techdemo provides a quick overview and some time lapse videos covering the growth cycle of cities.

sc1 sc2

This module originates from the GSOC 2016 Project Citysimulation by CptCrispyCrunchy with Skaldarnar and msteiger as mentors.

Images

The building icon image was taken from http://www.iconsmind.com (Linkware License)

dynamiccities's People

Contributors

4denthusiast avatar adrijaned avatar andytechguy avatar cervator avatar cptcrispycrunchy avatar darkweird avatar e-aakash avatar eviltak avatar f14v10 avatar iaronaraujo avatar jdrueckert avatar kaen avatar keturn avatar mayant15 avatar naalit avatar naman-sopho avatar pollend avatar qwertygiy avatar skaldarnar avatar spookynutz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dynamiccities's Issues

City Names Invisible on Game Reload

Over every city generated in DynamicCities, there is a blue hovering name tag that lists the town name. This name tag is visible to any player that is in the game when the city is first generated. However if a player joins after the city is generated (or a player reloads the game), this name tag is not visible. Here is a visual comparison with a player that joined before the city was generated, and a player that joined after the city was generated:

image image

These images were taken from the same position, where both players were clients on a multiplayer server.

Trees mess around with the height of buildings

As buildings are placed on a rectangle which is flattened to the mean height of the terrain, trees can significantly alter this mean height. Thus they have to be safely removed (without leaves floating in the air). The best way is to safe the information of the tree generator (seed and such) in the region entities and then fill it up with air. -> thanks to @msteiger for this idea

StructureTemplate placement still off at times

This probably came in via ST changes made during GSOC 2018 but I'm not sure. Some of those changes were salvaged from old PRs, so the possibility for bugs was higher than usual. At first seemingly all STs failed to translate their world coordinates right and ended up squashed together around 0,0,0. Later after @Naman-sopho found a fix for that (yay!) it still seems like they're not adjusting to the world surface very well:

terasology-180929111702-1152x720
terasology-180929111637-1152x720
terasology-180929111629-1152x720
terasology-180929111408-1152x720

Unsure if this is specific to placement in DC or a general issue with STs, but GooeysQuests seems to manage to place its ST segments lined up decently still.

Troubleshoot performance issues, improve monitoring

Starting recently I've noticed an occasional massive performance drop with DC active, both via MedievalCities and TutorialDynamicCities. Unsure if it came in during GSOC 2018 with some related ST changes or just has been hiding for a while.

It is hard to troubleshoot as I'm not sure yet how to reliably trigger it. Sometimes it'll happen before I even find the first village, other times I'll find one village and everything will be fine, then go off hunting another and suddenly the game will slow to a crawl. I fly around with ghost + hspeed

I suspect it might have something to do with scanning the world for suitable settlement sites, but I have no evidence for that. It just seems to trigger based on a number of chunks generated or from characteristics of specific chunks having generated.

To better troubleshoot, even if not resolving the issue, the goal here is to review likely spots for performance problem possibilities and better log/monitor to make finding them easier. When this slowdown occurs there is no unique monitoring category that spikes, when there really should be.

For an example see StateInGame which wraps several monitoring activities around various possible points that might take a while or become complicated in the future. Find similar spots in DC and add a unique new activity.

Example snippet:

        PerformanceMonitor.startActivity("Rendering NUI");
        nuiManager.render();
        PerformanceMonitor.endActivity();

Example target: The update method in SettlementEntityManager, specifically the two for loops. It may also make sense to move the first if block to within the throttling counter:

        if (counter != 0) {
            return;
        }
...
        counter = 250;

(The stuff represented here by ... is what I think we should try wrapping a monitor activity around)

I'm not sure if the stuff in the preceding if block really needs to happen before that counter check. Moving it past it would save that block from running 249 times out of 250 ticks.

Overhaul parcel - building generation

Rather than first spawning a parcel and then set a building on top of it, it would make much more sense to first get a building, get the dimensions (or in case of generators the range) and then try to spawn a parcel accordingly.
This will also allow to actually distinguish dimensions an thus min / max sizes would be min X min Y min Z, etc. .

NPE on attempting to place a parcel (with MedievalCities active?)

Catching back up on testing new modules. Enabled TutorialDynamicCities (and its dependencies) along with MedievalCities. After a few moments in-game I got the error below. Uncertain if it is from having the extras of the tutorial module active or the medieval buildings added.

Worth noting that I first tried without MC yet spawned somewhere without a city visible (not very flat). Second attempt with MC added crashed almost immediately, but not quite (10-20 seconds?). Third attempt still including MC worked fine, again didn't spawn me near a city (hilly again) but I flew around until I found one and it was looking fine. Maybe something related to the early phase of a city vs. the player having just spawned with a limited number of chunks available?

22:45:50.440 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:RedShroom with id 114
22:45:50.452 [main] INFO  o.t.e.systems.StorageHandlerLibrary - Registered new StorageComponentHandler org.terasology.economy.handler.InfiniteStorageHandler
22:45:50.467 [main] INFO  o.t.e.systems.StorageHandlerLibrary - Registered new StorageComponentHandler org.terasology.dynamicCities.economy.PopulationStorageHandler
22:45:50.482 [main] INFO  o.t.e.systems.StorageHandlerLibrary - Registered new StorageComponentHandler org.terasology.economy.handler.MultiInvStorageHandler
22:45:50.484 [main] INFO  o.t.d.population.CultureComponent - Obtaining culture prefabs...
22:45:50.498 [main] INFO  o.t.d.population.CultureComponent - Finished loading cultures: 2 culture types found: [develop clan, Medieval Society]
22:45:50.498 [main] INFO  o.t.d.districts.DistrictManager - Obtaining district prefabs...
22:45:50.498 [main] INFO  o.t.d.districts.DistrictManager - Finished loading districts: 6 district types found: [residential, City Center, commercial, city center, residential, commercial]
22:45:50.498 [main] INFO  o.t.d.buildings.BuildingManager - Loading building assets
22:45:50.499 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:smallHut
22:45:50.501 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:houseTemplate01 loaded successfully.
22:45:50.501 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:ShopTemplate01 loaded successfully.
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab TutorialDynamicCity:townHall
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:smallHouseTemplate02 loaded successfully.
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate TutorialDynamicCity:testTemplate loaded successfully.
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:stable
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:market
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:smallHouseTemplate03 loaded successfully.
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:smallShopTemplate01 loaded successfully.
22:45:50.502 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab TutorialDynamicCity:marketPlace
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:stableTemplate loaded successfully.
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:house02
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:house01
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:guardTowerTemplate02 loaded successfully.
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:smallHouse01
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab TutorialDynamicCity:residentialHouse
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:smallHouseTemplate01 loaded successfully.
22:45:50.503 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab TutorialDynamicCity:Blacksmith
22:45:50.504 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:smallHutTemplate01 loaded successfully.
22:45:50.504 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:guardTowerTemplate01 loaded successfully.
22:45:50.504 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab TutorialDynamicCity:simpleChurch
22:45:50.504 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:bigShop01
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:bigShopTemplate01 loaded successfully.
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:marketTemplate loaded successfully.
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:smallHouse03
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:houseTemplate02 loaded successfully.
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:shop01
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:smallShop01
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate TutorialDynamicCity:smithyTemplate loaded successfully.
22:45:50.505 [main] INFO  o.t.d.buildings.BuildingManager - Loaded building prefab MedievalCities:smallHouse02
22:45:50.506 [main] INFO  o.t.d.buildings.BuildingManager - StructuredTemplate MedievalCities:guardTowerTemplate03 loaded successfully.
22:45:50.506 [main] INFO  o.t.d.buildings.BuildingManager - Finished loading buildings. Number of building types: 16 | Strings found: [commercial, residential, clerical, governmental]
22:45:51.538 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:companion]
22:45:51.538 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:companion with id 115
22:45:51.541 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:brick:engine:stair]
22:45:51.542 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.LEFT with id 116
22:45:51.542 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.RIGHT with id 117
22:45:51.542 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.FRONT with id 118
22:45:51.542 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick:engine:stair.BACK with id 119
22:45:51.544 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:Tnt]
22:45:51.544 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:Tnt with id 120
22:45:51.547 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered BlockFamily[core:brick]
22:45:51.547 [main] INFO  o.t.w.b.internal.BlockManagerImpl - Registered Block core:brick with id 121
22:46:10.200 [main] INFO  o.t.logic.console.ConsoleImpl - [CONSOLE] Welcome to the wonderful world of Terasology!

Type 'help' to see a list with available commands or 'help <commandName>' for command details.
Text parameters do not need quotes, unless containing spaces. No commas between parameters.
You can use auto-completion by typing a partial command then hitting [tab] - examples:

gh + [tab] => 'ghost'
help gh + [tab] => 'help ghost' (can auto complete commands fed to help)
giv + [tab] => 'giveBlock giveItem givePermission' (use [tab] again to cycle between choices)
lS + [tab] => 'listShapes' (camel casing abbreviated commands)

22:46:10.709 [main] ERROR o.terasology.engine.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.NullPointerException: null
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.placeParcel(SettlementEntityManager.java:463)
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.growSettlement(SettlementEntityManager.java:404)
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.update(SettlementEntityManager.java:159)
    at org.terasology.engine.modes.StateIngame.update(StateIngame.java:176)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:413)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:368)
    at org.terasology.engine.Terasology.main(Terasology.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
22:46:10.709 [main] INFO  o.terasology.engine.TerasologyEngine - Shutting down Terasology...
22:46:10.810 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
22:46:10.813 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Snapshot created: Writing phase starts
22:46:10.813 [main] INFO  o.t.n.internal.NetworkSystemImpl - Client disconnected: Cervator
22:46:10.816 [main] INFO  o.t.logic.console.ConsoleImpl - [NOTIFICATION] Player "Cervator" has left the game
22:46:10.816 [main] INFO  o.t.n.internal.NetworkSystemImpl - Network shutdown
22:46:12.230 [Saving-0] INFO  o.t.p.internal.SaveTransaction - Save game finished
22:46:17.770 [main] WARN  o.t.rendering.nui.asset.UIFormat - Field 'emptyIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UIIconBar","id":"breathBar","icon":"engine:icons#bubble","family":"breathBar","emptyIcon":"engine:icons#burstBubble","halfIconMode":"shrink","spacing":2,"maxIcons":10,"layoutInfo":{"use-content-width":true,"use-content-height":true,"position-left":{"target":"CENTER"},"position-right":{"target":"RIGHT","widget":"healthBar"},"position-bottom":{"target":"TOP","widget":"healthBar","offset":1}}}
22:46:17.771 [main] WARN  o.t.rendering.nui.asset.UIFormat - Field 'crosshairIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UICrosshair","id":"crosshair","crosshairIcon":"engine:gui#crosshair","layoutInfo":{"use-content-width":true,"use-content-height":true,"position-horizontal-center":{},"position-vertical-center":{}}}
22:46:17.805 [main] WARN  o.t.rendering.nui.skin.UISkinFormat - Failed to resolve UIWidget class UIInputBindButton, skipping style information
java.lang.NullPointerException
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.placeParcel(SettlementEntityManager.java:463)
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.growSettlement(SettlementEntityManager.java:404)
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.update(SettlementEntityManager.java:159)
    at org.terasology.engine.modes.StateIngame.update(StateIngame.java:176)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:413)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:368)
    at org.terasology.engine.Terasology.main(Terasology.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
For more details, see the log files in J:\Dev\Terasology\Git\integrate\Terasology\logs\2016-09-08_22-41-30

Process finished with exit code 0

Fixes for new Terasology serialization system (engine PR 3535)

Merging MovingBlocks/Terasology#3456 causes this module to no longer compile

Current module users include TutorialDynamicCities and MedievalCities, both culture providers needed to be able to use DC.

Sending this @eviltak's way as the author of the engine PR and/or to @Naman-sopho as maybe interested from recent work here :-)

For previous reverted fixes (may be less relevant with later changes to the serialization system), see bce0354.

Template names in GenericBuildingComponent cannot handle module prefixes

The template names for structure templates cannot handle module prefixes it seems. However, it should be possible to reference templates from different module, e.g.,

{
  "GenericBuilding": {
    "name": "House",
    "templateNames": [ "houseTemplate", "moduleA:houseTemplate", "moduleB:houseTemplate" ],
    "zone": "RESIDENTIAL"
  }
}

Add structured template support

Create a building manager which will read prefabs of abstract building information and offer them to the construction class as plans. The strategy to use should also be in the spawning information as well as zone, size etc..

Intercity road placement improvements

There are two major issues with road placement at this point.

Building-Road Interactions

Currently, it is possible that a building will be spawned right on top of a road. There are two reasons for this. The first is that settlements seem to be expanding beyond the limits set in settlementMaxRadius. This means that the roads which should have been outside the city limits would eventually come inside.

The second problem is that the check for obstructions while placing buildings doesn't work for roads. The check is in SettlementEntityManager here and the main cause would most probably be in the isNotIntersecting function from ParcelList here.

Save Road Heights to RoadSegments

Each RoadSegment should have a height stored at which the segment will be laid down. This height should depend on the surface height in the world. Currently this height is a constant value set here. This leads to trouble with roads on mountains as roads create a chasm as they go through a mountain. Try looking at the flatten function in Construction to see if it helps to find surface heights.

Generate City Names

For static cities, a random name is generated using the NameGenerator. This should be done for dynamic cities as well. The theme to generate the names from should be specified in the culture component (use old english names as default).

Tree remover issues

In a dense forest, the removal of the trees can take a while -> game freezes for some seconds.
Threading of this process would help reducing freezing. However, care has to be taken when placing buildings then.

Additional worldprovider.isRegionRelevant(..) checks are needed for the top and side extensions of a tree as sometimes fragments don't get removed.

Inner-city road networks

This task is probably a bit harder than roads connecting cities. It is recommended to first solve that issue. I worked out a possible approach but there are probably a lot of ways to solve this task.

I orientated myself a bit on the method from Lechner et al., the paper “A Survey of Procedural Methods for Terrain Modelling” describes, using an agent based approach:

Every building will start with a node on its front door. 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 (calculation could be done in analogy to the calculation of the center of mass in physics).
Then Finding the corner points of buildings and spawn special raster nodes there will make it possible to apply optimization algorithms to find the shortest way between nodes of interest and ensure that all nodes will be between houses. The weighted middle node will be assigned to the nearest raster node.
The districts will now be connected with the weighted middle node as crossroads. For each house-node, the shortest intersection with the district lines will be calculated and connected accordingly.
With all preparations done, the roads have to be placed in a manner in which they won't intersect with the house spaces. This can easily be accomplished by just following the raster-nodes, while suppressing too diagonal movement. Later a distortion function can be used to give the roads a more natural feel.

Preparing for engine update

Some components still rely on some methods declared inside the component class.
Especially the facet-components rely on that.
To integrate well into the upcoming engine updates which may renders components incapable of having own methods, the latter have to be extracted into systems.

Tree remover performance improvements

In dense forested area the game slows down significantly. Part of it is of course the bigger work for the BlockBufferSystem, but there are also improvements to be done when iterating over the trees and regions.

Improve building placement

Currently only very low resolution information is used (mean of the roughness of that region and whether that region has water). -> Search the parcel area in a better resolution (the information is already there just has to be picked up).

District overlay for Minimap module

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.

Buildings placed into buffer while game is paused

While the game is paused, buildParcel inside Construction.java still runs on a regular time cycle, placing parcels and putting blocks into the buffer. These blocks are not placed until the game is unpaused; then the blocks rapidly unload out of the buffer.

This occurs for me in single-player play.

Crash, maybe from moving away from the growing city at spawn?

Was testing around a little, all looks very cool :-)

I got to wondering why the green text goes away after a while, wandered away from the starting city thinking I saw some distant text. Kept chasing it for a bit but it would disappear. Headed back to the original city but then the game crashed. Guessing it tried to spawn a new building while a chunk was unloaded or something like that?

Log:

13:35:58.023 [main] INFO  o.t.logic.console.ConsoleImpl - [CONSOLE] Ghost mode toggled
13:35:58.928 [main] INFO  o.t.logic.console.ConsoleImpl - [CONSOLE] High-speed mode activated
13:36:20.216 [main] ERROR o.t.p.t.TypeSerializationLibrary - Unable to register field of type Resource: not a supported type or MappedContainer
13:36:20.217 [main] ERROR o.t.p.t.TypeSerializationLibrary - Map field is not parametrized, does not have a String key, or holds unsupported values
13:36:20.217 [main] ERROR o.t.p.t.TypeSerializationLibrary - List field is not parametrized, or holds unsupported type
13:36:20.217 [main] INFO  o.t.p.t.TypeSerializationLibrary - Unsupported field: 'DynamicCities:ResourceFacet.data'
13:36:42.661 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
13:36:42.679 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Snapshot created: Writing phase starts
13:36:42.839 [Saving-0] ERROR o.t.p.t.TypeSerializationLibrary - Unable to register field of type DynParcel: not a supported type or MappedContainer
13:36:42.846 [Saving-0] ERROR o.t.p.t.TypeSerializationLibrary - Set field is not parametrized, or holds unsupported type
13:36:42.846 [Saving-0] INFO  o.t.p.t.TypeSerializationLibrary - Unsupported field: 'DynamicCities:BuildingQueue.buildingQueue'
13:36:42.846 [Saving-0] ERROR o.t.p.t.TypeSerializationLibrary - Unable to register field of type Construction: not a supported type or MappedContainer
13:36:42.846 [Saving-0] INFO  o.t.p.t.TypeSerializationLibrary - Unsupported field: 'DynamicCities:BuildingQueue.constructer'
13:36:42.846 [Saving-0] ERROR o.t.p.t.TypeSerializationLibrary - Unable to register field of type DynParcel: not a supported type or MappedContainer
13:36:42.846 [Saving-0] ERROR o.t.p.t.TypeSerializationLibrary - List field is not parametrized, or holds unsupported type
13:36:42.847 [Saving-0] INFO  o.t.p.t.TypeSerializationLibrary - Unsupported field: 'DynamicCities:ParcelList.parcels'
13:36:45.646 [Saving-0] INFO  o.t.p.internal.SaveTransaction - Save game finished
13:37:27.157 [main] ERROR o.terasology.engine.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.NullPointerException: null
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.growSettlement(SettlementEntityManager.java:336)
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.update(SettlementEntityManager.java:115)
    at org.terasology.engine.modes.StateIngame.update(StateIngame.java:176)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:414)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:369)
    at org.terasology.engine.Terasology.main(Terasology.java:150)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
13:37:27.158 [main] INFO  o.terasology.engine.TerasologyEngine - Shutting down Terasology...
13:37:27.258 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
13:37:27.263 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Snapshot created: Writing phase starts
13:37:27.268 [main] INFO  o.t.n.internal.NetworkSystemImpl - Client disconnected: Cervator
13:37:27.270 [main] INFO  o.t.logic.console.ConsoleImpl - [NOTIFICATION] Player "Cervator" has left the game
13:37:27.271 [main] INFO  o.t.n.internal.NetworkSystemImpl - Network shutdown
13:37:29.921 [Saving-0] INFO  o.t.p.internal.SaveTransaction - Save game finished
13:37:32.776 [main] WARN  o.t.rendering.nui.asset.UIFormat - Field 'emptyIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UIIconBar","id":"breathBar","icon":"engine:icons#bubble","family":"breathBar","emptyIcon":"engine:icons#burstBubble","halfIconMode":"shrink","spacing":2,"maxIcons":10,"layoutInfo":{"use-content-width":true,"use-content-height":true,"position-left":{"target":"CENTER"},"position-right":{"target":"RIGHT","widget":"healthBar"},"position-bottom":{"target":"TOP","widget":"healthBar","offset":1}}}
13:37:32.777 [main] WARN  o.t.rendering.nui.asset.UIFormat - Field 'crosshairIcon' not recognized for interface org.terasology.rendering.nui.UIWidget in {"type":"UICrosshair","id":"crosshair","crosshairIcon":"engine:gui#crosshair","layoutInfo":{"use-content-width":true,"use-content-height":true,"position-horizontal-center":{},"position-vertical-center":{}}}
13:37:32.801 [main] WARN  o.t.rendering.nui.skin.UISkinFormat - Failed to resolve UIWidget class UIInputBindButton, skipping style information
java.lang.NullPointerException
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.growSettlement(SettlementEntityManager.java:336)
    at org.terasology.dynamicCities.settlements.SettlementEntityManager.update(SettlementEntityManager.java:115)
    at org.terasology.engine.modes.StateIngame.update(StateIngame.java:176)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:414)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:369)
    at org.terasology.engine.Terasology.main(Terasology.java:150)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
For more details, see the log files in J:\Dev\Terasology\Git\integrate\Terasology\logs\2016-06-18_13-34-21

Create roads between cities

This involves adding dynamic road creation with generators found within the static cities module. The main task is to transform the facet based road creation, which creates roads at world generation, into one which places roads during playtime.
A similar technique used for the transformation of facet based building creation can be applied here.
Suggested steps are as followed:

  1. Create rules for what cities should be connected. A good approach can also be found in the StaticCities module here
  2. Create a road object containing all the road segments akin to the StaticCities road creation.
  3. Create a rasterizer which does the same stuff as the original but uses the BufferRasterTarget for actual block placement

It probably makes the most sense to save the road object to the corresponding city entity to which it connects. This will allow to check for overlap when placing new buildings/stuff.

City minimap details replicating incorrectly on clients

When using DynamicCities in multiplayer, there are key differences in the minimap displays between the host and a client player:

image image
Left: Minimap of the hosting player
Right: Minimap of a client player with the same position & zoom

Normally in singleplayer, the two parts of the city minimap (the district overlay and the city centre indicator) load in when the player first enters the area of the city. However when a client enters the city, this console warning message appears:

No SettlementCache found! Unable to create district overlay

This console log originates from this line in MinimapOverlaySystem. The information that places the overlays on the minimap comes from a SettlementsCacheComponent attached to a global settlement cache entity, which is created in the SettlementCachingSystem. This console log shows that the settlement cache entity is only present on the server. This entity has a NetworkComponent attached, meaning that it should theoretically be replicating to all clients, but it is not replicating for an unknown reason.

These minimap issues can be fixed in one of two ways:

  1. Figure out why the entity containing the SettlementsCacheComponent isn't replicating to clients; if the entity was replicating then the system would work as intended even on multiplayer.

  2. Use network events instead of components to communicate overlay information. This route should be used only after exhausting the first route.

Resource building creation

In the current state of the module, buildings get only placed in the city boundaries. However it would make sense to introduce buildings outside of the main city area, like farms, mines, etc. There is already a foundation to build upon: Region tiles, which can save (and already do save to a certain extend)
information about the resources and terrain. Hence this one should be relatively straight forward as it just puts together a lot of existing mechanics.
First the region tiles in the outskirts of the city have to be sorted for the relevant resource.
A DynParcel with the corresponding resource building can then be placed on the tile with the highest amount of resource.
The amount of resource buildings should orientate itself on the cultural needs and maybe even on the market dynamics.
Reasonable threshold values should be found for the amount of resources of a tile to qualify for building placement.

Expose growth and planning logic as Events and EventReceivers

I'd like to use DynamicCities as a framework for planning and rasterizing settlements in my own game, but much of the logic is hard coded into the various systems and I'd like to override it with my own. I have some changes prepared that will expose this logic as consumable events and add default event receivers to implement the existing logic. The idea is that user code can just define an event receiver with the same signature and higher priority to use custom logic, then simply consume the event to prevent the default logic from taking place.

Some things I'd like to expose as events:

  • Checking whether a site is suitable to become a settlement
  • Checking whether a settlement needs a parcel from a given zone
  • Checking which building type a particular parcel should become
  • Constructing the building as blocks in the world

This is an initial list, and I'm sure I'll discover more use cases as I press on. But I wanted to get your opinion on this suggestion, and whether you'd be interested in such a change.

Here's the WIP branch, with the general idea implemented for some basic logic

Cannot find any city

How to find cities, what distance or time should pass, what relief should be, where cities will be generated?
Adding module changes nothing in gameplay world

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.