CS Logo
Core Stratagem supports custom units and factions. It's actually pretty easy to do! All you really need is a text editor. If you want to use your own custom graphics, you just need an image editor that can save images with transparency. 

The Unit File
All of Core Stratagem's factions are found in the data/Units directory.
When the game starts up, it scans this directory for any subfolders. It compiles its list of factions from what it finds here.

A faction can be pretty simple. The bare minimum it requires for the game to work is one land unit and one sea unit. Purely by convention, the factions included in the game consist of 12 units and 6 structures each, with units of a particular type generally grouped together in order, but this is arbitrary. What's essential is that the .unt files start at 0.unt and go up in number with none missing.

A unit is defined by its .unt file, which is simply a plain text file in spite of the weird extension; you can open it up in Notepad or your preferred text editor. A unit also needs to have accompanying graphics and sound files in order to load, but let's focus on the .unt file for now.

The unit file is pretty simple--lines starting with * explain what the next line means. Let's take a look at the Tank. I've broken its file up into segments and color-coded them to make reading it a bit easier.
At the top in green, we have the unit's basic information, including its name and description as they appear in-game. "Damage Animation Type" defines which of 13 different animations will play when an enemy is struck by this unit's attack, from explosions to plasma bursts to lightning and arrow barrages.
In blue, we have basic information about the unit's movement capabilities, and in red, its combat abilities. Units with a ranged attack will multiply their damage by the "range multiplier" value when attacking at a distance

Let's break down the next section of the file.
First, we have the unit's special capabilities, if any, such as refueling allies or carrying units. Is it a stealth unit? Can it detect stealth units? And so on.

Next we have the unit's basic stats. Doesn't get simpler than this. And finally, the combat stat block. The combat engine in CS is pretty simple. When two units face off, there's a dice roll from 0-100. There are two threshold numbers: a threshold for the Attacker to get a Draw, and a higher threshold for them to win. If the roll is lower than both, the Attacker is repelled. The base Draw threshold is 33 and the base Win threshold is 66.

The Attacker and Defender both have bonuses (or sometimes, penalties) when fighting against each type of unit. The Attacker subtracts their attack bonus values from the thresholds, and the Defender adds their defense bonuses. So, from these numbers, if a Tank attacks another Tank, they need to roll a 29 or higher to get a Draw, and a 54 or higher to win. Less than 29, and they'll be repelled.

That's all there is to a simple unit. There are a few other little quirks that you might have noticed. Scroll down to the end for advanced Unit tips.

Graphics and Animations
The animations for a unit are split up between a few different files rather than a normal sprite sheet. (The design of CS was originally much, much more limited than it ended up--only one faction, max of two players, no animation--and so as more features were added, they were often cludged on in weird ways rather than as if they had been part of the game from the start.)

Within the Faction directory, the "images" folder contains all of the graphics for the faction. Each unit has four images that are used to animate it, in the form of transparent .png files. The filenames are based on the unit's number (the same number as its .unt file.) So for the Tank, which was defined in 0.unt for its faction, its graphics are 0.png, 0mov.png, 0fir.png, and 0exp.png. These are its basic appearance, its movement, its attack, and its death animation respectively.

You can see pretty clearly how these work. Each frame is 25x25 pixels, and the file considers the background color white to be transparent. Additionally, the game recognizes the various shades of blue that correspond to "faction colors" and will re-shade a unit to the appropriate color for the player who owns it.

Sound Effects
Finally, each unit has only two sound effects associated with it, which must be in the faction's "sfx" folder and named accordingly--for the Tank, 0fir.mp3 and 0exp.mp3, for its attack and death. Additionally, you'll need a "build.mp3" to play when a structure is built.

Filling out a Faction
Those are the basics for creating individual units, but what about when you want to complete a whole faction? There are a few more graphics required: "city.png" is the image used for this faction's cities. "builder.png" is used for any structure unit before it's placed, and "building.png" is the animation for a structure being constructed. For any stationary unit (which is defined in the .unt file by having 0 Moves), you'll have to use that unit's "walking" animation to preserve the "builder" appearance -- see the image below to see how the Turret's movement animation ("16mov.png") shows the Builder unit in motion, while the rest of its animations are for once it's constructed.

