Jump to content
smf_16

discovery Modifying .sc4 savegames: It IS possible!

smf_16

Information

For updating to the latest version package, remember to run the following command:

npm install -g sc4@latest

Message added by smf_16

230 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
Currently: Viewing Forums Index
 

@smf_16

Wow! Just: Wow!

This looks extremely exciting. *:)

I'm not at all familiar with this Node JS thinger so I'm going to read up on it a bit. Can I assume it allows you to write your C++ code which then does not need any compiling because Node handles that? I'm curious how it works from your creation side. ( I've done minor programming using TinyC, but I've not advanced to the more modern and sophisticated tools. *:blush: )

Anyhow, my next couple of days are rather busy, but I hope to have time to test your program over the weekend. I hope you won't mind if I just reply here rather than at the Github Repository since I'm also not familiar with that other than I've downloaded code from there before.

-Cori

  • Like 6

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
Posted:
Last Online:  
Currently: Viewing Forums Index
 

Ok, I'm still peeking at what I've downloaded from your Github. Am I correct that the code in cli.js is the part your wrote? My curiosity is such that your work is giving me some grand ideas of things I want to incorporate with my TinyC map generator programs. *;)

And I will test what you have created, but it'll be when I have more time this weekend.

  • Like 7

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
Posted:
Last Online:  
 

Wow. This sure sounds like a great and promising discovery. I don't have any programming skills, so I can't understand most parts of your explanation, but the results seem impressive so far. I'm always glad to see people finding new ways of tricking SC4 into doing what we want. Following this topic now to see how it develops.

About the no job zots: These might also have reasons not related to your modifications of your savegame. In general, they appear whenever Sims can't find a job, so if there was no (suitable) industrial/commercial lot in your city, it's only logical that the zots will appear.

  • Like 5
  • Yes 2

11241036 Lotting/Modding Thread - Support for all of my uploaded plugins

Visit my CJ Maxiland, where I'm taking on an enlarged version of Timbuktu!

 

