Terra-Mod Design & Problems

Laokong

Chieftain
Joined
Jul 31, 2009
Messages
36
Greetings, fellow Civ-Fanatics.

As a long time lurker of these forums (going back to some modding experiments on CIV3), I would first like to express my gratitude to everyone who has kept this site alive and full of content.

Now, I have been playing CIV5 pretty much since release and more so since G&K. One major source of frustration with this iteration of the game for me is I can’t play my favorite type of map: Terra. Indeed, as has been noted in many threads, due to game mechanics, playing on Terra is a disappointing experience. So I’ve been thinking about ways to make a mod that would improve play on Terran worlds. However, I have little experience with modding CIV5 and programming more generally so after going through most tutorial and help threads on the forum I am still facing some dead ends even at the mod design stage.

Below is a rather long post where I will:
1) describe some issues with playing Terra in CIV5,
2) provide some avenues to improve gameplay on Terra that I’d like to include in the mod,
3) explain some design issues I have bumped into so far.

I do understand that this project is probably way above my head given my lack of experience (some aspects may even be impossible due to game limitations or lack of access to DLLs), so any ideas and help, perhaps just to point me in the right direction, from veteran modders at this stage or further down would be much appreciated.

Problems with Terra in CIV5.
This has been covered in part in different threads and posts, but I think it useful to recap these in order to understand my aim and purpose with the mod.

Spoiler :

1- There is no incentive to expand to the “New World” (NW).
Due to happiness/culture mechanics regarding ‘wide’ Civs, there is little incentives besides gaining access to some resources for expansion in the mid-late game when the NW is revealed. This results in the AI/human player rarely colonizing the NW. Which removes much of the interest of playing Terra.

2- Settling the NW doesn’t help achieving victory
With the exception of gaining support from NW CS for a diplomatic victory, victory conditions don’t encourage dealing with the NW: there are no enemy capital to conquer and cities are likely to be settled too late to help with a science or culture victory (the latter acting against expansion to begin with).

3- Terra maps are larger than other maps of the same size, yet this is not taken into account in gameplay.
Science, Culture and Golden Age costs are all affected by the size of other maps, yet the extra landmasses on a Terra map isn’t balanced by changes to these costs.

4- Distances to the NW discourage expansion.
This is especially true on large/huge maps where 10+ turns may be needed to reach an overseas location.

5- Terra map scripts encourage AIs to explore, but not to expand overseas.
Caravels often visit the NW, but AIs presence often stops there.

6- Many CIVs are destroyed early on the “Old World” (OW) Pangea.
A large landmass, unbalanced costs and a smaller number of City States on the OW (since CS are split between OW and NW) means that non-expansionist CIVs are likely to be destroyed by their neighbors earlier than on other maps. This, in turn, reduces competition when it comes to settling the NW.

7- Discovering fully-developed CS in the NW robs CIV5 Terra of its “discovery” flavor.
This doesn’t have much impact on gameplay, but does feel odd. How did these minor civs develop in complete autarky? Semi-civilized barb cities in CIV4 made discovery of the NW more interesting and rewarding.


Modding Terra
The goal of this Mod would be to improve play on Terra (eventually Rspeer’s Terra Incognita too) by (a) making it worthwhile to settle the NW, (b) encouraging the AI to be more expansionist, (c) giving it a better “feeling” of discovery and colonization.

So here are the key elements and some options:

Spoiler :

1- Adoption of a social policy branch would give a unique bonus to overseas cities upon researching Navigation.
For example, opening “Commerce” could give a boost to the value of overseas trade routes or “Rationalism” would provide extra science from luxury resources found overseas. That way developing overseas colonies would provide an advantage to any CIV regardless of their grand strategy. Even those looking for a Cultural victory could gain, though they are more likely not to expand. I would select Navigation instead of Astronomy as the threshold so that these gains do not show up with the first settler sent to the NW.

Modding requirements: a) modify intro Social Policies to trigger the new bonus upon researching Navigation, b) find a way for the game to differentiate between same-continent and overseas cities.

2- Adapt the culture/science/golden age/national wonders costs and the target number of cities to account for the larger map.
This is a pretty straightforward way to encourage expansion or at least remove some disincentives to it.

Modding requirements: Mostly changes to ratios in World.xml and costs in Buildings.xml

