This page contains notes for the game Magic Carpet 2: The Netherworlds.
|
|
To do: |
Level.Dat Data Structures#
Magic Carpet 2 uses a very similar basic level data structure to the original, which slowly deviates from the original until the later parts of the level files are completely different.
Map Header and Generation Parameters#
|
|
To do: |
Magic Carpet 2 begins with very different data here compared to the original game. There is now a header on all levels of 02 00 - 02 for the second version of the level format, and for Magic Carpet 2.
Attribute |
Offset (hex) |
Length (hex) |
Notes |
|---|---|---|---|
File header |
0x0 |
0x2 |
Always 02 00 |
Unknown |
0x2 |
0x2 |
|
Unknown |
0x4 |
0x2 |
|
Level Type |
0x6 |
0x1 |
0 = Day, 1 = Night, 2 = Cave |
Graphics Type |
0x7 |
0x1 |
Need clarity on what this does |
Unknown |
0x8 |
0x2 |
|
Unknown |
0xA |
0x2 |
|
Player Castle Level |
0xB |
0x1 |
0 - 7. Determines starting castle level and therefore starting mana. Player is always 0 |
Nyphur Castle Level |
0xC |
0x1 |
|
Rahn Castle Level |
0xC |
0x1 |
|
Belix Castle Level |
0xD |
0x1 |
|
Jark Castle Level |
0xE |
0x1 |
|
Elyssia Castle Level |
0xF |
0x1 |
|
Yragore Castle Level |
0x10 |
0x1 |
|
Prish Castle Level |
0x11 |
0x1 |
The original MC1 mapgen paramters still exist, but now start at 17. Names below are again mostly from the GAM00088.DAT file found on the original Magic Carpet CD, which only begins from the Seed attribute. Note most of the later attributes only seem to work with one byte, higher values seem to crash the game (like rivers). There are likely more attributes that are not yet identified yet.
Variable |
Offset (hex) |
Length (hex) |
Notes |
|---|---|---|---|
Seed |
0x0 |
0x2 |
Determines the fundamental map landscape shape |
Blank |
0x2 |
0x2 |
|
Off[set] |
0x4 |
0x2 |
Offsets the generated landscape horizontally within the map frame |
Blank |
0x6 |
0x2 |
|
Raise |
0x8 |
0x2 |
Raises height of landscape peaks |
Blank |
0xA |
0x2 |
|
Gnarl |
0xE |
0x2 |
Gnarls landscape to create tree root style appearance. Rarely used |
Blank |
0x10 |
0x2 |
|
River |
0x12 |
0x2 |
Generates more rivers on the map. Values above 255 seem to crash the game |
Blank |
0x14 |
0x2 |
|
Sourc |
0x16 |
0x2 |
Seems to raise sea level/lower base level of terrain. While this seems to use two bytes, going beyond the first byte seems to crash the game |
Blank |
0x18 |
0x2 |
|
SnLin |
0x1A |
0x2 |
Always C8/200. Not sure what it does |
Blank |
0x1C |
0x2 |
|
SnFlt |
0x1E |
0x2 |
Generally low number below 50. Unknown what this does |
Blank |
0x20 |
0x2 |
|
BhLin |
0x22 |
0x2 |
Beach Line? Generally number below 30. This determines how desertified the level is - how much of the terrain is "beach". 255 is pretty much entirely sand. |
Blank |
0x24 |
0x2 |
|
BhFlt |
0x26 |
0x2 |
Values generally below 20. Presumably beach related, but not apparent what this actually does |
Blank |
0x28 |
0x2 |
|
RkSte |
0x3A |
0x2 |
Unknown. Values generally below 40 |
There is then a lots of zeroed data until position 457. This seems to be fixed across all levels as the start of Thing data.
Thing Definitions#
These always begin at position 457 in a level file. These include everything the player can see and interact with in the game, from enemies to collectables to switches. Each entry is 20 bytes long, and there are 1199 entries (condsierably less than MC1's 1999).
|
|
To do: |
Variable |
Offset (hex) |
Length hex) |
Notes |
|---|---|---|---|
Class |
0x0 |
0x2 |
What type of thing it is - enemy, scenery, etc |
Model |
0x1 |
0x2 |
Sub type. Which enemy type, what kind of scenery, etc |
Xpos |
0x3 |
0x2 |
X coordinate of Thing |
Ypos |
0x4 |
0x2 |
Y coordinate of Thing |
DisId |
0x6 |
0x2 |
Distinct ID? Used by switches, needs more research |
SwiSz |
0x8 |
0x2 |
Switch Size - the size of the area in which the player must enter to trigger the switch |
SwiId |
0xA |
0x2 |
The switch number that this item is triggered by. Also used as a modifier for other values, for example what kind of spell |
Paren |
0xC |
0x2 |
Joins together linked items, like segments of path and walls. Also used by teleports to store the X value of the destination. Also used as a modifier to e.g. determine what kind of building to place |
Child |
0xE |
0x2 |
Joins together linked items, like segments of path and walls. Also used by teleports to store the Y value of the destination |
Deformation |
0x10 |
0x2 |
This is used to cycle through different levels of shape/deformation of cave piece such as rooms or tunnels. Only used in cave levels. |
Each entry contains the above variables. Each entry is numbered 1 - 1999, but this is implicit from their order and used for things like the Parent and Child values, it's not explicitly recorded in the entry.
Thing Types#
|
|
To do: |
These go in the "Class" field. They define the basic Type of a Thing. Weather effects are totally removed now (if they weren't already), and spells now use a different number.
Value |
Type |
Notes |
|---|---|---|
02 |
Scenery |
|
03 |
Player Spawn |
|
05 |
Creatures |
|
0A |
Effects |
|
0B |
Switches |
|
0E |
Objects |
|
0F |
Spells |
Once a Thing type is set, the Thing Subtype (e.g. if a creature, what kind of creature it is) is then set in the "Model" field:
Scenery Thing SubTypes#
Value |
Thing Subtype |
Notes |
|---|---|---|
00 |
Tree |
MC2 only has a single tree type |
01 |
Statue |
|
02 |
Dolmen |
|
03 |
Bad Stone |
The standing stone with things carved into it |
04 |
Player Sprite |
This is probably some kind of placeholder |
05 |
Player Sprite |
|
06 |
Mushroom |
Only worksin cave levels |
07 |
Barrel |
|
08 |
Wicker Basket |
|
Player Spawn Subtypes#
|
|
To do: |
These are wizard (player) start positions. If the wizard (other than the player) has a castle level set above zero, they will build their castle here on level start
Value |
Thing Subtype |
Notes |
|---|---|---|
04 |
Flyer1 |
The player |
05 |
Flyer2 |
|
06 |
Flyer3 |
|
07 |
Flyer4 |
|
08 |
Flyer5 |
|
09 |
Flyer6 |
|
0A |
Flyer7 |
|
0B |
Flyer8 |
Creature Thing Subtypes#
Creatures with a SwiId value are spawned by triggering the switch with the corresponding SwiId value
Value |
Thing Subtype |
|---|---|
0 |
Dragon |
1 |
Goat |
2 |
Bee |
3 |
Worm |
4 |
Archer |
9 |
Skeleton |
10 |
Vissuluth |
12 |
Builder |
13 |
Townie |
14 |
Trader |
15 |
Castle Archer |
16 |
Wyvern |
17 |
Manticore |
18 |
Sentinel |
19 |
Firefly |
20 |
Spider |
21 |
Devil |
22 |
Mana Worm |
23 |
Moon Dweller |
24 |
Troglodyte |
25 |
Cymmerian |
26 |
Zombie |
27 |
Hydra |
28 |
Leviathan |
Effect Thing Subtypes#
|
|
To do: |
"Effects" range from all objects that are not creatures or scenery (buildings, Craters, walls, etc) to one-off effects like explosions and traps usually triggered by switches
Value |
Thing Subtype |
Notes |
|---|---|---|
1 |
Big explosion |
|
5 |
Splash |
|
6 |
Fire |
|
8 |
Mini Volcano |
|
9 |
Volcano |
|
0A |
Mini crater |
|
0B |
Crater |
|
0D |
White smoke |
|
0E |
Black smoke |
|
0F |
Earthquake |
|
11 |
Meteor |
|
15 |
Steal Mana |
Trap |
17 |
Lightning |
|
18 |
Rain of Fire |
|
19 |
Unknown |
|
1C |
Wall |
Always have a DisID of 65535 and SwiId of 1. They work by having a minimum of two points (Things) defined in the level and linked via the Parent and Child values (based on their Thing number in the list) to draw the wall to fit between the points. |
1D |
Path |
Works exactly the same as Walls above |
1F |
Canyon |
Again, works exactly the same as Walls do |
22 |
Teleport |
Uses the Parent field to store the X coordinate of its destination, and the Child field for its destination's Y coordinate |
27 |
Mana Ball |
|
2D |
Villager Building |
The Parent field value determines building type. 1 = Tent, various other values determine other building types |
31 |
Unknown |
|
32 |
Ridge Node |
Again, works exactly the same as Walls do |
34 |
Crab Egg |
Switch Thing Subtypes#
|
|
To do: |
More research is needed on switches. Essentially they behave as outlined below, and the SwiId (Switch ID) field is used to give each switch a unique ID, and also to assign Effects to trigger by giving them the same ID. However, there is more at play, the DisId field is also used in some cases, this seems to be to link other switches to be triggered by the first one, or more likely to work in sequence (so they will only trigger after the previously linked switch has been fired). Switch areas are always circular, and the SwiSz (Switch Size) field determines the radius of this circle.
Value |
Type |
Notes |
|---|---|---|
0 |
Hidden Inside |
A hidden switch activated once by the player moving inside its area |
1 |
Hidden outside |
A hidden switch activated once by the player moving outside its area |
2 |
Hidden Inside re |
A recurring/repeatable hidden switch activated by the player moving inside its area. |
4 |
On victory |
|
5 |
Death Inside |
|
6 |
Death Outside |
|
7 |
Death inside re |
|
9 |
Obvious Inside |
A visible switch that triggers by the player moving inside its area |
0A |
Obvious outside |
A visible switch that triggers by the player moving outside its area |
0D |
Dragon |
These switches seem to be used to trigger specific enemy spawns. There will usually be other Creature Things tied to the switch |
0E |
Vulture |
|
0F |
Bee |
|
11 |
Archer |
|
12 |
Crab |
|
13 |
Kraken |
|
14 |
Troll |
|
15 |
Griffon |
|
18 |
Genie |
|
1D |
Wyvern |
|
1E |
Creature all |
|
1F |
Unknown |
LEV000049 Uses this switch type |
Object Thing SubTypes#
|
|
To do: |
A new subtype for MC2.
Value |
Thing Subtype |
|---|---|
1 |
Gate |
2 |
Unknown |
3 |
Unknown |
5 |
Unknown |
Spell Thing SubTypes#
Spell jars. In MC2 these are now a totally different Class and in a different order to the original game. MC2 uses different values in the SwiId field that are not understood yet. If a spell jar is spawned by a switch, the DisId field is used to mark which one it is, NOT the SwiId field (which still marks what kind of jar it is).
Hex |
Thing Subtype |
|---|---|
0 |
Fireball |
1 |
Possession |
2 |
Castle |
3 |
Speed Up |
4 |
Metamorph |
5 |
Heal |
6 |
Shield |
7 |
Lightning |
8 |
Rebound |
9 |
Meteor |
A |
Teleport |
B |
Invisible |
C |
Beyond Sight |
D |
Steal Mana |
E |
Duel |
F |
Tremor |
10 |
Crater |
11 |
Earthquake |
12 |
Volcano |
13 |
Summon Army |
14 |
Gravity Well |
15 |
Whirlwind |
16 |
Fool's Mana |
17 |
Magic Mine |
18 |
Alliance |
19 |
Cave In |
Wizard Stats Block#
|
|
To do: |
From here MC2 files are very different. The APK stats are still there, and spells are still represented by booleans, but the structure is different.
Each Wizard definition is 110 bytes long.
Player 1 stats always begin at position 6207. Wizard 2 is then at 6275, Wizard 3 at 62E3, etc. Unlike the original game, if a wizard is not in the level, they simply won't have a definition here.
Attribute |
Offset (hex) |
Length (hex) |
Notes |
|---|---|---|---|
Aggression |
0x0 |
0x1 |
|
Blank |
0x1 |
0x4 |
|
Perception |
0x5 |
0x1 |
|
Blank |
0x6 |
0x4 |
|
Reflexes |
0x9 |
0x1 |
|
Blank |
0xA |
0x4 |
|
AI skills |
0xD |
0x18 |
These seems to determine which behaviours the AI utilise, as was the case in MC1 |
Blank |
0x24 |
0x2 |
|
Spell Loadout |
0x27 |
0x1A |
This seems to be the MC2 spell inventory for a wizard. Numbers now go from 0 -3 to reflect if the wizard has the spell, and its level |
Blank |
0x41 |
0x17 |
Probably actually one byte less in size, need to find more examples |
Unknown |
0x58 |
0x1 |
Some kind of Boolean. Probably either if wizard is in level, starting castle level, etc |
Unknown |
0x59 |
0x1 |
As above |
Unknown |
0x5A |
0x1 |
As above |
Life |
0x5B |
0x1 |
New for MC2 - how much base health the wizard and its castle have |
Blank |
0x5c |
0x12 |
Level Objectives#
A new addition for MC2. Each level has a maximum of eight objectives that need to be completed. These seem to need to be completed in order, there doesn't seem to be logic in place to AND or OR objectives.
This data is always found at position 6574. Note one byte before at position 6573 is the number of objectives used in the level. Objectives are 7 bytes long and there are always 8 objectives per level. Ones that are unused are marked with Objective Type FF. Some seem to have other data in despite being FF, so this needs to be looked into.
Attribute |
Offset (hex) |
Length (hex) |
Notes |
|---|---|---|---|
Objective Type |
0x0 |
0x1 |
See table below for objective types |
Thing No. |
0x1 |
0x1 |
If objective is kill target, the Thing number of that target is here. Other creatures of the same type will be made objective targets too if kill all of type is used |
X |
0x3 |
0x2 |
X coordinate of objective if go to point |
Y |
0x5 |
0x2 |
Y coordinate of objective if go to point |
Objective Types are as follows. Note these are confirmed from cut text in the ETEXT.DAT file from the BASF demo:
Objective Type No. (Hex) |
Objective Description |
Notes |
|---|---|---|
0 |
Gain Mana |
Thing No. seems to be amount needed |
1 |
Kill Creature |
|
2 |
Destroy building |
unsure of difference from 9, possible 9 is wrong |
3 |
Kill Player |
Kill Specific Wizard based on number |
4 |
Position Object |
Seems to be unused |
5 |
Fly To Point |
|
6 |
Pickup Object |
Seems to be unused |
7 |
Kill All |
Kill All of Type of Creature |
8 |
Kill All Players |
Kill All Wizards |
9 |
Destroy All buildings of type |
|
? |
Objects Held |
Need to check these |
? |
New Spell Level |
Need to check these |
FF |
Unused Objective/End of objectives |