Finally, you need a description of your faction! Create a file called desc.txt and type up the description that will appear in the faction selection tooltip for this army. Use basic html for formatting.

How the AI Plays
The AI will try to figure out how to play with any faction you create. It has an easier time with some factions than others. Here are some considerations to help you figure out how to make sure the game can use your faction effectively.

When the AI loads up, it examines all the units in its faction. If possible, it tries to assign some loose roles to a few different units. It wants to identify the best match for a front-line, land-based combat unit; a fast and cheap land-based scout that can capture cities; an air-based scout; a sea transport; and an air transport. It doesn't need to find all of these, but if it does identify units that match its ideas it will build them in specific circumstances. For example, if there are a lot of units requesting Boarding in a port city, the AI will likely build a unit there that it's tagged as a "sea transport."
In addition to trying to identify a few key units that will be needed in certain roles, the AI analyzes the entire unit set based in each unit's stats, built time cost, special abilities, and combat values, and gives each unit a certain weight based on how powerful it is, how long it takes to build, and its overall army composition. When testing out a new faction, it's often a good idea to play many games in a row with the AI automating your army so you can watch what it builds and how its units act. If it can't seem to figure out what to do with your units, if it's building a million of one type or never building another, you may need to consider rebalancing your army.

Unit Files, Redux--Advanced
The Unit files are mostly self-explanatory. Here are a few non-obvious considerations to help you build your units.

Escalation - Let's start from the bottom of the file. On the Tank, you might have noticed that just before the *end tag was this pair: *escalates? false. If escalation is marked true, instead, that means that this unit's stats will change as the match goes on. You can check out the Nuke Drone from Modern Military, Alternate Army's Automine, the Savage Saurians' Rex, or the Feudal Fantasy army's Flamesapper for examples. If a unit is set to escalate, then after the *escalates? true lines should come *escalation string followed by a short code that tells the game when and how this unit's stats should change. (These changes apply to newly built units, not existing ones on the field.)

The first bit is tx, where x is how often, in turns, this change should happen. There's no way to make it a one-time change, or make the changes come in a stretched out timeline (5 turns, then 8 turns, then 12 turns, etc.) In the case of the Automine, its escalation string is "t50,b6,R1,m1." That means every 50 turns, its build time will increase by 6; its Radius by 1; and its Moves by 1. Other options are s for Strength, p for Power, a for Attacks, and r for Range. You can use negative values, too, to make a unit weaker in a particular stat when built later in the game.

Amphibious Tag - Units can travel on both land and sea without being "Amphibious." Take the Floater Gun from the Alternate Army set, for example. In its basic movement section, *traversable: land and *traversable: sea are both set to true. So it can move through either terrain type. Making a unit truly "Amphibious" does a couple of different things. First, it will move more slowly when outside of its "home" terrain type, which is defined by the unit's base type. So an Amphibious Land unit will move half speed in water. Also, if a unit is Amphibious and uses fuel, it will be refueled by water and river tiles. (The "Amphibious" tag was originally designed just for the Deepwater Denizens faction.)

Finally, when an Amphibious unit is on land, in combat it will be treated as a land unit, and vice versa when it's on a water tile. (Wetlands count as land for this purpose.) This means when the combat roll happens, which of the opponent's bonuses are used depends on where the Amphibious unit is.

Structures - A unit with 0 Moves will be a Structure. When it first is constructed, it will appear as that faction's Builder and get 1 "bonus" Move for that turn only, to allow it to place itself. If a Unit's Moves are set to 0 in the .unt file, an additional two lines must be added to determine what, if any, effect the Structure has on its host city. Let's look at the Workshop.

The Unit's "structure bonus" code determines whether it boosts land, sea, or air production, repair, or Unit experience. Here's the code:
  • -1 : No bonus
  • 0 : Sea Production
  • 1 : Land Production
  • 2 : Air Production
  • 3 : Experience
  • 4 : Repair
With that, you should be well on your way to creating your own Units and Factions. Let me know if you have trouble, and if you do create your own faction let me know! Send me a zip so I can try them out! Email Urocyon Games

Copyright 2013-2019 Urocyon Games LLC