3- Make CIVs more resilient early in the game.
To ensure that the OW doesn’t become a graveyard of empires and to put more demographic, territorial and resource pressure to overseas expansion as well as stimulate competition.

Modding requirements: either a) change the base city defense value or b) add a building akin to Kael’s Palissade for early defense. I would be more inclined to go for the latter to preserve early game tradeoffs between expansion and defense.

4- AI CIVs destroyed early in the game respawn on the NW.
I don’t know if there is any way to make this working in the game. New CIVs would spawn on the NW once a OW CIV’s capital falls. Domination-oriented CIVs would thus have an incentive to expand to the NW or else would have to refrain from early conquest. I’m thinking of a cut-out point at year 0AD or upon the first accession to the Medieval Era to give the new CIV some time to develop (new CIV would probably start with an extra settler + warrior). Of course, this would add greatly to the new world flavor of Terra.

Modding requirements: this would be a tricky one as far as I know, I haven’t seen any reference to such a mod and I don’t know how the game’s limitation on the number of CIV per map as well as the CIV location scripts would interfere with such a modification. I’m thinking of a Lua script which would trigger the CIV spawn script following the conquest of a Capital before the cut-out point. The spawn point would have to be set on the NW and the location script would have to be re-run to get an acceptable spawn point in that area, both of which might be tricky to mod. If a second CIV falls before the cut-out point, its spawn location would have to be fairly far from the first one. In addition, the possibility of flipping barb units around the spawn point (à la Rhyes & Fall of Civ should be looked at).

5- City States on the NW spawn later in the game.
Again, not sure if this is possible at all. CS would only spawn on the NW (a) if a CIV’s capital fall on the OW (same as a major CIV respawn) or (b) once a player researches Astronomy (then they would get already-researched techs). This would ensure that either (a) NW CS are at the same level of development as a respawned CIV or (b) CS are at a similar level of development as early colonies from major CIVs. In addition to preserving the flavor of a NW discovery game, this would add a twist to Terra games: you may either deal with developed CS that are relatively behind technologically speaking because they appeared at the same time as a newly-spawned CIV or you find technologically up-to-date CS that just have started to colonize the NW.

Modding requirements: First, this change would entail rebalancing the Terra script so that about 2/3 of the total CS are on the OW, again adding pressure to overseas expansion and probably adding 2-3 CS to the total. As per CIVs’ respawn, Lua scripts would have to be design to trigger the spawn process, one for early appearance and one for astronomy-era development. Flipping barbs could also be needed, especially for early start.

Options: Eventually I’d like to be able to use davii.adams Minor Civs with a Terra Mod.

6- Add a new optional “Colonialism” technology and “Colonists” unit
Colonialism would come after Astronomy and would be slightly more expensive than Navigation, it wouldn’t lead to any other technology. Colonialism would allow the training of “Colonists” units. Colonist would be a special type of settler with the military unit attributes of Pikemen (perhaps with a possibility to upgrade to Musketmen attributes), they might also have slightly stronger defense rate when embarked. Cities founded by Colonists would start with 2 or 3 pop and a free harbor or monument/shrine (perhaps based on open Social Policy branches).

As was suggested in a CIV Fanatics thread (can’t find where), founding a city with a colonist could give the opportunity to select between a Colony (founds a regular city), a Territory (founds a puppeted city) or a Dominion (founds a new CS with a big chunk of influence). Founded CS would either be (a) of a random type, (b) selected according to policy branches or (c) Maritime by default (I don’t know yet which option would be best balanced).

Researching Colonialism and training colonists would certainly give a big advantage for colonizing the NW, that’s why I’d make it both expensive and optional. Of course, non-colonialist CIV could still expand in the NW using regular settlers.

Modding requirements: Creating the new tech and new unit should be relatively easy. Modding the type of colony created could be more difficult though. I was thinking that founding a city with a colonist could bring a CS-liberation-like menu which already has the abovementioned options built-in. However, I couldn’t find if/where the “settle” action could be modified.

