Custom Sponsor Tutorial [WIP]

GravityGames

Chieftain
Joined
Jan 20, 2015
Messages
35
Hello and welcome to my Civilization: Beyond Earth custom sponsor tutorial. I hope to eventually cover everything about making custom sponsors, but I’m writing this as I make a sponsor (and teaching isn’t really my gift either), so bear with me, as I’m learning too. Alright, so let’s get started.

Step 1: Starting Your Project:

Alright, so the first step is quite obviously to start your sponsor project, and the first step to do that is to get an idea. If you don’t have a specific idea, and simply want to try your hand at making a sponsor, then why not be a nice person and take a request? I’m quite sure the ratio of modders to regular gamers is rather low, and there are many unanswered requests to choose from. Granted, some of these requests may just be stupid, but there’s no harm in looking. If all else fails, you could just do an alternate history faction, but there’s understandably a lot of those, so I’d save that as a last resource, lest you want to risk making another “Space Rome/Japan/’murica/etc.” Against my better judgment, rather than use progress from my Grom mod as an example, I’m instead going to take a request (that was likely made in jest to begin with anyway):

Shang Mu (Zao)-
UA- Units and Buildings cost 25% less gold, +1 gold for each city, +5% gold for each trade route

UU- Infantry Truck: Replaces Landships, removes debuf for attacking cities, and more movement and combat strength

UB- Zao’s Shopping Mall: Replaces the Stock Exchange, provides +2 gold and +50% gold

…granted this is actually a Civ 5 request (you can tell right away from the unique unit and building parts), but considering that I sprung for that insane Steam deal not too long ago (the one with Civ 3, Civ 4, Civ 5 and Civ:BE for only 30 bucks), and I accidently bought the DLC thinking it was the expansions, and I’ve already spent pretty much my entire gaming budget between that and Freedom Planet (What? I’m a retro gamer. 60 bucks is normally enough to take me up through November, and then I just ask for anything else I want for Christmas. So I probably won’t be getting Brave New World or Gods and Kings anytime soon. Though I probably won’t be able to wait until next year TBE…), I’m going to use this request for my tutorial. AFAIK, no one else plays Vanilla Civ 5 these days anyways (and honestly the setting of BE is probably more fitting as well)…

Alright, if you have your idea ready, the next step is to start a new project. If you haven’t already, download the Civilization: Beyond Earth SDK from Steam, run it, select ModBuddy, and start a new project. Fill in all the information boxes that pop up and prepare to begin! You should start with a completely empty project. Do not fear, the void will NOT devour you, so long as you fill it with all the files you need. So let’s begin in step 2.



Step 2: Letting Beyond Earth Know That You Exist:


We need to let the game know our custom sponsor exists. To do so, we need to create a new XML file. Right click on the root of your project, move your mouse down to add, and select the New Item option. Select the “Game Rules (XML)” option, and choose a fitting name. It can be anything you want, but I’m going to try and stick as close to Firaxis’s naming conventions as possible (though not exact as to prevent replacing the stock sponsors). I’m going to name mine “CivBECivilizations_ShangMu.xml”. Now, with your new XML created, you can begin actually making your sponsor. To do so, I’m going to look at each define the official sponsors have, and then add them to my XML and change them as needed. Here’s the code, I’ll explain each variable, don’t worry:

Code:
<Civilizations>
		<Row>
			<Type>CIVILIZATION_SHANG_MU</Type>
			<Description>TXT_KEY_CIV_SHANG_MU_DESC</Description>
			<ShortDescription>TXT_KEY_CIV_SHANG_MU_SHORT_DESC</ShortDescription>
			<Adjective>TXT_KEY_CIV_SHANG_MU_ADJECTIVE</Adjective>
			<CivilopediaTag>TXT_KEY_CIV_SHANG_MU</CivilopediaTag>
			<DefaultPlayerColor>PLAYERCOLOR_ARC</DefaultPlayerColor>
			<ArtDefineTag>ART_DEF_CIVILIZATION_CHINA</ArtDefineTag>
			<ArtStyleType>ARTSTYLE_ASIAN</ArtStyleType>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
			<AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
			<GradientIconAtlas>CIV_GRADIENT_ATLAS</GradientIconAtlas>
			<GlowIconAtlas>CIV_GLOW_ATLAS</GlowIconAtlas>
			<MapImage/>
			<ArtStyleSuffix>_ASIA</ArtStyleSuffix>
			<ArtStylePrefix>ASIAN </ArtStylePrefix>
			<IntroductionQuote>TXT_KEY_CIV_INTRO_SHANG_MU_TEXT_%</IntroductionQuote>
			<IntroductionImage>DOM_Blue.dds</IntroductionImage>
			<IntroductionAudio>AS2D_DOM_SPEECH_UNITED_STATES</IntroductionAudio>
			<Personality>PERSONALITY_BRASILIA</Personality>
		</Row>
	</Civilizations>
