Jump to content
smf_16

Programmatically generating a city: A savegame experiment

122 posts in this topic Last Reply

Highlighted Posts

  • Original Poster
  • Posted:
    Last Online:  
     
    10 hours ago, Cyclone Boom said:

    Also it's great how you've shared all these details, even if for some of us it's rather very complicated.

    I do this on purpose so that anyone wanting to take up savegame editing would have the most information possible. Not just a list of results that I have found, but also the process that was behind it: trying out different things, trying to identify links between different parts and so on.

    1 hour ago, clarencethemayor said:

    Hey @smf_16, even though you did not see your inserted lot in the game, did the Query Tool or any of the Data Views recognize it as a lot?

    They did not unfortunately. The Query Tool just showed "Unzoned land" and neither of the Data Views reported the lot being present, but that was quite expected as I didn't modify any of its cSC4SimGrid classes and I know that for example the power paths are stored in here.

    I've attached the city to this post so you can mess with it a bit yourself. It uses the 1x1 Chicago tileset lot that was created by @CorinaMarie. There will be a lot at position (0, 1) and I tried to insert my new lot at position (2,1). You'll see that in the Savegame Explorer the lot and building are recognized nicely, but that's probably because SGE doesn't really care about the item index and just displays whatever it finds in the Lot and Building Subfiles. I thought that SC4 started from the Item Index and then decided what it should draw, but it appears that there's something else controlling it under the hood.

    If you're interested in the code that I used to plop it, I've added it below.

    Spoiler
    
    function clone(obj) {
    	return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
    }
    
    let buff = fs.readFileSync(path.resolve(__dirname, 'files/City - plop test.sc4'));
    let dbpf = new Savegame(buff);
    
    let index = dbpf.itemIndexFile;
    let lots = dbpf.lotFile.lots;
    let source = lots[0];
    
    // Create the new lot and add it to the lots as well and add to the 
    // **zone developer**.
    let lot = clone(source);
    lot.mem += 4;
    lot.minX = 2;
    lot.maxX = 2;
    lot.commuteX = 2;
    lots.push(lot);
    
    // Clone it's sgprops as well.
    lot.sgprops = lot.sgprops.map(clone);
    lot.jobCapacities = lot.jobCapacities.map(clone);
    lot.jobTotalCapacities = lot.jobTotalCapacities.map(clone);
    
    // Remember! This goes per **tile**! Not per tract!
    let dev = dbpf.zoneDeveloperFile;
    for (let x = lot.minX; x <= lot.maxX; x++) {
    	for (let z = lot.minZ; z <= lot.maxZ; z++) {
    		dev.cells[x][z] = {
    			"mem": lot.mem,
    			"type": FileType.LotFile
    		};
    	}
    }
    
    // Create the building on the new lot.
    let buildings = dbpf.buildingFile.buildings;
    source = buildings[0];
    let building = clone(source);
    building.mem += 4;
    building.minX += 2*16;
    building.maxX += 2*16;
    buildings.push(building);
    index.columns[64][64].push({
    	"mem": building.mem,
    	"type": FileType.BuildingFile
    });
    
    // Add the building to the lot developer.
    dev = dbpf.lotDeveloperFile;
    dev.buildings.push({
    	"mem": building.mem,
    	"type": FileType.BuildingFile
    });
    
    // Now add the texture as well.
    let txs = dbpf.baseTextureFile.textures;
    source = txs[0];
    
    // Don't forget that the textures array needs to be cloned as well!
    let tx = clone(source);
    tx.textures = tx.textures.map(clone);
    tx.mem += 4;
    tx.minX += 2*16;
    tx.maxX += 2*16
    tx.textures.forEach(function(tx) {
    	tx.x += 2;
    });
    txs.push(tx);
    
    // Add to the item index.
    index.columns[64][64].push({
    	"mem": tx.mem,
    	"type": FileType.BaseTextureFile
    });
    
    // Time for action: save!
    await dbpf.save({"file":path.resolve(REGION,'City - Plop test.sc4')});

     

    Interestingly, if I comment out all of the building & texture stuff and just create a new lot, the game doesn't show "Cannot build on top of reserved tiles". I'm thinking that perhaps I should just try messing with the SimGrids and see if something happens.

     

    - Seba

    City - Plop test.sc4

    • Like 2

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

    Hello all,

     

    I've done some more experiments with the SimGrids that I managed to decode yesterday. This time used a city that was a bit more established so that I would be able to see better what everything means. As a first test, I filled up all SimGrids with zeroes just to see if the city would even open up. It did, and as expected all data views were reporting, well, nothing. No fire hazard, no crime, no power being carried, no traffic congestion, just nothing - which is quite logical after all. However, all lots still showed up properly so at least this rules out the hypothesis that the simgrids were controlling whether lots appear or not. That was actually already what I expected yesterday, but it's nice to have it confirmed.

    I also ran my pdf generating script again and the data views it renders are now a little more comprehensive. I've added the pdf file in attachment, as well as the city. It's a vanilla small city so everyone should be able to import it within an existing region. It looks like this:

    ufoO98b.png

    Now I modified the pdf generating script a bit so that it shows the data id which is stored in the header as a hexadecimal number. We already knew that 0x49d5bc86 is the power data view, but based on the pdf file we can already guess what some others will be, notably:

    • 0x69d5c40e (Float32): Traffic related, probably all trafic
    • 0x69d5c3ac (Float 32): Traffic related, probably car traffic
    • 0x69d5c3e0 and up (Float 32): Traffic related.
    • 0x49d5bc40 (Int16): Probably air pollution
    • 0x89d5b91a (Int16): Probably fire coverage effectivity
    • 0x49d5b678 (UInt8): Probably zone view
    • 0x49d5bb8 and 0x49d5bba1 (UInt8): Probably water data view

    Now I could go on and find out what each of them does, but I don't see the point in that for the moment. It's not related at all to what I want to achieve. Perhaps someone with access to the debug symbols could have a look at what all the data ids mean - perhaps they are named somewhere - but I wouldn't pay too much attention to this for now.

    So, what does this mean for plopping the lots? Well it means that I'll have to keep on searching. I've decided that instead of plopping a lot, I will see if I can manage to define some zones programmatically first. I'm curious whether the lots not showing up when having them generated would also happen when creating new zones. I do have some RL stuff to do though so I'm not sure yet when I will be able to tackle this.

    Take care!

     

    - Seba

    output.pdf

    City - Established.sc4

    • Like 5

    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:  
     
    13 hours ago, smf_16 said:

    It uses the 1x1 Chicago tileset lot that was created by @CorinaMarie.

    I discovered that the Ploppable Lot would also grow on its own. I've fixed that so it won't happen now and attached a new version to that post.

    • 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
    Posted:
    Last Online:  
     
    On 6/29/2019 at 9:08 AM, smf_16 said:

    Perhaps someone with access to the debug symbols could have a look at what all the data ids mean - perhaps they are named somewhere -

    I attempted to get the list for you by extracting all the DataView exemplars, but those numbers aren't what you need:

    7010-0340.jpg

     

    The IIDs are in the 0x4a0b68xx format. Then I checked the DataView: Data source and the one for Power is 0x00000007. So, I guess there's no place I know where to find them. :O

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

    Hello everyone,

     

    After I gave my mind some very much needed rest the past days, I decided to have a look at the project again. I said that I would see if I could create zones, but then I realized that there’s an even simpler type of object I could try to create: Flora. The Flora Subfile is nicely decoded and so it was trivial to write a parser for it so that I could modify it.

    I created a small city tile with 1 tree and then cloned that tree, moved it a few meters, assigned it a unique memory address and inserted it into the item index.

    Searching for references to the original tree told me that this was all I had to do. Still, when I opened up SC4 again, the new tree wasn’t showing. Just to see if changing the flora file had any effect, I removed both trees from the subfile and the item index. The result was as expected: no more trees were showing. This shows that it has at least some effect.

    So, just when trying to clone lots there still have to be other variables that cause the tree not to show. I already often thought that perhaps there’s still a list somewhere of all memory references used in the entire savegame, but this is not possible because my ref search points out a flora item is only referenced in the item index!

    The only thing I can still think of is that perhaps somewhere the amount of all flora items is stored somewhere. This would explain why my ref search doesn’t find it. I’m going to test this by starting with 2 trees and then remove one and insert a new one. This should keep the length the same. Those experiments will be something for tomorrow though!

     

    - Seba

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

    You know, I just had like this, like HUGE breakthrough:

    Spoiler

    oAnne5L.jpg

    So, what happend here? During my writing of yesterday's post I realized that perhaps the amount of flora items was stored somewhere, which would explain why the ref search didn't find it. In order to test this I created a new small city with quite a lot of trees, at least sufficient trees (apparently 1910 in this case, 0x776 in hex) for it to be a rather unique number within the Savegame. Then I simply searched the entire Savegame for this number in the same way as my memory reference search worked and it reported that this number was encountered in cSC4COMSerializer::SaveClassObjects. I had a look at the 4 bytes that came before the number 0x776 and those corresonded exactly to the Type ID's of the Flora Subfile: 0xa9c05c85.

    Bingo! I examined this cSC4COMSerializer a bit more in depth and I found that a lot of the known Type ID's occured in here as well, all with the number of records of this Type ID coming after it, which we could have guessed already from finding the Flora Subfile. The file seemed to have a 12-byte header though, so I'm inclined to say that the structure looks like this (note the absence of a CRC here):

    DWORD	Unknown, seen 0x00000001, version number?	
    DWORD	Amount of Type-Count pairs	
    DWORD	Unknown, perhaps Memory?	
    (Repeat for Count times)		
    	DWORD	Type ID
    	DWORD	Amount of records in that type's subfile
    

    Once I knew this, I just had to set the length of the Flora Subfile to the amount of records in it and the flora that I generated with my script showed up correctly in the game. No CTD's when exiting to region without saving either!

    So, I'm pretty sure that the lots not showing up has the same root cause. I'm going to test this as soon as possible, but I simply couldn't wait to share these amazing results already!

     

    - Seba

    • Like 5
    • Yes 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:  
     
    2 hours ago, smf_16 said:

    Once that is done, I guess we can consider part 1 of this project finished.

    Impressive work. It seems to me that you have opened the door to many exciting possibilities.

    • Yes 3

    Check out my Linux Tutorials - How to use Wine with SC4D, NAM, Modding Tools

    Share this post


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

    Another amazing discovery!

    On 7/4/2019 at 5:51 AM, smf_16 said:

    The only drawback here is that you can't touch your streets anymore because this would cause the trees to disappear, even if you draw over it.

    Do the extra cheats with 'flora'....eg:

    * Flora on

    * Flora preserve off

    * Flora propogation on (sic)

    ....do anything in these instances?


      Edited by mattb325  

    For some reason it wouldn't let me quote the first time around (or now) but my post only refers to the street tree elements
    • Like 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    12 hours ago, mattb325 said:

    Do the extra cheats with 'flora'....

    <snip>

    ....do anything in these instances?

    I believe those are the code words to access little subroutines within the game executable which would then write its data to the save file. But in and of themselves as routines would not be apparent in the save game data. Only the results they created would show in the various sub files of the save.

    • Like 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
  • Original Poster
  • Posted:
    Last Online:  
     
    On 4-7-2019 at 1:56 AM, mattb325 said:

    Do the extra cheats with 'flora'....eg:

    * Flora on

    * Flora preserve off

    * Flora propogation on (sic)

    ....do anything in these instances?

    I don't know what "preserve" and "propagation" are used for, but I did test "flora off" and it correctly removed all trees from the streets. Interestingly in my city with the immortal flora, it seemed like it'd removed all flora, however when I changed zoom levels all immortal trees re-appeared. That's actually not what I expected: I'd think that "flora off" simply clears the array of all flora but apparently it still looks at the item index.

    • Like 1
    • Thanks 2

    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:  
     
    6 hours ago, smf_16 said:

    I don't know what "preserve" and "propagation" are used for, ....

    I thought I'd added an article to the Omnibus on the extra cheats ..... will do later, but this is what it says for Flora

    Quote

    Flora (on | off) | (preserve on | off) | (propogation on | off) | (blast )

    Controls flora simulation parameters. By default, during city play flora simulation is on, preservation is off, and propogation is off. Preservation refers to the keeping of trees on land when the land is developed. Propogation refers to the spreading of seeds and automatic creation of new flora life in the city.

    I think "propogation" should be propagation or at least that would make more sense

    -catty

    • Thanks 2

    Share this post


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

    Hello everyone,

    It's been some time, but I've recently gained new interest in this project. I already forgot that back in July I actually had been able to clone lots. The next step is thus being able to plop them without already being present in the city. As a small recap, this process globally looks like this:

    • Find the LotConfigurations Exemplar of the lot to plop.
    • Add an entry in the Lot Subfile of the Savegame
    • Add the building found in LotConfigPropertyLotObject to the Building Subfile of the Savegame
    • Add all props found in LotConfigPropertyLotObject to the Prop Subfile of the Savegame
    • Add all textures found in LotConfigPropertyLotObject to the Texture Subfile of the Savegame

    Back in July I've already written a data structure that can index all files in the Plugins folder by their TGI. Such a structure is essential because I need to be able to link files together and therefore I need to know where to find the appropriate linked files.

    The problem I'm currently facing though is that I don't really understand how the Group ID actually works. As an example, I'm using Diego Del Llano's magnificent recreation of 432 Park Avenue - gotta aim high, right? *:D

    Anyway, if we inspect the DiegoDL-432ParkAvenu-LM-DN.SC4Lot file, we find it has two Exemplars in it: a Building Exemplar and a LotConfigurations exemplar, as was to be expected according to RippleJet's tutorial:

    LxBul5I.png

    Inspecting the first LotConfigPropertyLotObject - which should contain the building IID - we find

    4hiPcfg.png

    The last rep here represents the building IID, which is 0x483248bb. Now this is the part that I don't understand. There's no reference to the Building Exemplar's Group ID, so I don't know how I can find the appropriate Building Exemplar in my index. As mentioned, the .SC4Lot file contains two Exemplars, but both have IID 0x483248bb. It's the one with Group ID 0xd60100c4 that we need.

    So my question is, how do I know what Group ID to look for. The game itself has to do it in a way as well. Of course I could simply look for all Exemplar files with IID 0x483248bb and then find the one that is actually a Building Exemplar, but that requires me to parse every exemplar file with that IID first. Additionally, the question arises what happens when there are multiple Building Exemplars with the same IID, but different GID's. Or does the game - and the community - simply assume this will never happen? Quite a lot of open questions here, so I'm hoping someone with a bit more modding experience can shed some light on this (thinking spontaneously of @CorinaMarie, @Cyclone Boom and @mattb325). Thanks!

     

    - Seba

    • Like 3

    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:  
     

    Hi again Seba, and it's great to see you're back into SC4 modding. *:)
    (And already with your new tileset tools as revealed yesterday.)

     

    1 hour ago, smf_16 said:

    So my question is, how do I know what Group ID to look for.

    The Group ID format is the 2nd part of the TGI for how it allocates similar related entries. With FSH textures for example, it's what defines the scaled sizes for how IIDs increment per zoom level. In terms of inside the LotConfig data, that Rep 13 value there as you've highlighted must correspond to the IID of the Buildings exemplar (as you've correctly identified). I see how you're looking for a way to lookup this GID so then it'll simplify filtering for a specific individual plopped lot. That way it'll make it more of a direct reference similarly in the real world to having a post code and also a house number (as opposed to one or the other).

    For the LotConfig exemplar, this will usually (if not always) have 0xA8FBD372 as the GID value, so that might help perhaps to narrow it down?

    Another thought I had was whether the Location value of a particular entry might be useful for tracking it down. This I believe would be the positioning where it's stored in memory, although with the value being for each container file and it might not be useful when this changes (say if DatPacked). For the TGI though and these remain the same because it's the method the game uses for distinguishing between the entries themselves for what's processed upon loading.


    Also while on the subject, here's a couple of resources that might also be useful for your research:

     

    1 hour ago, smf_16 said:

    Additionally, the question arises what happens when there are multiple Building Exemplars with the same IID, but different GID's. Or does the game - and the community - simply assume this will never happen?

    For when the IID is identical and there's a different GID for a given entry, it'll still be seen as unique.

    It'd be when the Type, Group, and Instance values are all matching that a certain conflict would occur. From my own observations, I've seen how in a prop pack there can be many which have the same Type and Group, and so the IID is the only way that each is individualised to be separate.

    • Like 3
    • Thanks 1

    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
  • Original Poster
  • Posted:
    Last Online:  
     
    10 minutes ago, Cyclone Boom said:

    For the LotConfig exemplar, this will usually (if not always) have 0xA8FBD372 as the GID value, so that might help perhaps to narrow it down?

    The problem here is that I actually need the building exemplar and for all I've seen those don't have a specific GID value.

    12 minutes ago, Cyclone Boom said:

    For when the IID is identical and there's a different GID for a given entry, it'll still be seen as unique.

    That's what I thought as well, but that's why I expected rep 13 in the LotConfigPropertyLotObject to have something like a TGI (or at least a GI) instead of just the IID because in that case it truely points to a unique building exemplar. Imagine two Lot Config exemplars that are totally unrelated. Imagine that Lot 1 has a building exemplar with a TGI of 0x6534284a,0x0000001,0xffffffff and Lot 2 has a building exemplar with TGI 0x6534284a,0x0000002,0xffffffff. Both would have rep 13 of LotConfigPropertyLotObject set to 0xffffffff. So the question is then, when the game decides to grow for example Lot 2, how does it now it has to look for building exemplar 0x6534284a,0x0000002,0xffffffff and *not* 0x6534284a,0x0000001,0xffffffff.

    If Building exemplars would always have the same GID, then it would be clear, but as mentioned this doesn't seem to be the case.

    • Like 1
    • 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:  
     
    8 hours ago, smf_16 said:

    The problem here is that I actually need the building exemplar and for all I've seen those don't have a specific GID value.

    Yes, its a problem when going from IID which should be unique back to the full building. The only way to do this reliably is to create a building list on IID while keeping TG, then use it as an index.  The same problem exists for props, flora and sounds and as I've recently discovered bridges.

    The game uses something else as well I think, because it can resolve duplicate buildings and props although I think it uses the last one found (just like other overrides). This can lead to props or buildings you didn't expect in-game. Fortunately if the TGI is generated then it will be unique. Its the manually created ones that can go wrong.

    I apply these rules in SC4DataNode, and flag duplicates.

    • Like 1
    • Thanks 3

    Share this post


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

    Hello everyone,

    A quick overview of today's progress. For now, as explained above, I'm simply looking up all Exemplar files with the IID that is mentioned in the Lot subfile and the one that is a Building Exemplar is the one I'm using, regardless of its GID.

    So, using the same logic as was used for the cloning, I'm now able to plop buildings by specifying an (x, z) tile and an orientation. I still have to include props & textures though, but the buildings are already appearing nicely:

    p3mbA1w.png

    The difference with the "cloning" that I did before is that now I have to decide which values to set for some properties myself. Some interesting things to note here:

    • The Lot Subfile requires at least 1 DemandSourceIndex entry to be specified, otherwise you'll get a nice CTD when opening the city. I haven't tested what happens though with pure eye candy landmarks that don't have jobs. Perhaps that those don't have this requirement.
    • The "zoneWealth" in the Lot Subfile must be set to a valid value. If you set it to 0x00, prepare for a CTD.

    The gist of it is that the Lot Subfile is quite sensitive to stuff that goes wrong. If something is wrong, you may very well end up with a CTD. The Building Subfile is much more forgiving. If you mess something up, the building simply doesn't show.

    I've also noticed that the wiki on the Building Subfile contains an error. It states

    BYTE	Unknown  (only seen 0x01)
    DWORD	Group ID  (from the Prop Exemplar)
    DWORD	Type ID  (from the Prop Exemplar)
    DWORD	Instance ID  (from the Prop Exemplar)
    DWORD	Instance ID  (the value given when the building appeared)

    but it appears to be 

    DWORD	Group ID  (from the Prop Exemplar)
    DWORD	Type ID  (from the Prop Exemplar)
    DWORD	Instance ID  (from the Prop Exemplar)
    DWORD	Instance ID  (the value given when the building appeared)
    BYTE	Unknown  (only seen 0x01)

    otherwise the TGI doesn't make sense.

    Speaking of the Wiki, given that I've already gathered quite a bit of information about Savegames that was still unknown - or at least not in the Wiki - I guess it could be useful if I was able to edit the Wiki and add some information. I have an account at SC4D too, same username, so perhaps that someone that's an Admin over there can give me editing rights.

    • Like 5

    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:  
     

    Nice work with the coordinated plopped buildings! *:8)

     

    11 minutes ago, smf_16 said:

    I guess it could be useful if I was able to edit the Wiki and add some information. I have an account at SC4D too, same username, so perhaps that someone that's an Admin over there can give me editing rights.

    Sounds a useful idea. I'm aware how the SC4Devotion Wiki is now open to everyone to create an account to edit articles. As per the posts following here, this is something @Naomi57 has been diligently doing recently in adding extra info and fixing up a few things around and about. If you've anything to add in regard to the saved game format, that'll certainly be great since your pioneering research and development is really delving deep into newfound territory for what can be achieved.

    • Like 3

    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
  • Original Poster
  • Posted:
    Last Online:  
     
    39 minutes ago, Cyclone Boom said:

    Sounds a useful idea. I'm aware how the SC4Devotion Wiki is now open to everyone to create an account to edit articles.

    Cool, I've created an account and started editing the Savegame page, but unfortunately it won't let me save my changes as it returns a 500 Internal Server Error. I've attached my changes to this post, perhaps that someone can try it instead.

    Anyway, I still wanted to share something else as well. While playing with programatically plopping lots I've noticed that it allows me to build over the lots I plopped, even though I set to the zoneType to 0x0f, which is "Plopped Building". This gives me hope for the problem that still existed with the ploppable residentials fix: they were not "truely" growified because it was impossible to build on top of them and they also wouldn't redevelop, even if you bulldozed the lot.

    The fact that my programmatically created lots does allow this gives some direction of where to look for what properties were still missing from the growable residentials to have them properly redevelop. I hope that I can investigate this a bit further soon!

    lm1PXDM.png

    wiki.txt

    • 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:  
     
    2 minutes ago, smf_16 said:

    I've created an account and started editing the Savegame page, but unfortunately it won't let me save my changes as it returns a 500 Internal Server Error.

    And unfortunately the last thing I tried to edit also gave that error. I was in a PM with @Tarkus, but he likely was very busy at the time with all the work of taking over as WebMaster of Devotion and afaik, it didn't get resolved.

     

    3 minutes ago, smf_16 said:

    I've noticed that it allows me to build over the lots I plopped,

    So, dragging that road thru and it explodes like being bulldozed just like regular grown one? Cool. *:yes:

    • Like 1
    • 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:  
     
    10 minutes ago, smf_16 said:

    Cool, I've created an account and started editing the Savegame page, but unfortunately it won't let me save my changes as it returns a 500 Internal Server Error.

    Maybe try Naomi's workaround as she posted here.

    It sounds like there's something not quite working correctly when links are posted on articles. Perhaps it needs a different URL markup format for them, and otherwise it's tripping up the server due to an incompatibility of some sorts. Last year SC4Devotion did have a server move and upgraded the MediaWiki software.

    • Like 2
    • Thanks 1

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

    So, dragging that road thru and it explodes like being bulldozed just like regular grown one? Cool. *:yes:

    Yeah, well kind of. It destroys the textures and allows me to build the road, but it keeps the building and effectively makes it immortal, so some research is needed here. Probably I'm not tying the building correctly to the lot or something. It's going to need some more research.

    4 minutes ago, Cyclone Boom said:

    Maybe try Naomi's workaround as she posted here.

    Ah that might solve it as I indeed added an external link. It will be something for tomorrow though.

    • Like 2
    • 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:  
     

    I've been tidying up and doing a little content creation on the SC4D wiki.  Here's my two biggest contributions so far:

    https://wiki.sc4devotion.com/index.php?title=Namdoc:Transit_Stations
    https://wiki.sc4devotion.com/index.php?title=Namdoc:Roundabouts

    These Wiki pages are essentially different to my tutorial contributions here on Simtropolis, the Wiki pages being much more tightly fact-based.

    3 hours ago, Cyclone Boom said:

    Maybe try Naomi's workaround as she posted here.

    3 hours ago, smf_16 said:

    Ah that might solve it as I indeed added an external link. It will be something for tomorrow though.

    Yes, I encountered that "HTTP ERROR 500" at various points, and each one was related to an external HTTP URL link.

    Once I had it isolated to external URL links, the most difficult case to resolve, was the DAMN page, which had the URL generated off a template.  I'm a dab hand at doing wiki, from a 12 month period on Wikipedia, but I don't know this wiki template stuff, and suspect I'd need admin privileges in any case.

    https://wiki.sc4devotion.com/index.php?title=DAMN
    SC4wiki-DAMN.png.b2c5ac788293cfa93ac4126861213d75.png

    So, I twiddled with it until I got it working again.  You can see the end result of my twiddles with this &diff link, which came right back down to <nowiki>...</nowiki>.

    https://wiki.sc4devotion.com/index.php?title=DAMN&type=revision&diff=49590&oldid=33987

    I haven't heard back from @Tarkus on this "HTTP ERROR 500", so I'm guessing he's super busy with NAM 37 and RL.

    I'm really interested in savegame experiments, coming from a data analytics / data wrangling / tech writing background professionally, so please do post back when you reach interesting milestones in your documentation.  *:ohyes:

    One key thing that makes WIKI different from writing tutorials, is the clear separation of three types of information:

    1. Undisputed verifiable facts – the bread and butter of wiki documentation.
    2. Contentious facts – identifying multiple perspectives, and separating out investigation to a separate topic page or separate section.
    3. Ideas, opinions, substantiation and elaboration – noted on the talk page for future reference.

    SC4 Wiki is so much less strict (and much more fun) than Jimmy's big Wikipedia, but separation of these three types of information is a big part of what makes collaboration possible.  You may find a blog or discussion thread a better medium for information types 2 and 3, or else use SC4 Wiki to deliver an outline of the contentious facts, with URL references to your blog pages or discussion threads.

    Feel free to msg me, or tag me, if you've any SC4 Wiki questions.  I've no official capacity, but I appear to be the one Wiki user that is most engaged with it at the moment, and I'm very happy to help if I can.

    • Like 4

    Share this post


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

    After yesterday's progress, I went ahead and implemented a basic "Skyline generating algorithm". I have to admit that I expected it would look a bit better: even though the skyline has a nice shape, the place looks grey and dead - almost as if Coronavirus broke out. That's probably due to the lack of roads, base textures and prop, which I'm not yet including when plopping.

    Still, the city opened on the first try without a single CTD, which I see as a success. The buildings I used also use of building families, which shows that I'm able to plop those as well.

    The next thing will be being able to include the base textures, props and flora as well and then I'm planning on taking a look what would happen when I turn the simulation on - but I'll probably need to be able to generate roads as well in that case!

    Sidenote: living on the edge just got a new dimension here *:rofl:

    YgTK6LH.png

     

    • 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:  
     
    38 minutes ago, smf_16 said:

    Still, the city opened on the first try without a single CTD, which I see as a success.

    This is what really matter! One step at a time. *:thumb:
    I already imagined having a random city generator so the challenge in the game will be to solve the problems of a TOTALLY unknown and chaotic city. :boggle: It would be very close to the reality of many places. *:ohyes:

    • Like 3

    "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
  • Original Poster
  • Posted:
    Last Online:  
     
    15 minutes ago, carlosmarcelo said:

    I already imagined having a random city generator so the challenge in the game will be to solve the problems of a TOTALLY unknown and chaotic city. :boggle:

    That's a fun idea indeed! But that's still something for the distant future I fear. The experiment here to programmatically generate a city is rather theoritical for me. I just hope it can serve as a resource for people wanting to tackle savegame modding as well. But who knows where this project ends up *:yes:

    • 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
  • Original Poster
  • Posted:
    Last Online:  
     
    18 hours ago, Naomi57 said:

    Yes, I encountered that "HTTP ERROR 500" at various points, and each one was related to an external HTTP URL link.

    Once I had it isolated to external URL links, the most difficult case to resolve, was the DAMN page, which had the URL generated off a template.  I'm a dab hand at doing wiki, from a 12 month period on Wikipedia, but I don't know this wiki template stuff, and suspect I'd need admin privileges in any case.

    I've managed to edit the Savegame page on the wiki. The problem was indeed an external link. I wanted to add a link to the CRC algorithm on GitHub (https://github.com/sebamarynissen/SC4/blob/ee7bee8173ec46d155ceaa316eaab074404dff87/src/crc.cpp) which I think is useful. Would you be able to put it in, @Naomi57? I've tried some things, but been unable to get the link to show up. I wanted "algorithm used for the checksum" to be the link text for it.


    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:  
     
    4 hours ago, smf_16 said:

    I've managed to edit the Savegame page on the wiki. The problem was indeed an external link. I wanted to add a link to the CRC algorithm on GitHub (https://github.com/sebamarynissen/SC4/blob/ee7bee8173ec46d155ceaa316eaab074404dff87/src/crc.cpp) which I think is useful. Would you be able to put it in, @Naomi57? I've tried some things, but been unable to get the link to show up. I wanted "algorithm used for the checksum" to be the link text for it.

    I've made the edit to the Savegame page on the wiki, @smf_16, feel free to modify as you see fit.

    Note that there is no ability to show link text, so I added portions of your paragraph as explanatory text.

    • Double colon :: is to indent.
    • Triple single-quote ''' is for bold text.
    • The nowiki tags <nowiki>...</nowiki> is what makes this wiki page saveable.  It's a crude workaround, and means the link is shown as text, not a hyperlink.

    Here's the &diff page to see what I did.
       https://wiki.sc4devotion.com/index.php?title=Savegame&type=revision&diff=49844&oldid=49843

    ==Source code==
    
    Here's a link to the '''CRC algorithm on GitHub''', the algorithm used for the savegame file checksum.
    
    ::'''<nowiki>https://github.com/sebamarynissen/SC4/blob/ee7bee8173ec46d155ceaa316eaab074404dff87/src/crc.cpp</nowiki>'''

    I could have formatted the link to look like a hyperlink, but figured that would create confusion, as clicking on it does nothing.  It's better for it to look like basic text.

    • Thanks 2

    Share this post


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

    After yesterday's skyline which exclusively used custom content, I've tried using the default Maxis content to see what it gives. I had to modify my code a bit though because the default Maxis content intensively makes use of inheritance, which my code did not take into account yet. I'm now able to walk down the inheritance chain to find the properties that I need - most notably the "Building/Prop family" property.

    Even though it's all Maxis content, the results are really pleasing. I've also modified the algorithm a bit so that it leaves holes for me to put roads in - which I did by hand - and I also manually added some trees. It's real fun to play with. The city below is only one out of 100+ cities that I've generated :D 

    MVvBALz.png

    The city can be saved and reopened by the way without any problem, so all is good on that front. I also turned on the simulation for a while which resulted in the ghost town depicted below. Quite logical of course because most buildings don't have road access. The most important thing is that the simulation ran just fine without crashing. Going to try and include the textures and props now as well!

    image.png.7801212edcc62b604dfcf5fe852a715b.png

    • 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

    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