7- Double speed of all units on Ocean tiles
This change would greatly speed up to discovery and colonization of the NW and thus encourage overseas expansion. One issue with this change is that it would affect coastal warfare and give an advantage to long-range attacks from the open seas. A solution would be to apply this modifier only to Ocean Hex located x hex from the coast or to limit it to “international waters” (i.e. outside of cultural boundaries.

Modding requirements: reduce the movement costs of Ocean hexes (excluding Ironclads), eventually find a way to reduce ocean hex movement near coastal areas.

8- Make some Luxury Resources only available in the NW.
This might already be part of the Terra script, needs to be confirmed.

Modding requirements: Ratio of OW/NW luxury resources might need a change. Terran maps may require one more Luxury Res than other maps of the same size to help expansion.

9- Introduce new strategic resources for Scientific Victory.
Replace the required strategic resource (aluminium) for SS Cockpit, SS Engine and SS Stasis Chamber to Rare Earths, Methane Hydroxide and Lithium respectively; SS Boosters would continue to require aluminium. These new strategic resources would be revealed upon discovery of Scientific Theory. Rare Earths and Lithium are Land resources and need a mine; Methane Hydroxide is a Sea resource and needs an Offshore Platform. Each node would yield 1 resource. Improved Rare Earths and Lithium resources would yield 1 more gold; improved Methane Hydroxide resource would yield 2 extra science. Two of these resources types would only be available in the NW.

Modding requirements: Add the 3 strategic resources; change the requirements for the units. Adapt the map script to distribute these resources in the OW and NW.

10- Consider introducing a NW area factor in Domination victory (especially if CIV respawn is impossible)
To ensure that Domination Victory is truly a domination, it may be necessary to add a factor to include the NW as a part of that domination, either as a % of total NW land or as a number of cities on the NW.

Modding requirements: Change domination victory conditions, I have no idea how an area % could be included as a condition.


Modding challenges
As described above some of the needed changes for this mod appear (at least in the eye of this modding dilettante) quite challenging. I have been reviewing the online tutorials and various threads on modding available. I have some ideas how to deal with some challenges after getting more comfortable with xml and Lua. Yet for some other issues, I am totally at loss because I can’t find ways or don’t know if it’s even possible to program the abovementioned modifications. Here are some troublesome issues.

Spoiler :

1- Overseas bonuses
I would need to find a way to define 2 types of cities so that colonies can gain Social Policy-based bonuses: 1) those on the same continent as the capital or accessible over Coastal waters, 2) those located on a different continent/island separated by Ocean hexes. This could probably be done by mapping potential trade routes connections (i.e. excluding blocades/open borders agreement from the equation) or by uncovering how “Other Continents” are defined in the ECONOMICAISTRATEGY_EXPAND_TO_OTHER_CONTINENTS function. Alternatively, a distance-from-capital factor could be set and modified depending on map size, but this would then benefit inland expansion Russian-style. If only the last option can be modded, then conquered cities located far away from the capital should be excluded from gaining these benefits.

Ideally this overseas definition could also be used to distinguished NW CIVs and CS to provide social policy-related bonuses.

2- CIV respawn and late CS spawn.
Though it seems theoretically possible to have a Lua script trigger the spawn process as a Game Event later in the game, I haven’t read anything on this subject online. I don’t know if it’s been tried and if it is possible at all. As far as I know, no official scenario has CIVs or CS spawn late in the game.

In addition, although the Terra map script includes a function to distribute CS on the NW, I’m not too sure how much this can be manipulated and if the location-selection script can be invoked later on in the game to make sure CIV respawn are restricted to the NW (there is a similar problem with restricting strategic resources to the NW).
Another issue is founding a city as a CS or as a puppet city, I know it’s been suggested on the forum, but I’m not sure if it’s ever been implemented in a mod. Also unclear is how to modify the “Settle” action.

3- Ocean movement
I believe the easiest way to deal with this would be to give all post-Astronomy naval/embarked units (excluding Ironclads) a promotion which boosts Ocean hex speed. As stated above however, finding a way to limit this bonus’ impact on coastal warfare could also create some modding difficulties like distinguishing between near-land vs. high seas or national vs. international waters. Alternatively, the map script could be adapted to double the average coastal width, yet that may introduce some issues with coastal resources/economics.

4- Area-wide barb flipping upon spawn
An issue related to mid-game spawning of CIVs or CS is to make sure that they won’t be surrounded by hostile barbs upon spawning. Thus a mechanism for converting nearby barbarians would probably be needed if a way to allow in game CIV spawn is found.

