Jump to content
Null 45

Region View Census UI - DLL Plugin

23 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

A DLL Plugin for SimCity 4 that adds a census UI that can be shown in the region view.

The region census panel shows the totals for each RCI group in the region. It also allows the player to export a CSV file with statistics for the individual cities. The CSV file is written to Documents/SimCity 4/Region_View/<Region Name> using UTF-8 encoding. The region census UI can be activated from the region view using one of the following methods:

  • Clicking the middle mouse button.
  • Using the RegionCensus cheat.

Download: https://community.simtropolis.com/files/file/36145-region-view-census-ui-dll-plugin/

Source Code: https://github.com/0xC0000054/sc4-region-census

System Requirements

  • SimCity 4 version 641
  • 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 SC4RegionCensus.dll into the Plugins folder in the SimCity 4 installation directory.
  3.  Copy RegionCensusUI.dat into your SimCity 4 Plugins folder.
  4.  Start SimCity 4.

Troubleshooting

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

  • Like 3

Share this post


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

You're gonna hate me *:lol:, but it crashes the game for me. It partially loads the region screen (it loads the UI but the map is black) and then it crashes. It isn't an incompatibility with another plugin because I have tried everything: full plugins folder, empty plugins folder, removing all other DLLs... So even with just this DLL and no other mods, the game crashes. I have CAM, I haven't tried restoring the original Simcity_1.dat, but I can't think a reason that will be the conflict.

Win11. 641. Steam version. dgVoodoo.

The log file doesn't report any error: SC4RegionCensus v1.0.0

