2D Modding

Creating 3D assets can be a difficult and technically complex task. So we have added the ability to create mods which use simpler, 2D visuals. These mods are only playable from top down (obviously!) and their visuals will be simpler than 3D versions. Currently no animation is supported, but the system does allow for emitters for particle effects etc. This can result in good looking battles from much simpler assets.

Some of this documentation will reference the 2D_TEMPLATE example campaign which can be downloaded from [here - link to come]. And it can be useful to check out the format of files and other things to compare to your own as you go along.

Setting up a 2D Campaign

The simplest way to create the initial campaign folder is to use the ingame New Campaign button, on the panel which appears when you hit Editor on the main menu. Then exit the game and head into My Documents\My Games\BBCBA\Campaigns (or ~\Documents\My Games\BBCBA\Campaigns on the Mac). This is your campaign folder.

To tell a campaign that you wish to use 2D assets, you will need to add a SETTINGS.TXT file into the main campaign folder. Then add the line

USE2D

to the file, and save. If you then go into the editor, you will notice that not much has changed, other than the editor being forced into a topdown view. This is because you can mix 2D and 3D units in your campaigns if you so desire, so all the normal units and objects are available. But the real power of the system is to allow you to simply create new assets, so let's get going with that!

Building a 2D Unit

First, all 2D units live in DATA\BATTLE\UNITS_2D folder. You will then have an image defining the body or hull of your unit which uses the same name as the AssetFilename attribute in the squads.csv file. So in the case of the template campaign, where we are using existing units, and example is our Sherman.DDS file. This is the hull of the Sherman. We also in this case need a turret, and so we create a Sherman_turret.DDS file. All turreted units use an _turret.DDS file for their turret graphics. NOTE: All images should be square, and powers of 2 (e.g. 64,128,256,512).

Next we need to set up some data so that the game knows where to rotate our unit, its turret, and other useful info. We do this in our Sherman_2D.TXT file. All units require one of these _2D.TXT files. Note that units continue to need a TXT file in the UNITS folder which contains their various animations. In this case we are hooking into the normal Sherman.TXT file in the main game DATA\BATTLE\UNITS folder, but you can of course define your own. This means 2D units can still use particle effects, sounds, etc.

_2D.TXT File

For the Sherman, our file looks like this

BASEPIVOT 0.5 0.5
TURRETPIVOT 0.5 0.5
TURRETONBASE 0.5 0.49
SIZE 48
BASEHEIGHT 2
TURRETHEIGHT 2
 
[I_0]
TURRET
POINT 0.5 0.31

[I_2]
POINT 0.5 0.77

[I_3]
POINT 0.5 0.77

To explain the various elements:

BASEPIVOT X Y
This is the point on the hull image that we want it to rotate around. The X and Y values are decimal values from 0 to 1 going from top left to bottom right. Another way to think about or calculate them is that X = pixels across / image width and Y = pixels down / image height (although as noted above image width and height should be the same!). So 0.5 0.5 would be the center of the image. This approach is used for all X Y coordinates in the file.

TURRETPIVOT X Y
This is the point on the turret image that the turret rotates around. The X Y coordinate uses the same approach as detailed above.

TURRETONBASE X Y
This is the point where the TURRETPIVOT attaches to the base image. Note that you do not need to include the TURRETPIVOT or TURRETONBASE values for units without a turret.

SIZE VALUE
The size that that the image is scaled to. This is in 3D units. A standard game tile is 32×32 in size. This allows you to tweak the onscreen size of your unit without having to redraw any images.

BASEHEIGHT VALUE
TURRETHEIGHT VALUE
These values, in 3D units again, define the nominal heights of the base and turret. These values are only used for casting the pseudo shadows from 2D units.

Emitters

To allow as many of the visual effects as possible to work on 2D units, you should try and define the emitter points on your 2D object. Each emitter is definted in its own chunk. Again, we will look at the example Sherman file and go through each entry.

[I_0]
TURRET
POINT 0.5 0.31\\

This defined emitter 0. Emitter 0 is used by the particle effects on the Sherman (and most other units) as the main weapon fire point. Also, on the Sherman, this is attached to the turret, not the hull. So we need to include the TURRET tag in the chunk. We then just use the POINT entry to define where on the turret we want the emitter to be, using the same approach as for the pivot placements.

We then define points 2 and 3 in the same manner (although they are attached to the hull, and therefore do not have a TURRET tag).

Death Images

We also recommend you include images that are shown when a unit dies. For armour this would tend to be a burnt out version of the hull and turret (if needed). For something like infantry you might show a dead soldier laying down. Of course, the image can be anything you want!

These images should match the filenames of your hull and turret images, but with an _D postfix. So in the case of the Sherman you have Sherman_D.DDS for the hull, and Sherman_turret_D.DDS for the turret.

2D Objects

You can also create new map objects in 2D. 2D objects need to be placed in a folder, in the same way as normal objects, and can use the same kinds of tags in the OBJECTS.TXT file. Objects can have up to 4 different images defining them. These are (using Object as the initial filename).

OBJECT.DDS
The object image.

OBJECT_M.DDS
The object image used when the object is in the shroud.

OBJECT_D.DDS
Only used by objects which can be damaged. This is the image shown when an object is damaged.

OBJECT_D_M.DDS
Only used by objects which can be damaged. This is the damaged version used when the object is in the shroud.

ba_modding_2d.txt · Last modified: 2020/11/01 00:59 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki