What it does: You first load the "worldbuilderconfig.html" page and enter in the pixel width of your square terrain textures. Then you specify the width and height in cells of your map (each cell is the size of one terrain image). Click "Submit" to be taken into the editor. Click a Terrain tile to automatically fill the map with the terrain texture. Then click a "prop icon" to select. Clicking on the map with a prop selected will place the prop in that area. Enter the name of the map, zone, and an X and Y location of the map in the game world. Zone, X and Y locations don't need to be present in your game. I simply needed them for travel in my game. If you don't need them, simply add a dummy value to them. Clicking the "Save Map" button will save the map details to the database.
Current Limitations: Currently, the background texture must be square, although you can use any size (within reason considering the size of the browser window and your cell size selections). Also, there is a limit of 26 props that can be added. It should be self explanatory to add more, but the design of my game that I made this editor for dictated that I needed to have a limit. If you want to increase the limit, add more variables to send on AJAX $.post() call, increase the limit in the IF structure in the '#field' event handler, and add the extra fields in the 'saveworld.php' file and in the database.
Technology Used: The project uses HTML, Javascript, jQuery, PHP and a tad of CSS when needed. The application is mostly unstyled, since this is a developer-facing application not suitable for public-facing use.
Current Version: This application is being released as v.0.3.2. It is still technically in beta, although currently it is fully functional.
To-Do: There is definitely some cleaning-up that could be done. For the life of me I could not get arrays passed the way I wanted through jQuery. They would be passed but would not be read correctly in PHP. So therefore I had to pass each variable individually, which added some extra bulk to the "Save" functionality in the client-side code that could really be cleaned up by handling all the values by array.
Also the application could really handle a "Load" function to load a saved map back into the editor for further editing. The application will be considered to be still in beta until it has this functionality.
I would also like to see it have a "ctrl+z" undo feature with a managed history of all the additions to the map to step back.
What is included: 1. worldbuilderconfig.html (used first when accessing the editor to set up the parameters) 2. worldbuilder.php (the actual client-side editor) 3. saveworld.php (the PHP backend file for saving to the database) 4. SQL code (to create the proper database structure) 5. maprecreator.html (the first file used to pull up the map; mostly just for testing) 6. mapshow.php (the second file used to pull up the map; mostly for testing and as an example of how to recreate the map from the database) 7. connect.php (a pretty run of the mill file, but I am including it so people using the "mysql" library can know how to setup their connect file with the "mysqli" library)
What is not included: jQuery, for space considerations. You can download the latest jQuery release here. You need to adjust the <script> tag that links the jQuery file to the scripts since it may be in a different directory and may be named differently (I trim the name of my jQuery down so it is easier to type while I am writing code).
Expected folder setup: PBBG World Builder is currently set up to expect that you have World Builder in a sub-folder inside your main game folder on your development machine. It is currently coded to go up one folder back into your main, and then go into a folder named "images" for your prop images to be loaded into the editor. In the "images folder" is another folder named "terrain" where you keep your terrain images to be loaded into the editor.
License: This application is being expressly released under the MIT license:
MIT License wrote:Copyright (c) 2010 Tim Crouch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.