Home and Links
 Your PC and Security
 Server NAS
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>

Adding new combat units

CF new Units

Adding new Units

The Unit artwork source (default = CFUnits.bmp) contains the 'icons' for the existing 24 units. Each unit is defined 12 times = once for each of the 6 'facings' in brown (player 1, rebels) and then again in blue (player 2, empire). So there are 288 different 'icons' in total.

The Unit definitions source (default = default.usrc) defines the unit characteristics (type, move, attack, defense etc) and 'links' the each of the 24 unit definitions to the start of a set of 12 icons, counting from '0'. So Infantry is 'icon = 0', Medium Tanks is 'icon = 12', and so on, up to the last set of 12 (Aircraft Carriers, 'icon = 276').

It's not possible to limit a Unit to 'one side only', however, the other sides .bmp icons (for that unit) could be set to a red 'X' (to 'prompt' you when Map making using CoMET)
Alternatively, because the unit 'bit map' icons are defined on a 'transparent background', it is possible to make the other players 'choice' invisible (i.e. define the shape for the other player as 'empty space')
Note: this allows invisible ('stealth', or 'submerged submarine') units to be defined !

New units should be 'defined' in sets of 4 = if not, you will find the CoMET 'unit select' menu 'wraps-round' (and re-displays the first bmps at the bottom). Also, you must define each new unit in units.src = otherwise they will not appear in CoMET's unit selection window**. The first new unit will use a set of 12 new icons starting at '288' (the next starts at 300, then 312 & the 4th, will start with 324 and so on).

**The unit icons are 'loaded' when edwindow.cpp creates the editing window.
The units panel (UnitWidget) is actually created in \src\comet\gfxwidget.cpp, however the contents (unit icons) exceeds the panel size, so have to be 'scrolled' from memory in lines of 4.
If you don't stick to 'sets of 4' new units, the 'wrap around' will produce some very odd results

New Unit icons (bmp)

Generally, to build your own 'scenario' (eg 'WW2 - Dieppe Raid'), it is necessary to define multiple new Units (for a start, Landing Craft :-) ). So what follows is really just a demonstration of 'how to do it'

You can download the demonstration new unit bmp file by Right clicking and selecting 'Save As' new-CFUnits.bmp

My new Units

It's easy enough to define new units (and use them on the existing maps) so long as the 'order' of the units is not changed. So I added new units to the end of the definitions file and CoMET was then used to add the new units to existing maps. The only 'problem' is that (in CoMET) the units are shown in definition order (so you will have to scroll down to find them)

My goal is to at least define enough new units to allow some specific WW2 'scenarios' to be fought - for example, Dieppe Raid, Battle of the Atlantic, Dam Busters, El Alamain, Market Garden, Kursk, Battle of the Bulge etc etc

Towed guns