…and what each line does:

<Civilizations> and <Row>: These define the tables, and tags like these are used in a lot of places in Civilization: Beyond Earth XMLs, more specifically the <Row> tag.
<Type>: This is how your sponsor will be referenced in your XML files.

<Description>: This is what your nation will be called in-game. Don’t enter your text directly, we’ll add the text properly soon, for now, just choose a fitting name for the text entry.

<ShortDescription>: This is the shortened version of the description tag. For instance, USA as opposed to United States of America

<Adjective>: The adjective applied to units owned by this sponsor.

<CivilopediaTag>: Related to the civilopedia, I’m honestly not quite sure what this one does, as I’ve yet to mess with Civilopedia entries.

<DefaultPlayerColor>: The colors used by this sponsor. Don’t worry, I’ll cover how to make a custom color set later.

<ArtDefineTag>: Something to do with art used for GUI, etc. Not quite sure exactly what it does.

<ArtStyleType>: Something to do with art used for GUI, etc. Not quite sure exactly what it does.

<PortraitIndex>: Related to the icon used. In cases where you’re not using the default icons, this will be set to 0 about 99% of the time.

<IconAtlas>: The image to use for the sponsor icon. Right now, the default image is being used, ARC’s part to be exact.

<AlphaIconAtlas>: As far as I know, this is the version of the icon that gets recolored in certain parts of the GUI.

<GradientIconAtlas>: EDIT: As far as I know, this goes unused.

<GlowIconAtlas>: EDIT: As far as I know, this goes unused.

<MapImage />: I’m assuming that this is a leftover from Civ 5…

<ArtStyleSuffix> and <ArtStylePrefix>: Not quite sure to be honest.

<IntroductionQuote>: The quote that appears on the loading screen.

<IntroductionImage>: EDIT: This actually does affect the image that shows on the loading screen. I played as Brasilia and the image was radically different.

<IntroductionAudio>: I’m pretty sure this is the audio that plays during the intro. I’ve seen mods that use it, but if I recall, all of the stock sponsors are completely silent here.

<Personality>: Not sure if this actually affects the personality of the sponsor in any way (as far as I know, it’s all set in a different place, but I could be wrong), so I set to the closest thing to a warmonger in the game just in case…

Now we need to add the default names for cities:

Code:
<Civilization_CityNames>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_SHANG_MU_1</CityName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_SHANG_MU_2</CityName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<CityName>TXT_KEY_CITY_NAME_SHANG_MU_3</CityName>
		</Row>
		…
	</Civilization_CityNames>

You can add as many city names as you want, but the official sponsors all have either ninteen or twenty. I would personally define at least twenty entries.

Now we need to define the buildings that our sponsor starts with. I know what you’re thinking, “my sponsor doesn’t start with a free building, why would I need to set it to start it off with one?” Unless your sponsor IS going to start with one that is, in which case you stayed silent. For the majority who fit into group one, that’s technically incorrect, every sponsor starts out with a headquarters building, so we need to define that for our sponsor like so:

Code:
<Civilization_FreeBuildingClasses>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_HEADQUARTERS</BuildingClassType>
		</Row>
	</Civilization_FreeBuildingClasses>

Likewise, each sponsor starts with the habitation tech, which is in the center of the tech web:

Code:
<Civilization_FreeTechs>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<TechType>TECH_HABITATION</TechType>
		</Row>
	</Civilization_FreeTechs>

Now we need to tell the game which leader to use for our sponsor. We’ll create Mayor Zao in a later step, for now, to the disappointment of nearly everyone who actually knows who the heck I’ve been making, we’ll simply use ARC’s leader.

