I’ve made the first steps towards supporting level creation/editing in YHtWtG. The latest patch enables this option, and I’ve also updated the installer at http://www.piratehearts.com/TheGame_Install_2012-12-20_17-22.exe for new players.
I should note that these tools are extremely rudimentary and have a number of known bugs that I never bothered to fix, but they’re the tools I used to build and ship the game, so that’s something.
At any time while the game is running, you can now hit Alt+E to switch to and from edit mode, which looks like this:
This is where you can navigate, create, edit, and test levels. The left and right mouse buttons select tiles from the palette and place them in the current room. Holding the Ctrl button will select tiles from the current room.
There are a number of tiles in the palette that have special functionality.
Starting point. This is where the player spawns in the starting room. This is also where the player will spawn when toggling out of edit mode.
Bell. This is a checkpoint. This can be used immediately when placed in the level without having to do any external editing. If no starting point is placed, the player will spawn at a bell when toggling out of edit mode.
Money. These can be collected immediately when placed in the level without having to do any external editing.
Selection tiles. When one of these is placed in the map, a random adjacent tile will be used in its place. This allows a variety of similar tiles to be placed very quickly.
Animation tile. These tiles will animate when not in edit mode.
Drop-through floors. The player can jump down through these while standing on top of them.
Ghost blocks. These will be enabled when the player collects the appropriate aura powerups. The solid versions of these blocks should not be placed manually.
Invisible walls. These will not appear in the level but will block the player like an ordinary wall.
Enemy blockers. These are like invisible walls, but they will only block or reflect enemies and their projectiles. The player can pass through these.
After creating and saving a level (in the .map format, in the default Maps folder), you’ll need to add two more files to the same folder before the level is playable. One is an XML file containing the names and contents of each room, and the other is a .gam file containing all the details about the level.
The XML file will look something like this:
<room x="0" y="0" title="Room Name Goes Here"> </room>
And the .gam file will look something like this:
Title: Sample FullTitle: New Level Sample DevTeam: Pirate Hearts DevLogo: phearts.bmp Author: J. Kyle Pittman URL: http://www.piratehearts.com/ Description: This is an example non-campaign map. MajorVersion: 1 MinorVersion: 0 Map: Sample.map Content: DefaultContent.ini Rooms: Rooms_Sample.xml StartX: 0 StartY: 0
As may be obvious at a glance, this is actually an INI file.
The “Rooms” field should be the name of the XML file created above. “StartX/Y” specify the room the player starts in when beginning a new campaign. “Content” should generally be left at the default “DefaultContent.ini,” but this can be changed for further modding, as I will discuss in a future post. “DevLogo” can reference a BMP file in the same folder if desired. The rest of the fields should be self-explanatory.
Once these three files (.map, .xml, .ini) exist, you should see something like this when you run the game and start a new game:
Aaaand that’s about the extent of it. Here are a few more links to get you started:
www.piratehearts.com/files/YHtWtG_SampleMap.zip: This is a minimum test case for adding a new map as described above.
www.piratehearts.com/files/YHtWtG_Campaign.zip: This is the main campaign content, containing many more examples of how things work.