Since the existing slow moving 'AA Guns' behaves more like an AA Missile Battery, I decided to add a real AA/AT Gun - specifically one that can be 'carried' (by it's transporter) and deployed

We need both 'Light' (50mm) and 'Heavy' (88/105mm) guns (the Light gun is needed so it can be deployed with paratroops and 'towed' by jeeps)
Most Light towed guns can be 'manhandled' (at least on good ground), so they will get a speed=5 (1 hex on road/track/grass only)
The Heavy has no move capability and will be of type=slow (i.e. can't 'unload' from it's transport and fire on the same go).
Both types have some minimal armour, appropriate power= ground/air/ship. Light range is 1-2, Heavy range 1-4.
I used the existing 'AA gun' artwork is used for the 'AA Missile Battery', which is a transporter with half-a dozen short range missile units (note = you can 'reload' them by returning to a 'shop' where missiles can be found. When you exit the shop you must be carrying the new missiles)

One limitation of towed artillery is that they are all speed=0, so have to be defined as type=mine to allow them to the 'picked up' (by a 'sweeper' type transporter) and 'deployed' (into their limited terrain= restrictions)

The existing self-propelled Artillery is renamed Heavy SPG (Self-Propelled Guns). I then added new towed Heavy Artillery and a Light Anti-tank gun.

The Heavy SPG represents self-propelled artillery in the 150mm region and gets a 'move and fire' capability, has it's Attack and range reduced (from 2-6 to 2-5) and it's armour increased compared to the existing Artillery. The new (towed) Heavy Artillery unit represents guns of 170mm and above, can't move and fire, has better Attack and range (2-7) than Heavy SP Guns but much lower armour. Unlike AA Guns, Heavy SP Guns and towed Artillery have no Attack capability against Air units. On the other-hand, a towed anti-aircraft gun will get an anti-tank capability.

Landing Craft for Dieppe Raid - see (1)
Transport Helicopters (Infantry, Light Anti-Tank guns)
Light Anti-Tank gun (2)
Heavy Self-Propelled Guns

(1) Landing Craft are defined as a transporter. Weight limited to Infantry, Light Anti-tank guns, Jeeps and similar. Terrain=water & shallowwater (which allows them to move up rivers !). They can be carried by Transport Ships (which are limited to deep and medium water).

When the 'armour=' of the existing Armoured Personnel Carrier (APC) was 'beefed up, there was a need for supply trucks. So the 'Landing Craft' artwork was reused for a new 'Heavy Truck' unit (no** attack, weaker armour, faster on road, able to carry more infantry than the APC). ** when used on a 'missile map' some power(air) is required so the missile 'explodes' on contact

(2) The Light Anti-Tank gun can be carried (towed) by Transport Helicopter, Landing Craft, Heavy Truck, Jeep.


Before I modified the source code** to add a new unit 'type = missile', I added artwork for Cruise missile, SAM (long range ground-to-air / air-to-air), AA missile (short range ground-to-air, air-to-air), Rocket and Torpedo. This allowed games with missiles, however because the missiles could just keep on flying around until needed it was a bit unrealistic

** see my Building Crimson Fields ver 060 pages. All units defined as type=missile are deleted at the start of the enemy turn after leaving their 'transport' (or building). Note that this applies to bombs and demolition charges as well as 'traditional' missiles

Cruise Missile (defense = 1, high attack and 'reasonable' speed)
AA Missile (I changed the AA Missile Battery to a 'transporter' for missiles)
Mobile Workshop see (1)
Long Range AA Missile

(1)The Mobile Workshop is a transporter with 'medic' (repair) functionality, with 'minweight' and 'maxweight' set to limit repair to AFV's (Tanks). It still 'costs 5 crystals' to 'repair' a unit, so the Workshop has to be supplied with crystals (it can start with a limited number, and Trucks (or other transport units) used to deliver more - in which case the Workshop min/max weight must be set to allow the 'delivery' unit to 'enter')

Submarines and Torpedo Boats

Torpedoes are just slow moving missiles with a power(ship) and limited to terrain=shallowwater, water and deepwater. Submarines and Torpedo Boats become 'transporters' for the new torpedo (type=missile) unit and have their power to attack drastically reduced (subs have deck guns = power against ship and ground only, whilst boats have 40mm multi-purpose guns = power against all)

Modern Submarine torpedoes can be fired from 40-50km away, and are 'homing', however the WW2 type can be assumed to be much shorter range.
NOTE the torpedo is classed as type = aircraft but is restricted to terrain = water / deepwater and only has an attack power against other ship units. If the Mine Sweeper is type ground (so can destroy sea mines without fear of counter-attack) we have a problem ...

By allowing Transport Aircraft to carry torpedoes, we have our Torpedo Bomber

Missile Radar Move=0, see (1)
Anti-tank Missile / RPG (2)
Guided Missile Cruiser

(1) In theory, defining a Missile Radar as a Unit would allows it to be carried and deployed, however there's a problem with missiles - if these were carried to the unit, the carrier could just launch them instead. So this ends up as a 'static' Unit with a fixed number of missiles (not ideal, since the A.I. will just 'launch' the lot on turn 1) will or must be 'linked' to the 'real' Missile Site (shop) terrain tile using 'Events' (so destroy the Radar, destroy the site) == see New Terrain Tiles

(2) The Anti-tank missile let's me define Helicopter Gunships and Infantry as 'transporter', the Torpedo goes with the Bomber, Torpedo Boat and Submarine whilst Guided Missile Cruiser is 'self explanatory'

Limiting missiles/bombs to specific transporters

To ensure Bombers could 'drop' Mines & launch Torpedoes & Cruise Missiles - but not AA missiles - whilst Fighters could use short range AA missiles (only), and Interceptors & AA Missile Battery both had the choice of mixing both long & short AA Missiles required a lot of 'playing around' with all the unit 'weights' (since 'minweight' and 'maxweight' is used to control all the 'transporter' types, not just those already mentioned).

ASW Frigate
Depth Charge / Transport Container** (Note 1)
Pontoon Bridge (limited to shallow water, Note 2)
Tank / Pontoon transporter (Note 2)

(1) This icon bmp ended up being used in multiple different unit definitions. First there's the Depth Charge (which can only be carried by Naval units, including the new ASW Frigate), but also Aerial Mine, Heavy Bomb, Demolition Charge and Supply Container (which can only be carried by transport aircraft). AllDunits are defined as 'type=mine'.

The Depth Charge, Aerial Mine, Bomb etc. are 'type=ground' and 'type=ship'. They have high attack (power(ground)= and power(ship)= ) but armour=1 (so should 'die' on 'counter attack).
The Supply Container no attack, weak armour (allowing it to be destroyed rather than fall into the hands of the enemy) plus translots of eg. 10 with mix/man*** weights set to 99 (which still allows crystals to be carried). Because it is a type 'mine', the enemy can 'sweep' it (and grab the crystals) if they are fast enough. ***with appropriate min/max limits, other things could be carried eg. rockets, missiles, air-portable artillery

(2) When a 'scenario' is set-up to use Pontoons, the Map must be built so that there is only a few places where a Pontoon bridge can be 'deployed' (from it's Transport, or from a Landing Craft). The Events system can then be used to 'monitor' these places and, when a Pontoon Unit appears in one of the 'watched' hex's, it is 'converted' into a Pontoon Tile (i.e. the Pontoon Unit is 'destroyed' and the shallow water tile is replaced with a pontoon bridge tile). This is has to be done if units are to cross the pontoon bridge (since no unit is permitted to move through another)

Mines, bombs, demolition charges

The existing 'concrete block' Mine has no attack capability and is too 'universal' (i.e. same for ground and sea). I added an 'attack' value against ships only and used the existing artwork for 'Sea Mine' only with new artwork for a Land Mine. Both mines have speed=0**

Mines have a (very) high 'power=' but armour=1 so Enemy units that 'move up to' and attack mines will revieve high damage in the 'counter attack' before the mine 'dies'.
The 'terrain types allowed' is used to prevent sea mines being used on land (or land-mines being used at sea).
**Note that speed=0 means that the unit must be defined as type=mine (otherwise it can't be 'unloaded' from it's transport (see below re: Transport issues))

Rather than give a Mine Sweeper 'sweeper' capability (which lets them pick up and 'steal' enemy mines), a ship with heavy armour (to survive the mines attack) and low attack power (to destroy the mine) could be used

The 'problem' is that such a ship with high armour becomes 'invulnerable' to attack by the enemy, which allows it to be used as a 'bock ship'.
However there is a 'trick' you can pull when you realise that the terrain restrictions are independent of the unit type ...
Sea Mines have power=ship, so can't attack ground units - however other sea units (ships) DO have an attack value against ground types.
So you make the Mine Sweeper a ground type with terrain allowed =water ... and give it normal attack powet against sea/ground and normal armour.
This lets it fight other sea unist 'as normnal' but be immune to Sea Mines (which have no power ground). It also makes them invulnerable to torpedoes that are limited to power ship (you could give torpedoes power ground but that means torpedoes can br used to attack ground units on the shore line .. )

I then created a number 'bombs' ('Depth Charge', 'Demolition charge', 'Bomb' and 'Blockbuster') as type 'missile' (so die after first use) all with appropriate attack power values.

Like other missiles, each bomb type has different cost and 'weight'.
The 'carrying capacity' of a unit (along with the min and max 'weight' allowed) is used (together with different mine 'weights') to limit what transport unit can carry what type of mine/bomb
NB. The standard 'Bomb' is intended for Dive-bombers to use (i.e. against both land and sea tragets), whilst the 'Blockbuster' is for Heavy Bombers to use against land (only) targets. See my WW2 scenarios, later)

Players should note that they must explicitly 'detonate' their bombs and missiles i.e. use them to 'attack' their targets, otherwise they will 'self destruct' without damaging anyone !

Missile and bomb Transport issues

All units set to type=transported have min weight, max weight and translots limits. Together with the weight of a mine/missile this limits what can carry what.

A spreadsheet is the only way to 'keep track' and ensure that, say Infantry, are limited to RPG's and can't carry AAmisiles ...

To 'deploy' a mine from it's transport, the Mine must be 'allowed' into the terrain (the 'move cost' is ignored as Mines have a 0 move allowance). Missiles are all set to type=aircraft so ignore terrain limitations and costs

This lets you limit sea mines to water and land mones to plains/roads etc.

Transporters with 'sweeper' capability can 'pick up' mines

To do so, they must have the ability to enter the terrain where the mine is deployed. !

Units can't 'exit' one transporter and 'enter' another on the same move. This prevents mines and missiles being 'swapped' from one transporter to another. When a unit exists a transporter, this ends the transporters move

Note, however, that the missile move is in addition to the transporter move - i.e. you can move the transporter (eg aircraft) first and then launch the missile

Coastal Artillery
Beach defences (mined)
Pillbox (see Note)

Note. Both Coastal Artillery and the Pill box are 'transports' (but have 'move = 0') so they can act as 'bunkers' into which Infantry and Light AT guns can 'hide' from naval units bombarding coastal defences

Scouts (SPG, Light Tanks, Armoured Cars and Jeeps)

The existing Scout unit is renamed 'Self Propelled Howitzer'. In armoured warfare, the 'scout' function is performed by Light tanks, Armoured cars or even armed jeeps - and all these unit types are 'missing'. Note that the existing 'AA Tank' artwork makes a good basis for both an Armoured Car and a Light tank ('Panzer 1').

The Armoured Car is a all-wheel-drive vehicle so is about the fastest ground vehicle on road.
The Light Tank is slower but slightly better armoured and aermed.
Finally there is the Armed Jeep. This is a transporter, allowing it to carry 1 Infantry or (tow) 1 light AT Gun. It has minimal armour/attack value.

Tank Destroyer

Another missing Unit is the 'Tank Destroyer'. At least 2 types are required, 'Heavy' and 'Light' (Heavy = longer range, higher armour/attack but slower moving)

In the basic game, Tanks have no 'ranged attack' ability, so same applies to the Tank Destroyer (It is tempting to give Tanks a range attack capability - the problem is that this would allow them to 'fire over' other units, which we don't want).

Building the .units 'compiled' file

Before your new Unit icons (CFUnits.bmp) can be used, they must be referenced by a 'definition' in the ".usrc" file. The best way to define units is to create a spreadsheet (and then use a QBasic utility to 'convert' the .csv into a new .usrc file). For a spreadsheet of my current Unit definitions, Right click and 'save link as' demo-Units.xls

Assuming you have modified the default files (CFUnits.bmp default.usrc) in the CF source & /gfx folder, to build a new 'default.units' (compiled units) file :-
From a cmd window, navigate to the CF \tools folder (where mkunitset.exe is found) and type:
mkunitset default.usrc default.units ../gfx where ../gfx is the folder at the same level as /tools and where the .bmp icon files are to be found

You can Right click and 'save link as' here for mkunitset.exe

Clicking "Next >>" (Nav bar, left) will take you to my 'New Terrain Tiles' page

Next page :- Diving submarines - (source code changes)