logo
background
 Home and Links
 Your PC and Security
 Server NAS
 Wargames
 Astronomy
 PhotoStory
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>

Adding new combat units

CF new Units

Adding new (missile) 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 (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')
 
This allows invisible ('stealth', or 'submerged submarine') units to be defined !

New units should be 'defined' in sets of 4 = if not, the CoMET unit select menu will 'wrap around' (and re-display 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

Demo 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' CFUnits.bmp

Image
Landing Craft (see Note)
Transport Helicopters (Infantry, Light Anti-Tank guns)
Light Anti-Tank gun (to go with the Transport Helicopter)
Self-Propelled Guns

Landing Craft is a transporter limited to Infantry Light Anti-tank and Medium Tanks, 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).

Image
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 Note)
Long Range AA Missile

Note. This 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')

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

Note 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
Note 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'

Image
ASW Frigate
Depth charge (a type of mine)
Pontoon Bridge (limiter to shallow water, see Note)
Truck / Pontoon transporter (see Note)

Note. 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 other units to cross the pontoon bridge (since no unit is permitted to move through another)

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

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

Limiting Missiles to specific Unit types

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).

Building the units 'compiled' file

Before your new Unit icons (CFUnits.bmp) can be used, they must have a matching '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 and type:
mkunitset default.usrc default.units ../gfx where ../gfx is the location of the .bmp icon files

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)

[top]