Modifying CEP food yields

jakob51

Chieftain
Joined
Dec 5, 2005
Messages
50
Location
Brisbane, Australia
Hi all, I've got another question regarding CEP.

I'm wanting to mod the base yields of food resources in CEP (I always play the game modded, can't stand vanilla Civ V and expansions). Just to clarify I mean the yields of the resources before they are improved (so for example I want to change the yield of unimproved wheat from no yield in CEP back to the default +1 yield of the unmodded game).

I just recently with guidance from ExpiredReign used ModBuddy for the first time to make another mod incompatible with CEP compatible and playable with it but clearly I am out of my depth and obviously keen to avoid screwing up my game completely.

I've been able to open the relevant XML file with ModBuddy and then had a look at it but until I have a clear idea of what I am doing I am not going to proceed any further.

Any instructions or guidance on this matter will be greatly appreciated; please and thank you in advance.
jakob51
 
Before you proceed down that path, have a read of this thread about the matter and decide whether Wheat needs a modification.

Afterwards, assuming you still want to change it, it will only require a one line piece of sql as a mod to restore it. The fiddling around in ModBuddy to prepare the actual mod is more tiresome. As nice as it is to have a tool that assists in modding, ModBuddy will go down in history as a 'turkey'.
 
Thanks for the reply once again ExpiredReign, you clearly are a very busy contributor to this ambitious mod project and its community.

An interesting little thread; a very enlightening discussion, thanks for linking it. It's definitely got a number of relevant points of view regarding whether wheat as a bonus resource deserved to be nerfed or whether the other bonus resources deserve buffing.

In the context of my question its definitely convinced me that the other bonus resources need either their base yield buffed or tech improvements for their terrain improvements.

Personally I am leaning heavily towards base yield for the simple fact that its is an immediately accessible effect whereas tech improvements may not be accessible until much later in the game when new cities are less likely to be in need of a boost to their growth and productivity, and when its less likely that new cities will be founded either by myself or the AI.

I would still like to return wheat to its original vanilla base yield but also I was planning on increasing the base yields of the other bonus resources cause I believe that they are underwhelming as so called bonuses and deserve to be made more valuable.

Thanks again for the link, the response and any guidance that you can offer on changing the yields, I definitely want to change all the bonuses to better reflect their bonus resource status and historical value as food/raw material sources.
 
Also I forgot to ask: I was hoping to change the yield of flood plains back to the Civ III/Civ IV yield of +3 food from the Civ V yield of +2; is this possible in the same SQL file or is it going to be overcomplicating something that should be kept as simple as possible?
 
If you are bumping up food yields more generally, you may want to consider increasing the cost of population growth. Our experience is that the AI seems to be poor at prioritizing growth and this appears to be only fixable at the margins without a dll mod. Your approach may or may not help to add more food as a base yield effect, but would be also more valuable in the hands of a human player. So you may want to balance it with some decrease in growth speed. Test it first without and see how the AI does.

For the yield balances, I would look for a tech to put a pasture-camp-plantation bump in (maybe a freshwater/non-water yield for "two" bumps) if you are looking for that. The base bump is fine for each of those to start because it adds to a unique tile already. The issue there is farms and mines keep getting bumped up further and pastures/camps/plantations do not (as much). +1 food on pastures somewhere, +1 gold or food on camps, and +1 gold or food on plantations would help there. Probably gold or production on quarries or oil wells as well.
 
Also I forgot to ask: I was hoping to change the yield of flood plains back to the Civ III/Civ IV yield of +3 food from the Civ V yield of +2; is this possible in the same SQL file or is it going to be overcomplicating something that should be kept as simple as possible?

Changes to the database values are an easy thing todo. You can place all the 'yield' related changes into one sql file and your set. For that matter you could place ALL your edits into one file. CEP uses a large directory/file structure simply to help locate changes.
I would however advise you to take on board the suggestions from @mystikx21 and others.
Balance is the biggest issue I have come across in my modding experience. It is so easy to make a change here, lower a value there, raise the base value here, and the end result is a dog's breakfast of unrelated changes messing up things in other areas.

My advice is, just have a go. Read all the code you can from CEP and other mods and see what is being changed and where. Gather some modding tools together, I can help you with that if you want, and start modding. I started modding only in February of last year. Before then I may have dabbled in making minor edits to other peoples work, but at that time I joined Thalassicus in this project. I am still in the paddling pool compared to other modders, but you will never learn to swim without getting wet.:D

Oh and another thing. Just as you are doing now, ask questions. Even if they are stupid or obvious, if you are not sure, ask. Even now I ask questions of others and when I get the answer back I often think, "I knew that, that makes sense, why did I need to ask?" Sometimes all is needed is a little outside nudge for the penny to drop.
 
