# Creating Custom Maps
Foe Frenzy has a simple system in place that allows you to create your own maps using a simple image editing software as well as a text editor. To play a map, all you have to do is put it into a special folder and the game will automatically load it up. If you want to play a custom map in Multiplayer, you need to make sure that all players have the map installed.

## Where to Put Map Files
All files that the game uses are stored in `Documents/Foe Frenzy` on Windows or `~/Foe Frenzy` on Linux. After launching the game for the first time, a `Maps` folder and a `SpawnPools` folder will be generated. This is the location where custom maps live.

## Creating a Map
When creating a Map, two files are required:
- `Maps/MapName.xml`: This is a file containing information about the map, like which tile is which, where items can spawn, where players can spawn and so on.  
Note that the example file included has some more comments inside of it that explain what the different parts of the file do.
- `Maps/Textures/MapName.png`: This file represents the actual layout of the map. You can edit it in an image editor of your choice. Each pixel represents one tile on the map, and the colors of the pixels represent what tiles should be placed there. The size of the image is the same as the size of the finished map.  
Note that, further down on this page, there is some information about which colors the game's default tiles have in the map image.

Below is the file as well as the image for an example map with some comments that explain the structure in greater detail. To get started making your own map, it would be easiest to copy this information.
```xml
<?xml version="1.0"?>
<!-- XML header information, don't change this -->
<RawMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <!-- A short description of the map that displays when it's selected to be played -->
  <Description>A test custom map</Description>
  <!-- The amount of seconds it takes until an item spawner spawns an item -->
  <ItemSpawnerDelay>5</ItemSpawnerDelay>
  <!-- The weather effect that is displayed on the map. Possible values are Snow and Rain -->
  <WeatherEffect>Snow</WeatherEffect>
  <!-- The type of music that should be displayed on the map. Scroll down for reference on all types -->
  <MusicTheme>Lava</MusicTheme>
  <!-- The map's global light modifier. This is the amount of "sunlight" that the map has, where 255 for each R, G, B value means "full light" and 0 means "no light". -->
  <LightModifier>
    <B>255</B>
    <G>255</G>
    <R>255</R>
    <A>255</A>
  </LightModifier>
  <!-- The intensity of lights (like torches) on the map, 1 means full intensity, 0 means that they give off no light at all -->
  <LightIntensity>0</LightIntensity>
  <!-- The tile that is placed outside the borders of the map for visual purposes if the map is smaller than the screen size -->
  <FillerTile>Grass</FillerTile>
  <!-- The structure that is placed on top of the filler tile -->
  <FillerStructure>Tree</FillerStructure>
  <!-- Tile properties are custom combinations of tiles and structures that can be placed in specific locations using the map image. If multiple tile properties are required, an entire RawTileProperty can be copied and pasted below any number of times. -->
  <TileProperties>
    <RawTileProperty>
      <!-- The color specified in the map image file to make this specific property occur in the map -->
      <Color>
        <B>151</B>
        <G>255</G>
        <R>151</R>
        <A>255</A>      
      </Color>
      <Tile>Grass</Tile>
      <Structure>Vine</Structure>
    </RawTileProperty>
  </TileProperties>
  <!-- This is the list of item spawners, their locations and the spawn pools they spawn from. Scroll down for reference on spawn pools. -->
  <ItemSpawners>
    <RawItemSpawner>
      <Location>
        <X>11</X>
        <Y>10</Y>
      </Location>
      <Pool>Test</Pool>
    </RawItemSpawner>
    <RawItemSpawner>
      <Location>
        <X>25</X>
        <Y>10</Y>
      </Location>
      <Pool>Test</Pool>
    </RawItemSpawner>
  </ItemSpawners>
  <!-- This is the list of structure spawners. Structure spawners are basically instructions on how to randomly spawn a set of structures onto different tiles of the map. -->
  <StructureSpawners>
    <!-- The first spawner in this list randomly spawns Rock structures on Sand tiles. The Amount field determines how many tries the spawning should have. -->
    <RawStructureSpawner>
      <ValidPositions>
        <string>Sand</string>
      </ValidPositions>
      <Structure>Rock</Structure>
      <Amount>40</Amount>
    </RawStructureSpawner>
    <RawStructureSpawner>
      <ValidPositions>
        <string>Grass</string>
      </ValidPositions>
      <Structure>Tree</Structure>
      <Amount>60</Amount>
    </RawStructureSpawner>
  </StructureSpawners>
  <!-- These are the spawn points for the four players. When spawning, the spawn points are shuffled so that players don't spawn in the same order every time. -->
  <SpawnPoints>
    <Point>
      <X>1</X>
      <Y>8</Y>
    </Point>
    <Point>
      <X>27</X>
      <Y>4</Y>
    </Point>
    <Point>
      <X>6</X>
      <Y>18</Y>
    </Point>
    <Point>
      <X>25</X>
      <Y>15</Y>
    </Point>
  </SpawnPoints>
</RawMap>
```
![](docs/map.png =100%x*)

