Cities acting like units!

Civkid1991

in shade of poison trees
Joined
Feb 20, 2006
Messages
871
I'm want to mod but theres a small problem with my idea. I want to have cities that move and act like units. I know this seems impossible, but looking at what some of what you all do (like gray fox, kael and the ffh team, TGA, ect) i think with a bit of help from the forum civver/modders i could possible bring my ideas into reality. Im going to download the sdk and fool around with that a bit and hopefull (after i refresh what i know about c++) will have some codes.

If you have any idea on how to make this work please help.... :thanx:

Edit: I decided to put down some basic ideas:
Concepts:
- City-States: All civs will be city states. In the book London was the only thing left to represent England (im guessing?) so what im thinking for right now is all of the civs will end up being city-states unless they make a permanent alliance with someone.
- Culture vs. Fuel : well because this is a Municipal-Darwinist word people invade your cultural boundaries (if they really existed lol) so im going to eliminate culture and replace it with fuel points. In the game workers will be replaced with engineers(?). Besides having the ability to help the mother city (and sacrificing itself to be used as fuel for that city) it could go out and collect various resources to use for fuel (cutting down, trees, retrieving the remains of old tech cities, harvesting coal and other natural resources).
- Some city specalists- Some of the specialists will be replaced or altered. Like the artist could produce +Happy faces or maybe we can have him do hard labor (^_^) and add +hammers (j/k). But im sure historian will be a specialist. If you can think of more or something to alter the please tell.
- Religion: I can't really remember what the religions were, but i do know some where like polytheistic.
- Undead: Will have some units that are living dead (o joy!)
- Barbs!: this is going to be one of the fun parts of the mod... the anti-traction league. The barbarian will be anti-tractionists. I'm not sure however if i should make them playable or barbian so tell me what you think.

Civs/Cities:
Spoiler cities/cities :

* Benghazi
* Chidanagaram
* Cittamotore
* Edinburgh
* Glasgow
* Gorky
* Gutak
* Jagdstadt Magdeburg
* Juggernautpur
* Kom Ombo
* London
* Manchester
* Montpelier
* Motoropolis
* Murnau
* Nizhny Novgorod
* Panzerstadt-Bayreuth
* Pandzerstadt-Linz
* Paris
* Prague
* Traktiongrad
* Xanne-Sandansky
* Zimbra

Raft Cities

* Brighton
* Grimsby (sunken)
* Marseilles
* Puerto Angeles

Ice Cities

* Anchorage
* Arkangel
* Breidhavik
* Kivitoo
* Wolverinehampton
* Reykjavík


Techs and Eras:
Spoiler techs and eras :

Rebirth:
Theme: Rise of post-60minWar Civilization
+ Fuel Mining: will allow Engineers to mine coal
+Botanical Adulteration: will allow Engineers to cut down forests
+Municipal Militia: will allow city to produce 3 national units: Municipal Police (alternate names: Social Police, Civil Police)
+ Reconnoiter: Can build Land Scouts
+Terra Firma Intensification: cities can get more fuel and food from land

Growth:
Theme: "Know that we have these moving towns, what next? " - Engineers at the traction lab of Traktiongrad
+Airfaring: Can begin to build airships and AirScouts
+International Linguestics: will allow specific culture buildings
+ Tier2 Expansion: will allow hamlets to become towns
+BioEngineering: prereq for Restless Silence: will city to produce suburban colonies (improvement)

Darwinism:
Theme: City Evolution

+Municuple Darwinism
+
+Tier3 Expansion: will allow towns to become Cities

Traction:
Theme: leading up to the traction golden age
+ Traction rail: Engineers can now lay down traction rails, which allows cities to move over land faster, but has the side effect of downgrading the land (grassland->plain->desert) Note* tile has to be deforested by a Engineer first
+ Airdocking : Allow access to the airdock (or should it be called the Air harbor or Airport ?)

Matalic:
Theme: "We've just triggered the golden age of Traction!" -Grand Council of Panzerstadt-Linz
+Tier3 Expansion: Will allow cites to become a metropolis -> allows access to other tiers (tier3+)
+ Lampits: Land-Sea units and allows acces to tier1 lampit dock
+ Air Infantry: Battle Airship
+ Restless Silence : Allows access to stalkers

Green:
Theme: Anti-Traction threat
+Enviromentalism: The begining of the anti-tractionist threat: can replant trees if civs have enviromentalism civic
+ Resettlement: will allow traction cities to settle in one place (hasn't been well developed yet)
+ Advanced Land infantry: Can build AdvLand Infantries

Future:
Theme: "What will the future hold for us...?" - Traction Union of the North Sea
+Traction Union
+ Old tech Revival (may be removed...)

Limited Access Techs:
Theme: Techs that can only be gained through finding them in old tech "goody huts" or sacrificing a historian or archeologist
+ Lasers: will allow founders access to laser infantry? Airships with laser promotion? MEDUSA?


Units:
+Traction City:



Thanks to Chamaedrys for the city graphics :)

+Airship:



Thanks agian to Chamaedrys for his amazing graphics :goodjob:

+Grimsby Lostboy: this will either be a slaveish unit that will be produced if grimsby attacks a city or a early scout
+Limpit(i forgot what the sea-land units they sailed in where called): will be a grimsby only unit that is like a pirate ship (o and grimsby will have the piracy trait). It can steal resources (maybe) from other cities and is invisible.
+Great Historian
+Great Archeologist
+Stalkers (i believe they were called):undead units for those evil militaristic cities
- Weather Units (Not sure if im going to actually use this or not): Units that are generated at sea during specific times of they year. Hurricans have the ability to attack raft cities... if its near a coast tile then it may generate a thunderstorm... which has a small chance of upgradeing a tile before it "disappears"

If i think of something else ill post an update :)
 
It is possible to move a city with Python, theoretically. First you could save all of the city's information in variables, then you create a new city on the tile you want to move it to, then you kill the city you wanted to move. Then you change the information of the new city to be a copy of the old city. (like add buildings, GPP, great specialists etc). You could trigger the movement of the city with a special unit.

Would be faster if you did the function for it in the SDK, and just called on it in the python code though (in CyCity.cpp/CvCity.cpp). And then in the python eventmanager;

Code:
def onUnitMovement():
   if unit.getUnitType() == gc.getInfoTypeForString('UNIT_CITY_UNIT'):
      pCity = function() #do a loop in the surrounding tiles to find the city, 
      #or save the last plot the unit moved from somewhere and fetch 
      #the city from that plot)
     pCity.moveCity(pPlot)

!WARNING -- This is mockup code, it doesnt actually work this way
                  unless you change the SDK so it does.
 
Civkid1991 said:
I'm want to mod but theres a small problem with my idea. I want to have cities that move and act like units. I know this seems impossible, but looking at what some of what you all do (like gray fox, kael and the ffh team, TGA, ect) i think with a bit of help from the forum civver/modders i could possible bring my ideas into reality. Im going to download the sdk and fool around with that a bit and hopefull (after i refresh what i know about c++) will have some codes.

If you have any idea on how to make this work please help.... :thanx:

Civkid, I tried to do this a while ago and the task is daunting due to the amount of SDK code that you need to change... there are a lot of things that you need to keep in mind when doing this:

1) How are you going to keep cities from stacking?
2) You will need to rewrite the CityAI code so it keeps the plots that are being worked by citizens when the city moves.
3) How are you going to change the culture model of cities? Which brings up another point: you will need to recalculate the culture levels for each plot when a city moves.
4) When a city moves you will need to recalculate the trade network to see if the city that moved is still on the trade network or not. If it isn't then you will need to remove all the bonuses that it isn't connected too.
5) How are you going to handle sea based units that are at a city that moves away from the ocean's edge?
6) How will you handle the case when players set a rally point for units when the city moves? (yes, you can set rally points in Civ4)
7) You will need to rewrite the code that handles maintenance costs for cities in the case that the captial city moves, or a city with the forbidden palace or Versailles.

As you can see there are a lot of considerations to think about when trying to implement this idea... you should do a search on this board for similar threads since I remember posting a bigger list about this topic to someone else who was going to try.

Let me know if you need some clarifications on the items I listed above.

I'll try to find the previous thread where I posted my list of items for the other person who tried this idea out before.

EDIT:

Here's one of the posts: http://forums.civfanatics.com/showthread.php?t=174278&highlight=cities
 
@Thelopez: These are really good points. Most of these i've been thinking about already and have started to solve.
1) How are you going to keep cities from stacking?
im still in the prosses of figureing this out...
2) You will need to rewrite the CityAI code so it keeps the plots that are being worked by citizens when the city moves.
Im willing to do this... and because im going to have a C++ class at my highschool when i go back in september ill have a some time. (and who needs a social life or lunch or while im at it sleep! j/k :) )
3) How are you going to change the culture model of cities? Which brings up another point: you will need to recalculate the culture levels for each plot when a city moves.
Good question. I solved this first. There wont be any culture :)! (or at least cutural boundries)This is one of my faviorit parts of the mod. Culture points will be replaced with "fuel" points which will determine how far, how fast, and if the city could move. You see the cities (which act as units and are mechanical) will have the ability to attack other cities and suburban colonies (which are like movable improvemnts) eliminating the necessity of cultural boundries. The cities that are attacked attacked will be used for fuel and in additon to that workers can cut down trees and harvest other resources to make fuel. Fuel is also used along with the natural land production points to creat buildings the will allow the city to advance.
These cities are based from the book mortal engines. If you what to know more about the system look at the article on wiki about municipal darwinism.
4) When a city moves you will need to recalculate the trade network to see if the city that moved is still on the trade network or not. If it isn't then you will need to remove all the bonuses that it isn't connected too.
I'm still working on this too. But im also going to have a new trading system. (its hush-hush for right now :) )
5) How are you going to handle sea based units that are at a city that moves away from the ocean's edge?
Once again im working on this but i have some ideas. I just need to do the coding.
6) How will you handle the case when players set a rally point for units when the city moves? (yes, you can set rally points in Civ4)
Rally points?!? I've never actually thought about or used rally points so im not sure how that will work. Right now im thinking of haveing a outside-of-city-disk that will keep the units and follow the city at the same time (improvement acting as city part?).
7) You will need to rewrite the code that handles maintenance costs for cities in the case that the captial city moves, or a city with the forbidden palace or Versailles.
This shouldn't be that hard. Like i said im taking a c++ class and could use this as a project or something :)

If you would like to join me and creat a development team for this mod that would be great. Im a bit new but will a pit of practice and example i should be able to do this in reasonable time. :D

~CivKid~

ps. thanks for the link.

Edit: I like alot of the ideas from grey foxes "solar system cities" in his( or her?:blush: ) Interstellar Colonization mod. The main "city" (in his mod the star) would be at the center and around the main city (in my mod the mechanical traction city) will be various improvements (the planets in foxes mod) that pull in food, production, and fuel points (suburban colonies, engineering orbitals, agriculture units, etc in my mod). In foxes mod the planets are the places that keep the building. In my mod (if you've read the book you'd know cities have tiers) will have better living qualities depending on how many tiers it has. Tiers will also when gained will allow you to acces diffrent units and diffrent buildings. So in my mod the central citiy unit will be the main and only cityunit for the whole civilization. Note* there will be suburban colonies that will allow you to get more production and act as people holders for the main city. Of course this will change gameplay dramatically.

Edit 2: I looked at the link you provided. Sounds good but i think what im doing is a bit diffrent from his ideas. But we could learn from eachother as development continues.
 
Civkid1991 said:
@Thelopez: These are really good points. Most of these i've been thinking about already and have started to solve.

@Thelopez: These are really good points. Most of these i've been thinking about already and have started to solve.
Quote:
1) How are you going to keep cities from stacking?
im still in the prosses of figureing this out...

If you go the route of having cities be controlled by special units, you can modify the "CvUnit::canMoveInto".

Quote:
2) You will need to rewrite the CityAI code so it keeps the plots that are being worked by citizens when the city moves.
Im willing to do this... and because im going to have a C++ class at my highschool when i go back in september ill have a some time. (and who needs a social life or lunch or while im at it sleep! j/k )

I'm not sure you'd really need to keep the plots, since some of them wouldn't even be available any more. Wouldn't it make more sense to just pick up, move the city, and then recalculate the plots using the normal AI calculations at the new spot?

6) How will you handle the case when players set a rally point for units when the city moves? (yes, you can set rally points in Civ4)
Rally points?!? I've never actually thought about or used rally points so im not sure how that will work. Right now im thinking of haveing a outside-of-city-disk that will keep the units and follow the city at the same time (improvement acting as city part?).

That shouldn't even be a problem. All the rally point does is push a move mission to the unit once it's done training. It doesn't have anything to do with the starting point. If the city moves, this shouldn't affect the move mission, since the end position will stay the same.


Quote:
7) You will need to rewrite the code that handles maintenance costs for cities in the case that the captial city moves, or a city with the forbidden palace or Versailles.
This shouldn't be that hard. Like i said im taking a c++ class and could use this as a project or something

Might not be hard, but time-consuming. Good luck with that :p
 
gerikes said:
if you go the route of having cities be controlled by special units, you can modify the "CvUnit::canMoveInto".

Yep!... it looks like we were thinking almost the same thing. In the book cities traded and went from city (here civ) to city by airship. So i was thinking of having special national units that specialize in trade (and some other things if neccessary). For oceanic trade ill have to have units that can move into the sea and over land (this comes from a bit of ideas from the 2nd and 3rd books in the series).

