A little help with cities.

matteo773

Deity
Joined
Jul 10, 2005
Messages
102
Location
England
How would I be able to make cities move?

I am doing this for the mortal engines mod, I hope to be starting soon but without this the mod is basically pointless.

This will probably be quite difficult to do, so if someone could just point me to the right file that would be greatly appreciated:).
 
matteo773, this has been previously requested by someone else... though I can't remember exactly who off the top of my head right now. Anyways, the ability to making cities move would entail quite a bit of SDK and python hacking if you are up to it. There are a number of files that would probably require changing CvCity.cpp, CyCity.cpp, CvCity.h, CvCityAI.cpp, CvCityAi.h, CvPlot.cpp, CvPlot.h, CyPlot.cpp, CyPlot.h, etc., etc.

Please remember that it isn't just the city that you have to move but all of it's underlying infrastructure as well like culture, units, etc. Also you would need to have the game figure out where cities could and could not move like too close to other cities, into impassible plots, etc.


EDIT: I am not trying to disuade you from trying to do this but I am just trying to let you know that the task you are proposing to do isn't easy or for the faint of heart.
 
I agree that this is a complicated mod, but I'd direct your attention to CvUnit.cpp, specifically, I recommend that you add a relationship to City in a unit (a City Unit) and then whenever the unit moves you get it to move the City as well. The biggest challenge with this I think, would be the graphics - what does a city on the move look like?

...and the AI would be a big task as well.
 
CvUnit.cpp would not be enough scottland. You will have to do a lot of calculations in the Files TheLopes listed plus CvPlayerAI.cpp, CvPlayer.cpp. The problem is kind of similar to a problem i had recently. Most thing you have to be will be kind of mechanical/ meaning no need to think very much. But the things mentioned by the Lopez and scottland will provide some difficlut problems to solve.

It depends of course also if you want the city to move constanly or if you want the city to Move - settle - Move - settle (which probably would be much easier).
 
Thanks for the help, and the speed of your resposnes:). I knew this would be hard but I thought I should give it a go. It'll probably take me a while but I'll get it done!(hopefully:blush: )
 
Wouldn't this be as simple as creating a setter for the X,Y coordinates of the city, exposing it to python, and then calling it? You should move units in the city and culture as well but it's not necessary, in the strictest sense. I imagine there is a refresh function that will take care of cleaning up the graphics for you after the city moves.

There may be more to it than that but I would definately start with making setX(int xVal) and a setY(int Yval) and exposing them to python.

Roger Bacon
 
This would be quite a good idea for a mod with a lot of Nomads in it such as a fall of Rome mod.
 
Chalid: I agree that some other files will need minor modifications (certainly CvCity*.* would need some work), I just think CvUnit*.* warrants the most attention.

RogerBacon: How does the City know when and where to move to?
 
Back
Top Bottom