Code:
<Civilization_Leaders>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<LeaderheadType>LEADER_ARC</LeaderheadType>
		</Row>
	</Civilization_Leaders>
Then we need to add spy names:

Code:
<Civilization_SpyNames>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_0</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_1</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_2</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_3</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_4</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_5</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_6</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_7</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_8</SpyName>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<SpyName>TXT_KEY_SPY_NAME_SHANG_MU_9</SpyName>
		</Row>
	</Civilization_SpyNames>

Finally, we need to let the game know that our sponsor can’t spawn alien drones (yes, the regular sponsors do it to, I’m surprised there’s actually an alien unit without a human equivalent…)

Code:
<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_SHANG_MU</CivilizationType>
			<UnitClassType>UNITCLASS_ALIEN_FLYER</UnitClassType>
			<UnitType/>
		</Row>
	</Civilization_UnitClassOverrides>


…now I know what you’re thinking, and no. All this is still not enough to get your sponsor to show up in the game. There’s still a bit more we need to do to even get it to appear, much less act unique. Now we need to add that text I mentioned earlier. Create another XML file (well, you don’t have to, but it helps to keep things organized…), and name it whatever you like. I’m going to go with “CivBETextEntries_ShangMu.xml” (not sure where this stuff is in the vanilla files, I actually haven’t looked before).

Now, the code for the text XML:

Code:
<LocalizedText>
			<Row Language="en_US" Tag="TXT_KEY_CIV_SHANG_MU_DESC">
				<Text>Shang Mu</Text>
			</Row>
			<Row Language="en_US" Tag="TXT_KEY_CIV_SHANG_MU_SHORT_DESC">
				<Text>Shang Mu</Text>
			</Row>
			<Row Language="en_US" Tag="TXT_KEY_CIV_SHANG_MU_ADJECTIVE">
				<Text>Shang Mu</Text>
			</Row>
			<Row Language="en_US" Tag="TXT_KEY_CIV_SHANG_MU">
				<Text>Shang Mu</Text>
			</Row>
			<Row Language="en_US" Tag="TXT_KEY_CIV_INTRO_SHANG_MU_TEXT_0">
				<Text>&lt;&lt; Placeholder Text &gt;&gt;[NEWLINE][NEWLINE]</Text>
			</Row>
		</LocalizedText>


The Language attribute defines what language the text is in, and the main reason why you can’t just type in text willy-nilly wherever you like (that and the fact that it’ll give you an error if you try). Civilization: Beyond Earth will replace this with some text with the same Tag but a different Language for that specific language’s region if we define it as well. An example:

Code:
<Row Language=”en_US” Tag=”TXT_THE_ONLY_SPANISH_I_KNOW”>
	<Text>I don’t speak Spanish, I speak English</Text>
</Row>
<Row Language=”es_ES” Tag=”TXT_THE_ONLY_SPANISH_I_KNOW”>
	<Text> No habla espanol, habla engles.</Text>
</Row>

If I put this text into the game, people could choose to be alerted to the fact that I speak English and not Spanish in either English or Spanish (though the Spanish is likely horribly misspelled...), get it? Good. Now the text in the Tag attribute should look familiar (with the exception of “TXT_KEY_CIV_INTRO_SHANG_MU_TEXT_0”, but I’ll get to that), and that’s because it is. That text is what we referenced in the first XML. Now the last tag is special, remember the “%” symbol in one of the tags in the first XML, well in Beyond Earth, the % symbol can be used to replace any number. That means during the loading screen, the game will look for“TXT_KEY_CIV_INTRO_SHANG_MU_TEXT_0”, then “TXT_KEY_CIV_INTRO_SHANG_MU_TEXT_1”, and so on. This is how you get different text to appear for the same event, like how the sponsors have more than one greeting. You should be able to use this knowledge to fill in the other text entries, but I’m going to do that later, as we have enough for our faction to show up on the sponsor select screen. Now, if all went well, we SHOULD be able to see our faction…almost. Before we leave ModBuddy, we want to save and compile our work. Click the icon with two floppy disks to save all of the open files, then click on the Build tab at the top and select Build Solution. Now our mod should appear when we open the mod section in Beyond Earth, so let’s go check!