That shouldn't even be a problem. All the rally point does is push a move mission to the unit once it's done training. It doesn't have anything to do with the starting point. If the city moves, this shouldn't affect the move mission, since the end position will stay the same.
Actually it would be a problem because (what i've been tolded) when cities are moved from tile to tile they have to be erased and then recreated in the new tile. I think this would screw up the rally point location if this does happen. (although it may be possible to have the rally point move with the city and its location would be stored in an array for citiy info)

Might not be hard, but time-consuming. Good luck with that :p
Darn my human need for sleep!:mad: :D

Edit: if you'd like to join the team your welcome... can never have to many good programmers! (ok maybe thats not true but close enough :lol:)
 
Civkid1991 said:
Actually it would be a problem because (what i've been tolded) when cities are moved from tile to tile they have to be erased and then recreated in the new tile. I think this would screw up the rally point location if this does happen. (although it may be possible to have the rally point move with the city and its location would be stored in an array for citiy info)

Well, I'm assuming you have figured a way to get all the data from one city into the next (if the "city movement" is indeed going to be a delete one city and make a duplicate of it). The rally point is just one of the many pieces of data of the city that you would have to copy over. Once you have the issue of how the data is being copied, then your rally point issue is solved.
 
As soon as i hack the sdk ill be able to do this:)... but remember i said im new to modding and that most of what im discribing is what could be possible.(*Note: i have some experience with other languages(asm,basic,ti-calc basic, and python) so most of my ideas can be made into a reality if i work hard enough with the knowledge i have*)
 
Civkid1991 said:
As soon as i hack the sdk ill be able to do this:)... but remember i said im new to modding and that most of what im discribing is what could be possible.(*Note: i have some experience with other languages(asm,basic,ti-calc basic, and python) so most of my ideas can be made into a reality if i work hard enough with the knowledge i have*)

I like the way you think. Ideas first, code later. Makes the game much more interesting.

Good luck! Feel free to ask if you need any help.
 
Thanks... development is really high on my list. Next right under would be programming it and then the story (although i do have a writer already and a book to use for insperation and ideas :lol:)
 
(This thread doesnt actually mention mortal engines exept in your signature... but the rest of this post assumes this is basically what it is about lol)

This is brilliant news! I proposed a mortal engines mod ages ago but no-one sounded interested too much, and since i dont really knoe where to start when it comes to modding so nothing much happened...

Some questions:

So when did you start working on the mod?

Is your aim to focus soley on traction cities or to still allow stactic ones such as the anti-traction league and the Green Storm and shift the focus to the conflicts between them?

Are you actually going to have traction-factions (hehe) as such, or more city-states as per the books?

I probably have many more questions as well as suggestions... I am very geared up abut this mod, and although i have no mod experince ill be happy to help with input on concepts and development.

...Keep up the good work:goodjob:
 
Civkid, there is much to be discussed... If you have a thread devoted to the mod concept, could you point me to it? If not waste no time in creating one (I had one before but it was ignored lol)
 
Interesting questions. To answer your first question i started this mod 2 or 3 days ago. What i plan on having is both tractionist cities and anti-tractionist cities. And no... it would get really messy especially in the coding if i had traction unions... i plane on haveing massive citiy-states in the book. But if i can im going to try to allow them to make "allience" that will sort of make them into unions.

I would like to hear your other questions and suggestions... (although i can't take or answer all :) ) it would be helpful with development.
 
So how true to the books concepts are you going to go?
In the books, the land around the cities wasnt really worked at all, any farming was usually done on the decks of the cities... Building material would have been gained by driving over to a forest, mountain, scrapheap. or by 'eating' another city, and most of the work done by the cities 'jaws' without anybody leaving the city, since most people are disgusted by the idea of walking on the earth... Land units for traction cities would be extremley rare, exept as garrisons or as boarding crews to go on airships... Most combat revolves around airships.
And you need a good way of creating 'chases' between cities...
 
Since I havnt read the books, everything you two says makes this more interesting for me ;)
 
well for the land im going to have "worker" units (or maybe ill call them engineers?) that will have the ability to lay tracts for the traction cities. And i would like to keep the idea of city eating cities. Like i said earlier there will be now culture and fuel will be put in its place. There will be now war or peace because its a darwinistic world. Only the strongest city will come out on the top.

A thought that i just had: if i can get (or steal :) ) so things from ffh i would like to use the explotions used for the flames to blow up mountian (behind the scens downgrading the terrain to hills ^_^). You can have workers go to mountians and destroy them for fuel points.... What does everyone thing about these? would that be too much or reasonable for this mod?

Ill upgrade the first post to show more ideas later,
~Civkid~

Edit: i just updated it so tell me what you think
 
Check out the FFH python code, thats how I started learning. It speeded up my learning speed dramatically.

Dont be afraid to steal code, or copy code. Give credit where credit is due though.
 
ok, thanks for the tip... ive looked at various files but not that many so ill get to that now.
 
It can be confusing at first. I suggest you read TGA's Civ4 Python tutorial too.
 
Top Bottom