Modding The Tech Tree

Aheadatime

Prince
Joined
Dec 21, 2009
Messages
325
Hey guys, quick question. If I wanted to do some simple tweaks to the tech tree (moving building/unit unlocks to different techs etc.), would this be XML work? I downloaded a tech tree mod to reverse engineer it, and there was some SQL that looked like this;

Spoiler :
Code:
UPDATE Technologies SET GridX = GridX+1;
UPDATE Technologies SET GridX = GridX-1 WHERE Type IN ('TECH_AGRICULTURE', 'TECH_POTTERY', 'TECH_TRAPPING', 'TECH_ANIMAL_HUSBANDRY', 'TECH_ARCHERY', 'TECH_MINING', 'TECH_CALENDAR', 'TECH_REAL_HORSEBACK_RIDING', 'TECH_MASONRY');

UPDATE Technologies SET Help = 'TXT_KEY_TECH_HELP';

Strikes me as odd though, as the mod completely overhauls the tech tree for pretty much every era, so I'm wondering why the SQL was needed for these specific techs, and what it does exactly.
 
The top two lines of SQL move everything in the tech tree one column to the right, and then move the specific techs back one column to the left, thus creating an 'empty' column in the tech-tree where a mod can then add new stuff.

The purpose of the third line of SQL eludes me since unless I am mis-interpretting it would make all techs show the same 'Help" tooltip.

-----------------------------------------------------------

As far as the question as to whether altering a Building or Unit's Prerequisite Technology is XML work or SQL work, the answer is yes. Whether you use XML or SQL depends entirely on which you find more comfortable and the 'easement' one language will provide over the other (SQL can simplify your code if 'group-moves' or 'group-changes' can be applied).

Some of us, such as the SQL heretic advocate JFD, refuse to use anything except SQL unless XML cannot be avoided.
 
Thanks Lee. I've begun messing around with some ideas. I can't seem to find a way to make Trading Posts unlocked at a particular tech. Searched through the terrain files pretty thoroughly and the Improvement folder has Trading Posts listed like this;

Spoiler :
Code:
<Row>
<Type>IMPROVEMENT_TRADING_POST</Type>
<Description>TXT_KEY_IMPROVEMENT_TRADING_POST</Description>
<Civilopedia>TXT_KEY_CIV5_IMPROVEMENTS_TRADING_POST_TEXT</Civilopedia>
<ArtDefineTag>ART_DEF_IMPROVEMENT_TRADING_POST</ArtDefineTag>
<PillageGold>20</PillageGold>
<PortraitIndex>32</PortraitIndex>
<IconAtlas>TERRAIN_ATLAS</IconAtlas>
</Row>

No PrereqTech. Is this particular instance beyond XML?
 
The technology requirements for terrain-improvements are not found in the Improvements table. They are found in the Builds table, which defines which unit-build-actions create which improvements.
Code:
<Row>
	<Type>[COLOR="Blue"]BUILD_TRADING_POST[/COLOR]</Type>
	<PrereqTech>[COLOR="blue"]TECH_GUILDS[/COLOR]</PrereqTech>
	<Time>700</Time>
	<ImprovementType>[COLOR="blue"]IMPROVEMENT_TRADING_POST[/COLOR]</ImprovementType>
	<Description>TXT_KEY_BUILD_TRADING_POST</Description>
	<EntityEvent>ENTITY_EVENT_BUILD</EntityEvent>
	<HotKey>KB_T</HotKey>
	<OrderPriority>95</OrderPriority>
	<IconIndex>41</IconIndex>
	<IconAtlas>UNIT_ACTION_ATLAS</IconAtlas>
</Row>
Workers are then allowed to create the BUILD_TRADING_POST by the spcifications with table Unit_Builds:
Code:
	<Unit_Builds>
	<Row>
		<UnitType>UNIT_WORKER</UnitType>
		<BuildType>BUILD_ROAD</BuildType>
	</Row>
	<Row>
		<UnitType>UNIT_WORKER</UnitType>
		<BuildType>BUILD_RAILROAD</BuildType>
	</Row>
	<Row>
		<UnitType>UNIT_WORKER</UnitType>
		<BuildType>BUILD_FARM</BuildType>
	</Row>
	<Row>
		<UnitType>UNIT_WORKER</UnitType>
		<BuildType>BUILD_MINE</BuildType>
	</Row>
	<Row>
		<UnitType>UNIT_WORKER</UnitType>
		<BuildType>[COLOR="blue"]BUILD_TRADING_POST[/COLOR]</BuildType>
	</Row>
	......etc........
 
Fixed, thanks Lee. I have a question concerning art.. the topic that has always scared me. I've moved the ability to chop jungle and marshes over to mining, and now the icons for removing forest, jungle, and marsh all appear in the tech tree under mining. I want to have just one icon with a hover-text that reads "Remove forests, jungles, and marshes". How would this be achieved?

Tried looking at what's known as "icon atlas", but some of the icons in the tech tree, despite being totally different, share the same icon atlas, so that's as far as my research went.
 
Fixed, thanks Lee. I have a question concerning art.. the topic that has always scared me. I've moved the ability to chop jungle and marshes over to mining, and now the icons for removing forest, jungle, and marsh all appear in the tech tree under mining. I want to have just one icon with a hover-text that reads "Remove forests, jungles, and marshes". How would this be achieved?

