Giter Site home page Giter Site logo

buildingthemes's People

Contributors

algernon-a avatar bloodypenguin avatar boformer avatar daegi01 avatar earalov avatar meda22 avatar samsamts avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buildingthemes's Issues

Extending the vanilla themes

I thought about it again: It makes sense to allow users to add their own buildings to euro/int theme (by adding them to the config).

It is the easiest way to use custom assets with this mod.

For example, users could add these buildings to the european theme:
http://steamcommunity.com/sharedfiles/filedetails/?id=446190120
http://steamcommunity.com/sharedfiles/filedetails/?id=446201704

And all of these to the international theme:
http://steamcommunity.com/sharedfiles/filedetails/?id=423659623

To make it futureproof, vanilla buildings should be never be saved in the config (isBuiltIn field for Configuration.Building)

Performance of the Filter

The GetRandomBuildingInfo method is called quite frequently (especially while a building is upgrading, it is called every tick).

Right now wer are filtering the FastList of assets which are allowed to grow again every time.

It would be better to precompile one "m_areaBuildings" array for every district.

Building Themes Feature included in after dark patch - What will we do now?

https://forum.paradoxplaza.com/forum/index.php?threads/cities-skylines-after-dark-dev-diary-2-whats-new-with-modding.878916/

Problems I see so far:

  • it does not allow cloning
  • no vanilla buildings in themes
  • you can only select one theme per district

I guess that a lot of referenced game code will be changed by the patch, and the mod will be broken. While this is not a serious problem because the mod does not break the save files, we have to decide what to do next.

I would suggest that we disable the cloning feature in our mod (only remove the option to create new clones in the theme manager) and warn users with clones in their themes that the feature will not be supported by the official theme system.

Many users also reported problems with the cloning feature, so disabling it is probably good to improve the stability of the mod.

I would also suggest that we include a version switch in our mod, so that it disables itself when the new update is installed (with option to bypass in the options menu).

Ideas for post-update time:

  • Make the Theme Manager GUI work with the official theme system (ingame creation of themes with 3d preview = awesome)
  • Create a mod that allows you to select multiple themes per district (if possible)
  • Create a mod that improves the footprint selection and upgrade system:
    • support for small 1x2 buildings (if not included in the update)
    • splitting and merging on update
    • intelligent calculation of footprints: for example a 4x10 road block would be filled with building with a depth of 2, to have buildings spawning on both sides.
  • Find a better way to create building duplicates for different levels (meshes and textures shared between models, so asset creators can publish multiple assets which do not increase memory usage)

nullRefException in ZoneBlock.SimulationStep

Object reference not set to an instance of an object [System.NullReferenceException]