Share this post


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

    Yeah it weren’t no job zots, but actual no road access zots. However I did indeed not have any commercial or industry in that city and I vaguely remember having seen this before back in the days.

    It’s going to need some additional testing in the coming days, but given that everything worked in the city with more lots (and jobs) it’ll probably have something to do with that.

    • Like 4

    Visit www.growifier.com for ploppable residentials

    Love playing hearts and other card games? Have a look at www.whisthub.com!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    3 minutes ago, smf_16 said:

    Yeah it weren’t no job zots, but actual no road access zots. However I did indeed not have any commercial or industry in that city and I vaguely remember having seen this before back in the days.

    That is typical of the game. If there is no jobs available via the road then you get the no road access zots. So, all is well on that front.

    • Like 6
    • Yes 2

    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
    Posted:
    Last Online:  
     

    Hmmm... Regarding the issues with the residential lot above, is it possible that lots are stored into different tables? One for plopped lots and one for grown lots? I believe I mentioned this before. How are the lots stored, actually? One table? Two, separated by whether it was grown or plopped? Based on the type of lot? Are transit-enabled lots handled differently or the same?

     

    Now that we have the checksum figured out, this also begs the old questions:

    1. How are bridges and tunnels saved? Are they only saved at the ends?

    2. How would the game respond to bridges being adjacent or intersecting?

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    3 minutes ago, Wiimeiser said:

    whether it was grown or plopped?

    Based on the following, I'd day it's in that zoneType property in the Lot Record so only one record per lot needed.

     

    2 hours ago, smf_16 said:

    The plopped R§ building has its zoneType set to "Plopped building" (0x0000000f) whereas the grown building has it set to "R - Low" (0x00000001).

    • Like 4
    • Thanks 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
    Posted:
    Last Online:  
     

    I did see that just now. I wonder what each possible value does, like, would AC be a valid value? And do we have a list of what each known value is?

    • Like 2

    Share this post


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

    Hmmm... Regarding the issues with the residential lot above, is it possible that lots are stored into different tables? One for plopped lots and one for grown lots? I believe I mentioned this before. How are the lots stored, actually? One table? Two, separated by whether it was grown or plopped? Based on the type of lot? Are transit-enabled lots handled differently or the same?

    For all I've seen, every lot is simply stored in the Lot Subfile, regardless of whether its grown or plopped. You can see that in my image of the Savegame explorer, the last entry there was the Windmill I plopped. It seems like the only difference here is the zoneType property. The fact that changing this zoneType property from "Plopped" to "R - Low" also caused a green rectangle to be shown in the Zone View, so I'm guessing the game determines your zones based on what is stored in this Lot Subfile as well.

    Quote

    I did see that just now. I wonder what each possible value does, like, would AC be a valid value? And do we have a list of what each known value is?

    Well there's at least a partial list as the Savegame explorer gives me a human-readable form of the zoneType, not the raw hex value (it's a pity that you can't see the underlying hex value in the Savegame explorer though). Hence it has to be in the source code somewhere. I'm guessing 0x00000001 is R - Low, 0x00000002 is R - Medium and so on, where plopped is 0x0000000f. Let's hope that the checksum discovery draws some new intrest in decoding the savegame, as a lot of it is still unknown.

    I'm actually interested in the story behind how @simmaster07 found the checksum algorithm. From what I've read he uses the Mac version which is non-obfuscated or something. Still it's remarkable that it hasn't been noted that this could make editing savegames possible as well.

     

    - Seba

    • Like 7

    Visit www.growifier.com for ploppable residentials

    Love playing hearts and other card games? Have a look at www.whisthub.com!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 6/19/2019 at 5:47 AM, smf_16 said:

    This couldn't mean that it would make modifying savegames possible, right? Well turns out it does! 

    in all seriousness: what a time to be alive! the work that modders are doing w this lovely game, 16 years after it was first released, is really amazing. bravo! 

    • Like 7
    • Yes 2

    Share this post


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

    It would be nice if you could find a way to force the alpha blend in SimCity 4 ...

    190131104904639708.png  190130023347206866.png

    It would help us to reduce the size of .sc4model files by 75%, create decals, avoid alpha bleeding, jaggered edges, etc, etc.

    • Like 3

    Discord: JLeCoultre#9124

    My Simtropolis BAT Thread

    Share this post


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

    I set "R - Low" for the plopped building as well, and saved the .sc4 file again, recalculating the CRC checksum

    Now we just need a switch so we can choose the density (or the script might use some metric so it can set an appropriate density for each R lot it finds). And then there are the plopped commercial and industrial lots, working landmarks etc, but they're not as much of a problem as the residentials have been.

    • Like 2

    -- Jeff Fisher ><> Vancouver WA
    "I may be pissing into the wind, but if I keep my enemies behind me and aim carefully, I can still rain on their parade."

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     

    This is really something! Another brilliant breakthrough with allowing plopped residentials to be functional. Even though testing will be needed to ensure there are no unintended side effects, it's an area which never seemed even remotely reachable, and how they just abandon otherwise. It might be useful to try using the Extra Cheats DLL for running the BuildingPlop or LotPlop commands. This allows plopped RCI and other lots to be built from a selection window.

    For decoding the subfiles, that certainly will establish the groundwork for understanding what can be done. Lots of this will need trial and error, and to slowly build up a clearer picture of how each matches up with the various class sizes. Looking at previous attempts to investigate the inner-workings, there's lots to be learned there which may help to make sense of certain aspects. As you say, there's no rush for any of this to be done overnight, and it can be a pathway to discovery which is slow and still successful. I know how small ideas to begin with can often lead to bigger things too. So just from initial proof of concepts and it's all an important step.

     

    1 hour ago, smf_16 said:

    PS Forgive me the double post, but I felt that this content deserved a post of its own because it's about something entirely different than my previous one.

    It's all good, and absolutely fine. This is your topic where you're free to reply as many times as you wish, consecutively or otherwise. We've relaxed the old rules of topic bumping to aim for a much more friendlier atmosphere here now on the forums. Splitting replies of different subject matter helps with clarity too. *;)

    • Like 7

    Quick Links

    “SimCity 4 is not just a game, but a tool driven by our own imagination and creativity.”

    Buy me a coffee

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     

    @smf_16

    One thing you mention in your comments starting at line 264:

    // I think there's an error on the SC4D wiki. It states that the §, §§
    // and §§§ capacities are floats, but this seems to be incorrect.

    And peeking at those in Reader (both 0.9.3 and 1.5.4) they are indeed unsigned integers:

    7010-0217.jpg

     

    When you found float on the Wiki page, was that in the Exemplars Properties? Checking there a moment ago, I see it is listed as Uint32 so I'm prolly looking at a different line. I do know property 0x27812834 is where the building's capacity is set.

    If there is indeed an error with the Wiki information I can edit it. *;)

    • Like 7

    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
  • Original Poster
  • Posted:
    Last Online:  
     

    @CorinaMarie It was in the documentation of the Lot Subfile. If I remember correctly, the values didn’t seem to make any sense when being read as floats, but it’s possible that it was an error of my side as well *:D Actually I don’t use this “parseComplete” method anymore. I started implementing it, but then I realized that I could just work on the raw buffer itself without having to fully parse the entry. Hence I didn’t test the method any further. I would leave the Wiki as it is for now, or perhaps put something there that says it has to be clarified whether it’s a float or uint16.

    • Like 4
    • Thanks 1

    Visit www.growifier.com for ploppable residentials

    Love playing hearts and other card games? Have a look at www.whisthub.com!

    Share this post


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

    YES!!!! Yesyesyesyesyesyes!!!!!! This is the Holy Grail of SC4!!! Man, I've spent so many frustrating hours bulldozing and redeveloping areas wishing there was a way to plop functional residential buildings. @smf_16 Many of us will be ever so grateful to you just for kicking this into gear, this is truly a complete gamechanger :ohyes:

    • Like 7
    • Yes 1

    Check out my content on the STEX

    Or pay a visit to my Lot thread to see the projects I'm working on!

    Mi taller de lotes, ¡Ahora en español!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
    Currently: Viewing Forums Index
     
    6 hours ago, smf_16 said:

    I would leave the Wiki as it is for now, or perhaps put something there that says it has to be clarified whether it’s a float or uint16.

    I'll hold off on any edits to the Wiki for now. Your tests seem conclusive to me that it is not a float and the Wiki and Reader both agree it is Uint. The only difference being they say Uint32. I wonder if we should mod a building with an extremely high capacity for testing your code. I'm concerned the data in the .sc4 file could be larger than a Uint16 can hold.

    On a possibly related note, @Klyte45 created the KREW - Klyte's Region Exporter as Webpage using Java and there were some properties in the one of the City SubFiles which were unknown to them at the time. Thru testing I figured those out. In case you run into them, here's the results of my tests:

    On 14/02/2019 at 5:30 AM, CorinaMarie said:

    Number of Eligible Workforce Sims per Education Bracket

    R$
    0x2111: EQ is 0 - 49
    0x2112: EQ is 50 - 99
    0x2113: EQ is 100 - 149
    0x2114: EQ is 150+

    R$$
    0x2121: EQ is 0 - 49
    0x2122: EQ is 50 - 99
    0x2123: EQ is 100 - 149
    0x2124: EQ is 150+

    R$$$
    0x2131: EQ is 0 - 49
    0x2132: EQ is 50 - 99
    0x2133: EQ is 100 - 149
    0x2134: EQ is 150+


    I have one more grueling day of RL work and then I'll be able to do some testing for you.

    • Like 5

    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
  • Original Poster
  • Posted:
    Last Online:  
     
    48 minutes ago, CorinaMarie said:

    The only difference being they say Uint32. I wonder if we should mod a building with an extremely high capacity for testing your code. I'm concerned the data in the .sc4 file could be larger than a Uint16 can hold.

    Could very well be a Uint32, and as you say it would be a lot more logical as well. The thing is that I had some difficulties here parsing the Lot File which is why I switched to the buffer implementation instead, but left the already written code there in case I would ever need it again. Yesterday I've noticed that I missed something from the Lot Subfile documentation:

    DWORD	Memory Address for linked industrial lot
    DWORD	0x4A232DA8, Industry Subfile Type ID. Appears only if the previous DWORD is not 0x00000000
    DWORD	Memory Address of the Anchor or Farm Lot
    DWORD	0xC9BD5D4A, Lot Subfile Type ID. Appears only if the previous DWORD is not 0x00000000

    I read over the fact that that 0x4A232DA8 and 0xC9BD5D4A were only present if the former value was not 0x00000000 (perhaps some indentation in the docs would help here). This probably caused some offset mismatches which I tried to correct by assuming those capacities where UInt16's instead of UInt32's. Or something like that. *:D For the purpose of the plopped residentials it doesn't matter too much anyway as I could derive everything I needed from the jobCapacities entry. The wiki isn't too clear about this though, as it states

    BYTE	Count  (0x00 or 0x01)
    BYTE	Count of RCI Types  (0x01, 0x02 or 0x03)
    DWORD	Demand Source Index  (See Appendix 4 below)
    WORD	Capacity

    which took me longer than needed to realize that the the Demand Source Index & Capacity were repeated count times. The Savegame explorer came to the rescue here.
    Now that I see the docs above, I've come to think that the Capacity may be a Uint16 after all, as the docs state here that it's a WORD, so 2 bytes. Maybe this means that in the Lot Subfile capacities are given as UInt16's, while being UInt32's in Building exemplars. Wondering indeed what would happen if we were to create a building with more than 65 535 capacity. Would the game start counting from 0 again, crash, ... ? Who knows *:lol:

    I'm going to do some additional testing tonight as well. I'm planning on using the make historical and ploppable residentials in already established cities and continue playing them for a while to see if I can spot some side effects.

    • Like 8

    Visit www.growifier.com for ploppable residentials

    Love playing hearts and other card games? Have a look at www.whisthub.com!

    Share this post


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

    Amazing work!  I for one am thrilled a the prospect of marking everything historical.  I would much rather selectively demolish than selectively mark historical.  For one, demolishing is a lot faster than marking historical.

    • Like 5
    • Yes 1

    Proud member of the NAM development team.

    Share this post


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

    I can't find a word to define this wonder!!! Thanks @smf_16 , @simmaster07 and others to dedicate a time to discover and share with us this things to add easiness and become game more fun. A new horizon is borning to SC4 and your community, giving it at least more 20 years of life.

    17 hours ago, smf_16 said:

    It would be very much appreciated if some people could test this as well to see if there are still issues. I would love to hear some feedback.

    I would like test, but I don't know about node js and developer tools. Is there step by step instructions?

    Can I use Reader instead of savegame explorer?

     

    • Like 6

    "Nenhum sucesso no mundo compensa o fracasso no lar." - "No other success can compensate for failure in the home."
    Como fazer da sua família um time de sucesso! - How to make your family a successful team!
     

    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