Tried looking at what's known as "icon atlas", but some of the icons in the tech tree, despite being totally different, share the same icon atlas, so that's as far as my research went.
Multiple Icons are often shoved into the same "Icon Files". This allows up to 64 icons to share the same file for each size of icon. So there can be up to 64 "256-size" icons in one file, and up to 64 "128-size" icons in another file, etc. The Icon Atlas defines for the game which dds-files contain which size of icon for a group of icons, and give this group of icons all residing within the same files a convenient "name" for reference within other xml files.

  1. <PortraitIndex> tells the game which picture (0-63) within this group of files to use.
  2. <IconAtlas> gives a reference to table IconTextureAtlases and column Atlas within that IconTextureAtlases table so the game can then read this information and know that for <IconAtlas>BW_ATLAS_1</IconAtlas> the 256-sized icons are within file BuildingAtlas.dds, whereas all the icons for the 128-sized icons are within file BuildingAtlas1024.dds. Unlike what Firaxis did with their Icons File Names, most mod-makers follow a naming convention for their icon files such as MyIcons256.dds, MyIcons128.dds, etc.

--------------------------------------------------------------------

For the other thing with the tech tree, intense modding of the Tech Tree UI panel lua-file would likely be required, if not also DLL level modding.
 
I've never added to the tech tree before, mainly because I'm terrible with spatial perception -- including coordinates on that great big chart. One of my mod ideas (focused on the motion-picture biz) would add the following two techs as requirements for other components.

  1. Photography (requires both Chemistry and Scientific Theory first) unlocks a few buildings that boost Culture, Gold, and/or Tourism. (Travel Agency and Newsstand come to mind; has anyone got other ideas that fit both the tech and the Modern Era?)
  2. Motion Photography (requires both Replacement Parts and Photography) unlocks the movie-related buildings described in my original thread.

If someone here could please write the tech-tree code, I'd be happy to credit them for the help when I finish that mod. Thank you so much!
 
I've never added to the tech tree before, mainly because I'm terrible with spatial perception -- including coordinates on that great big chart. One of my mod ideas (focused on the motion-picture biz) would add the following two techs as requirements for other components.

  1. Photography (requires both Chemistry and Scientific Theory first) unlocks a few buildings that boost Culture, Gold, and/or Tourism. (Travel Agency and Newsstand come to mind; has anyone got other ideas that fit both the tech and the Modern Era?)
  2. Motion Photography (requires both Replacement Parts and Photography) unlocks the movie-related buildings described in my original thread.

If someone here could please write the tech-tree code, I'd be happy to credit them for the help when I finish that mod. Thank you so much!

  • If table <Unit_TechTypes> works (at all) and in a similar manner to table <Building_TechAndPrereqs> then you can handle all the building and unit "prereqs" by using these tables to specify an additional required technology before the unit or building can be made.
  • This will allow you to place your Photography tech at the same "Y" height in the tech tree as Scientific Theory, and at an "X" location one greater than Scientific Theory.
  • Your Motion Photography is then placed in a similar relationship to tech Replaceable Parts so far as the tech's XY placement in the tech grid.
  • Photography then uses Scientific Theory as a prerequisite technology in table Technology_PrereqTechs. Motion Photography uses Replaceable Parts as its prerequisite.
  • Then you just make Replaceable Parts require Photography in addition to anything it currently requires, and you make Atomic Theory require Motion Photography in addition to its current requirements.
  • Buildings and units that will need Photography use this as their direct PrereqTech in <Units> or <Buildings>, but also have an entry in either <Unit_TechTypes> or <Building_TechAndPrereqs> to also require Chemistry.
  • Buildings and units that will need Motion Photography use this as their direct PrereqTech in <Units> or <Buildings>, but also have an entry in either <Unit_TechTypes> or <Building_TechAndPrereqs> to also require Chemistry because even though there is no way the player can get to Motion Photography without already having Scientific Theory, Photography, and Replaceable Parts they could still get there without Chemistry.
  • There are also lua methods that can be applied to lock players from getting Tech-X if they don't also have Tech-Y, but for cases of one or two specific technologies you would need very clear tool-tips to explain this to players otherwise they will probably freak out and claim your mod is broken and no good because "I can't research photography!!!!"
 
Multiple Icons are often shoved into the same "Icon Files". This allows up to 64 icons to share the same file for each size of icon. So there can be up to 64 "256-size" icons in one file, and up to 64 "128-size" icons in another file, etc. The Icon Atlas defines for the game which dds-files contain which size of icon for a group of icons, and give this group of icons all residing within the same files a convenient "name" for reference within other xml files.

  1. <PortraitIndex> tells the game which picture (0-63) within this group of files to use.
  2. <IconAtlas> gives a reference to table IconTextureAtlases and column Atlas within that IconTextureAtlases table so the game can then read this information and know that for <IconAtlas>BW_ATLAS_1</IconAtlas> the 256-sized icons are within file BuildingAtlas.dds, whereas all the icons for the 128-sized icons are within file BuildingAtlas1024.dds. Unlike what Firaxis did with their Icons File Names, most mod-makers follow a naming convention for their icon files such as MyIcons256.dds, MyIcons128.dds, etc.

--------------------------------------------------------------------

For the other thing with the tech tree, intense modding of the Tech Tree UI panel lua-file would likely be required, if not also DLL level modding.

Well the icon I had in mind wasn't anything new, it was just the chop forest/jungle icon (the hatchet). But if you're saying that having that hover-text dsiplay something specific (other than "chop forest") is too tedious a task, then there's no use in modding the icons in the first place.

Now I'm trying to create new buildings that serve to smooth over transitions in the tech tree and create more decision making/specialization, and I plan on reverse engineering some mods later tonight to learn what I can, but if any of you guys can point me to a good guide or tutorial on how to do so, it'd be much appreciated.
 
  • If table <Unit_TechTypes> works (at all) and in a similar manner to table <Building_TechAndPrereqs> then you can handle all the building and unit "prereqs" by using these tables to specify an additional required technology before the unit or building can be made.
  • This will allow you to place your Photography tech at the same "Y" height in the tech tree as Scientific Theory, and at an "X" location one greater than Scientific Theory.
  • Your Motion Photography is then placed in a similar relationship to tech Replaceable Parts so far as the tech's XY placement in the tech grid.
  • Photography then uses Scientific Theory as a prerequisite technology in table Technology_PrereqTechs. Motion Photography uses Replaceable Parts as its prerequisite.
  • Then you just make Replaceable Parts require Photography in addition to anything it currently requires, and you make Atomic Theory require Motion Photography in addition to its current requirements.
  • Buildings and units that will need Photography use this as their direct PrereqTech in <Units> or <Buildings>, but also have an entry in either <Unit_TechTypes> or <Building_TechAndPrereqs> to also require Chemistry.
  • Buildings and units that will need Motion Photography use this as their direct PrereqTech in <Units> or <Buildings>, but also have an entry in either <Unit_TechTypes> or <Building_TechAndPrereqs> to also require Chemistry because even though there is no way the player can get to Motion Photography without already having Scientific Theory, Photography, and Replaceable Parts they could still get there without Chemistry.
  • There are also lua methods that can be applied to lock players from getting Tech-X if they don't also have Tech-Y, but for cases of one or two specific technologies you would need very clear tool-tips to explain this to players otherwise they will probably freak out and claim your mod is broken and no good because "I can't research photography!!!!"

Hmmm. that's a bit convoluted; I've seen official technologies with two prerequisites before, though. (Reaching Theology, for example, requires both Drama/Poetry and Philosophy first; those two techs are parallel links on the tree.) Do you think you could code in my new techs as I described them, please? I'd gladly credit you for that part.
 
The problem is where two techs from different regions of the tech tree are both prerequisites for Tech-X causes some unfortunate tech-tree piping to be displayed in the tech UI panel. The method I proposed would avoid these odd disturbed tech-tree layouts, give greater conformity to a greater number of other mods (because the pre-exisiting tech tree is jiggered-around less), and still have the functional result you are looking for: Construction of Building-X requires the player to have Tech Photography (which is the apparent unlocker) but it also requires the player to have Tech Chemistry.
 
@LeeS: OK...could you please post your simpler version of the new tech-tree code, when you have time to write it?
 
Multiple Icons are often shoved into the same "Icon Files". This allows up to 64 icons to share the same file for each size of icon. So there can be up to 64 "256-size" icons in one file, and up to 64 "128-size" icons in another file, etc. The Icon Atlas defines for the game which dds-files contain which size of icon for a group of icons, and give this group of icons all residing within the same files a convenient "name" for reference within other xml files.

  1. <PortraitIndex> tells the game which picture (0-63) within this group of files to use.
  2. <IconAtlas> gives a reference to table IconTextureAtlases and column Atlas within that IconTextureAtlases table so the game can then read this information and know that for <IconAtlas>BW_ATLAS_1</IconAtlas> the 256-sized icons are within file BuildingAtlas.dds, whereas all the icons for the 128-sized icons are within file BuildingAtlas1024.dds. Unlike what Firaxis did with their Icons File Names, most mod-makers follow a naming convention for their icon files such as MyIcons256.dds, MyIcons128.dds, etc.

To be honest, I'm having a hard time fully absorbing this information still. It helps my mind to use tangible examples, so I'll paste a few snippets of code from a building I'm using as a reference to reverse engineer. Under the 'Buildings' define row, there are these three art references;

Spoiler :
Code:
<IconAtlas>RES_BUILDING_DJSH_ATLAS</IconAtlas>
<PortraitIndex>3</PortraitIndex>
<ArtDefineTag>ART_DEF_BUILDING_BANK</ArtDefineTag>

What does each line mean exactly? How would I load my image into modbuddy, and how would I utilize the Atlas to communicate to the game which image is to be used?
 
<ArtDefineTag> is used to tell the game which 3d model animation to use on the main-mnap rendering of the city when a building is present in the city. But for buildings added by mods, most people omit this entirely or they state "NONE" because except for a few specific buildings and for Firaxis-supplied world wonders there isn't anything 3d rendered anyway.

-------------------------------------------------------------------------------------------------

In Pouakai/Janboruta's Enlightenment Era mod you will find this for two of the wonders added by Enlightenment Era:
Code:
<GameData>
	<Buildings>
		<!--=====================-->
		<!--== New Wonders ======-->
		<!--=====================-->
		<!--Crystal Palace-->
		<Row>
			<Type>BUILDING_EE_CRYSTAL_PALACE</Type>
			<BuildingClass>BUILDINGCLASS_EE_CRYSTAL_PALACE</BuildingClass>
			<Description>TXT_KEY_BUILDING_EE_CRYSTAL_PALACE</Description>
			<Help>TXT_KEY_WONDER_EE_CRYSTAL_PALACE_HELP</Help>
			<Civilopedia>TXT_KEY_WONDER_EE_CRYSTAL_PALACE_PEDIA</Civilopedia>
			<ThemingBonusHelp>TXT_KEY_EE_CRYSTAL_PALACE_THEMING_BONUS_HELP</ThemingBonusHelp>
			<Quote>TXT_KEY_WONDER_EE_CRYSTAL_PALACE_QUOTE</Quote>
			<Cost>950</Cost>
			<PrereqTech>TECH_EE_ROMANTICISM</PrereqTech>
			<MaxStartEra>ERA_MODERN</MaxStartEra>
			<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<NukeImmune>true</NukeImmune>
			<HurryCostModifier>-1</HurryCostModifier>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>100</ConquestProb>
			<GreatWorkSlotType>GREAT_WORK_SLOT_ART_ARTIFACT</GreatWorkSlotType>
			<GreatWorkCount>3</GreatWorkCount>
			[color="blue"]<IconAtlas>ENLIGHTENMENT_WONDER_ATLAS</IconAtlas>[/color]
			[color="green"]<PortraitIndex>3</PortraitIndex>[/color]
			<WonderSplashImage>EE_Crystal_Palace_splash.dds</WonderSplashImage>
			<WonderSplashAnchor>L,B</WonderSplashAnchor>
			<WonderSplashAudio>AS2D_WONDER_SPEECH_EE_CRYSTAL_PALACE</WonderSplashAudio>
		</Row>
		<!--Fasil Ghebbi-->
		<Row>
			<Type>BUILDING_EE_FASIL_GHEBBI</Type>
			<BuildingClass>BUILDINGCLASS_EE_FASIL_GHEBBI</BuildingClass>
			<Description>TXT_KEY_BUILDING_EE_FASIL_GHEBBI</Description>
			<Help>TXT_KEY_WONDER_EE_FASIL_GHEBBI_HELP</Help>
			<Civilopedia>TXT_KEY_WONDER_EE_FASIL_GHEBBI_PEDIA</Civilopedia>
			<Quote>TXT_KEY_WONDER_EE_FASIL_GHEBBI_QUOTE</Quote>
			<Cost>875</Cost>
			<PrereqTech>TECH_EE_FORTIFICATION</PrereqTech>
			<MaxStartEra>ERA_INDUSTRIAL</MaxStartEra>
			<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<NukeImmune>true</NukeImmune>
			<Defense>900</Defense>
			<HurryCostModifier>-1</HurryCostModifier>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>100</ConquestProb>
			[color="blue"]<IconAtlas>ENLIGHTENMENT_WONDER_ATLAS</IconAtlas>[/color]
			[color="green"]<PortraitIndex>6</PortraitIndex>[/color]
			<WonderSplashImage>EE_FasilGhebbi_splash.dds</WonderSplashImage>
			<WonderSplashAnchor>L,B</WonderSplashAnchor>
			<WonderSplashAudio>AS2D_WONDER_SPEECH_EE_FASIL_GHEBBI</WonderSplashAudio>
		</Row>
	</Buildings>