https://dl.dropboxusercontent.com/u/29071079/Civ%20Modding/Beyond%20Earth/Custom%20Sponsor%20Tutorial/001.png

Well, the mod shows up in the mods section, but when I went to set up the game (not shown), Shang Mu didn’t appear. Sorry, I forgot the most important part (and also sorry for all the mods I have installed, but let’s face it, the stock sponsors are all really, REALLY boring, and this is coming from someone who actually likes the game. Hence why I have 64 hours of playtime so far on Civ:BE and only about half the achievements. Because I have to play with the boring stock sponsors…). Go back to the Mod Buddy window and right click on the top of our project, click properties, and the Mod Properties window should appear. Click on actions, then click add. Now, select OnModActivated for the event, UpdateDatabase for the action, and select one of your XMLs for the file. Repeat for the other XML. NOW save and compile, and see the mod appear.

https://dl.dropboxusercontent.com/u/29071079/Civ%20Modding/Beyond%20Earth/Custom%20Sponsor%20Tutorial/002.png

LOOK! THERE IT IS! RIGHT BELOW ARC! …with ARC’s ability. That’s because we set ARC’s leader as our sponsor’s leader, that’s where the abilities are tied to. Well, I’m going to get working on the next part of the tutorial, where I’ll cover making custom icons, in the meantime, why not fill in those extra text entries? Hope this helped someone get started!
 
Step 3: Making a Custom Icon

So, you&#8217;ve got your sponsor technically in the game, and want to start making it stand out? Good, now we&#8217;re going to make a custom icon. Before you start, you should probably do some research on things that represent your sponsor, and pick the one you feel is the most iconic. Unless, of course, you&#8217;re making a sponsor that was entirely your idea, or a request of something that doesn&#8217;t already exist in some form, then you&#8217;ll want to do some brainstorming. Once you know what you want to draw for your icon, you can begin drawing it. Before that, however, I&#8217;ll give you some basic information you might want to know. First, the style that Beyond Earth uses. Most sponsors have the outline and the backdrop as different shades/hues of the same general color (for example, Pan-Asia has a dark purple backdrop and light purple outline), and they ALL have a gradient on the colors, with the backdrop gradient usually being more extreme than the outline. Also, most of them have a very subtle glow on the inside pattern, with the exception of ARC and Pan-Asia, which have more noticeable ones. Personally, I like the glow being more noticeable, but that&#8217;s just my taste. Of course, rules are meant to be broken, (heck, the Slavic Federation breaks two out of the three, unless I&#8217;m just not seeing the glow&#8230;), so feel free to experiment. As a general rule of thumb, compare it to the in-game sponsor icons, if it fits in at least okay and looks remotely sci-fi-ey, you&#8217;re probably fine. Now, this second bit of advice is less a suggestion and more a command, unless you want to resize your artwork. You need several different versions in several different sizes, so it&#8217;s a good idea to start at the largest and scale down, as doing the inverse will probably look a lot worse. The dimensions you need are 128x128, 64x64, 45x45, and 32x32. Files for the original sponsors also exist at sizes 80x80 and 57x57, but these are supposedly unused. However, it is probably a good idea to make sure files exist for these sizes, as some sort of later patch, DLC, or expansion might need them (yes, while probably unlikely at this point considering there&#8217;s been no announcement for it, Firaxis could make an expansion pack. Or maybe Starships will use these sizes, I dunno).Keep in mind that sponsor icons have transparency around them. Making the largest at 116x116, centering it in the 128x128 frame, adding a black outline, and then exporting it at all of the different sizes SHOULD work just fine. Now, as for actually making your icon, if you use Photoshop, then there&#8217;s actually a nice template you can use (I say it&#8217;s nice, yet I&#8217;ve never used it, so I really don&#8217;t know). However, I hope you can find someone else who uses it, oh rich one. Poor folks like me are going to have to use GIMP, and optionally Inkscape. Personally, what I do is make my graphic in Inkscape, then import it into GIMP for pixel-level editing and touching up, then export it. This allows me to use vector art graphics. The really REALLY big upside to vector art is that I can draw it once and render it out to all of the different sizes. The downside, however, is that since vector art doesn&#8217;t use a pixel based system, you may have to do some manual tweaking to get it looking nice. However, that&#8217;s still better than placing every pixel in a 128x128 image manually, then doing it for the 64x64, etc. IMHO. For those of you who want to follow the same process I do, here&#8217;s some tips based off of what I did for my Grom sponsor icon. In Inkscape, create a 116x116 image, you&#8217;ll see later why. Then create a rectangle with a line thickness of 2 and make it the size of the canvas (116x116 at position x of 0 and y of 0). I draw all of my lines with a line width of 4 (accidently had a width of 2 here, oops...), unless they&#8217;re on the inside, in which case I usually go for either 2 or 3, whichever looks better. For the glow, copy your whole inside shape, paste it, then group it. Place it as close to right on top of your icon as possible. Set the blur value to around 10 (feel free to fiddle with it more if you like). Send it to the bottom layer, and raise it until it&#8217;s right above the square. That should hopefully give you an icon in close to the same style. So, once you&#8217;ve drawn your icon, it&#8217;s time to import it. Here&#8217;s mine by the way.



