Mod to increase city size

Well, I got the improvements to load in after I realized you need to create and place a rural district first. Unfortunately somethings are still broken and some new things are now broken. The improvements are no longer being counted towards the city, so I have to find out what happened there and fix that. After reading a lot more of the code and looking through error messages and what not, I'm still on the fence if this is even possible. Graphically I think everything will be able to work along with the UI. However, the actual turn mechanics and yield generations + resources and their effects might be impossible to add on to cities. I haven't seen anything in the code that would allow me to edit a specific object. Since I can't find a public function that deals with resource or economy (only getter functions) I don't really see a path forward but I'll keep thinking on it.
test.png
test2.png
 
Okay so it should be possible. I think if I patch every one of the city calls for things like expansionplots, yields, resources, buildings, districts and improvement types.

Here is a list of things I still need to do.
Add the extended plot information to the expandable plot grids [x]
Add the plot when clicked [x]
Create the improvement/upgrade [x]
Add the improvement/upgrade to the building list [x]
Add to both the yield list and yield changes list to reflect acquiring the tile []
Add any resource claimed to the proper city list and player list []
Write the logic so the tiles appear when 1 plot length away and disappear when acquired []
Bug check / edge case handling []


From the limited testing I've done this should work and should all be accessible in the code. However the resource objects and the city yield object is rather large and complicated. It'll take me a while to wrap my head around it and insert the correct parameters. I'll be updating this post with pics of my updated work. (This would of been a whole lot easier with reflection but I can't seem to get it to work. The objects seem to be writable [i.e. The reflect function returns true for both the writable property and for the set function.] but the changes aren't being reflected and the value aren't actually being written. So if anyone who knows JavaScript better than I (never really used it that much) knows how to setup reflection please let me know. (I assume I need to hook into the actual initialization function instead of just reflecting the object into itself?)
test.png
test2.png
test3.png
test4.png
test5.png
test6.png
 
Last edited:
Awesome! Did you try to contact the guy that did the 4 tile distance mod for Civ 6?
 
I have not but that's a great idea, I'll get on that! I think I have a working prototype I just have to clean up the code / add the automation logic to make sure it's working.
 
Really looking forward to this mod. One of my greatest disappointments with the game was that when it was confirmed it would be a 3 tiles city working distance and it being extremely hardcoded.
 
Mine too! Still digging into the yield / resources code. Once I have that solved the logic to generalize the code should be pretty easy. Hopefully I'll have a working version by the end of the week. Unfortunately after digging into the Yields and Resources code a lot more it seems the game only ever gets the data associated with them from the owning city / player. The city and player seem to be private objects that are immutable. I've tried both reflection and deleting the element and recreating it but to no avail. I can get all of the visual updates but unfortunately it seems to be impossible to actually change the city mechanics. I have a few backup ideas that I'll try but don't hold your breath.
 
Last edited:
So here is where it stands. Plots can be added (visually / slight mechanics [gives vision and can block other players from building / owning plots but can't use improvement / yields from the plot]). Resources can also be added (I think, haven't tested it yet but found the code and since it seems to just require a valid resource hash and a valid cityID it should work.) Districts are currently untested right now. I see the code for them and in my testing of functions / game code it might of worked? I've mostly been testing city expansion and not building placement stuff. I might just get a semi-working version in a mod just so others can play with it. Still going to take a while actually putting all the code together into one mod but I think I'm going to put my focus on that instead of searching for a way to get the yields to update/work.
 
Last edited:
I also fell down another rabbit hole and did not do what I said I was going to do but I did discover more and potentially a way for this mod to work. It turns out you CAN modify in-game objects. You just can't do it through a js file, at least not directly. If you use an xml file you should be able to dynamically edit the yields of each city by referencing the city name and the yield value to change. I just have to figure out how to do this from a js file and I'll be able to edit city yields on the fly (and anything else from private game objects).

From the gameplay-copy.sqlite under the table Yields:
YIELD_FOOD|1.0|ICON_FOOD|LOC_YIELD_FOOD|0.0
YIELD_PRODUCTION|1.0|ICON_PRODUCTION|LOC_YIELD_PRODUCTION|0.0
YIELD_GOLD|1.0|ICON_GOLD|LOC_YIELD_GOLD|0.0
YIELD_SCIENCE|1.0|ICON_SCIENCE|LOC_YIELD_SCIENCE|0.0
YIELD_CULTURE|1.0|ICON_CULTURE|LOC_YIELD_CULTURE|0.0
YIELD_HAPPINESS|1.0|ICON_HAPPINESS|LOC_YIELD_HAPPINESS|0.0
YIELD_DIPLOMACY|1.0|ICON_DIPLOMACY|LOC_YIELD_DIPLOMACY|0.0
 
I'm also rooting hard for you to get this working. Any luck getting it to work? Seems like you're so close!!
 
Responding to your original post you seem to have gotten past is it loading, why isn't it loading, did it load and not run type problems. Particularly you learned to use the console. Another option is:
JavaScript:
UI.setClipboardText(txt);
That's most useful in response to something you do since it's one shot. Call it again and the old text is gone so you have to paste into something. That's generally when Chrispresso's Debug Console isn't enough. When what you get back is big, very, very big, being able to get it into an external tool, like Notepad++, is very helpful.
 
Back
Top Bottom