</GameData>
The parts I highlighted in blue are referring to this information, which registers with the game the Atlas that will be referred to as ENLIGHTENMENT_WONDER_ATLAS:
Code:
GameData>
	<IconTextureAtlases>
		<Row>
			<Atlas>[color="blue"]ENLIGHTENMENT_WONDER_ATLAS<[/color]/Atlas>
			<IconSize>256</IconSize>
			<Filename>Enlightenment_Wonders_256.dds</Filename>
			<IconsPerRow>5</IconsPerRow>
			<IconsPerColumn>2</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>[color="blue"]ENLIGHTENMENT_WONDER_ATLAS<[/color]/Atlas>
			<IconSize>128</IconSize>
			<Filename>Enlightenment_Wonders_128.dds</Filename>
			<IconsPerRow>5</IconsPerRow>
			<IconsPerColumn>2</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>[color="blue"]ENLIGHTENMENT_WONDER_ATLAS<[/color]/Atlas>
			<IconSize>80</IconSize>
			<Filename>Enlightenment_Wonders_80.dds</Filename>
			<IconsPerRow>5</IconsPerRow>
			<IconsPerColumn>2</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>[color="blue"]ENLIGHTENMENT_WONDER_ATLAS<[/color]/Atlas>
			<IconSize>64</IconSize>
			<Filename>Enlightenment_Wonders_64.dds</Filename>
			<IconsPerRow>5</IconsPerRow>
			<IconsPerColumn>2</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>[color="blue"]ENLIGHTENMENT_WONDER_ATLAS<[/color]/Atlas>
			<IconSize>45</IconSize>
			<Filename>Enlightenment_Wonders_45.dds</Filename>
			<IconsPerRow>5</IconsPerRow>
			<IconsPerColumn>2</IconsPerColumn>
		</Row>
	</IconTextureAtlases>
</GameData>
  1. This second chunk of code defines the name of the Atlas
  2. This second chunk of code tells the game which dds file is to be used for each size of icon needed by an Atlas
  3. See FramedArchitect's Icon and Screen Pixel Dimension Reference tutorial, which tells you for which type of game element (such as a building or a wonder) what sizes of icons are required by the game.
    • What sizes of icons the game needs for a building or a wonder is not the same as the sizes of icons it needs for a unit icon or a leader icon, for example.
  4. If you download the Enlightment Era mod and then use GIMP or Photoshop to open and look at what is inside the file called Enlightenment_Wonders_256.dds
    • You will see a series of little circular images contained within that file.
    • If you then close that file and open Enlightenment_Wonders_128.dds you will see the exact same images, except these images are scaled-down in size.
    • Rinse, repeat for each of the other dds files specified in the second chunk of code quoted from Enlightenment Era mod. The images themselves remain the same from one file to another, they are just of different pixel-dimension scales.
  5. But how does the game know which of these images to use for BUILDING_EE_CRYSTAL_PALACE and which to use for BUILDING_EE_FASIL_GHEBBI ?
    • Answer: The <PortraitIndex> # specified for each of these wonders tells the game which image from within the dds files is to be used for "Crystal Palace", and which for "Fasil Ghebbi"
      • <PortraitIndex> #'s start at '0' for the image in the upper left corner and are numbered from there proceeding across each row from left to right, and then continuing on for the next row down, starting at the left and numbering towards the right.
      • So, for a dds file with four icons the <PortraitIndex> #'s could be arranged as:
        Code:
        0	1
        2	3
        or
        Code:
        0	1	2	3
        or
        Code:
        0
        1
        2
        3
        All depending on how the creator of the dds file arranged the images within the dds file.
 
Downloaded GIMP and have been trying to learn all of this quickly this morning, but it's been slow lol. Thanks for the explanation lee.

Another question. I've separated the 'bonus food from resources' feature of the granary into two new buildings; the Stockyard and the Garden. Stockyards provide food for furs, deer, and bison. Gardens provide food for wheat, bananas, and truffles. These buildings provide food to the resource tiles, but provide no flat resources of their own. Thus, they should require the effected resources to be in range of the city to construct.

