Jump to content

5 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Hi,

I am new so please excuse clumsiness.

I would like to understand the mechanism and find appropriate pieces of game code that are responsible for updating buildings (storage buildings from Industries DLC, to be exact) while the gape plays.

By updating I mean things like changing properties in time, like for example  fill ratio. But what I am most interested in are:

1) how storage building "places an order" for import. How this is triggered.

2) how storage building "sends truck" for export.

Reason why I am interested to find this is because "original logic" of the game of how storage buildings operate is just terrible. And I am curious if this can be "fixed". Logically changes required are small and should not be challenging to code, but I am no expert in this regard.

So far I went (in general) through "WarehouseAI" and "Building" Classes and parts of some other but so far I found nothing that would "drive this buildings".

I understand that above explanation may sound childish, as I obviously lack proper terminology. My coding experience is purely hobby amateur.

Anyway I will appreciate any help, directions or clues.

 

Regards,

Cris.

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Sorry for the late reply.

The OutsideConnectionAI (a building) is sending out transfer offers, incoming and outgoing (one is export, one import).

Buildings also sent out offers. When 2 offers are matching, a truck is spawned, then ModifyMaterialBuffer is called on the building, and the vehicle route is calculated. Then the vehicle goes to outside connection (on export) or to the building (on import).

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Thanks,

    I got to this point by now.

    Now I am looking for more in depth details.

    I noticed that TransferManager has a RemoveOffer method but this method is not called from within MatchOffers method.

    Instead RemoveOffer is invoked by multiple methods of various AIs. This suggests that thins methods (in particular AI) also do something with their base object. So probably set material bufer, ad or remove truck, change flags ..

    I did not investigated very deep in to it. But I probably need to know in general.

     

    I am working (slowly) to make more advanced transfer manager that would solve some obvious problems related to transfer. MoreEffectiveTrnasfer mod that is available works and solves some but I would like a little bit more.

    Basically I see I need to override MatchOffers method in TransferManager and some other methods and properties of this Manager, but also I will need to do some alterations to some of building AIs, probably WarehouseAI and maybe some other (not entirely sure yet).

    One of the things that are to be solved is problem with how individual offers are matched and fulfilled.

    So currently (vanilla) MatchOffers method takes incomming offer and outgoingoffer (basically) and initialises a transfer. in the same time offer amount of both (in and out) is decreased by the value of the transfer. This potential leads to leaving "left overs" of offers that require very little quantity to be transferred thus leading to almost empty trucks running.

    So at current stage I am trying to find possible way of dealing with this issue. I see some potential solutions:

    1) remove "left over offer" - I would not like to do it, as normally it does not work like this in the real world

    2) combine next offer from given building to with previous one - I would better like this solution but I am not sure if buildingAI sends another offer before previous one is complacently  done. If not than it would have to be overridden, but I am not sure if I want to go that farr, as there are many many AIs to override in such case.

     

    Any thoughts welcome.

    Cris

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Hi @Kmeld I appreciate this is a very old thread, but in case you have email notifications turned on, or for any others who find this thread on Google like me, I have done a deep dive into the `TransferManager` class which handles the trading of goods between industrial/commercial buildings in the supply chain (and a whole lot more).

     

    You can find it here, I hope it's helpful: https://jamesmonger.com/2021/02/24/cities-skylines-trading-market.html

    • Like 1
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    2 minutes ago, the_jkm said:

    I appreciate this is a very old thread,

    No worries about the age of the thread when adding something relevant as you have done. *;)

    • Like 1
    • Yes 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections