TonyV Site Admin

Joined: 07 Feb 2006 Posts: 1509 Location: Paragon City, Rhode Island
|
Posted: Wed Dec 20, 2006 7:45 am Post subject: FAQ: How to modify maps in the City of Heroes client |
|
|
Hey all, I could really use some help with getting some of the information I'm using for Paragon Maps. This is the first in (hopefully) a series of FAQs describing the process I go through to get the information I use in constructing the maps.
Overview
Every map in City of Heroes is stored as an image file inside the game's .pigg files. Getting at them isn't necessarily very easy, but it's a necessary first step in creating custom maps for either display on sites such as Paragon Maps or for use in so-called "map patches" such as the Paragon Maps or VidiotMaps overlays.
List of Utilities Referenced
The following are utilities referenced in this FAQ:
PiggViewer
Before the files can be worked with, they need to be obtained. City of Heroes stores, among other things, all of its graphics in the client in a file type that ends with the extension .pigg. These files, stored in the piggs subdirectory of the main application directory (C:\Program Files\City of Heroes by default) are compressed filesystem files, similar to .zip files that many people are well-familiar with. The tool usually used by the community to extract files from .pigg files is called PiggViewer.
There are two main versions of PiggViewer available: the original version and a new, open source version. The open source version has slightly better user interface, but is only able to extract images as .bmp (bitmap) files. The original version is a bit harder to navigate, but is able to extract images as .bmp or .dds (DirectDraw Surface). The latter is highly preferable for in-game graphics, as it stores alpha channel (i.e. transparency) information in the file. Also, the old version of PiggViewer has one essential capability that the open source version still lacks: the ability to convert edited graphics files back into original .texture format files. Currently, the original version of PiggViewer is highly recommended for creating modified maps or for extracting game graphics.
The original version of PiggViewer is available at the City of Heroes Coldfront site, and the newer open source version is available at SourceForge.
Extracting Files
As mentioned, the game graphics are stored in the piggs subdirectory of the City of Heroes application directory. You'll notice that there are a lot of .pigg files, and figuring out which one has the map or graphic you're looking for and where in the directory structure within the .pigg file your file(s) of interest are can be challenging. The following is a list of where the game maps are stored:
- Paragon City Maps: texMaps.pigg, in texture_library/MAPS/static
- Safeguard Maps: texMaps.pigg, in texture_library/MAPS/Safeguard
- Mission Maps (hero-side): texMaps.pigg, in texture_library/MAPS/outdoor_mission
- Main Paragon City map (seen in monorail stations): texMaps.pigg, in texture_library/MAPS/city/citymap.texture
- Rogue Island Maps: texMisc.pigg, in texture_library/V_MAPS/Static
- Mission Maps (villain-side): texMisc, in texture_library/V_MAPS/Outdoor_Missions
- Main Rogue Isles map (not used, to my knowledge): texMisc.pigg, in texture_library/V_MAPS/City/V_citymap.texture
- Mayhem Mission Maps: texMisc.pigg, in texture_library/V_MAPS/Outdoor_Missions/map_V_Mayhem_*.texture
Once the desired map is found, it can be extracted by right-clicking on its name in the directory list and choosing Extract as format from the popup list, where format is either BMP or DDS. For maps, the preferable format is BMP.
Tip: An entire directory of files may be extracted at one time by right-clicking on the directory the files are stored in and selecting Extract all textures in this folder as format, where format is either BMP or DDS.
Customizing Maps
Once a file is extracted in its desired format, any common image editor may be used to customize it as desired. My personal editor-of-choice is The Gimp, a powerful open source image editor. To edit DDS files in The Gimp, a plug-in will be needed. A Gimp-specific plug-in is available here, or the nVidia Photoshop DDS tool will work as well. (The Gimp can use Photoshop plug-ins.) For BMP files, no special plug-ins are needed, and for working with game maps, BMP files are perfectly sufficient for the purpose at hand.
Converting Maps to Textures
Once a map has been edited, it needs to be converted to a .texture file, which is the format that City of Heroes uses for its images. To do so, open PiggViewer once again and find the map file of interest in the directory structure. Right-click on the filename, and select Create .texture from format, where format is either BMP or DDS. You'll be prompted for the source file and a destination to store the edited .texture file. The .texture file will be saved in a subdirectory of the directory you choose.
Note that the full path of the .texture file is created in your chosen directory. For example, if you choose to save a modified copy of map_city_00_01.bmp in your C:\maps directory, the .texture file will actually be saved as C:\maps\texture_library\MAPS\static\map_city_00_01.texture. This is normal, and the program is actually doing you a favor, which will be discussed in the next section.
Enabling the Modified Files to Be Used
Once the modified .texture files are created, they need to be placed in a specific location so that City of Heroes will know to use them instead of the file inside the built-in .pigg file. This location is in a subdirectory of a special data directory in the application directory.
Begin by creating a subdirectory in the main application directory named data. By default, the full path of this subdirectory will be C:\Program Files\City of Heroes\data.
Modified .texture files should be placed in this data directory using the same directory structure that is stored in the .pigg file. So for example, if the modified .texture file is stored in the .pigg file as texture_library/MAPS/static/map_city_00_01.texture, the modified .texture should be stored (by default) in a C:\Program Files\City of Heroes\data\texture\MAPS\static directory on your filesystem.
As mentioned above, when PiggViewer saved your modified .texture file, it saved it in the appropriate directory structure. If you have not moved the modified .texture file to a different location, you may simply copy or move the root of the directory structure that PiggViewer created (texture_library for all maps and other graphics files) under the data directory in the main application directory, and it will be in the correct place for City of Heroes to use.
Test the Modified Map
It's the moment of truth! Launch City of Heroes, go into whatever zone or mission you have edited your map for, and see the results!
When Things Go Wrong
Oh no, it didn't work! It's all screwed up! What do I do!!?
First of all, don't panic. You have hopefully noticed that in customizing any files, you have not modified the City of Heroes client. The "drop back and punt" method of fixing any errors is to simply delete any customized files you have created out of the data subdirectory, and City of Heroes will revert to using its built-in graphics files.
That having been said, here are some common things that can go wrong:
- The edited files haven't been converted to .texture files. Remember, City of Heroes can only read .texture files, not DDS or BMP files.
- The edited files aren't in the correct directory. The modified .texture files must be in the City of Heroes\data\pigg file path directory. For example, by default, a modified Atlas Park city map should be stored as C:\Program Files\City of Heroes\data\texture_library\MAPS\static\map_city_01_01.texture.
- The wrong map was used to generate the .texture file. I've done this once or twice, which is plenty enough to mess with my head. Basically, it boils down to something like this: I extract the Atlas Park map. I edit the Atlas Park map. When I convert it back to a .texture file, I select map_city_01_02.texture (Kings Row) instead of map_city_01_01.texture (Atlas Park). I move the file into the City of Heroes directory and fire up the game. My Atlas Park map is unchanged. My Kings Row map is totally hosed up. Oops. When (not if, but when) this happens to you, simply delete the old file, re-convert the correct file, and move it back over.
- Other snafus. This is a general catch-all category of other things that could go wrong. You saved the map with the wrong dimensions. You accidentally introduced an offset on one side of the map. You (insert whatever you did wrong here). Hopefully, the troubleshooting process is clear by now: delete your edited file out of the data subdirectory and start over as far back as you need to correct the situation
- The absolute, positive worst-case scenario is that for some reason, you've corrupted a .pigg file in your client. Since PiggViewer doesn't modify its source files, I can't imagine how in the world you could have possibly done that, but under the assumption that in some bizarro universe it happened, even that is relatively easy to fix. Simply launch City of Heroes and click on the Verify All Files button instead of Next. Or, if literally everything has gone to hell and you're so flustered that you want to frickin' start everything over from absolute scratch, download the CoHUpdater.exe client installation utility from NCsoft and do a complete reinstall. (But I've never even been close to having to do this, and I really can't imagine any scenario so screwed up that this is even remotely close to being necessary.)
If anyone else has run into any trouble, by all means, please feel free to reply with your comments below.
Tips and Tricks
The following tips and tricks and extra info might be useful, even if you're already familiar with the process of so-called "pigg diving" and/or map and graphics extraction and editing.
- The original (highly recommended!) version of PiggViewer requires the .NET framework, as I think the open source version does as well. If you don't have it, download and install it before trying to run PiggViewer.
- PiggViewer can extract whole directories at a time. This is extremely useful for editing several maps. To do so, right-click on the directory that contains the files you wish to extract and select Extract all textures in this folder as format, where format is either DDS or BMP. If you want to extract the raw .texture files (or want to extract non-graphics files), right-click on the folder and select Extract from the popup menu.
- Map files are best worked with as BMP files. The native format of almost all files in the game, including maps, is DDS, with transparency and other information. (A notable exception is the load screens, which are .jpg files.) However, the game maps do not use these features, so BMPs work find and are generally easier to work with.
- Tired of having to navigate to your buried directory to save each... and... every... texture... file...? Shortcuts don't work in the directory selection dialog box (grrr!), so I use an über-nifty little tool created by Marc Russinovich, the god of Windows utilities, called junction. Describing how it works and exactly what it does is beyond the scope of this document, but the nuts and bolts of it is that you should create a reparse point in your C:\Documents and Settings\username\Desktop directory that points to wherever you are storing your edited files. At least this way, it shows up as a top-level directory and is very easily navigable.
- Discussing mods is strictly prohibited on the official forums. Don't do it, because any post or thread about it is automatically deleted, period. Even threads discussing map overlays such as the Paragon Maps and VidiotMaps overlay are deleted. It's not so much because they're worried about people screwing up the software (surely by now you've noticed that you're not modifying any actual client files, right?) as it is they're worried about people using mods to infringe on copyrights. Using similar editing methods, for example, it's possible to change a costume logo to be Superman's S symbol. Or even to make (gasp!) naked people. Please note that I highly discourage this kind of silliness, as it only serves to 1) convince the developers to shut down all client modifications, and 2) even if you do modify the client graphics, it only affects your client. So no one else will see that fancy logo you created any more than anyone will see a map overlay that you install.
- Do you like your map overlay enough that you would like to put it out there for folks to use? Most normal people don't understand what you mean when you say something like, "extract this zip file into your application directory." If you want to create a nice little executable installer, I suggest checking into an open source (free!) utility called NSIS. Using NSIS is way beyond the scope of this document, but hey, you're a guru, you can figure it out.
It's what I used for creating the installer of the Paragon Maps overlay, and is widely used by developers (yes, even fancy schmancy developers who sell their software for lots of money) to roll out Windows applications. Have fun with it! At some point, I'll post the script I use to create the executable file so that if you want to roll out your own overlay, you'll have an example to start from.
I think that about covers it. If you all can think of anything else that needs to be said, please post a reply below. Enjoy, and be sure to let me know if you come up with any cool map ideas! |
|