Seems I cannot make it so that the city requires these resources in range without requiring them to be improved before displaying the option to construct them. The features I could find are LocalResourcesOrs and LocalResourcesAnd, both of which seem to require the improved version of the resource. I don't know what to do about this, other than making them require the improved version which I don't want due to my preference to sometimes keep resources unimproved (particularly bananas).
 
@LeeS: OK...could you please post your simpler version of the new tech-tree code, when you have time to write it?
Adds Photograpy and Motion Photography techs as mentioned, and a Cinema building that requires both the Motion Photography and the Chemistry Techs. The Cinema also requires an Amphitheater in the same city
Spoiler verified and tested xml code :
Code:
<GameData>

<!--		NEW TECHS		-->

	<Technologies>
		<Row>
			<Type>TECH_PHOTOGRAPHY</Type>
			<Cost>2350</Cost>
			<Description>TXT_KEY_TECH_PHOTOGRAPHY_TITLE</Description>
			<Help>TXT_KEY_TECH_PHOTOGRAPHY_HELP</Help>
			<Civilopedia>TXT_KEY_TECH_PHOTOGRAPHY_DESC</Civilopedia>
			<Quote>TXT_KEY_TECH_PHOTOGRAPHY_QUOTE</Quote>
			<Era>ERA_INDUSTRIAL</Era>
			<Trade>true</Trade>
			<GridX>10</GridX>
			<GridY>3</GridY>
			<PortraitIndex>55</PortraitIndex>
			<IconAtlas>TECH_ATLAS_1</IconAtlas>
		</Row>
		<Row>
			<Type>TECH_MOTION_PHOTOGRAPHY</Type>
			<Cost>4100</Cost>
			<Description>TXT_KEY_TECH_MOTION_PHOTOGRAPHY_TITLE</Description>
			<Help>TXT_KEY_TECH_MOTION_PHOTOGRAPHY_HELP</Help>
			<Civilopedia>TXT_KEY_TECH_MOTION_PHOTOGRAPHY_DESC</Civilopedia>
			<Quote>TXT_KEY_TECH_MOTION_PHOTOGRAPHY_QUOTE</Quote>
			<Era>ERA_MODERN</Era>
			<Trade>true</Trade>
			<GridX>12</GridX>
			<GridY>3</GridY>
			<PortraitIndex>55</PortraitIndex>
			<IconAtlas>TECH_ATLAS_1</IconAtlas>
		</Row>
	</Technologies>
	<Technology_PrereqTechs>
		<Row>
			<TechType>TECH_PHOTOGRAPHY</TechType>
			<PrereqTech>TECH_SCIENTIFIC_THEORY</PrereqTech>
		</Row>
		<Row>
			<TechType>TECH_MOTION_PHOTOGRAPHY</TechType>
			<PrereqTech>TECH_REPLACEABLE_PARTS</PrereqTech>
		</Row>
		<Row>
			<TechType>TECH_REPLACEABLE_PARTS</TechType>
			<PrereqTech>TECH_PHOTOGRAPHY</PrereqTech>
		</Row>
		<Row>
			<TechType>TECH_ATOMIC_THEORY</TechType>
			<PrereqTech>TECH_MOTION_PHOTOGRAPHY</PrereqTech>
		</Row>
	</Technology_PrereqTechs>
	<Technology_Flavors>
		<Row>
			<TechType>TECH_PHOTOGRAPHY</TechType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>2</Flavor>
		</Row>
		<Row>
			<TechType>TECH_PHOTOGRAPHY</TechType>
			<FlavorType>FLAVOR_SCIENCE</FlavorType>
			<Flavor>3</Flavor>
		</Row>
		<Row>
			<TechType>TECH_PHOTOGRAPHY</TechType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>3</Flavor>
		</Row>
		<Row>
			<TechType>TECH_MOTION_PHOTOGRAPHY</TechType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>2</Flavor>
		</Row>
		<Row>
			<TechType>TECH_MOTION_PHOTOGRAPHY</TechType>
			<FlavorType>FLAVOR_SCIENCE</FlavorType>
			<Flavor>3</Flavor>
		</Row>
		<Row>
			<TechType>TECH_MOTION_PHOTOGRAPHY</TechType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>3</Flavor>
		</Row>
	</Technology_Flavors>

<!--		CINEMA BUILDING		-->

	<Buildings>
		<Row>
			<Type>BUILDING_MOVIE_CINEMA</Type>
			<BuildingClass>BUILDINGCLASS_MOVIE_CINEMA</BuildingClass>
			<Cost>100</Cost>
			<GoldMaintenance>2</GoldMaintenance>
			<PrereqTech>TECH_MOTION_PHOTOGRAPHY</PrereqTech>
			<FreeStartEra>ERA_INDUSTRIAL</FreeStartEra>
			<Help>TXT_KEY_BUILDING_MOVIE_CINEMA_HELP</Help>
			<Description>TXT_KEY_BUILDING_MOVIE_CINEMA</Description>
			<Civilopedia>TXT_KEY_BUILDING_MOVIE_CINEMA_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_BUILDING_MOVIE_CINEMA_STRATEGY</Strategy>
			<ArtDefineTag>NONE</ArtDefineTag>
			<MinAreaSize>-1</MinAreaSize>
			<ConquestProb>66</ConquestProb>
			<Happiness>1</Happiness>
			<IconAtlas>BW_ATLAS_1</IconAtlas>
			<PortraitIndex>63</PortraitIndex>
		</Row>
	</Buildings>
	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_MOVIE_CINEMA</Type>
			<DefaultBuilding>BUILDING_MOVIE_CINEMA</DefaultBuilding>
			<Description>TXT_KEY_BUILDING_MOVIE_CINEMA</Description>
		</Row>
	</BuildingClasses>
	<Civilization_BuildingClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_BARBARIAN</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_MOVIE_CINEMA</BuildingClassType>
			<BuildingType/>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_MINOR</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_MOVIE_CINEMA</BuildingClassType>
			<BuildingType/>
		</Row>
	</Civilization_BuildingClassOverrides>
	<Building_ClassesNeededInCity>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<BuildingClassType>BUILDINGCLASS_AMPHITHEATER</BuildingClassType>
		</Row>
	</Building_ClassesNeededInCity>
	<Building_TechAndPrereqs>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<TechType>TECH_CHEMISTRY</TechType>
		</Row>
	</Building_TechAndPrereqs>
	<Building_YieldChanges>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<YieldType>YIELD_CULTURE</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_YieldChanges>
	<Building_Flavors>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<FlavorType>FLAVOR_GOLD</FlavorType>
			<Flavor>5</Flavor>
		</Row>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<FlavorType>FLAVOR_CULTURE</FlavorType>
			<Flavor>10</Flavor>
		</Row>
		<Row>
			<BuildingType>BUILDING_MOVIE_CINEMA</BuildingType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>10</Flavor>
		</Row>
	</Building_Flavors>

