CFED(6) | CFED(6) |
cfed - a level compiler for Crimson Fields
cfed mapsource --tiles tileset --units unitset [-o outfile]
cfed {--help | --version}
cfed is the Crimson Fields level compiler.
It creates a *.lev file out of a source file *.src. You can use any standard text editor to create the level source files (for the syntax of those files, see the section called “FILE FORMAT” below). cfed reads the input file and creates the level file. If the name of the output file is not given on the command line, it is created in the same location as the source file with the .src suffix substituted by .lev.
--help
--tiles tileset
--units unitset
--version
-o
A level source file consists of sections. A section is started by the section name in square brackets, i.e. the line
[unit]
starts a unit section. Lines in a section are usually composed like this:
qualifier = value
The only exceptions to this are the map and messages sections. Lines starting with # are considered comments. The following sections exist:
This section defines some global mission parameters like map size or the graphics set to use. The mission section is mandatory and must appear before the map section in the file. Valid qualifiers are
name
mapwidth
mapheight
nextmap
info
campaign
campaignname
campaigninfo
skirmish
players
music
tileset
unitset
The map section defines the actual map layout. It is a rectangle of the size specified in the mission section, consisting of various symbols which describe a certain map tile type. The map section is mandatory and may not contain comments. The following symbols exist.
.
*
%
=
~
-
#
"
0
1
2
3
4
5
6
7
8
9
J
L
A
B
C
D
E
F
G
H
I
>
<
^
v
\
|
/
y
Y
X
x
o
k
K
(
)
]
[
n
u
T
U
V
W
!
`
´
a
b
c
d
e
f
g
h
i
j
l
m
p
There is also an alternative format. If the section is called map-raw instead, the map is defined by giving the hexagon identifiers directly, using the comma as a tile separator. This approach requires intimate knowledge of the tileset used and may break the map if the tileset changes. The format has been created because there are now more tiles than can be represented with single ASCII characters.
This can be used to set some player definitions. There may be a maximum of two player sections in a file. The first section encountered corresponds to the first player, the next to the second. Valid qualifiers are
name
briefing
fcolor
bcolor
Each of these sections creates a unit on the map. Loaded transporter units must be specified before any units they carry. Valid qualifiers for units are
pos
id
type
player
size
xp
face
crystals
A building section is required to actually create a building (sometimes also called a shop) on the map that units can enter. This is not automatically done by placing the symbol for a building entrance in the map section.
pos
id
player
type
name
mining
capacity
crystals
factory
minweight
maxweight
Events provide a way to interact with players during a game. They can cause actions like points being awarded or messages being displayed under certain conditions. The event type defines what happens, the event trigger controls when (or if) the event is executed.
Event Types
configure
createunit
destroyunit
manipulateevent
message
mining
research
score
sethex
settimer
Event Triggers
handicap
havebuilding
havecrystals
haveunit
timer
unitdestroyed
unitposition
The following list contains generic qualifiers which are valid for all event types.
Qualifiers
id
type
trigger
message
title
depend
discard
flags
In addition there are special qualifiers which can only be used with certain event types or triggers. All of these are mandatory if nothing else is stated.
action (manipulateevent, mining, research)
For mining 0 will set the crystal storage to an absolute amount, 1 will modify the current amount by the given number, 2 will set the mining rate, i.e. the amount mined each turn, and 3 will change the current mining rate by the given value. Minimum mining rate is 0, maximum is 200.
For research 0 allows and 1 disallows producing the specified unit type. Default is 0.
building (mining, research)
crystals (mining)
eflags (manipulateevent)
event (manipulateevent, settimer)
face (createunit)
offset (settimer)
othermsg (score)
othertitle (score)
owner (destroyunit)
pos (createunit)
pos (destroyunit)
pos (message)
pos (sethex)
setting (configure)
size (createunit)
success (score)
unit (createunit, research)
unit (destroyunit)
tbuilding (havebuilding, havecrystals)
tcrystals (havecrystals)
thandicap (handicap)
tile (sethex)
time (settimer)
towner (havebuilding, havecrystals, haveunit, unitdestroyed, unitposition)
ttime (havebuilding, haveunit, timer)
tunit (haveunit, unitdestroyed, unitposition)
tpos (unitposition)
value (configure)
xp (createunit)
The messages section contains all text messages that may possibly be displayed in the course of a mission. The format of this section differs from that of the other sections. Here is an excerpt from an imaginary level file.
[messages(en)] This is a message. % this line separates messages This is the second message. % separator lines can be used for comments This is the third message, containing a line break. [/messages] this marks the end of the messages section
The two characters in brackets identify the language messages in this section are written in. There is one messages section for each language the mission supports. The (en) in the section title shows that this section contains English messages. All messages must be encoded in UTF-8.
### This is a simple example mission file [mission] # mission title is "The Great Example" name = 5 mapwidth = 11 mapheight = 10 # the first message in the [messages] section # will be used as level information info = 0 # we use the default tileset and unit set so we could # omit the next two lines tileset = default unitset = default [map] ***...***.. **...****.= *<^1n]*..== **v..(..==~ ***...].=~~ #=#.==!==== ======(]... %*.=...E^>. %%..%...v.. %%%%.%...** ### first player - The Good [player] name = 6 # second message is briefing for this player briefing = 1 ### second player - The Bad [player] name = 7 # third message is briefing for this player briefing = 2 ### units for player 1 [unit] # this unit will start in the building pos = 3/2 player = 1 id = 0 type = Infantry [unit] pos = 5/4 player = 1 id = 1 type = Medium Tanks [unit] pos = 6/3 player = 1 id = 2 type = Medium Tanks [unit] pos = 3/2 player = 1 id = 3 type = Scouts ### units for player 2 [unit] pos = 7/7 player = 2 id = 10 type = Anti-Aircraft Tanks [unit] pos = 6/6 player = 2 id = 11 type = Personnel Carriers [unit] pos = 7/6 player = 2 id = 12 type = Infantry [unit] pos = 7/7 player = 2 id = 13 type = Heavy Tanks ### buildings # HQ of the Good [building] name = 8 pos = 3/2 id = 0 player = 1 # can repair units here type = workshop crystals = 25 # HQ of the Bad [building] name = 9 pos = 7/7 id = 1 player = 2 # can repair and build units type = workshop type = factory # the following units can be built factory = personnel carriers factory = anti-aircraft guns factory = bomber wing crystals = 25 ### events # player 1 wins if he conquers # the enemy building at any time... [event] type = score id = 0 player = 1 trigger = havebuilding tbuilding = 1 towner = 1 # the next line could be left out ttime = -1 success = 100 message = 3 title = 4 # ...or destroys all enemy units [event] type = score id = 1 player = 1 trigger = unitdestroyed tunit = -1 success = 100 # player 2 wins if he conquers # the enemy building at any time... [event] type = score id = 2 player = 2 trigger = havebuilding tbuilding = 0 towner = 2 success = 100 message = 3 title = 4 # ...or destroys all enemy units as well [event] type = score id = 3 player = 2 trigger = unitdestroyed tunit = -1 success = 100 # display briefings on first turn # [event] type = message id = 4 player = 1 trigger = timer ttime = 0 title = 5 message = 1 # Even though time index 0 is during player 1's phase # we want to trigger the message for player 2 as well. # This way it gets queued for display during the turn # replay. Otherwise player 2 would only see the briefing # after his replay. [event] type = message id = 5 player = 2 trigger = timer ttime = 0 title = 5 message = 2 # we want to support difficulty levels (handicaps) # # if player 1 is handicapped we allocate some more # crystals to players 2's factory [event] type = mining id = 6 player = 2 trigger = handicap # 1 is no handicap, 2 is player 1, 4 is player 2 thandicap = 2 building = 1 action = 1 crystals = 35 # if player 2 is handicapped player 1 gets another tank [event] type = createunit id = 7 player = 1 trigger = handicap thandicap = 4 unit = Medium Tanks pos = 3/2 ### english messages [messages(en)] The Great Example Revision 6 (16-08-2004) by Jens Granseuer <jensgr@gmx.net> % This is a nice introductory message, so that player 1 knows what he is expected to do. Word wraps are done automatically, so don't include line breaks if you don't want them. So, Player 1, let's take them apart: Either conquer the enemy headquarters or destroy all their troops. % This should present the situation to player 2. You are being attacked. Defend yourself. The attack is considered repelled if you gain control of the enemy headquarters or the entire attacking army is no more. % This is the success message for conquering the enemy headquarters. Congratulations! % Hip! Hip! Hurrah! % The Great Example % The Good % The Bad % HQ of the Good % HQ of the Bad [/messages]
The file format of level files (source and data) is subject to change without notice. If you get an error "File not of the required type", it mostly should be sufficient to feed the appropriate source file to cfed again to create a valid level file. However, no promises are being made. You have been warned!
cfed will eventually be phased out in favour of CoMET, the graphical map editor for crimson.
Copyright © 2000-2007 Jens Granseuer
This software is distributed under the terms of the GNU General Public License[1] (GPL).
Jens Granseuer <jensgr@gmx.net>
January 18 2007 |