Details:
No details
System.NullReferenceException: Object reference not set to an instance of an object
  at BuildingThemes.Detour.ZoneBlockDetour.SimulationStep (UInt16 blockID) [0x00000] in <filename unknown>:0 
  at ZoneManager.SimulationStepImpl (Int32 subStep) [0x00000] in <filename unknown>:0 
  at SimulationManagerBase`2[Manager,Properties].SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
  at ZoneManager.ISimulationManager.SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
  at SimulationManager.SimulationStep () [0x00000] in <filename unknown>:0 
  at SimulationManager.SimulationThread () [0x00000] in <filename unknown>:0 

Description:

  • No I did not modify the BuildingThemes.xml manually
  • Occurs every few seconds
  • I created a new theme using the UI manager and added some buildings to it. There is a global theme "European" enabled
  • If I disable the custom theme I created using the UI, the error stops

Detect the loaded building packs

It doesn't make sense to display a "European" theme on a boreal/tropical/sunny map without the EuroBuildingsUnlocker mod.

We have to check which collections are loaded:

Sunny Collections | Boreal Collections | Tropical Collections --> Display "International" Theme
Europe Collections --> Display "European" Theme

The problem is that this can only be determined when the game is already loaded (OnLevelLoaded).

A different solution would be to check if EBU is installed.

Themes as separate mods?

Creating a custom theme is quite difficult (and it will take some time to create the GUI for it).

A simple solution would be separate mods which add preconfigured themes.

The ingame theme manager could also be a separate mod (we can outsource the xml configuration to that mod)

Realistic buildung upgrades

From simtropolis:

Would it be possible to make mod that can allow buildings to level up without replacing the lot?

Old buildings like row homes may have been originally been built as cheap housing, but were renovated as the land values increased and the city grew.

It makes it hard to try to find a place for historical building models in the game.

My answer:

What would be possible is the following:

Asset creators create multiple versions of their assets (lvl 1 ugly with trash, lvl 2 renovated, lvl 3 with small pool).

The mod hooks into the building selection that occurs on upgrading and looks for an asset with a similar name ("myhome L1" -> "myhome L2").

I could easily integrate this into the Building Themes mod. It would just require the help of the asset authors to create the different asset versions and to name them correctly.

Better Detour Usage

GetRandomBuildingInfo is called in 3 places:

  • ZoneBlock.SimulationStep - Places new growables on empty land
  • PrivateBuildingAI.GetUpgradeInfo - Finds a new growable of the same size (current level +1)
  • PrivateBuildingAI.SimulationStep - "Downgrades" abandoned buildings to level1 buildings

We ran into trouble when we tried to detour PrivateBuildingAI.GetUpgradeInfo and PrivateBuildingAI.SimulationStep.

That's why we used a LevelUpExtension and other hacky methods to determine where the building is/will be located.

Luckily I found out how we can detour all of the 3 methods. It will make the code of this mod much clearer and maybe even improve performance:

We have to detour the AI methods for every subclass of PrivateBuildingAI. A very elegant way to do it is to use generics, as seen here.

Checkbox "Enable theme management for this district" in policy panel

There are many use cases for Districts in C:SL. Not all districts are used to create areas with different building themes.

That's why I think that by default, a district should not have a separate theme configuration like it is now.

A player should explicitely enable that in the Policy GUI.

Renaming theme

I think renaming a theme is not possible with the current system.

In the districts configuration, the names of enabled themes are saved. If the name of a theme is changed later on, the association is lost unless we update the name in every district configuration for all possible saves. Which can prove to be problematic.

One possible solution would be to generate a unique ID. This unique ID would never change for a given theme. That id would be saved instead of the name.

Of course changing this now would break the current saved districts. So maybe we could keep the name but add a "displayName" property to the theme. It could be changed at will while the internal name doesn't ever change. If the displayName doesn't exist, the internal name is displayed instead.

Or I can ditch the rename idea altogether.

Missing GUI bug related to this mod?

We both experienced the bug where only a strange road icon appeared in the toolbar.

This happened to me again. I hit the "Unpause" button and got an exception:

Object reference not set to an instance of an object [System.NullReferenceException]

Details:
No details
System.NullReferenceException: Object reference not set to an instance of an object
  at BuildingThemes.BuildingThemesManager.<MergeThemes>b__3 (BuildingThemes.Theme theme) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[BuildingThemes.Configuration+Theme,BuildingThemes.Configuration+Building].MoveNext () [0x00000] in <filename unknown>:0 
  at BuildingThemes.BuildingThemesManager.MergeThemes (System.Collections.Generic.HashSet`1 themes) [0x00000] in <filename unknown>:0 
  at BuildingThemes.BuildingThemesManager.MergeDistrictThemes (UInt32 districtIdx) [0x00000] in <filename unknown>:0 
  at BuildingThemes.BuildingThemesManager.GetMergedThemes (UInt32 districtIdx) [0x00000] in <filename unknown>:0 
  at BuildingThemes.BuildingThemesManager.DoesBuildingBelongToDistrict (System.String buildingName, UInt32 districtIdx) [0x00000] in <filename unknown>:0 
  at BuildingThemes.DefaultFilteringStrategy.DoesBuildingBelongToDistrict (System.String name, UInt32 districtIdx) [0x00000] in <filename unknown>:0 
  at BuildingThemes.DetoursHolder.FilterList (Vector3 position, .FastList`1& list) [0x00000] in <filename unknown>:0 
  at BuildingThemes.DetoursHolder.GetRandomBuildingInfo (ColossalFramework.Math.Randomizer& r, Service service, SubService subService, Level level, Int32 width, Int32 length, ZoningMode zoningMode) [0x00000] in <filename unknown>:0 
  at ZoneBlock.SimulationStep (UInt16 blockID) [0x00000] in <filename unknown>:0 
  at ZoneManager.SimulationStepImpl (Int32 subStep) [0x00000] in <filename unknown>:0 
  at SimulationManagerBase`2[Manager,Properties].SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
  at ZoneManager.ISimulationManager.SimulationStep (Int32 subStep) [0x00000] in <filename unknown>:0 
  at SimulationManager.SimulationStep () [0x00000] in <filename unknown>:0 
  at SimulationManager.SimulationThread () [0x00000] in <filename unknown>:0 

Theme assignment Loading bug

Bug Report: after loading, theme settings for each district reset to default (international+european).

Reported by /b/tard on steam.

It looks like the mod saves everything correcty. It also loads the xml file.

The problem is that it also adds the default themes (based on biome) to the city, and the themes of the city to the districts.

Flickering Buildings Bugs

Seems like the bug I experienced yesterday is related to BT.

This is what the output_log of a steam user contained:

NullReferenceException: Object reference not set to an instance of an object
  at TreeInstance.RenderInstance (.CameraInfo cameraInfo, .TreeInfo info, Vector3 position, Single scale, Single brightness) [0x00000] in <filename unknown>:0 

  at BuildingAI.RenderProps (.CameraInfo cameraInfo, UInt16 buildingID, .Building& data, Int32 layerMask, .Instance& instance) [0x00000] in <filename unknown>:0 

  at BuildingAI.RenderInstance (.CameraInfo cameraInfo, UInt16 buildingID, .Building& data, Int32 layerMask, .Instance& instance) [0x00000] in <filename unknown>:0 

  at CommonBuildingAI.RenderInstance (.CameraInfo cameraInfo, UInt16 buildingID, .Building& data, Int32 layerMask, .Instance& instance) [0x00000] in <filename unknown>:0 

  at Building.RenderInstance (.CameraInfo cameraInfo, UInt16 buildingID, Int32 layerMask, .BuildingInfo info, .Instance& data) [0x00000] in <filename unknown>:0 

  at Building.RenderInstance (.CameraInfo cameraInfo, UInt16 buildingID, Int32 layerMask) [0x00000] in <filename unknown>:0 

  at BuildingManager.EndRenderingImpl (.CameraInfo cameraInfo) [0x00000] in <filename unknown>:0 

  at SimulationManagerBase`2[Manager,Properties].EndRendering (.CameraInfo cameraInfo) [0x00000] in <filename unknown>:0 

  at BuildingManager.IRenderableManager.EndRendering (.CameraInfo cameraInfo) [0x00000] in <filename unknown>:0 

  at RenderManager.LateUpdate () [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

Grid layout for Themes Manager UI

I'm planning rewriting of Improved Assets Panel grid layout and making it a reusable component. My idea is to display buildings' thumbnails with text overlay in Themes Manager UI instead of the plain text list (or maybe add it as another layout mode).

variable to control front/backyard expansion

By default the length of a growable building plot will extend if there is enough space. For example, a 1x1 asset will create a 1x4 asset if there is enough space.

Some assets place additional parking spaces and props in the backyard.

Other assets don't use the additional space, so it is a waste of space to expand the backyard.

I disabled the backyard expansion feature when I modified the footprint calculator.

It would be better if there was a way to control the backyard expansion.

Ideas:

  • A field per Theme (true / false): Not very precise, but easy to implement. Drawback: What happens when you select one theme with and one without backyard expansion?
  • A field per building type: Would require a new data structure, but it is very precise.
  • A check box in the policy GUI to enable backyard expansion per district: Hmm, I don't like that

And the last idea: Automatically determine if the backyard should be extended by checking if any props are place in the backyard: My favorite, but difficult to implement.

Nothing grows bug?

Hello, Sorry, but doesn't work at all for me. If i destroy the buildings in a district, they wont grow again, and a strange bug appears in the policy district tab. But keep up the good work, that mod is a mod i was waiting for.

I have made another try, but this time on an International map, only using E.BU, Building Theme and Unlock all + Wonders and Landmarks. And it seemed to work fine. Maybe there's a problem with the European maps.

I was not able to reproduce this yet.

Add "parent" XML attribute to a theme

That would be handy if a user wants to base his theme on some built-in theme or a theme that is already present in the config. If ha wants to ban some buildings from parent theme he may explicitly set "remove" attribute for such buildings.

Ex:

<Themes>
  <Theme name="Berlin" parent="London">
    <Buildings>
      <Building name="TowerBridge" include="false">
    </Buildings>
  </Theme>
</Themes>

Building Footprint selection

One problem of the default "ZoneBlock.SimulationStep" method is that it always searches for the largest possible footprint.

If no prefab with the right footprint is available in that category, nothing will grow.

It would be better if it worked like this:


Example:
Available Space: 4x4 (width x depth)

No prefab found?
Look for 2x4 (place it on left or right side of plot to grow another 2x4)

No prefab found?
Look for 1x4


No prefab found?
Look for 4x3

No prefab found?
Look for 2x3 (place it on left or right side of plot to grow another 2x3)

No prefab found?
Look for 1x3


No prefab found?
Look for 4x2

....

Another District assignment xml file bug

This is also a bug in TrafficManager.

When you save a city, the buildingThemesSave_generated-id.xml is created.

When you save the city again (same file name), the mod does not override/delete the old xml file, but creates a new file with a different generated id.

Possible 'No High Rises' policy overriding?

Vanilla 'No High Rises' policy just bans Level 5 Res. (and Level3 Office and Commercial) buildings. But there are lots of custom high rise assets that are Level1-4 (especially rtrstream's) and not so tall assets of Level 5 which makes that policy impractical. Is it possible to actually measure asset's height and filter buildings by it in GetRandomBuildingInfo method and at the same time allowing growing of Level 5 buildings in 'Ho High Rises' districts?

Compatibility with 81 Tiles mod

Building Themes is incompatible with 81 Tiles Mod because both mods are detouring the same methods.

This could be fixed by detecting if the other mod is loaded.

Bug caused by Policy GUI hook

IndexOutOfRangeException: Array index is out of range.
  at ColossalFramework.PoolList`1[ColossalFramework.UI.UIComponent].get_Item (Int32 index) [0x00000] in <filename unknown>:0 

  at DistrictWorldInfoPanel.UpdatePolicies () [0x00000] in <filename unknown>:0 

  at DistrictWorldInfoPanel.UpdateBindings () [0x00000] in <filename unknown>:0 

  at WorldInfoPanel.LateUpdate () [0x00000] in <filename unknown>:0 

  at WorldInfoPanel.SetTarget (Vector3 worldMousePosition, InstanceID id) [0x00000] in <filename unknown>:0 

  at WorldInfoPanel.Show[DistrictWorldInfoPanel] (Vector3 worldMousePosition, InstanceID instanceID) [0x00000] in <filename unknown>:0 

  at DefaultTool.OpenWorldInfoPanel (InstanceID id, Vector3 position) [0x00000] in <filename unknown>:0 

  at DefaultTool.OnToolGUI () [0x00000] in <filename unknown>:0 

  at ToolBase.OnGUI () [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

IndexOutOfRangeException: Array index is out of range.
  at ColossalFramework.PoolList`1[ColossalFramework.UI.UIComponent].get_Item (Int32 index) [0x00000] in <filename unknown>:0 

  at DistrictWorldInfoPanel.UpdatePolicies () [0x00000] in <filename unknown>:0 

  at DistrictWorldInfoPanel.UpdateBindings () [0x00000] in <filename unknown>:0 

  at WorldInfoPanel.LateUpdate () [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

Theme Management GUI

Proposal:

We manage a list of buildings which are available (Vanilla and Custom assets) as a separate XML file.

When a new building is found that is not in the XML file, a window pops up:

New growable asset found: (name)
(rendered preview)
(stats)

Add the asset to themes:
[ X ] European
[   ] International
[   ] Custom theme
[   ] Another custom theme
[ + New Theme ]

[ Done ]

The mod also adds a new entry to the Esc menu: "Theme Manager"

It opens a window with 3 columns:

left column (width 25%):
The left column contains the list of themes (and a Add new theme button in the bottom). The user has to select one.

Center column (width 50%):
The list of all growables with checkboxes to enable an asset in a theme. The list should also contain assets which are not loaded, but were found in the XML buildings list. It would be nice if we could display a more readable name (load title from workshop, replace "_" with " ")

Right column:
Top:
preview and stats of the selected asset

Bottom:
Information about the theme.
For example, display how many assets of each zone type are included.
Display a warning when there is a L2 4x4 asset, but no L1 4x4 asset.

Built-in status not conserved when include changed.

I investigated the problem reported by Benny :

The only problem I have with this mod at the moment is that when I disable any building from the default sets ingame from the theme manager it only works temporarily. They re-enable each time I quit and reload the game.

The isBuiltIn property of a built-in building that has been disabled is set to false when re-loading the config. Is this intended?

Clone feature: More color variations of vanilla and euro growables

I'm referring to this:
"+[*] More cloning options: Change the zone type, color variation or density of a building"

I hope that some day more color variations can be made from/with vanilla and euro growables.

Certainly euro set would need more color variations. Those red roofs anyone? :)

I hope this feature (of the cloning) will see daylight some day.

blacklist mode?

Sometimes it might be easier to allow only buildings that are not included in a theme.

Right now when you enable one or both default themes (euro, international), custom buildings will not be placed.

Blacklist mode should be selectable per district.

First beta release date? What features are we still lacking for it?

It looks like our core logic works now. I think custom themes may be added later.
At this point I think we might just add a 'Custom' theme as temporary solution that might allow growing of custom buildings alongside with vanilla ones in themed districts.

I'll be mostly unavailable for modding from upcoming Thursday (6/25) till August because I'll marry on the Saturday (6/27) and will have my honeymoon after that. And before that I would like to enjoy seeing this mod released in Workshop :)

Building Level Control

I heard someone say that the Control Building Level Up mod isn't working anymore and won't be updated. I was wondering if we could incorporate a maximum level option in the district options along side the themes options. Something like a combobox (or several for the different zone types) where you can choose the maximum level.

I know it is possible to make a theme that only include buildings up to certain level, but it may be less practical for the user.

Good idea or not?

Theme types

There are different kinds of themes:

  • Themes based on a BuildingCollection (e.g. "European Buildings" gameobject)
  • Themes based on a fixed list of building names (configurable)

How can we solve this?

Remove buildings from the vanilla theme.

Based on this reddit comment:

There's one ,just one building I can't handle. it's the european one that's often blue and orange and has a rounded roof. It's pretty realistic, I know, but I generally dislike that direction in architecture, so i tend to manually buldoze it every time it pops up.

We could extend the config format like this:

    <Theme name="European">
      <Buildings>
        <Building name="ugly_vanilla_blueroof_building" include="false" />
      </Buildings>
    </Theme>

Issue with theme mods

This line in BuildingThemeManager causes issues when users extend the mod themes:

existingTheme.buildings.AddRange(theme.buildings);

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.