5- Policy bonuses
For Social Policy-based bonuses triggered by the discovery of Navigation, I think adding a new column to the Social Policy table (using Afforess’ SQL methodology) for the bonus and making it dependent on the tech would be the way to go. I might be wrong though since I haven’t seen any policy bonuses dependent on technology.
 
This is a very interesting goal, and I wish you luck with it. But it seems to me that there is still one huge extra issue that isn't mentioned here: how to get the AI to contest the new world successfully.

All the modifications that make contesting the new world interesting/important for the player probably aren't by themselves going to make the AI do so.
 
I agree, that is a big issue and I truly don't know if AIs are ever going to go for it.

I was hoping to make it work through a mix of:
(a) playing around with flavors, AIs' economic and military strategies as well as leaders priorities,
(b) making some victory conditions dependent on the new world,
(c) increasing the benefits of going overseas for most Grand Strategies while making it slightly harder to have a wholly Old World approach to winning the game (through higher scientific costs and a different repartition of resources) and
(d) increasing demographic/territorial pressure on the Old World.​

Now, that will certainly need a lot of fine-tuning and, hopefully, general improvement of the AI over time. I believe that the greatest difficulty will be to get the right level of incentives without unbalancing the game, hence the need to fix as many of the problems I have mentioned in my original post as possible.

Here I might have to rely on more experienced modders again: in your experience how well do these kinds of incentives work when trying to orient AIs' strategies? What would be the best way to encourage an unusual type of behavior (like colonizing an empty continent) from AIs?
 
I am not an experienced modder on the technical side at all, and I know little about the AI, so take this with a huge grain of salt. But I would be amazed if you could change AI intercontinental settlement patterns with Flavors, and most of the mechanic changes you're talking about aren't things that I think would affect AI decision-making (ocean movement rates, particular valuable resources, trade routes differing for across continents).

My guess is that you won't be able to get much change here until we have access to more AI code.
 
Here I might have to rely on more experienced modders again: in your experience how well do these kinds of incentives work when trying to orient AIs' strategies? What would be the best way to encourage an unusual type of behavior (like colonizing an empty continent) from AIs?

I don't know how much you can influence the AI using the defines, but I know that you could take complete control of some AI settler via Lua if you're ready to invest enough time in the coding.
 
Not all AIs have to expand to the new world, so you shouldn't view that as a limitation (the world becomes a bit more dynamic if not every AI is 100% going to gun for the new world).

Making a victory condition tied to the new world will not affect AI behavior in the slightest until access to the DLL is given. (so yeah btw that was promised 3 times over the past 2 years and they still haven't delivered, do they think we're just dumb or something?)
 
On a related note, what IS the biggest possible map tile wise?

Is it a huge terra, huge earth, or is it one of the scenarios? What's the hard limit?
 
On a related note, what IS the biggest possible map tile wise?

Is it a huge terra, huge earth, or is it one of the scenarios? What's the hard limit?

~182x96, but I didn't tried higher values since a long time, would be interesting to test bigger maps with G&K
 
I am not an experienced modder on the technical side at all, and I know little about the AI, so take this with a huge grain of salt. But I would be amazed if you could change AI intercontinental settlement patterns with Flavors, and most of the mechanic changes you're talking about aren't things that I think would affect AI decision-making (ocean movement rates, particular valuable resources, trade routes differing for across continents).

My guess is that you won't be able to get much change here until we have access to more AI code.

What made me think of these as a way to encourage expansion was the way they were used in the New World scenario. Then again, in that scenario, European powers have only one city and nowhere else to expand. There seems to be an agreement in the forum that Defines/Flavors aren't as effective as they should be, but as you point out, barring the release of codes, that's what we have to work with...

Not all AIs have to expand to the new world, so you shouldn't view that as a limitation (the world becomes a bit more dynamic if not every AI is 100% going to gun for the new world).

I totally agree with you, I wouldn't expect/like to see all of them go for the New World, it wouldn't make much sense for a CIV following a cultural Grand Strategy. I'd be happy to see 50-60% of the AI's CIVs establish some sort of presence on the new continent before the late 19th Century though.

~182x96, but I didn't tried higher values since a long time, would be interesting to test bigger maps with G&K