<!--		LANGUAGE TXT_KEYS		-->

	<Language_en_US>
		<Row Tag="TXT_KEY_TECH_PHOTOGRAPHY_TITLE">
			<Text>Photography</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_PHOTOGRAPHY_HELP">
			<Text>The [COLOR_POSITIVE_TEXTPhotography[ENDCOLOR] technology allows you to have photographs and stuff.</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_PHOTOGRAPHY_DESC">
			<Text>Photography is a means by which real-world images are captured on etched steel or glass plates or other media, preserving these images for all time. Or until your city gets pillaged.</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_PHOTOGRAPHY_QUOTE">
			<Text>"I have siezed the light. I have arrested its flight." -- Louis Daguerre</Text>
		</Row>

		<Row Tag="TXT_KEY_TECH_MOTION_PHOTOGRAPHY_TITLE">
			<Text>Motion Pictures</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_MOTION_PHOTOGRAPHY_HELP">
			<Text>The [COLOR_POSITIVE_TEXT]Motion Pictures[ENDCOLOR] technology allows you to build the Cinema, a Modern-Era Building where Motion Pictures are presented as entertainment and enjoyed by the city population, increasing happiness.</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_MOTION_PHOTOGRAPHY_DESC">
			<Text>I propose [COLOR_POSITIVE_TEXT]A Voyage From the Earth to the Moon![ENDCOLOR][NEWLINE][NEWLINE]-- Georges Méliès</Text>
		</Row>
		<Row Tag="TXT_KEY_TECH_MOTION_PHOTOGRAPHY_QUOTE">
			<Text>"Look at the image of the train. It is [COLOR_POSITIVE_TEXT]moving ![ENDCOLOR][NEWLINE][COLOR_NEGATIVE_TEXT]Oh My God!!! Run! It's headed right for us![ENDCOLOR]"[NEWLINE]-- Unknown</Text>
		</Row>


		<Row Tag="TXT_KEY_BUILDING_MOVIE_CINEMA">
			<Text>Cinema</Text>
		</Row>
		<Row Tag="TXT_KEY_BUILDING_MOVIE_CINEMA_HELP">
			<Text>Provides extra happiness to a city. Like the Colosseum and similar buildings, the sum-total of the happiness added to the city can never exceed the city population. A City must have an Amphitheater in order to construct a Cinema, and you must also have learned the Chemistry Technology.</Text>
		</Row>
		<Row Tag="TXT_KEY_BUILDING_MOVIE_CINEMA_PEDIA">
			<Text>Cinemas are innovations of the Modern and Late-Industrial Eras originally adapted from the more classical designs of live action theaters, opera and music halls, to the specific needs of displaying motions pictures to large audiences.</Text>
		</Row>
		<Row Tag="TXT_KEY_BUILDING_MOVIE_CINEMA_STRATEGY">
			<Text>Construct Cinemas in your cities to raise happiness and to gain a small amount of [ICON_GOLD] Gold and [ICON_CULTURE] Culture. Presence of Cinemas in your cites also unlocks the xxxxx National Wonder once you have a Cinema in every city.</Text>
		</Row>
	</Language_en_US>
</GameData>
You will have to:
  1. Make adjustments to the <Building_ClassesNeededInCity>, etc., as I am not sure this was 100% what you wanted.
  2. Alter IconAtlas and PortraitIndex once you have the icons for the buildings, the techs, etc.
  3. Adjust building and tech flavors, probably.
  4. Change the Cinema Building's GoldMaintenance and Cost settings, as I just copy/pasted from an existing template I had.
  5. Massage the TXT_KEY tooltips. Deguerre's quote is authentic....the others part apochrophal and part based on some of the stuff that actually happend (people ran screaming from some theaters when the theaters were showing some of the first filmed "Train Pulling Into Station" or "Train Approaching Along Track" sequences). Melies' "Le Voyage Dans la Lun (A Trip to the Moon) (1902)" was the first true motion picture as we think of them in the modern world -- it created a sensation in the US, and preceeded production of "The Great Train Robbery (1903)" (which is often quoted as being the first modern-definition 'motion-picture') by one year.
 
Downloaded GIMP and have been trying to learn all of this quickly this morning, but it's been slow lol. Thanks for the explanation lee.

Another question. I've separated the 'bonus food from resources' feature of the granary into two new buildings; the Stockyard and the Garden. Stockyards provide food for furs, deer, and bison. Gardens provide food for wheat, bananas, and truffles. These buildings provide food to the resource tiles, but provide no flat resources of their own. Thus, they should require the effected resources to be in range of the city to construct.

Seems I cannot make it so that the city requires these resources in range without requiring them to be improved before displaying the option to construct them. The features I could find are LocalResourcesOrs and LocalResourcesAnd, both of which seem to require the improved version of the resource. I don't know what to do about this, other than making them require the improved version which I don't want due to my preference to sometimes keep resources unimproved (particularly bananas).
The behavior you are quoting is the behavior coded into the game-tables in question. I have rather an extensive reference posted here on the forum and linked in my signature on how various building-related tables function and what they require which should answer 99+% of any questions you may have on how a particular Building-Related table functions, what its requirements are, idiosyncracies, best usages, etc.
 
Just checked your guide to Buildings XML, and I'm assuming the answer lies in Lua, which is Chinese to me. The issue is that both tables 'LocalResourceOrs' and 'LocalResourceAnds' establish a relationship between the building and an improved resource. I wish to have a building become available if an unimproved resource is within working distance.

Thus, I fear I would need to create a new table for this in Lua to reference via XML. This is beyond me. If somebody would be willing to help, that'd be very much appreciated and I would give credit in the mod. I can always tweak the buildings to balance around the improved resource (LocalResourceOrs in this case), but that would be a last resort.
 
Apparently after working on my mod for a few hours this morning, it is now causing civ to crash. Couldn't isolate the change I made that caused this. Checked the logs and the issues seem normal (meaning the types of issues that have been present since I started working on this mod which haven't caused any issue in-game). Could anyone tell me if something sticks out?
 

