How to create maps
It's quite easy to create maps for BattleWorms. They can be created using
any image manipulation program like PhotoShop or the Gimp.
Overview
A map for BattleWorms consists of 4 parts:
- bg.png: The background image, this image will be displayed as the background for
your map.
- fg.png: The foreground, this image should be partially transparent (see explanation
below) and can be destroyed by the player.
- fm.png: The flagmap, this image contains information for the game on what parts of
the foreground can be destroyed.
- map.cfg: A file containing information like author and version, but can also
contain location for the flags in Capture the flag.
These files should be in a directory under <BattleWorms>/maps. The name of
the directory is also the name of the map visible in the game. Only maps
that start with "CTF_" can be used for capture the flag.
When you want to use a map, you have to make sure everyone in the game has
this map in the same directory as you.
Step 1
Decide how large you want your map to be. The visible area for the player
is 500x300 pixels. So 1000x600 is a nice large map.
Step 2
Create/Choose the background. This image can be anything as long as it has
the same size as all the other images. Try to use an image that has
different colors so a player who chose a blue color isn't invisible all
over your map because you used that color as a background.
Here is the background of the map 'playground' (scaled to 50%):
Step 3
Create the foreground. Again this can also be anything. Try thinking about
what you want to be destructable. If you want to make parts transparent
(so you can see the background in those places) make them the following
color: Red: 255, Green: 0, Blue: 255.
This is also a good time to disable anti-aliasing in your application.
Transparent areas need to have this exact color to be transparent.
All the destructable areas become transparent automatically when
destroyed.
Here is the foreground of the map 'playground' (scaled to 50%):
Step 4
Create the flagmap. Using the colors in this map the game can determine
which areas of the foreground can be destroyed. Make sure the areas fit
perfectly and that anti-aliasing is still disabled. The colors need to
be exactly as specified below else strange things start to happen.
You can look at the supplied maps for examples of how the colors work
there.
The colors you can use are (Red,Green,Blue):
- Indestructable: (0 , 255, 0)
- Destructable: (255, 255, 255)
- Nothing (Air): (255, 0, 255)
Special areas for capture the flag:
- Red base: (255, 0, 0)
- Blue base: (0, 0, 255)
In capture the flag when you capture the flag you need to take it to your
own base. Using the flagmap the game determines if you have reached it.
Here is the flagmap of the map 'playground' (scaled to 50%):
Step 5
Now you can create the configuration file for your map. When you don't need
some settings for your map you can just leave them out. For example you
don't need to supply respawn positions, because BattleWorms can generate
random ones. But for capture the flag you will need to supply the positions
of the red and blue flag and you will probably also need respawn positions
so the worms don't respawn near their enemies flags!
The coordinates are in number of pixels from the top-left corner of your map to the top-left corner of the worm (the default worm is 20 pixels wide and 18 pixels high) or flag (the default flag is 60 pixels wide and 40 pixels high).
An example configuration with explanations (don't include those explanations in your config file).
[Map]
Author = FlyBoy (Here you can put your name!)
Version = 1.0 (The version number. When you change something in the
flagmap be sure to change this and give this version to
everyone using it.)
NrOfRespawnPositions = 1 (The number of pre-defined respawn positions you
supply below.)
NrOfTeams = 2 (The number of teams for which you supply respawn
positions)
NrOfTeamRespawnPositions = 2 (The number of respawn positions per team
you supply below)
[Position_0] (The first pre-defined respawn position)
X = 80
Y = 100
[Team_0_Position_0] (The first pre-defined respawn position for the first team)
X = 80
Y = 215
[Team_0_Position_1] (The second pre-defined respawn position for the first team)
X = 180
Y = 215
.
.
.
[Flag_Team_red] (The position of the top-left corner of the red flag in a CTF game)
X = 40
Y = 360
[Flag_Team_Blue] (The position of the top-left corner of the blue flag in a CTF game)
X = 1565
Y = 360
Your Done!
Well maybe you should first test it, but then you can play BattleWorms
with your own maps!
|