Speaking of which. Earlier on, when I was thinking about Terran maps in CIV5, I wondered that the size of these maps might be part of the problem: the Old World is vast enough that Civs don't need to expand. Then I was worried that changing the proportions would only lead to slaughter early in the game. Any thoughts about that?
 
CIV5AIEconomicStrategies.xml

Code:
<Row>
			<Type>ECONOMICAISTRATEGY_EXPAND_TO_OTHER_CONTINENTS</Type>
			<WeightThreshold>50</WeightThreshold>
			<NoMinorCivs>true</NoMinorCivs>
			<MinimumNumTurnsExecuted>25</MinimumNumTurnsExecuted>
			<CheckTriggerTurnCount>10</CheckTriggerTurnCount>
			<TechPrereq>TECH_OPTICS</TechPrereq>
		</Row>

Blow that up to like 300 and see what you get.
 
Blow that up to like 300 and see what you get.

Yes, I played with ECONOMICAISTRATEGY_EXPAND_TO_OTHER_CONTINENTS, not as drastically though. I can't say I've seen much of a change in AI behavior so far.

I've been going over and over the XML and Lua assets and there are 2 things that I can't find that are kinda holding me back on my design/modding process. Would anyone point me in the right direction?

1- Where can I find the XML item that define the type of great people that can be bought with faith upon opening the bottom policy branches?

2- Is there a way to differentiate between cities that are connected by land/coastal tiles and cities that can only be connected with overseas (ocean) trade routes?
 
Something that came up to my mind when reading this post: sure, there is no strong incentive to settle the new continent but, historically, this is more or less accurate.

  • * Exploiting resources provided wealth (special resources with nice bonuses only available on this continent). But this is not settling.
    * Settling was only a sovereignty issue: "those lands are useless but, who knows, they could be useful later so let's get them before other do" (nothing special to do) and maybe a sea control issue.
    * Mose of the settling came from the fact that this continent was a haven for people suffering from religious persecution, or trying to escape justice, or people with such miserable lives that they wanted to reset it, which includes many wicked people and low-lives (free settlers or spontaneous city creations?).
    * In the end there was no to few benefits since those colonies became independent, one of them ending up bigger than the mother countries (create a new civilization on this continent and make it end up at war with everyone who settled there? Or make it a strong challenger that you would have to defeat in the end game?)

Now I am no historian, it would be interesting to look at the exact circumstances to get some gameplay ideas.
 
Something that came up to my mind when reading this post: sure, there is no strong incentive to settle the new continent but, historically, this is more or less accurate.
[...]
Now I am no historian, it would be interesting to look at the exact circumstances to get some gameplay ideas.

I can't say that I totally agree with you, but I'm no historian either. The elements you point at might hold true, to a certain point, as far as the U.S. is concerned, but do not always apply to other colonies.

Your suggestion of looking at exact circumstances is truly worthwhile though, so, here are a few circumstances I am aware of (others may certainly think of other historical incentives to colonization).

The 1st spur of European overseas expansion was the control of trade routes. The expansion of the Ottoman empire led to their monopoly over traditional spice routes and trade links to China. In turn, the Portuguese established a series of ports and forts around Africa and in the Indian Ocean all the way to Macau. Due to demographic limitations, these remained mostly military and commercial settlements. Spain's support to Columbus' expeditions came as a response to the Portuguese control of those routes. Only they didn't expect the Americas to lie in the way. This reason for expansion would be difficult to include as part of a non-scenario CIV5 game since contact with a CIV and extra resources are the minimum requirements for inter-Civ trade.

