Jump to content
Null 45

SC4 More Demand Info - a DLL that provides more RCI demand variables

42 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

A DLL plugin for SimCity 4 that provides modders with more RCI demand info.

With this plugin installed there will be the following new variables that can be used from LUA scripts and UI files:

Variable name                                          Description
g_cs1_active_demand Cs§ active demand
g_cs1_demand Cs§ demand
g_cs2_active_demand Cs§§ active demand
g_cs2_demand Cs§§ demand
g_cs3_active_demand Cs§§§ active demand
g_cs3_demand Cs§§§ demand
g_ir_active_demand IR (I-Ag) active demand
g_ir_demand IR (I-Ag) demand
g_current_ir_cap Current IR (I-Ag) cap
g_id_demand ID demand
g_im_demand IM demand
g_iht_demand IHT demand
g_region_r1_population Region R§ population
g_region_r2_population Region R§§ population
g_region_r3_population Region R§§§ population
g_region_cs1_population Region Cs§ population
g_region_cs2_population Region Cs§§ population
g_region_cs3_population Region Cs§§§ population
g_region_co2_population Region Co§§ population
g_region_co3_population Region Co§§§ population
g_region_ir_population Region IR (I-Ag) population
g_region_id_population Region ID population
g_region_im_population Region IM population
g_region_iht_population Region IHT population
g_tax_income_r_low Estimated monthly R§ tax income
g_tax_income_r_med Estimated monthly R§§ tax income
g_tax_income_r_high Estimated monthly R§§§ tax income
g_tax_income_cs_low Estimated monthly Cs§ tax income
g_tax_income_cs_med Estimated monthly Cs§§ tax income
g_tax_income_cs_high Estimated monthly Cs§§§ tax income
g_tax_income_co_med Estimated monthly Co§§ tax income
g_tax_income_co_high Estimated monthly Co§§§ tax income
g_tax_income_i_resource Estimated monthly industrial resource (IR, I-Ag) tax income
g_tax_income_i_dirty Estimated monthly industrial dirty tax income
g_tax_income_i_manufacturing Estimated monthly industrial manufacturing tax income
g_tax_income_i_hightech Estimated monthly industrial high tech tax income

The values can be accessed using game.<value name> in LUA scripts and UI placeholder text.

Download: https://community.simtropolis.com/files/file/35978-sc4moredemandinfo/

Source Code: https://github.com/0xC0000054/sc4-more-demand-info

System Requirements

  • Windows 10 or later

The plugin may work on Windows 7 or later with the Microsoft Visual C++ 2022 x86 Redistribute installed, but I do not have the ability to test that.

Installation

  1. Close SimCity 4.
  2. Copy SC4MoreDemandInfo.dll into the Plugins folder in the SimCity 4 installation directory.
  3. Start SimCity 4.

Troubleshooting

The plugin should write a SC4MoreDemandInfo.log file in the same folder as the plugin.
The log contains status information for the most recent run of the plugin.

  • Like 1

Share this post


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

