Giter Site home page Giter Site logo

Comments (8)

boformer avatar boformer commented on September 18, 2024

Another memory-friendly solution: Duplicate the assets ingame, use same mesh and texture.

There could be a slider in the themes manager to select the levels where an asset can grow ( e.g. 2 - 4). What do you think?

from buildingthemes.

bloodypenguin avatar bloodypenguin commented on September 18, 2024

slider in the themes manager to select the levels

I once thought about that. This would be really nice. If I like a building but it's a L1 asset (like most fast food assets), I want to let it level up without changing mesh. Some buildings must level up with mesh changing though (like cheap condos)

Duplicate the assets

I don't like that idea much. First, it should be done on level loading to prevent unwanted side effects. Second, it will be to hard for users to configure and for us to control.

Another idea that comes to mind:
Let buildings grow straight from level > L1 (e.g. to spawn a L5 building without previous levelups if land value is high enough. This is what happens IRL. If user thinks that some building is L5 but building's author set it another level, user should be able to override assets level.

from buildingthemes.

boformer avatar boformer commented on September 18, 2024

I don't like that idea much. First, it should be done on level loading to prevent unwanted side effects.

This mod seems to do it as well in a way: https://github.com/AJ3D/PloppableRCI/blob/master/PloppableRCI/OnLoad.cs

from buildingthemes.

AJ3D avatar AJ3D commented on September 18, 2024

Hey guys!

You can do the leveling range by using the custom attributes fields on the building AI. I haven't fully cleaned this up on my mod, but I was able to get it to work in a test.

The BuildingInfo object also stores the information related to the props, and can be changed.

I had an idea for this feature, and was thinking it could work by creating a new AI that was extended from the basic ones. The new AI would have the custom fields, and would bypass the normal leveling logic. On scene load, the game would find the assets with the new AI, and create the additional BuildingInfos for assignment upon leveling.

I did talk with BloodyPengiun, and I think he mentioned that creating a new AI class should be ok....

from buildingthemes.

bloodypenguin avatar bloodypenguin commented on September 18, 2024

@AJ3D
It should be OK only for new assets (designed specially for your mod). Replacing existing assets AI is not a good idea IMO.

from buildingthemes.

AJ3D avatar AJ3D commented on September 18, 2024

Having the XML files that store custom information could completely eliminate the need for new AI's.
I don't fully understand how reflection works yet, but I think you can add logic to existing objects and methods.
A simple if statement in the simulation step could allow you to implement the different logic selectively for the buildings that are not meant to have their meshes changed on level up.
From what I've read in the source code, when the Building object levelUpProgress his 255, it sets off a long chain of methods that destroys the Building object, and creates a new one. If you wanted to preserve the current residents and workers, you would need to catch it earlier, and impement your own simple leveling logic. Mine so far just simply assigns a new BuildingInfo object that was instantiated from the original. The original references are the same, except for the new ItemClass that has a higher level assigned.

from buildingthemes.

boformer avatar boformer commented on September 18, 2024

Actually it doesn't matter if the building gets destroyed and rebuilt.

We have hooked into the method that selects the new BuildingInfo on building upgrade.

We just need a way to copy the BuildingInfo and to change the assigned level.

For compatibility, it makes sense to revert the BuildingInfos to the original ones when the level is saved.

No messing with the AI.

from buildingthemes.

boformer avatar boformer commented on September 18, 2024

Working on this as a separate mod.

from buildingthemes.

Related Issues (20)

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.