Airfix DogFighter Programmer's Manual


<< Page 5  Tutorial   Page 7 >>

4: Scenario Environments: Creating a New Mission.

NOTE: In the discussion that follows, a Scenario Environment means a selection/combination of rooms in which a Mission/Dogfight is played out.

So, can we create our own Missions, and if so, how do we go about it? The simple answer is: Yes, we can, but only in an indirect way. It is possible to create a Mission from scratch with just the aid of a Hex-Editor (try HxD, it's a good one, and it's for free!), but that WILL be a complicated business, and there is an easier way: Airfix Dogfighter ships with a Utility called the House Editor, but on first sight that is only geared up to let you make your own Dogfights. When you start it up you can either edit an existing Dogfight, which is one that UDS has preprogrammed, or create a new one. If you opt for creating a new one, you are being given a choice of 9 combinations of Rooms. They are:

You will notice that, unlike in the Missions, these combinations do not include the Entrance Hall or the Upper Hall except the third, where both halls are present but no other room is included. In this "World", the Entrance Hall is rather flooded and therefore practically useless. We can also opt for modifying one of the preprogrammed, existing Dogfights. They are:

It is pretty obvious that these preprogrammed Dogfights use the same combinations of rooms as those available as "new" Scenario's in the first list...
Unfortunately the House Editor can only offer the combinations of rooms as described above. You can't, for instance, build a Scenario where you can fly from the Parent's Room, through the Halls, via the Kitchen and the Dining Room to the Living Room and back out to the Entrance Hall and on to the Garage.
As mentioned, we are working on that but so far it has proven trickier than at first thought.

As only certain Environments are available that you can use and re-use as starting points for creating Dogfights, there must be some templates around where these Environments are defined. Before we can go any further, we need to establish where the templates for these Environments are stored.

You might be tempted to think they are in the User\Save\Levels-folder, and you are almost right...
As you will remember, when we saved sample1 in the House-Editor, both the .asf-file and the .level-file were stored in this folder.

If we have another look at the .level-file of sample1 that we created earlier, specifically the first three lines, we see:

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000    46 48 4F 55 8A 03 00 00 48 4F 55 53 21 00 00 00    FHOUŠ...HOUS!...
00000010    47 61 6D 65 5C 57 6F 72 6C 64 73 5C 44 6F 67 66    Game\Worlds\Dogf
00000020    69 67 68 74 73 5C 64 66 5F 31 2E 77 6F 72 6C 64    ights\df_1.world
00000030    00 47 43 43 53 04 00 00 00 CD D2 CF 00 4D 4F 44    .GCCS....ÍÒÏ.MOD


4.1: World-files

In the .level-file, the first Block after the FHOU-Block is the HOUS-Block. This has a String as value, and this string is a reference to the .world-file that defines the Environment of the Map: Game\Worlds\Dogfights\df_1.world.

The complete structure of .world-files is explained in the FileType-section, but for now let's have a look at the first part of this file:

00000000    48 4F 55 53 83 6C 00 00 4E 41 4D 45 18 00 00 00    HOUSƒl..NAME....
00000010    4C 69 76 69 6E 67 2C 20 44 69 6E 69 6E 67 2C 20    Living, Dining,
00000020    4B 69 74 63 68 65 6E 00 54 45 58 55 13 00 00 00    Kitchen.TEXU....
00000030    47 72 61 70 68 69 63 73 5C 54 65 78 74 75 72 65    Graphics\Texture
00000040    73 5C 00 43 43 46 46 23 00 00 00 47 72 61 70 68    s\.CCFF#...Graph
00000050    69 63 73 5C 57 6F 72 6C 64 73 5C 44 6F 67 66 69    ics\Worlds\Dogfi
00000060    67 68 74 73 5C 64 66 5F 31 2E 63 63 66 00 42 43    ghts\df_1.ccf.BC
00000070    4B 44 1B 00 00 00 47 72 61 70 68 69 63 73 5C 42    KD....Graphics\B
00000080    61 63 6B 64 72 6F 70 73 5C 73 6B 79 2E 63 63 66    ackdrops\sky.ccf
00000090    00 4D 4D 53 4B 34 00 00 00 47 72 61 70 68 69 63    .MMSK4...Graphic
000000A0    73 5C 46 72 6F 6E 74 65 6E 64 5C 48 6F 75 73 65    s\Frontend\House

The first block in the .world-file is the HOUS-block with a hexadecimal value following it, denoting the total length of the file minus the first 8 positions.

The next block is the NAME-block, and here we find something very interesting: The value is: Living, Dining, Kitchen, which is the name of the Template we chose when we created sample1!         It turns out that, when you select "New House" in the House Editor, the list of options displayed (see above) is the list of .world-files, taken from the folder Game\Worlds\Dogfights...

The third block is the TEXU-block, which holds a reference to where the Textures for the Environment can be found, and we will skip that one for now.
For detailed explanations, see the FileType-section.

The fourth Block is called the CCFF-block with the value: Graphics\Worlds\Dogfights\df_1.ccf, and this finally is the file where the Environment is defined.
It goes a bit too far at this stage to delve deeply into the .ccf-files, suffice for now to say that these files ultimately define the shape of each and every object in the Game, ranging from a simple toy-cube via the aircraft that you fly, to ultimately the combination of rooms like in Axis10, that comprises of about a third of the whole Villa!


To be continued.....


<< Page 5  Tutorial   Page 7 >>