How to edit Creeper World custom map (.cwm) files by hand

Started by mopa42, October 29, 2010, 10:28:04 AM

Previous topic - Next topic

UpperKEES

#15
Just used some of the above info to create a new map. I like the ability to use 2 additional elevation levels, but unfortunately I can't set their tint value. It seems like the level 0 tint is fixed at 0.2 or something close to that and the level 6 tint at about 1.6.

It would have been great when these 2 extra levels could be used in the map editor as well, including setting their tint.

Edit: adjusted level 6 tint value.
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

UpperKEES

Quote from: mopa42 on October 29, 2010, 10:28:04 AM
Custom background (if any) is base64-encoded image data (the game and editor are ok with .jpg or .png data of any size initially; if you set the image using the editor it converts it to a 700x480 jpg @ 85% quality)

I really hope Virgil remembers what he said earlier about custom background compression (hint hint ;)). I know there will be a final patch of the map editor (i.e. with Chronom type map generation), so I hope this will be improved as well, because the graphics I created after a lot of work currently get reduced a lot in quality....
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

mopa42

Quote from: UpperKEES on November 14, 2010, 06:44:01 PM
the graphics I created after a lot of work currently get reduced a lot in quality....
I think I can help.

Here are some more details on custom backgrounds.
You can manually edit the files to avoid the 85% quality restriction on custom backgrounds. First base64-encode your image (in whatever jpeg quality you desire). Make sure that the data isn't broken up into multiple lines, then add it in the XML file like this: <custombackground>/9j/4AAQSkZJRgABAQE....</custombackground>, and finally convert back to .cwm format. Alternately, my cwm_edit.pl program can do this step automatically.

The only caveat is that the map editor will reconvert the custom background to 85% quality whenever you save. So, for a high-quality custom background image, set it manually as the last step in creating your game. (I haven't actually tested submitting a map using this method, but it certainly would work for maps on one's own computer).

UpperKEES

Oh, great! That's very useful, thanks! :)

I won't be able to run the PERL-script, but won't have a problem doing it manually I guess.
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

Echo51

Join the chat! :D
- The only echo present here...

UpperKEES

Quote from: mopa42 on December 12, 2010, 06:09:24 PM
First base64-encode your image (in whatever jpeg quality you desire). Make sure that the data isn't broken up into multiple lines, then add it in the XML file like this: <custombackground>/9j/4AAQSkZJRgABAQE....</custombackground>, and finally convert back to .cwm format.

I just tried it with a 1.3 MB PNG-file (zero compression). The online base64 encoder froze my browser, just like another online version I tried, but after installing a Firefox base64 encoder as Add-On it worked like a charm.

Quote from: Echo51 on December 14, 2010, 03:49:09 AM
Notepad and other loose tools ftw, eh? ;)

I actually tried Notepad, but it seems to have some problems with large file sizes, so I used WordPad instead. I replaced the custom image string with the new one and converted the XML file back to CWM format. After copying the map to my customgames folder it loaded without any problems and looks great! 8)

The resulting CWM-file is now 336 KB instead of 104 KB, so nothing to worry about.

Thanks mopa42! :)
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

UpperKEES

Quote from: mopa42 on October 29, 2010, 10:28:04 AM

Ways to use this knowledge about the custom map format:


  • Easily delete all collectors/mines/totems/...
  • Edit spore waves by hand
  • Set emitter settings to precalculated values (such as stacked emitters whose intensity doubles each minute)
  • Automatically generate a custom background based on the terrain, or vice versa.
  • Create a map with randomly-generated terrain
  • Someone very ambitious with too much extra time could even write their own map editor program, with whatever desired features (circle terrain brush, undo, etc) that the current map editor doesn't yet have.

About the only things I found I could do only by editing the XML by hand:


  • Set the terrain to 0 or 6 (which the game still displays, giving two additional elevations to work with).
  • Set walls to other values than 0, 1, or 1000000 (a 2-value wall survives about twice as long as a 1-value wall; the editor doesn't display it even though the game does).
  • Tweak timing values in smaller increments than tenths of a second.
  • Bypass the 85% custom background compression.


Your latest addition about tweaking timing values can be very useful, especially when you like to use an emitter with a frequency of for instance 6 frames, so only blasters with the fire rate upgrade can synchronize with it, or multiples of 7 to allow blasters without the fire rate upgrade to synchronize.

A few more additions (only possible by hand):


  • Lower or higher entire terrain levels by using find & replace.
  • Shift the entire map a certain amount of blocks up, down, left or right, which can save you quite some time when the terrain is already finished. I wrote a little program to do this for me; just let me know if you need it.
  • The use of intensities higher than 1000 for both spores and emitters.
  • The use of more than 1 decimal for specifying intensities (only useful for very precise tweaking on for instance puzzle maps).
  • The use of negative values for spore intensities which will result in 'soaking sponges'. (This does not work for emitters, because negative creeper doesn't spread.)
  • The use of delays larger than 9999 seconds.

Happy map making! 8)
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

thepenguin

We have become the creeper...

Kingo

I know this thread is old, but this is amazing...
Upperkees told me about it in chat and I believe i'll have to try this sometime :)

Kingo

I have tried both programs (packzip and offzip) and have tried to use the Command prompt but the system is not taking it.
Is there a program that will work for windows?

UpperKEES

You have to use offzip from the command line to decompress the CWM-file:

offzip.exe my_map.cwm my_map.xml 0

What version of Windows do you use and what is the error message you get?
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

mopa42

Here's one of the images in the demo screens zip, showing the two commands in action. This might clarify things if you're still having problems.

Kingo

I downloaded both the offzip and packzip, but they don't have those files.
And if I  try to run either .exe, it just runs a line of code through the command prompt and exits before I can see anything. And it does nothing.
I am using windows 7 and I got the "'offzip.exe'" is not a recognized file" type error message from the command prompt.

UpperKEES

Quote from: Kingo on February 06, 2013, 10:21:38 AM
I downloaded both the offzip and packzip, but they don't have those files.

Of course you have to replace the file names of the maps with the file names of your maps.

Quote from: Kingo on February 06, 2013, 10:21:38 AM
And if I  try to run either .exe, it just runs a line of code through the command prompt and exits before I can see anything. And it does nothing.
I am using windows 7 and I got the "'offzip.exe'" is not a recognized file" type error message from the command prompt.

That's because they are not included in the search path. I recommend you copy those files to the same folder as your CWM files.
Then use the CD (change directory) command at the command prompt to change folders before you execute offzip (or open the command prompt in that folder from the Windows Explorer).
If you don't know how to use CD, you should consider not to mess with your CWM-files anyway.... :P
My CW1 maps: downloads - overview
My CW2 maps: downloads - overview