/////////////////////////////////////////////////////
// //
// City Expansion v2.0 - A mod by Pedrunn and BlueO //
// //
/////////////////////////////////////////////////////
(Pedrunn) Apolyton
forums |
--------------------------------------------------------------------------------
I. Introduction
II. Installation
III. How Does It Works?
IV. Graphics
V. Thanks
VI. How to I Play It With Other mods?
VII. How to use it together with IW's Wonder Code
---------------------------------------------------------------------------------
I. Introduction
The concept of having cities expanding was first idealize by the apolytioneer
BlueO. At that time there was no way of changing the terrain or tile improvements.
So he created city graphics as good. This mean the city was actually a good
that could be traded. The idea of cities being traded, added to that several
game-play bugs and the difficulty of implementing it. The idea did not had good
acceptancy to the CTP2 community. The project was forgotten. But the concept
still remaint in the head of several CTP2 modmakers. Including me.
After the Tiledit was released by Martin, the Dane. It became possible to create
and edit terrain a tile improvements graphics. This is made possible to redo
all the city expansion coding concept. This way after a while learning the Slic
language I used the BlueO's ExpandCity function to make cities grow using tile
improvements. After more than a month working in this project I have finally
achieved my goal. The City Expansion v2.0 is totally functional and bug free.
II. Instalation
Basic Prerequisites:
1) Download and install properly the CTP2 Patch 1.11
2) Download and install properly the Modswapper
3) Download and install properly the Apolyton Tile File
Make sure the prerequisites are ok.
Unzip the file cityexpansion.zip (where this document is inside) in your CTP2
base
You will find the option to play with it when launching Modswapper.
III. How Does It Work?
The Expansion
The city expansion works adding a terrain graphic aside the city every time
a city reaches a multiple of three (3, 6, 9, 12, 15,
120) population number
until the max number of 120 in every land terrain except forests, swamps, forests,
jungles, mountains and glaciers (if the city is settled in land) or every deep
or rift sea terrain (if it is a sea city) . And for those ages that the set
of cities has more than one city size graphics the citiesy will continually
upgrade to a bigger size as the city grow.
The city kills all food collecting from the tile but increases the production
and gold input from it.
If there is no possible terrains (mountains, shallow water and sea terrain for
land cities and shallow sea or land terrain for sea cities) in the city radius
or all possible ones are already taken by city expansion. The city has reached
a maximum number of pop so it can't grow anymore.
If the tile has forests, swamps or jungles the city cant grow either but it
will create a couple plains tiles to prepare for the next expansion.
Once the city expansion is added it cant be removed anymore.
The Losing of Pop and dead city expansions
If the city looses population from starvation or after being captured and reaches
a city
population one number smaller then the multiple of three that were supposed
add the new tile improvement the city expansion next to the city dies. What
I mean by saying that the city expansion dies is that a dead/ruins city takes
it place. The dead city doesn't only kill all food input but also the gold and
the production. In another words, the tile works as if it was a dead terrain.
- The building of settlers, urban planners and sea engineers will kill one city
expansion;
- The enslavent the population of a city by slaver one city expansion will also
kill one city expansion
- When an abolitionist removes slaves from the city one city expansion will
die.
When happens the death of a big number of population the cities expansions in
the radius will get killed according to the population killed.
-The totally death of a city for the actual death of all pop (Cretate Park
or slic related events)
- Nuking a city.
- When the city is plagued.
The only event not related to the death of population that creates a dead tile
is pillaging. Any player can pillage another player city expansion. This will
also cause the death of the city expansion.
Once a dead city expansion is added it can't be removed anymore. (Ghost Cities). The only way to remove them is to expand the city and by that replacing it by a brand new city expansion or terraforming the city.
Entering City Ages
Once a player researchs a defined advance it means he has achieved a city expansion age. That in most case will be parallel to the entering of an age in the game. This will make cities expansion from early ages to be replaced for modern ones as the city expands. You must not that this transition of city expansions as in real-life is slow and only one or two will be replaced every time a city expands. And as nowadays you may find really developed nations with cities using old archtecture since the city did not follow the progress of its nation. Every age has it series of graphics for big, medium and/or small cities. The place of different expansion of a city depends on the size of the city. Currently Ancient and medieval has one tile; modern has three; and, genetic and diamond has two.
IV. Graphics
Those are the used graphics in the code. Yet there are more in the apolyton Tile File
|
![]() |
V. Thanks
Special Thanks
The special thanks
goes to BlueO who has disapeared a while ago but without him this mod wasnt
possible at all. Since he was the creator of the City Expansion v1.0 therefore
the ExpandCity function, related fuctions and some graphics.
A big Thanks to the Immortal Wombat who rescued the city expansion concept making me start the work on it, helped me in the bug hunt, and compiled mine and BlueO's graphics into the Apolyton Tile File.
And to Martin who helped in the fix really important bugs in the final version of the code.
And Finally
I hope you find this mod fun, useful, helpful, enjoyable, or whatever, to make
it worth the time I spent on it.
Special thanks to Apolyton Civ Site.
Apolyton CS - Thankyou Dan Quick & Markos
Gianopoulos.
VI. How To Play It With Others Mods
How to install to play with Apolyton Pack or the Good Mod?
Make sure the prerequisites are ok and the mod doenst already uses the mod..
There is a folder call modmaking resources that comes together with the code
(inside the zip but dont unzip it).
1) Copy the cityexpasion.slc file inside the directory
path starting from the CTP2 base directory /ctp2_data/default/gamedata/,
2) Then cut the content of CE_Tileimp and paste inside the *_tileimp.txt file
(inside the gamedata folder).
3) Then add in the correct *_script.slc the line: #include
"cityexpasion.slc"
4) Launch the mod
* This stands for the mod file prefix (APOL for Apolyton Pack and GM1 for goodmod).
How to install to play with others mods?
This will require the same procedure of the installation
for the Apolyton Pack or the GoodMod. But it will also require changes in the
code itself. Mainly to "warn" the code when a new age has entered.
This is warned in the ExpandCity function wich starts in line 613 of the code.
In this function you will see several
ID_ADVANCE_* that need to be changed according to the mod.If you already has
some background in modding CTP2 that will not be a problem. If you dont have
this background or did not figure out how to do this just send me a e-mail
or ask in the Apolyton
forums.
VI. How to use it together with IW's Wonder
Code.
First make the same procedure as if you were using it together with the Apolyton Pack or the GoodMod. Explained above. Ther problem is to prevent cities to be placed over the wonder.
At the very beginning of the code there this fuction to prevent the city expansions to be placed over a Wonder Improvement from IW code in a current location (tmpLoc). It works returning a number when triggered. If there is a Wonder it returns 1 (true) if there isnt it returns 0 (false). So if it returns 1 the Placment dont occur.
int_f TileHasWonder(location_t
tmpLoc) {
return 0;
}
}
As you can see, hte way it is set it always return 0. So you will have to change this code so that it returns 1 when there is a wonder in the location. Since the wonder from the IW's code are tile improvements you will have to use a function called TileHasImprovement(location_t, int_t). This functions works checking in a certain location ("location_t" wich we will call tmpLoc in this code) a certain tile improvement ("int_t" wich is the entry for the wonder in the form TerrainImprovementDB(TILEIMP_*) since it comes from the tileimp.txt). This way if there actually is this improvement/wonder we make it return 1. The code will look like this:
int_f TileHasWonder(location_t
tmpLoc) {
if(TileHasImprovement(tmpLoc,
TerrainImprovementDB(TILEIMP_WONDER_PYRAMIDS))
) {
return 1;
} else {
return 0;
}
}
Wich can be easily be read like "when calling the TileHasWonder(location_t) function it will check the loaction tmpLoc. If tile (tmpLoc) has improvement TILEIMP_WONDER_PYRAMIDS (that stands for the pyramids) the function returns 1 to confirm the existence of a wonder".
Now you need to make others wonders also returns 1. For this there is the symbol "||" wich stands for "or". So the code will look like this.
int_f TileHasWonder(location_t
tmpLoc) {
if(TileHasImprovement(tmpLoc,
TerrainImprovementDB(TILEIMP_WONDER_PYRAMIDS))
|| TileHasImprovement(tmpLoc,
TerrainImprovementDB(TILEIMP_WONDER_HANGING_GARDENS))
|| TileHasImprovement(tmpLoc,
TerrainImprovementDB(TILEIMP_WONDER_CHICHEN_ITZA))
|| TileHasImprovement(tmpLoc,
TerrainImprovementDB(TILEIMP_WONDER_GREAT_WALL_A))
|| TileHasImprovement(tmpLoc,
TerrainImprovementDB(TILEIMP_WONDER_GREAT_WALL_B))
) {
return 1;
} else {
return 0;
}
}
Wich can be read as "when calling the TileHasWonder(location_t) function
it will check the loaction tmpLoc. If tile (tmpLoc) has improvement TILEIMP_WONDER_PYRAMIDS
(that stands for the pyramids) or tile (tmpLoc) has improvement TILEIMP_WONDER_HANGING_GARDENS
(that stands for the Hnging Gardens) or tile (tmpLoc) has improvement TILEIMP_WONDER_GREAT_WALL_A
(that stands for part A of the Great wall) or tile (tmpLoc) has improvement
TILEIMP_WONDER_GREAT_WALL_B (that stands for part B of the Great wall) the function
returns 1 to confirm the existence of a wonder"
You may note that every "(" or "{" opened has to be closed
at the end. All of this expanation is to make
you understand what you are doing but the only thing you really to now is to
add after the last
TileHasImprovement line in the last piece of the
code the line:
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(*))
Where * stands for a tile improvement
from the file tileimp.txt of the woder code that is a wonder.
If you cant make this work
just send me a e-mail or ask in
the Apolyton
forums.