## Creating a Spawn Pool
When creating a map, the items that can spawn at any given spawn point are referenced by their Spawn Pool. A spawn pool is basically just a list of items mapped to weights, where a higher weight means that the item will spawn more often, and a lower weight means that the item will spawn less often.

Spawn pools are stored in `SpawnPools/PoolName.xml`. Note that the example file included has some more comments inside of it that explain what the different parts of the file do. Also note that, further down on this page, there is a list of the game's default spawn pools.

Below is the file for an example spawn pool with some comments that explain the structure in greater detail. To get started making your own spawn pool, it would be easiest to copy this information.
```xml
<?xml version="1.0"?>
<!-- XML header information, don't change this -->
<RawPool xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <!-- These are the entries that this spawn pool has -->
  <Entries>
    <!-- Each entry contains the name of an item that should be spawned, as well as the weight that item should have. Scroll down for information on what the weight value means. -->
    <RawPoolEntry>
      <Item>Arrow</Item>
      <Weight>10</Weight>
    </RawPoolEntry>
    <RawPoolEntry>
      <Item>Bomb</Item>
      <Weight>15</Weight>
    </RawPoolEntry>
    <RawPoolEntry>
      <Item>Sword</Item>
      <Weight>15</Weight>
    </RawPoolEntry>
    <RawPoolEntry>
      <Item>LeatherArmor</Item>
      <Weight>10</Weight>
    </RawPoolEntry>
    <RawPoolEntry>
      <Item>RubberHammer</Item>
      <Weight>5</Weight>
    </RawPoolEntry>
    <RawPoolEntry>
      <Item>Spear</Item>
      <Weight>15</Weight>
    </RawPoolEntry>
    <RawPoolEntry>
      <Item>Potion</Item>
      <Weight>3</Weight>
    </RawPoolEntry>
  </Entries>
</RawPool>
```

## Tile Names And Colors
Each tile color is written as (R, G, B). The alpha value (A) is always 255.
- Rock (255, 255, 255)
- Grass (0, 255, 0)
- Sand (255, 255, 0)
- Water (0, 0, 255)
- DeepWater (0, 0, 96)
- Dirt (127, 51, 0)
- RockWall (0, 0, 0)
- RockWallFront (81, 81, 81)
- Lava (255, 0, 0)
- Snow (208, 219, 221)
- Ice (96, 96, 255)
- FallGrass (156, 98, 43)

## Structure Names
- Rock
- Tree (automatically changes to snow or fall tree based on the tile below)
- Torch
- Cactus
- GrassTuft (automatically generates on grass as decoration)
- Flower (automatically generates on grass as decoration)
- Vine
- JungleTree

## Item Names
- Bomb
- Sword
- Arrow
- Wall
- RubberHammer
- Pickaxe
- Dynamite
- Spear
- Potion
- FlameThrower
- LeatherArmor
- Feather
- SpeedBoots
- Torch
- Shield
- AntiSlipBoots

## Default Spawn Pools
- All (Most of the game's items)
- Low (Items that are considered lower tier)
- Cave (All items except long-range weapons like arrows)
- CaveLow (Cave items that are considered lower tier)
- Lighting (Lighting items like torches)
- Pickaxe (Items to destroy rocks with like pickaxes, bombs and dynamite)
- Ice (Most of the game's items, including flame thrower, anti-slip boots and other ice stuff)

## Music Themes
- Lava
- Beach
- Cold
- Forest
- Desert