CreepTD enables developers to add their own maps, graphics packs and sound sets to the game. This page will cover all neccessary information you need to get started with development.
1. Introduction
CreepTD is unique. It's both developer friendly and a professionally developed RTS game suitable for e-sports. To keep you on track we are providing all neccessary information on this page to get you started as a developer.
1.1 License
CreepTD itself is Freeware and all contributions made by the community are licensed to CreepTD either under the Standard CreepTD Contributor License Agreement or the Exclusive CreepTD Contriburor License Agreement. Please read the according license file for detailed information.
CreepTD Freeware/Donationware License
BY USING THIS SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE.
1. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER/AUTHOR/DEVELOPER BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,SPECIAL,INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE INCLUDING BUT NOT LIMITED TO LOSS OF DATA, FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS OR SOFTWARE, EVEN IF COPYRIGHT HOLDER/AUTHOR/DEVELOPER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
2. YOU MAY NOT COPY, SUB-LICENSE, REVERSE ENGINEER, DECOMPILE, DISASSEMBLE, OR MODIFY THIS SOFTWARE AND/OR THE NETWORKING PROTOCOL USED BY THIS SOFTWARE IN ANY WAY.
3. YOU MAY NOT DISTRIBUTE THE SOFTWARE ON ANY MEDIUM WITHOUT PRIOR NOTICE FROM THE AUTHOR OF THIS SOFTWARE. YOU HAVE TO ASK FOR PERMISSION IN ORDER TO MAKE THIS SOFTWARE AVAILABLE FOR DISTRIBUTION OVER THE INTERNET OR ANY OTHER DISTRIBUTABLE MEDIUM.
By possessing and/or using this software you are automatically agreeing to and show that you have read and understood the terms and conditions contained within this Freeware Software License Agreement. This Freeware Software License Agreement is then effective while you possess, use and continue to make use of these software products. If you do not agree with our Freeware Software License Agreement you must not possess or use the software - this Freeware Software License Agreement will then not apply to you. This Freeware Software License Agreement is subject to change without notice.
This Software contains a huge variety of contributions made by community members. Every single one has been either licensed to CreepTD under the "Standard CreepTD Contributor License Agreement" (CLA) or the "Exclusive CreepTD Contributor License Agreement" (ECLA). For more information, please visit www.creeptd.com/developers. If you intend to use contributed parts for something else than CreepTD, you have to obtain the permission of the original author (the contributor). If you intend to use contributed parts licensed under the ECLA, you have to obtain the permission of the authors of CreepTD. If you contribute your work to CreepTD and nothing else is explicitly noted, you implicitly license it to CreepTD under the "Standard CreepTD Contributor License Agreement".
This software is free, however if you do enjoy it, please consider a small donation to the developers for their time and efforts to make this software possible.
If you have any questions regarding this license, please contact creeptd@virtunity.com
All rights reserved by Daniel 'dcode' Wirtz, virtunity media
CreepTD Standard Contributor License Agreement (CLA)
Thank you for your interest in the CreepTD Project (the "Project"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Project must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign, then submit this Agreement by filling the electronic form and pressing the Submit button at the end of this electronic form. Please read this document carefully before signing and keep a copy for your records. You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Project. In return, the Project shall not use Your Contributions in a way that is contrary to the public benefit. Except for the license granted herein to the Project and recipients of software distributed by the Project, You reserve all right, title, and interest in and to Your Contributions.
1. Definitions.
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with the Project. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to the Project for inclusion in, or documentation of, any of the products owned or managed by the Project (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Project or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
2. Grant of Copyright License.
Subject to the terms and conditions of this Agreement, You hereby grant to the Project and to recipients of software distributed by the Project a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
3. Grant of Patent License.
Subject to the terms and conditions of this Agreement, You hereby grant to the Project and to recipients of software distributed by the Project a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
4. You represent that you are legally entitled to grant the above license.
If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to the Project, or that your employer has executed a separate Corporate CLA with the Project.
5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others).
You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support.
You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may submit it to the Project separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
8. You agree to notify the Project of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
CreepTD Exclusive Contributor License Agreement (ECLA)
Thank you for your interest in the CreepTD Project (the "Project"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Project must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign, then submit this Agreement by filling the electronic form and pressing the Submit button at the end of this electronic form. Please read this document carefully before signing and keep a copy for your records. You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Project. In return, the Project shall not use Your Contributions in a way that is contrary to the public benefit. Except for the license granted herein to the Project and recipients of software distributed by the Project, You reserve all right, title, and interest in and to Your Contributions.
1. Definitions.
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with the Project. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to the Project for inclusion in, or documentation of, any of the products owned or managed by the Project (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Project or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
2. Grant of Copyright License.
Subject to the terms and conditions of this Agreement, You hereby grant to the Project and to recipients of software distributed by the Project a perpetual, worldwide, exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
3. Grant of Patent License.
Subject to the terms and conditions of this Agreement, You hereby grant to the Project and to recipients of software distributed by the Project a perpetual, worldwide, exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
4. You represent that you are legally entitled to grant the above license.
If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to the Project, or that your employer has executed a separate Corporate CLA with the Project.
5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others).
You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support.
You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may submit it to the Project separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
8. You agree to notify the Project of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
4. Creating your own maps
In fact, most of the maps that are available in the game have been created by the community. So, if you have a really cool idea, feel free to try it by yourself.
4.1 Drawing the map background image
The basics: Maps must be sized 16x16, 16x32, 32x16 or 32x32 cells. Other values cannot be used. The background image's size in pixels is always width=MAPWIDTH*20+1 and height=MAPHEIGHT*20+1. This is because every map cell has an outer size of 20x20 pixels and includes the outer left and top grid line only (not the outer right or bottom grid line which is drawn by the next cell). +1 because the last Cells at the right or the bottom end of the map do not contain the right and bottom grid line. So this is added to the background image. With this in mind, the inner dimension of a cell, where towers will be drawn, is 19x19 when not counting the grid lines at the top/left.
Image editors: You are free to use any image editing software you like (*) as long as you save the background image in JPEG format (at best in 75% quality) with a name of "{your map's lower case name}.jpg".
Even nicer 16x.. maps When creating 16x16 sized maps, the map image you draw will be shown for the top left player (player 1). For player 2 (top right) the image will be rotated by 90° in clockwise order, for player 3 (bottom right) by 180° and for player 4 (bottom left) by 270°. Because of this, best visual results will be achived by drawing a nice crossover at the right/bottom of your initial image. Likewise, the image of a 16x32 or 32x16 map is rotated by 180°.
You can use these plain 16x16, 16x32, 32x16 or 32x32 empty grid images to get started with (download all).
(*) GIMP (free), Photoshop (non-free) etc. will work fine. You could even use MS Paint, but the result could be somewhat...you know.
4.2 Simple map file syntax
Creating your first 16x16 map is really easy. All you need is a background image sized 321x321 pixels and a corresponding map file. The background image is always named {lower case map name without blanks}.jpg and the map file {lower case map name without blanks}.map. Both will then be added to a ZIP-Archive named {lower case map name without blanks}.zip.
- Path segments
-
In simple map file syntax, path segments are defined line by line using simple coordinates in the form of "X,Y". The upper left cell is indexed 0,0 and the bottom right cell 15,15. Just write your path to the .map-file. Creeps will follow the path from the beginning to the end. Example:
0,0
0,1
0,2
0,3
0,4
- Blocked coordinates
-
Additionally you have the option to define so named blocked coordinates to cells where no towers can be placed. To define blocked coordinates, use a ";" instead of a "," to separate the x and the y coordinate. Example:
2;3
2;4
2;5
- Comments
-
To add a comment to your map file, prepend a "#" to your comment's text. Example:
# This is a commented line
0,1 # This is a trailing comment
Entirely blank lines are also possible.
This basically is all you have to do to create your first map in simple map file syntax. Please note: Simple map file syntax is limited to maps sized 16x16.
4.3 Advanced map file syntax
CreepTD version 1.0 introduces an advanced map file syntax that is completely backward compatible to the simple map file syntax. It allows the creation of alternative paths using labels, multiple start and end segments and underground sections of segments.
- Extending simple map file syntax
Basic path segments and blocked coordinates are defined as known from simple map file syntax.
- @author preparser option
-
Let others know that you are this map's author. Please use your player name. Example:
@author PlayerName
- @size preparser option
-
Starting from version 1.0, maps can be sized 16x16, 16x32, 32x16 or 32x32. Other values than these will cause the parser to fail. If omitted and not using strict mode, 16x16 will be assumed. To define your map's size, use:
@size 16x16
- @strict preparser option
-
If you want to be sure that the parser will not accidentally fall back to simple map file syntax e.g. by guessing start and end segments of your path, ignoring invalid lines or try to fix anything you had not intended this way, you are able to enable strict parsing mode by adding:
@strict
In strict parsing mode, the parser will not tolerate any (accidentally) mistakes.
- Start segments
-
With advanced map file syntax it is possible to define multiple start segments that will be choosen round-robin by incoming creeps. Example:
1,2 start
Hints: Creeps will appear in the middle of a start segment (to avoid this, see "underground segments" below). It's also possible to create weighted starts by defining one coordinate multiple times and merging the path afterwards using labels (see below). Furthermore, the very first declared segment in the map file will automatically be treated as a start when strict mode is disabled. If strict mode is enabled, you have to correctly define each start segment.
- End segments
-
Similar to start segments, it is possible to define multiple end segments that will be reached by creeps using alternate paths. Example:
1,2 end
Hints: Creeps will disapear in the middle of an end segment (to avoid this, see "underground segments" below). When no end segment(s) are defined and strict mode is disabled, the parser will try to use the last declared segment as an end segment.
- Labeled segments
-
If you plan to create alternate paths, you will have to define labels on path segments that are a "goto" target. Example:
1,2 A
Hints: Labels don't cause any immediate effect, they are just labels. Labels cannot contain white spaces.
- Jump segments
-
To create alternate paths, you will require jump labels. When reaching a segment containing one or more jump labels, the creep will continue to walk the path at the defined labeled segment. Example:
1,2 goto A
Hints: It's also possible to create jump segments with multiple targets. Example:
1,2 goto A,A,B
Explanation:Creeps will choose to go to A or B with A weighted 2 (66%) and B weighted 1 (33%).
- Underground segments
-
If you plan to create subways or tunnels, there are underground segments. Underground segments are declared by indenting the line at least by one blank space. When walking along an underground segment, creeps are hidden and cannot be shot by towers. Example:
1,2
1,2 start
1,3 end
...
Hints: Underground segments may also be placed 1 index outside of the map (but no farther) e.g. " -1,-1 start" or " 4,16 end". In this example it will cause creeps to be displayed entering the map from the outside instead of spawning in the middle of a normal start segment. Example:
0,-1 start
0,0
0,1
...
0,15
0,16 end
- Syntax mixing
-
It is possible to mix segment definitions with each other. Example:
1,2 start A goto B,B,C
Explanation: The declared segment is an underground segment (see the indentation) at coordinates 1,2. It is a start. It is labeled "A" to be used as a jump target and creeps leaving the segment will jump to segments labeled B or C with B weighted 2 (66%) and C weighted 1 (33%).
The following is a special case example for declaring weighted starts:
1,1 start goto B
1,1 start
1,2 B
1,3
...
2,1 start
2,2
2,3
...
In this example creeps will start at 1,1 or 2,1 with 1,1 weighted 2 (66%) and 2,1 weighted 1 (33%).
Hints: End segments cannot be mixed with jump labels because they are...end segments. Start and end segments cannot be mixed either. The order of the mixed statements is important and must use the order shown in the first example.
- Infinite loops
-
It is not possible to declare infinite loops (neither pure nor conditional) where creeps get stuck. If declared, the map is returned as invalid by the parser.
- Last but not least: A map file example
-
The map file for the above example would look like this:
# Map TEST
# compiled by CreepTD PHP library 1.0.3
# at Wed, 12 Oct 2011 14:56:22 +0000
@author dcode
@size 16x16
@strict
1,1 start
2,1
3,1 goto A,B
# Route A
4,1 A
5,1 C
6,1
7,1 end
# Route B
3,2 B
3,3
4,3
5,3
5,2 goto C
For advanced insights into this topic you may have a look at the PHP library's sources (Path::validate).
4.4 Using a map editor
Instead of doing all these steps manually, you are also free to use the CreepTD Map Editor for all these heavy tasks. The official editor supports full advanced map file syntax.
3.5 Using the CreepTD PHP library
We provide you with the CreepTD PHP library that is able to parse, validate and compile CreepTD map files in simple and advanced map file syntax. Use this if you just want to validate a map file or use it as a starting point if you want to create your own parser, validator and/or compiler in another programming language.
See the files "README" and "test.php" to get started:
README
=== CreepTD PHP library ===
== Contents ==
1. License
2. Installation
3. Usage
4. About CreepTD
== License ==
CreepTD PHP library Copyright (C) 2011 by
- Daniel Wirtz, virtunity media (
http://virtunity.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <
http://www.gnu.org/licenses/>.
== Installation ==
Copy or upload the contained folder to a directory on your webserver. The
library requires PHP 5 to operate. Open the included test.php in your browser to
check if it's working.
== Usage ==
1. Include the CreepTD.php file in any PHP file you wish to access the library.
e.g. include "folder/you/uploaded/to/CreepTD.php";
2. Use creeptd_validate_mapdata($mapdata, $warnings, $message) to validate map data.
Use creeptd_validate_mapfile($mapfile, $warnings, $message) to validate a map file.
Use CreepTD::parseMapdata($mapdata, $warnings, $message) to gain access to the
parsed map object containing the traversable path and blocked coordinates.
Use CreepTD::parseMapfile($mapfile, $warnings, $message) to do the above for a file.
The variable $warnings will contain all parse and validation warnings.
On success, the variable $message will contain the final validation message.
3. See CreepTD*.php for all available functionality.
== About CreepTD ==
CreepTD is an Open Source Online Multiplayer TowerDefense game for 1-4 players
playing on one map. It's the mother of all TD games.
Visit
www.creeptd.com for more information!
test.php<?php
include "CreepTD.php";
$mapfile = CREEPTD_BASE."/map_test.map";
echo "<pre>";
try {
$valid = creeptd_validate_mapfile($mapfile, $warnings);
echo "<b>Valid:</b ".(($valid) ? "yes" : "no")."\n";
echo "<b>Warnings:</b>";
if (empty($warnings)) {
echo " none\n";
} else {
echo "\n";
foreach ($warnings as $warning) {
echo "- ".htmlspecialchars($warning)."\n";
}
}
$map = CreepTD::parseMapfile($mapfile, $warnings, $message);
if ($valid) {
echo "<b>Map name:</b> ".htmlspecialchars($map->getName())."\n";
echo "<b>Author:</b> ".htmlspecialchars($map->getAuthor())."\n";
echo "<b>Validation message:</b> ".htmlspecialchars($message)."\n";
echo "<b>Size:</b> ".$map->getWidth()."x".$map->getHeight()."\n";
// $map->getPath() contains the full traversable path tree
echo "\n";
echo "<b>Parsed segments:</b>\n";
foreach ($map->getPath()->getSegments() as $segment) {
echo " [".htmlspecialchars($segment->compile())."] depth=".$segment->getDepth()."\n";
}
echo "<b>Blocked coordinates:</b> "; print_r($map->getBlockedCoordinates());
echo "<b>Compiler output:</b>\n";
$compiledMap = $map->compile();
echo htmlspecialchars($compiledMap);
echo "\n<b>Re-Validation:</b> ".((creeptd_validate_mapdata($compiledMap)) ? "ok" : "failed")."\r\n";
}
} catch (Exception $ex) {
echo "Unable to parse map: ".htmlspecialchars($ex)."\n";
}
echo "</pre>";
?>