Attachments

  1. Don't do this
    Code:
    <Delete Type="BUILDING_WINDMILL"/>
    
    <Row>
    	<Type>BUILDING_WINDMILL</Type>
    	<BuildingClass>BUILDINGCLASS_WINDMILL</BuildingClass>
    	<Cost>250</Cost>
    	<GoldMaintenance>2</GoldMaintenance>
    	<PrereqTech>TECH_ECONOMICS</PrereqTech>
    	<Description>TXT_KEY_BUILDING_WINDMILL</Description>
    	<Civilopedia>TXT_KEY_CIV5_BUILDINGS_WINDMILL_TEXT</Civilopedia>
    	<Strategy>TXT_KEY_BUILDING_WINDMILL_STRATEGY</Strategy>
    	<Help>TXT_KEY_BUILDING_WINDMILL_HELP</Help>
    	<ArtDefineTag>ART_DEF_BUILDING_FORGE</ArtDefineTag>
    	<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
    	<SpecialistCount>1</SpecialistCount>
    	<MinAreaSize>-1</MinAreaSize>
    	<ConquestProb>66</ConquestProb>
    	<BuildingProductionModifier>10</BuildingProductionModifier>
    	<HurryCostModifier>25</HurryCostModifier>
    	<IconAtlas>BW_ATLAS_1</IconAtlas>
    	<PortraitIndex>1</PortraitIndex>
    </Row>
    Do this:
    Code:
    <Replace>
    	<Type>BUILDING_WINDMILL</Type>
    	<BuildingClass>BUILDINGCLASS_WINDMILL</BuildingClass>
    	<Cost>250</Cost>
    	<GoldMaintenance>2</GoldMaintenance>
    	<PrereqTech>TECH_ECONOMICS</PrereqTech>
    	<Description>TXT_KEY_BUILDING_WINDMILL</Description>
    	<Civilopedia>TXT_KEY_CIV5_BUILDINGS_WINDMILL_TEXT</Civilopedia>
    	<Strategy>TXT_KEY_BUILDING_WINDMILL_STRATEGY</Strategy>
    	<Help>TXT_KEY_BUILDING_WINDMILL_HELP</Help>
    	<ArtDefineTag>ART_DEF_BUILDING_FORGE</ArtDefineTag>
    	<SpecialistType>SPECIALIST_ENGINEER</SpecialistType>
    	<SpecialistCount>1</SpecialistCount>
    	<MinAreaSize>-1</MinAreaSize>
    	<ConquestProb>66</ConquestProb>
    	<BuildingProductionModifier>10</BuildingProductionModifier>
    	<HurryCostModifier>25</HurryCostModifier>
    	<IconAtlas>BW_ATLAS_1</IconAtlas>
    	<PortraitIndex>1</PortraitIndex>
    </Replace>
  2. You neither have any art files as part of your mod, nor have you defined what this 'Atlas' is, nor which art dds files this 'Atlas' should make use of:
    Code:
    RES_BUILDING_STOCKYARD_ATLAS
    • This makes your addition of BUILDING_STOCKYARD fail because while the building will probably be used by the game, every attempt to access it will cause on or another type of failures, such as the ugly blob instead of an icon in city views, civilopedia, etc.
    • Until you can get custom artwork made and the proper dds icon-files (and the necessary XML-code that defines RES_BUILDING_STOCKYARD_ATLAS) added to your mod, just use the Courthouse icon as a stand-in, for example:
      Code:
      <IconAtlas>BW_ATLAS_1</IconAtlas>
      <PortraitIndex>63</PortraitIndex>
    • You have the same basic error spread throughout your mod, across new building, techs, whatever.
  3. All of these errors in the Database.log are pointing to problems that require resolution:
    Code:
    [1130759.937] Invalid Reference on Buildings.IconAtlas - "RES_BUILDING_STOCKYARD_ATLAS" does not exist in IconTextureAtlases
    [1130759.937] Invalid Reference on Buildings.IconAtlas - "RES_BUILDING_CONFECTIONARY_ATLAS" does not exist in IconTextureAtlases
    [1130759.937] Invalid Reference on Buildings.IconAtlas - "RES_BUILDING_EXPORT" does not exist in IconTextureAtlases
    [1130759.953] Invalid Reference on Buildings.BuildingClass - "BUILDINGCLASS_EXPORT_CENTER" does not exist in BuildingClasses
    [1130760.312] Invalid Reference on Building_LocalResourceOrs.ResourceType - "RESOURCE_FURS" does not exist in Resources
    [1130760.312] Invalid Reference on Building_ResourceYieldChanges.ResourceType - "RESOURCE_TRUFFLE" does not exist in Resources
    [1130760.312] Invalid Reference on Building_ResourceYieldChanges.ResourceType - "RESOURCE_FURS" does not exist in Resources
    [1130761.421] Invalid Reference on Technologies.IconAtlas - "ICON_ATLAS_CRAFTS" does not exist in IconTextureAtlases
  4. RESOURCE_FUR and RESOURCE_TRUFFLES are the correct designations.
  5. The fact that there is no BUILDINGCLASS_EXPORT_CENTER registered with the game is the likely cause of the crash. Buildings must belong to a valid Building-Class, and Units must belong to a valid Unit-Class, or you get CTD on game-loading after you press "START GAME" from the game set-up menu, or you press "LOAD GAME" when attempting to load a saved game (though you would only see this as an error introduced when attempting to rescue a corrupted saved game -- in such cases you are always time-ahead in just accepting that the saved game is corrupt past any hope of redemption).
    • No such animal as "BUILDINGCLASS_EXPORT_CENTER" exists here:
      Code:
      	<BuildingClasses>
      		<Row>
      			<Type>BUILDINGCLASS_STOCKYARD</Type>
      			<DefaultBuilding>BUILDING_STOCKYARD</DefaultBuilding>
      			<Description>Stockyard</Description>
      		</Row>
      
      		<Row>
      			<Type>BUILDINGCLASS_CONFECTIONARY</Type>
      			<DefaultBuilding>BUILDING_CONFECTIONARY</DefaultBuilding>
      			<Description>Confectionary</Description>
      		</Row>
      	</BuildingClasses>
    • But you are attempting to reference it here:
      Code:
      		<Row>
      			<Type>BUILDING_EXPORT_CENTER</Type>
      			<BuildingClass>[color="red"]BUILDINGCLASS_EXPORT_CENTER[/color]</BuildingClass>
      			<Cost>100</Cost>
      			<PrereqTech>TECH_GUILDS</PrereqTech>
      			<Description>Export Center</Description>
      			<Civilopedia>Exporting goods is a cornerstone of international trade.</Civilopedia>
      			<Strategy>The Export Center increases the amount of [ICON_GOLD] Gold available to trade routes established with other civilizations.</Strategy>
      			<Help>Trade Routes originating from this city produce an additional 5 [ICON_GOLD] Gold when connecting to another civilization</Help>
      			<ArtDefineTag>ART_DEF_BUILDING_BANK</ArtDefineTag>
      			<MinAreaSize>-1</MinAreaSize>
      			<ConquestProb>66</ConquestProb>
      			<HurryCostModifier>25</HurryCostModifier>
      			<TradeRouteLandGoldBonus>500</TradeRouteLandGoldBonus>
      			<IconAtlas>RES_BUILDING_EXPORT</IconAtlas>
      			<PortraitIndex>3</PortraitIndex>
      		</Row>
  6. All of these errors in the Database.log:
    Code:
    [1130760.140] Invalid Reference on Buildings.Help - "Each source of [ICON_RES_DEER] Deer [ICON_RES_BISON] Bison and [ICON_RES_FUR] Furs worked by this City produces +1 [ICON_FOOD] Food[NEWLINE][NEWLINE]City must have at least one of these resources nearby" does not exist in Language_en_US
    [1130760.140] Invalid Reference on Buildings.Help - "Each source of [ICON_RES_COCOA] Cocoa [ICON_RES_SUGAR] Sugar and [ICON_RES_CITRUS] Citrus worked by this City produces +1 [ICON_GOLD] Gold[NEWLINE][NEWLINE]City must have at least one of these resources nearby" does not exist in Language_en_US
    [1130760.140] Invalid Reference on Buildings.Help - "Trade Routes originating from this city produce an additional 5 [ICON_GOLD] Gold when connecting to another civilization" does not exist in Language_en_US
    [1130760.187] Invalid Reference on Buildings.Strategy - "The Stockyard can only be constructed in cities with a nearby source of [ICON_RES_DEER] Deer [ICON_RES_BISON] Bison or [ICON_RES_FUR] Furs and provides +1 [ICON_FOOD] Food to these resources." does not exist in Language_en_US
    [1130760.187] Invalid Reference on Buildings.Strategy - "The Confectionary provides +1 [ICON_GOLD] to [ICON_RES_COCOA] Cocoa [ICON_RES_SUGAR] Sugar and [ICON_RES_CITRUS] Citrus, providing a boost to a city's gold output should one or more of these resources be within working range." does not exist in Language_en_US
    [1130760.187] Invalid Reference on Buildings.Strategy - "The Export Center increases the amount of [ICON_GOLD] Gold available to trade routes established with other civilizations." does not exist in Language_en_US
    [1130760.250] Invalid Reference on Buildings.Civilopedia - "A Stockyard is an area used to house livestock before harvesting their meat." does not exist in Language_en_US
    [1130760.250] Invalid Reference on Buildings.Civilopedia - "Confectionaries are shops where sweets are sold." does not exist in Language_en_US
    [1130760.250] Invalid Reference on Buildings.Civilopedia - "Exporting goods is a cornerstone of international trade." does not exist in Language_en_US
    [1130760.312] Invalid Reference on Buildings.Description - "Stockyard" does not exist in Language_en_US
    [1130760.312] Invalid Reference on Buildings.Description - "Confectionary" does not exist in Language_en_US
    [1130760.312] Invalid Reference on Buildings.Description - "Export Center" does not exist in Language_en_US
    Originate from doing this sort of thing:
    Code:
    <Description>Export Center</Description>
    instead of this sort of thing:
    • In your Building:
      Code:
      <Description>TXT_KEY_BUILDING_EXPORT_CENTER</Description>
    • And then adding this:
      Code:
      <Language_en_US>
      	<Row Tag="TXT_KEY_BUILDING_EXPORT_CENTER" >
      		<Text>Export Center</Text>
      	</Row>
      </Language_en_US>
 
Back
Top Bottom