Now if you followed my process, export your image to a PNG and then import it as a new layer into a 128x128 GIMP project. Center it, add a black outline, then touch it up as needed. Here&#8217;s the result:



I&#8217;m actually quite surprised, I had so little to actually touch up, it was just adding the outline. Maybe it has to do with the fact that I accidently created my Grom icon at 128x128 and had to scale it down, or maybe I just got lucky. Either way, you&#8217;re going to want to export this to a DDS. If you haven&#8217;t got a plugin to export DDS files from Blender, I&#8217;ll leave a link to the plugin HERE. Export it with the default settings, they&#8217;re already what you need for the sponsor images, though there could be a setting which offers better compression, all I know is the DTX1 is best for images with no transparency and few gradients, which does not fit our icon at all. Now, once you have at least the 128x128 and 64x64 images (I&#8217;d wait to do the others just to see how the icon looks in-game next to the others), import them into Mod Buddy with the Add Existing Item command. Click on each image and set the Import to VFS setting to &#8220;true&#8221;. Now, to actually use these images, we&#8217;re going to need to create another XML file. Name it whatever you like, but for this particular project, I&#8217;m going to go with &#8220;CivBEIconAtlases_ShangMu.xml&#8221;. Now would also be a good time to tell the mod that the XML needs to be loaded, before we forget. You should know the drill, right click, properties, actions, set up the proper events. Now, reference the images in your XML like so:

Code:
<IconTextureAtlases>
		<Row>
			<Atlas>CIV_COLOR_ATLAS_SHANG_MU</Atlas>
			<IconSize>128</IconSize>
			<Filename>IconAtlas_Shang_Mu_128x128.dds</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
&#8230;
</IconTextureAtlases>

Alright, let me explain what all of these do, in case you haven&#8217;t figured out by now.

<Atlas>: The name of the image itself, you&#8217;ll want all of the different sized images to have the same name.

<IconSize>: &#8230;well, the size of the icon of course. This tells Beyond Earth which size the icon is, so for our 128x128 image, we set this to 128.

<Filename>: Self explanatory. The name of the file in your mod.

<IconsPerRow> and <IconsPerColumn>: These are pretty much only useful if you&#8217;re making a mod that adds a group of sponsors or a base mod that simply adds a bunch of images for other sponsor mods to use as a dependency. Since we&#8217;re not doing either, we should leave these at 1. Now, repeat this for every other instance of the image (for now, we&#8217;re just doing the 128x128 and 64x64 images, just to see if they properly load). Then you want to go back to the XML where you defined your sponsor and change the <IconAtlas> tag to the same value as the <Atlas> tag in your image XML. Once you&#8217;re done, build and load up your mod in Civ: BE, and you should see your new icon!

https://dl.dropboxusercontent.com/u/29071079/Civ%20Modding/Beyond%20Earth/Custom%20Sponsor%20Tutorial/003.png

There we go, that&#8217;s how to add custom icons. You also probably see why I didn&#8217;t have you make all of them at once, as the icon doesn&#8217;t quite fit in. I&#8217;m going to need to make my lines a bit thicker, etc. I&#8217;ll have it changed before the next tutorial, in the meantime, you can make the rest of those images and get them working. I&#8217;m not sure what I&#8217;ll cover in the next tutorial, but probably either icon alpha atlases or making a custom leader.
 
Top Bottom