The second source of expansion were resources (that we'd call luxury). At first it was the exploitation of Central and South America's mineral resources (gold & silver) which required a workforce following the demographic collapse of native people, this workforce came both from Spain and Africa through slave trade. Next came the development of sugar, spice, cotton and tobacco plantations in the Carribeans, Brazil and North America. In parallel, England and France were vying for control of furs in the northern part of North America. Development of all those resources needed colonial development as they would in the game.

What we'd call strategic resources played a lesser role in overseas expansion from European powers. Yet, access to North America's hardwood was crucial in the development of the English navy, especially during the Napoleonic continental blockade.

Even before the Spanish discovery/conquest, one could argue that food resources had already drawn fishermen and whalers to the St-Lawrence Gulf/Great Banks of Newfoundland areas, which in turn supported demographic expansion in Europe.

Earlier still, demographic pressures and technical discoveries encouraged Scandinavians to explore and settle the Northern Atlantic (Iceland, Greenland, Vinland) until the Great Plague and climate change (a short Ice Age) put an end to their expansion.

Of course, religion had a great role to play. In some cases, as you mention, colonization was stengthened by religious strife. In other cases, religion limited colonization. For instance, French protestants (Huguenots) ended up settling in the Netherlands, England and their colonies because Louis XIV had proclaimed that New France would be Catholic. It also goes without saying that proselytism also brought quite a few Spaniards to the New World...

At first, most European overseas settlements were established by semi-private Chartered Companies or for military purposes. Free-wheeling immigration to the New World came much later as steam power made transportation less expensive.

Now, the independence question you mention is a nagging one. In hindsight Renaissance-Era Portugal, Spain, England and France might have had second thoughts about their colonial drive. Yet, it did leave some heritage to these days through things like the Commonwealth or the French Dom-Tom. I thought the Vassals system in CIV4 was an elegant way to dealing with this. I don't think it could be effectively modded in CIV5. Then again, how much impact does that have on winning the game in the real world? Hard to tell... I'd say the U.S came close to diplomatic victory in the 1990s, China is probably the one heading for Alpha Century over the long term and we all hope we don't get to see military domination in our lifetime... ;)

Finally, I don't think we should underestimate the scientific gains of the European overseas expansion, for examples new crops (tomatoes, potatoes, tobacco, etc.) and a new understanding of the world (shape of the Earth, Darwinian Evolution). Neither should we understimate the economic gains of that period: gold bullions made Spain the dominant European power for about 2 centuries, opium trade helped balance British trade and financed its industrialization, access to overseas spices/food were a factor in triggering a demographic revolution, etc.

How to mod this on a Terra Map? As mentioned in my original post, I would:

1- Give policy-based bonuses to dovetail with the Grand Strat. of a Civ and to create incentives for settlement.
2- Make it faster/easier/more rewarding to settle the new world
3- Make staying on the Old World less appealing for Grand Strategies other than cultural.
4- Encourge AI overseas expansion through flavors, AI Economic strategies, and such.
5- Rebalance the game to take the larger map into account.
6- Have Civs respawn on the New World when one is defeated on the Old World.

Limited as they are (though nonetheless complicated to mod), I hope these changes would make playing a Terran map more rewarding gamewise. Thank you very much Don for forcing me to think it over historically. :goodjob:
 
Noobish Questions Vol. I (First 3 of a presumably long series)

1- The Terra Lua script uses the following function to discriminate between continents when it comes to Natural Wonders placement. Can I use the same function in other scripts to discriminate between Old World and New World?

Code:
local iAreaID = plot:GetArea();
if iAreaID == self.iBiggestLandmassID then

2- Do I need to create a SQL file to signal a new table (not a new column in an existing table as per [TUTORIAL] Adding New XML Columns to Existing XML Tables w/SQL)? On a related matter, since most of the content of a new table would have to be coded in Lua anyway, would it be necessary to create a new XML table as well?

3- Will the engine recognize XML tags out of context. In other words, can I use an existing tag (let's say <Column name="TradeRouteGoldModifier" type="integer" default="0"/> existing in the Policies Table and still get the same effect in a new table?
 
1. Only if the new continent is the biggest landmass (note that "Map" has several LUA functions to get specific areas such as the biggest landmass). So you have to look at the terra script to know how it decides which continent is the old one and which is the new one.
2. Afaik you can just create a new XML file that will declare a new table, no need for a SQL file. But you could indeed just create a LUA table, it's a matter of which is the most convenient to edit, whether you want other mods to be able to add content to that table (if you plan to have optional features for example), whether you need the convenient features of GameInfo (GameInfo.Resources[0], GameInfo.Resources["RESOURCE_GOLD"], GameInfo.Resources{MinLatitude = 0}), and about the pain of sharing LUA data between contexts (you need to use a LUA event). For those reasons a XML file still seems like a better choice but I am not 100% sure that GameInfo works correctly for custom tables.
3. It's very unlikely.
 
Back
Top Bottom