Thanks for the responses guys, much appreciated.

I definitely am keen to learn basic modding skills to be self-sufficient at this sort of tweaking for personal taste; I'm just nervous at the prospect of screwing up and causing a bigger problem than I started with.

@mystikx21: I'm not sure that I'd need to increase the cost of pop growth by much simply cause I always play games on Marathon speed; but it is a valid point to ponder on none-the-less, particularly as I have no experience at trying to get the AI to utilise any changes made correctly.

Aside from ModBuddy (which I now have) what are the other modding tools that I should acquire that are suitable for my requirements? Also in terms of reading the code of mods it appears fairly straight forward but I was wondering if there is any traps or tricks I should be aware of?

Otherwise thanks again for the responses, advice and suggestions and stay posted, I will definitely be asking more questions.
 
With regards to SQL, is there a particular source I should get an SQL template from for use with ModBuddy, because as it stands now it does not have any SQL templates by default. Googling it has just completely overwhelmed and bewildered me.
 
Regarding tools. IMO, it is essential to have a good text editor, preferably one with code-completion such as Notepad++ or SublimeText. Don't even think of using the ModBuddy text editor as your main editor, it is a waste of time. ModBuddy should really be used ONLY to build your finalized mod into the package used for distribution. Even then all of that can be done without it. But I digress.

Next after your editor is SQLiteSpy. This is a very handy tool for looking through the game's database and seeing all the tables used to make the game. Additionally when you come to writing new SQL commands they can be trialled in the actual database without the need to start a game and see how they affect the game.
As all the code provided by Firaxis and by mods are only sets of commands, in either SQL or XML, to generate a database, you will find it easier to look at that database this way.

Have a look in the 'cache' folder under the \Documents\My Games\Sid Meier's Civilization 5 folder.

All those files are databases compiled from the source code of the game. The two that you have control over with mods are:
Civ5DebugDatabase.db
Localization-Merged.db


The 'debug' database is the one that holds all the values that the game uses, such as the yields for wheat or floodplains. The Localization database holds all the in game text that is displayed, in all the languages the game is made for.

So let's use your original question about 'Wheat'.

The original Firaxis code creates a table called Resource_YieldChanges with XML code like this:
Code:
<Resource_YieldChanges>
...
	<Row>
		<ResourceType>RESOURCE_WHEAT</ResourceType>
		<YieldType>YIELD_FOOD</YieldType>
		<Yield>1</Yield>
	</Row>
...
</Resource_YieldChanges>

(the ellipses are just to show that there was other code in this block, they're not part of the code)

Now to change that value you need to modify that table with new code, by writing a set of commands in XML or SQL to replace or update the values of the existing table. This is what mods do. They simply provide new commands to the game engine to update the compiled database.
The steps are this:
1) Game engine reads all the stock code from the original game plus the extensions and any DLC you have and it builds those databases.
2) Then it reads all the installed mods and makes a copy of that database and adds in the changes that the mods bring.
That's why in the 'cache' folder there are two files very similar, Civ5DebugDatabase.db and Civ5CoreDatabase.db. One of them, Civ5CoreDatabase.db is the unmodded game database and the other is with all the mod changes. ( using SQLiteSpy you can look through those files and see what goes where and how they use different tables to do different things)

Now CEP has changed that table to remove the initial 'Wheat' yield and it now no longer exists in that table. That was done with this:
Code:
<Resource_YieldChanges>
	<Update>
		<Where YieldType="YIELD_GOLD" />
		<Set Yield="1" />
	</Update>
	[B]<Delete ResourceType="RESOURCE_WHEAT" />[/B]
	<Delete ResourceType="RESOURCE_COW" />
	<Row>
		<ResourceType>RESOURCE_COW</ResourceType>
		<YieldType>YIELD_PRODUCTION</YieldType>
		<Yield>1</Yield>
	</Row>
...

So to revert that change you need to give some commands to 'put it back'.

You could use XML, like the original Firaxis code. Or you could use SQL to insert it that way. Either way is fine. It just depends on what you are familiar/comfortable with.

As a general rule of thumb, CEP uses XML when creating something like a new building or unit and uses SQL to update existing values. Sometimes though, as with this example, XML is just simpler to use in structuring the command than SQL.

Next step for you is find some good online references for SQL & XML. By 'good' I mean ones that you find easy to follow, not what others think tell everything. Happy googling.
 
Thanks for the response once again ExpiredReign, you've been incredibly helpful and I really appreciate it.

Looks like I've got some googling and downloading to do.

Once again thank you very much for your responses, advice and suggestions; I will definitely take it all on-board and see how I go. Like you said, can't learn to swim without getting wet.
 
Top Bottom