This is awesome.  I saw your screenshots about this when you were making it.  But am I correct in that this mod doesn't do anything other than provide the information but otherwise isn't shown until someone else makes another mod?  In your screenshots I saw you were editing the Census Repository.  Perhaps you could upload an edit to the Census Repository in order to see this in the game?

 

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    57 minutes ago, Kel9509 said:

    But am I correct in that this mod doesn't do anything other than provide the information but otherwise isn't shown until someone else makes another mod?

    Correct. I am open to suggestions on how to reduce confusion about that.

    56 minutes ago, Kel9509 said:

    Perhaps you could upload an edit to the Census Repository in order to see this in the game?

    Done:

    • Like 1

    Share this post


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

    We (moderators) can add a notice to the download page with something like:

    Please note that this download is intended for developers and/or as a dependency, it will not by itself add anything new to your game.

    Then again, I can see how one of the most useful things it does it provide the missing data for the Census Repository. My mistake was thinking these values existed as 'placeholders' in the original CR files. Maybe it's worth including the patch as part of the .dll download directly?

    • Like 1
    • Yes 1

    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    53 minutes ago, rsc204 said:

    Maybe it's worth including the patch as part of the .dll download directly?

    Done.

    • Like 1

    Share this post


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

     

    This mod is working perfectly!  I love seeing the new CS demand in the Census Repository.

    BUT...

    In ONE of my cities (not all of them) after swapping out RippleJet's Census Repository file with the one included in your patch, I got a missing plugin-pack warning error message upon loading the city, and also got a TON of new reward messages involving BSC lots I never downloaded.  I do not get the error if I use  the non-patched, original version of RippleJet's Census Repository file, and all the new "rewards" do not pop up.  I've tested this extensively by swapping the new file in and out repeatedly.  Again, this only happens in ONE of my cities.  Not sure why the others aren't affected (they all use the Census Repository as well).

    See images below for a sample of the error and the non-existing rewards.  I'm using the latest BSC Common Dependencies Pack from Sc4Evermore also.  This is only a sample of the images.  I get around 13 messages upon loading the city for new, non-existing rewards.  

     

    65a4d505de3e8_GDriverWindow--DirectX1_14_202411_51_40PM.jpg.e8e381e06f1d8048446c23f761153656.jpg

    65a4d51109ae3_GDriverWindow--DirectX1_15_20241_33_47AM.jpg.3d7c8d6267a7dea2e1a8734764960f1d.jpg

    65a4d519b9a8f_GDriverWindow--DirectX1_15_20241_34_21AM.jpg.4306fd2e832d2e2581b90270aa0e66f3.jpg

    65a4d52446e8f_GDriverWindow--DirectX1_15_20241_34_44AM.jpg.83997241678e587f525efc27f8970b61.jpg

    • Thanks 1

    Share this post


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

    I believe that’s because the Reward LUA code was accidentally included with the BSC custom UIs, hence these messages are triggered. @Tyberius06 knows about it so the next release should solve it. For now you can close them safely and ignore them. 

    • Thanks 1

    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


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

    @Null 45, I am almost certain that the .dat file is causing CTDs to my game. I never had CTDs before, but after a few days suffering them I decided to track them down. I removed some mods that I installed when the CTDs started, among them the SC4MoreDemandInfo. The CTDs ceased to happen. Then I have been adding a mod each time and testing the game. I didn't have any CTD until I installed the modified RJ - Census_Repository_Model_and_Query_3.1.dat (the DLL alone seems to be fine). CTDs seem to be random to me. I can share the exception reports if they can be helpful.

    Thanks for the support and sorry for bringing you bad news.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    2 hours ago, Membrillo said:

    I didn't have any CTD until I installed the modified RJ - Census_Repository_Model_and_Query_3.1.dat

    Sorry to hear that you are having issues. I have no idea what the problem could be, unless I made some kind of mistake when editing the the query UI.

    By itself, the only thing the DLL does is provide the variables listed in the first post for other plugins to use. I don't think the variables added by the DLL could be the issue, I add them using the same system that SC4 uses for its built-in variables.

    As the crash sounds like it is within SC4's code, I don't think the exception reports would be of use to anyone outside of Maxis. But it probably would not hurt to post them here or send them by PM.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 2/2/2024 at 6:29 PM, Null 45 said:

    Sorry to hear that you are having issues. I have no idea what the problem could be, unless I made some kind of mistake when editing the the query UI.

    By itself, the only thing the DLL does is provide the variables listed in the first post for other plugins to use. I don't think the variables added by the DLL could be the issue, I add them using the same system that SC4 uses for its built-in variables.

    As the crash sounds like it is within SC4's code, I don't think the exception reports would be of use to anyone outside of Maxis. But it probably would not hurt to post them here or send them by PM.

    It may be all a coincidence and the dat file isn't the culprit. I attached the reports. From Jan 16 to 30 I had a full Plugins folder. SC4moredemandinfo dll and dat files were installed on Jan. 15. On Jan. 31, I removed moredemand and a couple more mods that I installed around Jan 16 and I had no CTD. For a few days, I installed each mode and run the game for a reasonable amount of time (hours) without crashes, until I replaced the original census dat file with yours. Then the crashes came back (Jan. 2). With just the DLL file, the game run without issues.

    Now I will try to reproduce the issue with a limited Plugin folder (CAM, NAM) and the DLL + dat. I had a crash on Jan. 4, but I did change dgVoodoo from dx11 to 12, so maybe this was the cause (the game loaded fine and loaded the city, but CTDed shortly afterwards). I reverted it to dx11 but I haven't had time to run the game for a decent amount of time yet.

    As I said, it can be a coincidence, but I've always been able to run the game for hours without issues, except with the modified dat file. Although I realize that my test are not enough to prove causation.

    Exception Reports.zip

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    4 hours ago, Membrillo said:

    As I said, it can be a coincidence, but I've always been able to run the game for hours without issues, except with the modified dat file. Although I realize that my test are not enough to prove causation.

    The only thing the exception reports tell me is that all of the crashes are access violations. The 2024.02.04 11.21.51 crash appears to have occurred in DDraw.dll, and the others are at various locations in SimCity 4.exe.

    • Thanks 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    3 hours ago, Null 45 said:

    The 2024.02.04 11.21.51 crash appears to have occurred in DDraw.dll, and the others are at various locations in ins SimCity 4.exe.

    Yeah, every time I try to set dgVoodoo to directx12, it crashes the game. Which is a shame, because until it crashes it goes much more smooth. My card is crap, but it is dx12 compatible.

    I've been trying to reproduce the CTD with the reduced plugin folder without luck, if I can say it this way. So, maybe the crashes during my experimentation where just unrelated with the dat file and there is something else going on.

    In the meantime, I've got rid of the launcher by Dnullfying my SC4. Thanks for all your latest efforts. I hope we can have more tilesets coming soon.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    1 hour ago, Membrillo said:

    I hope we can have more tilesets coming soon.

    That would depend on other users creating them, and the UI file modifications that go with it. I have not had any feedback on the DLL, but it looks like 5 people have downloaded it from GitHub. I am concerned that it would not be user friendly enough to post in the STEX, even as a dependency. Because as far as I know there are not any Building Style mods that could make use of it. I already ran into the same issue with this mod. *:)

    I also wrote a DLL version of Cori's NKO mod that I have not released due to the two mods being so similar. The only difference between them is that my DLL version doesn't have the load order and property conflict issues that the BDS override patches can have. The DLL loads the BDS exemplar before SC4 reads it and sets the Tract Developer Kick Out Lower Wealth property to false on the in-memory copy of the exemplar. Abusing the game's in-memory cache to modify an exemplar is the same trick that the park-n-ride ordinance uses.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    5 hours ago, Membrillo said:

    Yeah, every time I try to set dgVoodoo to directx12, it crashes the game. Which is a shame, because until it crashes it goes much more smooth. My card is crap, but it is dx12 compatible.

    Apparently there are issues with DirectX12, so you should maybe try DirectX11 instead, generally speaking dgVoodoo has been super reliable when I was using it.


    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    8 hours ago, Membrillo said:

    Yeah, every time I try to set dgVoodoo to directx12, it crashes the game. Which is a shame, because until it crashes it goes much more smooth. My card is crap, but it is dx12 compatible.

    I've been trying to reproduce the CTD with the reduced plugin folder without luck, if I can say it this way. So, maybe the crashes during my experimentation where just unrelated with the dat file and there is something else going on.

    In the meantime, I've got rid of the launcher by Dnullfying my SC4. Thanks for all your latest efforts. I hope we can have more tilesets coming soon.

     

    3 hours ago, rsc204 said:

    Apparently there are issues with DirectX12, so you should maybe try DirectX11 instead, generally speaking dgVoodoo has been super reliable when I was using it.

    Directx 12 and SC4 do not get along very well as I have experienced a deterioration in performance especially in large cities. I think the wrapper fails to corectually translate DirectX 7 calls to Directx 12 calls. I recommend that you set up DgVoodoo in Directx 11 where you get a performance improvement


    Federal Republic of SiculiaFederal Republic of Sonora

       Ain Member  Wiki

    NAM Team - Co-developer of Pedestian Revolution Mod - Railway Department (Hybrid Railway | HRW Expert) - MTA Member - BAT Creator

    Ulisse Wolf YouTube Channel - Ulisse Wolf Mastodon Profile

    Share this post


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

    I'm following up on this topic because I'm trying to edit Equinox's Commercial Query by adding some of the new functions from the Query UI Extensions DLL.  I also notice that this new demand info will be similar to the information Equinox added for Commercial Office Demand and Active Office Demand.  This mod adds Commercial Services Active Demand, like "g_cs1_active_demand".  Is there a similar way to add "regular" demand?

    The function in Equinox's mod for CO$$ demand is: CO$$ Demand (Active): #game.g_co2_demand# (#game.g_co2_active_demand#)

    In looking at the list of LUA Constants identified in this post in the CORI Reports Thread and can see those items clearly displayed from the base game.  

    Since this mod add "g_cs1_active_demand", is there a way to also add something like "g_cs1_demand" (ie: not ACTIVE demand but "regular" or not-active demand?).  That way, the Query could report both numbers for Commercial Services (at all 3 wealth levels) similar to how the Commercial Query reports both #s for Commercial Office $$ and $$$ wealth levels.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    7 minutes ago, Kel9509 said:

    Since this mod add "g_cs1_active_demand", is there a way to also add something like "g_cs1_demand" (ie: not ACTIVE demand but "regular" or not-active demand?).

    That should be simple to add.

    Share this post


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

    That should be simple to add.

    Wow!  That's incredible.  Excellent!  

    Of course, I'm not even sure what "regular" demand is.  Is it just a "total" of all the acquired demand to date?

    And looking at the LUA Constants, I notice that all of the Industrial Demands are only "active" also in the base game as well (except for Agricultural, which Sc4MoreDemandInfo DLL adds).  I'm not sure why that is.  I'm assuming these numbers mean something and can be helpful to players, though.  If "regular" demand is just a "total" number, it might be useful if it could be reported for all the Industrial types also.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    26 minutes ago, Kel9509 said:

    Of course, I'm not even sure what "regular" demand is.  Is it just a "total" of all the acquired demand to date?

    I have no idea. Only the developers who wrote the game would know what all the variables are for.

    As far as I can tell, the active demand has current, min and max values, and is computed using a complex algorithm. Even the RCI graph rendering code is doing a lot of math with the 3 active demand values (current, min and max).

    26 minutes ago, Kel9509 said:

    And looking at the LUA Constants, I notice that all of the Industrial Demands are only "active" also in the base game as well (except for Agricultural, which Sc4MoreDemandInfo DLL adds).  I'm not sure why that is.

    I don't know that either. My best guess would be that Maxis only added the variables that were needed for their UI/LUA code. But it is inconsistent to have some variables expose the regular demand and others only expose the active demand.

    If you can provide a list of the new variables you want added, it would be helpful.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    18 hours ago, Null 45 said:

    f you can provide a list of the new variables you want added, it would be helpful.

    Ok, thank you.  I think these might be useful if they could be added:

    game.g_cs1_demand
    game.g_cs2_demand
    game.g_cs3_demand
    game.g_id_demand 
    game.g_im_demand
    game.g_iht_demand
    game.g_ir_demand

    Those are the ones that are "missing", based on the others being there in some manner.  I didn't ask to create variables for CS Caps, because according to the game they don't exist.  If you tried to create those I suppose it wouldn't work (maybe).

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 hours ago, Kel9509 said:

    Ok, thank you.  I think these might be useful if they could be added:

    I added those values for the next release.

    3 hours ago, Kel9509 said:

    I didn't ask to create variables for CS Caps, because according to the game they don't exist.  If you tried to create those I suppose it wouldn't work (maybe).

    It looks like the game reports 0% for the Cs caps. I could add them for consistency with the other cap values, but I am not sure it would be useful.

    Share this post


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

    Thank you very much!  I think that with those additions, there may be some new info that could help in building out cities.  And yes, I agree that reporting 0% for caps that the game never hits wouldn't be useful at all.  

    Share this post


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

    Release version 1.1.0, which adds a number of new demand variables.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    23 hours ago, Null 45 said:

    Release version 1.1.0, which adds a number of new demand variables.

    Thanks!  I think the Readme file probably should be updated to match your edit of the first post here.  

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    17 minutes ago, Kel9509 said:

    I think the Readme file probably should be updated to match your edit of the first post here.

    Done.

    Share this post


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

    Release version 1.2.0, which adds the following new variables:

    • g_region_r1_population
    • g_region_r2_population
    • g_region_r3_population
    • g_region_cs1_population
    • g_region_cs2_population
    • g_region_cs3_population
    • g_region_co2_population
    • g_region_co3_population
    • g_region_ir_population
    • g_region_id_population
    • g_region_im_population
    • g_region_iht_population

    Share this post


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

    Interesting and fun mod, ty!.

     

    An issue I cannot solve though:

    When replacing the RJ - Census_Repository_Model_and_Query_3.1.dat that came in the download https://www.sc4evermore.com/index.php/downloads/download/21-other/39-bsc-census-repository-building-by-ripplejet with the  RJ - Census_Repository_Model_and_Query_3.1.dat in the download 

     

    the lots are now brown boxes. I also tried the .dat from your  Census Repository Patch for MoreDemandInfo download as well, still brown boxes. The .dll is installed properly in the install path plugins folder,  the log created looks good. Going back to the original  RJ - Census_Repository_Model_and_Query_3.1.dat removes the brown boxes. Any tips? 

     

     

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    6 minutes ago, mojogojo said:

    Going back to the original  RJ - Census_Repository_Model_and_Query_3.1.dat removes the brown boxes.

    This is because it contains the models used in-game that generate the Query, you need to keep that file and ensure the file that comes with the DLL loads after (overrides) it.

    • Thanks 1

    Head over to my Lot and Mod Shack to keep abreast of my latest developments.

    Do you like custom textures, but don't like all the work involved creating them?, take a look at the Texture Automation options here. Change the look and feel of your transit networks, with the minimum of effort, for example customised versions of my Sidewalk NAM (SWN) and Terrain Grass NAM (TGN) mods, and much more besides.

    New to the NAM? Check out my tutorials on YouTube. Latest upload: How to: RHW - MHO Roundabout Interchanges. (Nov 25).

    p.s. - I'm MGB over on SC4D and a member of the NAM team.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    27 minutes ago, rsc204 said:

    This is because it contains the models used in-game that generate the Query, you need to keep that file and ensure the file that comes with the DLL loads after (overrides) it.

    I tried leaving the original .dat and adding the .dat from the  .dll download. Put it in a zzzfolder and checked SC4datanode and confirmed that the original .dat is overridden. Brown boxes still showing. I'll see if I can break open the original dat to get the models only. 

    Share this post


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

    I redid the whole installation, including making sure the newer .dat overrides the original. Everything is working properly now. I must have swapped the dats between the override folder. Thanks for your help!

    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