Share this post


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

    It partially loads the region screen (it loads the UI but the map is black) and then it crashes.

    I can't think of anything that would cause that. Does SC4 write a crash log?

    Share this post


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

    Yes, the exception is the DLL.

    Could you re-upload that zip with the exception minidump file(s) that SC4 generated? The only information in those text files is a memory offset that I am having trouble making sense of.

    Share this post


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

    Release version 1.0.1, which fixes a crash when loading a region and improves the plugin's error reporting.

    • Like 1

    Share this post


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

    I'm looking at this mod's UI file, comparing the information reported here with other Queries.  It seems that the information in this mod reports information that is not really available anywhere else.  All of the regional data reported in this mod seems like "actual population counts", whereas other information reported in the Census Repository or Equinox's Query, are "capacity" amounts or workforce (both Commercial and Industrial job) amounts.

    Are these stats native to the game or did the DLL mod "create" them?  Can these stats be used elsewhere, in queries within a city? 

    Share this post


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

    Are these stats native to the game or did the DLL mod "create" them?

    They are native to the game, part of the cISC4RegionalCity class.

    30 minutes ago, Kel9509 said:

    Can these stats be used elsewhere, in queries within a city? 

    Probably. It looks like the regional city data is cached from the current city, which SC4 periodically updates. Which values are you interested in?

    I had noticed that a lot of the population values shown in the region view appeared off, e.g. the residential total didn't match the totals for the 3 residential wealth groups. I just wrote it off as Maxis math.

    Share this post


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

    Probably. It looks like the regional city data is cached from the current city, which SC4 periodically updates. Which values are you interested in?

    I'm thinking of adding some of these stats to my project to revise Equinox's UI Queries, particularly since I found that he has errors in his original queries that need to be fixed and could be fixed with these numbers.  Also, there is a big gaping hole in the Census Repository that might be filled with this info:

    66399d66ad6bd_CensusRepository-2.jpg.6d3bc223795fa8afe7b82d4ac86a9252.jpg

    (In fact, now that I think about it, I wonder if the blank "Projected" amounts can finally be filled in with the information reported in your SC4MoreDemand mod....  It seems like that's the data that was missing originally in the first place from the demand numbers.)

    I realize that the values don't 100% match.  I wonder if it's a matter of "capacity" versus "actual amounts"? Here's the same data reported in your Census:

    66399d93dfa2a_RegionCensus-1.jpg.918a45fbe9b5ba59d2eb4ab2a1733447.jpg

    Share this post


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

    Also, there is a big gaping hole in the Census Repository that might be filled with this info

    It appears that the game's region RCI population totals (g_region_r_population, etc.) are retrieved from the demand simulator, I don't know how much those values would differ from the cached regional city data.

    If I was going to add values that are retrieved from the regional city data, I would be using new values (e.g. g_region_r_population_total, g_region_r1_population_total, etc.). This avoids the problem of breaking things by overwriting the default Maxis values.

    20 minutes ago, Kel9509 said:

    (In fact, now that I think about it, I wonder if the blank "Projected" amounts can finally be filled in with the information reported in your SC4MoreDemand mod....  It seems like that's the data that was missing originally in the first place from the demand numbers.)

    Looking at the query LTEXT, the Projected values appear to be using the game.g_xx_demand variables. Which I already added to the more query info DLL for the missing RCI groups.

    23 minutes ago, Kel9509 said:

    I wonder if it's a matter of "capacity" versus "actual amounts"?

    I suspect the difference could be due to the regional city data being a snapshot of the data for each city, whereas when a city is loaded the game will be updating the city demand and population data while simulation is running.

    Share this post


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

    If I was going to add values that are retrieved from the regional city data, I would be using new values (e.g. g_region_r_population_total, g_region_r1_population_total, etc.). This avoids the problem of breaking things by overwriting the default Maxis values.

    I thought this Region mod did in fact use new values, but I guess I was mistaken.  Even still, it is great.  Do you know if it'd be possible to create new values though?  Like:

    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

    If those were available, all the gaps in the Census Repository could be filled.  And you're right, your SC4MoreDemandInfo partially fills those gaps.  I  have a feeling I'll try editing the Census Repository next to add as much as I can into it.

     

    Share this post


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

    Do you know if it'd be possible to create new values though?

    It would be, I just have to decide which DLL to put it in. I am currently thinking that MoreDemandInfo would be the more appropriate DLL.

    The query UI and MoreDemandInfo DLLs expose the values using different methods. The query UI DLL uses the game's string token system, so its values can only be displayed in a query dialog UI. MoreDemandInfo uses the game's LUA system (the game.nnn variables), this allows the values to be used in LUA calculations in addition to being displayed as a string.

    The reason I suggested using new g_region_nn_population_total values for the region RCI population totals is that the game's built-in g_region_r_population value would be from a different source than the g_region_r1_population value.

    Share this post


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

    The crash mentioned above only happens in blank regions (regions with no city files, including regions created by the game itself), though I haven't tested if it happens when some cities are present and others aren't. Seems like it might be a null pointer exception, not sure how that could be fixed...

    Share this post


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

    The crash mentioned above only happens in blank regions (regions with no city files, including regions created by the game itself), though I haven't tested if it happens when some cities are present and others aren't. Seems like it might be a null pointer exception, not sure how that could be fixed...

    It should have already been fixed. I just tested it in a blank region, and the game didn't crash.

    Share this post


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

    Maybe I'm using an outdated version?

    The current version is 1.0.1. If you are using 1.0.1, please zip and upload the crash logs (.txt and .mdmp).

    Share this post


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

    Okay, I downloaded it again, and it seems like the problem is fixed.

    Share this post


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

    For clarity sake, I just wanted to make sure what "Rxxx extrapolated pop." means?

    An anticipated population of a group given the current development trend in a city?


    The "SimCity 4" vanilla Opera House is the most evil thing in existence. Avoid.

     

    My city journals! *:read:
    - SimCity: Tribalism - seven urbanization concepts clashed together
    Saving Magnasanti... - the most depressing city in history being revitalized

    Also worth checking...
    - "TMC's Drawing Board" - my city designs and plans.
     

    Share this post


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

    An anticipated population of a group given the current development trend in a city?

    Possibly, only Maxis would know for sure what it is as they wrote the relevant algorithms.

    Share this post


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

    Possibly, only Maxis would know for sure what it is as they wrote the relevant algorithms.

    Oh... I thought that you added this. Ok, thanks.


    The "SimCity 4" vanilla Opera House is the most evil thing in existence. Avoid.

     

    My city journals! *:read:
    - SimCity: Tribalism - seven urbanization concepts clashed together
    Saving Magnasanti... - the most depressing city in history being revitalized

    Also worth checking...
    - "TMC's Drawing Board" - my city designs and plans.
     

    Share this post


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

    Oh... I thought that you added this.

    No, I am just pulling data from the game's C++ API.

    • Like 1

    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