FANDOM


  • In the Firaxis livestreams about modding Pete Murray first created a new building and then a new wonder. Well, what about units? Fear not, for here's what you need to do to add some simple units into the game! It is, however, strongly recommended that you first watch at least the first livestream to get an overview of the tools.

    Pre-requirements

    But, let's begin. If you did not watch the first livestream or have not installed the Beyond Earth Software Development Kit (SDK) yet, do that now. Go to your Steam client, then click Library to open the menu and select Tools. Find the Sid Meier's Civilization: Beyond Earth SDK entry, right click it and install it.

    After the installation has finished, run it and select "ModBuddy". If it asks you to install some Visual Studio stuff, you must first download and install that one too.

    Creating the mod

    When you open ModBuddy it looks something like this:

    ModBuddy startup (CivBE)

    ModBuddy -- the modding tool for Beyond Earth


    Initializing a new project

    Choose File > New > Project. Give your mod a name. The unit that I'm creating is called Cardboard Destroyer. It's a decoy unit that looks like a LEV Destroyer but is cheap and very weak, i.e. supposedly made out of cardboard. I thought it'd be fun to play with "LEV Destroyers" right from the beginning, though, because normally you'd only get to play with them in Purity late game. :)

    So, give your mod a name and click "OK". I named it Cardboard_Destroyer. A rather blank screen appears. You should see a "Solution Explorer" window. If you don't, enable it from the View menu. Right click on the mod name in the Solution Explorer and select Add > New Item... and then "Game Rules (XML)". Name it, say, cardboarddestroyer.xml and hit "Add".

    Getting into the business

    A new tab opens up, with some minimal XML markup. This is for adding or updating the rows in the database that basically runs the game. In the Firaxis streams Pete Murray added some Building and Wonder data here, I'm going to add Unit data.

    The important thing to know is, which database tables contribute to the entity that you are creating. In my case the tables are called "Units" and "UnitClasses". The existing unit definitions can be found from the Beyond Earth installation directory, in the assets\Gameplay\XML\Units\CivBEUnits.xml and assets\Gameplay\XML\Units\CivBEUnitClasses.xml files. I just copied some <Row>s from them and pasted them into the ModBuddy cardboarddestroyer.xml tab. I then edited some values, like the Combat value (the unit's 20xStrengthBE Strength, 20xProductionBE Cost and text keys. Finally, I added some plain English description texts for my new unit, ending up with a result like this:

    ModBuddy Cardboard Destroyer XML (CivBE)

    The Cardboard Destroyer XML definition in ModBuddy


    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
     <Units>
    		<Row>
    			<Type>UNIT_CARDBOARD</Type>
    			<Class>UNITCLASS_CARDBOARD</Class>
    			<Combat>3</Combat>
    			<Cost>25</Cost>
    			<PrereqTech>TECH_HABITATION</PrereqTech>
    			<Description>TXT_KEY_UNIT_CARDBOARD_DESC</Description>
    			<Civilopedia>TXT_KEY_UNIT_CARDBOARD_PEDIA</Civilopedia>
    			<Help>TXT_KEY_UNIT_CARDBOARD_HELP</Help>
    			<Moves>2</Moves>
    			<CombatClass>UNITCOMBAT_MELEE</CombatClass>
    			<Domain>DOMAIN_LAND</Domain>
    			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
    			<MilitarySupport>true</MilitarySupport>
    			<MilitaryProduction>true</MilitaryProduction>
    			<Pillage>true</Pillage>
    			<AdvancedStartCost>25</AdvancedStartCost>
    			<XPValueAttack>1</XPValueAttack>
    			<XPValueDefense>1</XPValueDefense>
    			<Conscription>1</Conscription>
    			<UnitArtInfo>ART_DEF_UNIT_LEV_DESTROYER</UnitArtInfo>
    			<MoveRate>WHEELED</MoveRate>
    		</Row>
    	</Units>
    	<UnitClasses>
    		<Row>
    			<Type>UNITCLASS_CARDBOARD</Type>
    			<Description>TXT_KEY_UNIT_CARDBOARD_DESC</Description>
    			<DefaultUnit>UNIT_CARDBOARD</DefaultUnit>
    		</Row>
    	</UnitClasses>
    	<LocalizedText>
    		<Row Language="en_US" Tag="TXT_KEY_UNIT_CARDBOARD_DESC">
    			<Text>Cardboard Destroyer</Text>
    		</Row>
    		<Row Language="en_US" Tag="TXT_KEY_UNIT_CARDBOARD_PEDIA">
    			<Text>A decoy unit with limited fighting capabilities. Looks like a LEV Destroyer but is extremely weak and does not hover over the terrain.</Text>
    		</Row>
    		<Row Language="en_US" Tag="TXT_KEY_UNIT_CARDBOARD_HELP">
    			<Text>Weak decoy unit that looks like a LEV Destroyer.</Text>
    		</Row>
    	</LocalizedText>
    </GameData>
    



    Now, we're close to having a playable mod at our hands, but we must do a couple of more things. Right click on the mod in the Solution Explorer again and choose Properties. Go to the Actions tab, click Add, select Event "OnModActivated", Action "UpdateDatabase" and File "cardboarddestroyer.xml". This tells the game that it should use your newly created XML file to update the database when the mod is loaded.

    Next, click on the Build menu at the top menu bar and select Build Solution! This "builds" your mod, i.e. packages it as ready to play. If all goes well, you should see a text like this in the Output window:

    ------ Build started: Project: Cardboard_Destroyer, Configuration: Default x86 ------
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
    

    However, in my case it didn't all go that well: I got an error that said "CivBEPath must be defined. Use the Project Properties window to set it to the location where Civlization Beyond Earth is installed.". Fortunately that was easily remedied: go to Tools > Options... > Civilization Beyond Earth and fill in your Beyond Earth installation and user data paths. For me, the settings look like this:

    ModBuddy build error solution (CivBE)

    Solution for a build error in ModBuddy


    After I confirmed those settings and tried to build again, it succeeded!

    Trying it out

    Fire up the game. In the main menu select Mods and after a dialog screen a screen for selecting mods should appear, looking something like this:

    Mods screen (CivBE)

    The Mods screen of the game


    Exciting! Check the checkbox next to the Cardboard Destroyer mod like in the picture and hit "Next":

    Mods in use screen (CivBE)

    The screen after you click "Next" in the Mods screen


    Then proceed to setting up a game like you normally would. Once the game launches and you make a planetfall, you should see your new unit at the top left corner right away, because we made it available right from the beginning by setting TECH_HABITATION as its prerequirement technology:

    Cardboard Destroyer mod at planetfall (CivBE)

    Researching Habitation has unlocked the Cardboard Destroyer!


    It works, awesome! Now let's build one:

    Building a Cardboard Destroyer (CivBE)

    Selecting the Cardboard Destroyer from the build menu


    Wait for a few turns and voilá! You have your very own LEV Des.. I mean, Cardboard Destroyer! You can even try fighting some aliens with it:

    Cardboard Destroyer vs alien part 1 (CivBE)

    The odds are against you,

    Cardboard Destroyer vs alien part 2 (CivBE)

    the show is spectacular...

    Cardboard Destroyer vs alien part 3 (CivBE)

    ...and the end result is just what you'd expect.

    So, there you have it: a very basic mod that adds one simple unit! Be bold and experiment with other data and values and please report back with your results. :)

      Loading editor
    • Great Tutorial

        Loading editor
    • ZeroOne
      ZeroOne removed this reply because:
      oops, wrote it while not logged in
      00:02, January 6, 2015
      This reply has been removed
    • Robot rover wrote: Great Tutorial

      Thank you! I'm glad you found it useful. :) Let us know if you create any mods!

        Loading editor
    • Creating a unit is cool only as long as it has a unique feel about it. So I have three questions:


      1. Can you modify current 3d models of the existing units ?

      2. If that's not an option, can you at least recolor the existing units, for example creating green tanks based on the yellow-red LEV Tank ?

      3. Can you rescale existing units so that instead of 1 you'll have 2 smaller units, like two smaller LEV Destroyers ?

        Loading editor
    • 89.42.156.58 wrote:

      1. Can you modify current 3d models of the existing units ?

      2. If that's not an option, can you at least recolor the existing units, for example creating green tanks based on the yellow-red LEV Tank ?

      3. Can you rescale existing units so that instead of 1 you'll have 2 smaller units, like two smaller LEV Destroyers ?

      1. As far as I'm aware, yeah, but this is quite in-depth? Existing tutorials for Civilisation 5 will work here, but I haven't tried it myself.

      2. Yes, absolutely. Again, the process is very similar to Civilisation 5. I've done this, you'll need various community-made tools and a bit of patience. http://forums.civfanatics.com/showthread.php?t=392773 - this is a useful link to get you started. The version of Nexus that is compatibly with Beyond Earth should also work with very little config, better than the Civ 5 tutorials describe anyhow.

      Two things to bear in mind. One, some texture files won't open properly in anything but Photoshop (apparently). A really hacky workaround I developed is here - http://forums.civfanatics.com/showpost.php?p=13586125&postcount=9. Two, Nexus / Granny (the model editor) / the game doesn't like you editing the same damn model each time. If you change the texture (or model, I dunno), make sure to export it as a new name every time. This'll mean using that new name in the code you'll have to update as well.

      3. As far as I know, yes. Look for mods on the workshop that do this - I haven't been able to get changes to the squad formation code to work ingame yet. The relevant code should all be in the art data files.

        Loading editor
    • Thanks for the tutorial. I have tried creating alien units using game images (Rocktopus and Xeno titan) but they do not spawn. Any ideas please? Thank you

        Loading editor
    • nice tutorial!!!!!!!!!!!!!!!

      But how do you add a UNIQUE building or unit?

        Loading editor
    • How do incorperate my own models for units?

        Loading editor
    • So is the code still compatible with Rising Tide or has nothing changed with the unit xml's?

        Loading editor
    • also i am trying to make a LEV tank so what would be in place of the "Domain_Land" and how would i chang ethe attack range?

        Loading editor
    • 71.80.179.141 wrote: So is the code still compatible with Rising Tide or has nothing changed with the unit xml's?

      That's a good question! I haven't actually tried it, but I would expect it to work. Why don't you try it and report back? :)

        Loading editor
    • 71.80.179.141 wrote: also i am trying to make a LEV tank so what would be in place of the "Domain_Land" and how would i chang ethe attack range?

      I haven't tried this, but I believe you need to add two new tags: "<Range>2</Range>" and "<RangedCombat>12</RangedCombat>" where the first tells the range and the second tells the ranged combat strength.

      If you want to make the vehicle hover, replace the "DOMAIN_LAND" with "DOMAIN_HOVER".

        Loading editor
    • Thanks - this also helped me in Civ5

      - Now How to I change the Images to my Custome made ones ^^

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.