Recently I was inspired (partly by this post: Upgrade the editor (http://knucklecracker.com/forums/index.php?topic=739.0)) to make my own map editor.
Why?
A reasonable question, especially since CW2 is coming soon. Mainly I just like the game a lot. Part of it is that I'm taking a java programming class this semester which has really gotten me excited about making GUIs. The other is I've been wanting to continue working on the custom map file format, which I began in my first post here (How to edit Creeper World custom map (.cwm) files by hand (http://knucklecracker.com/forums/index.php?topic=5177.0)).
So what's wrong with the current custom map editor? The main things are that it is hard to draw continuous lines (the brush skips if moved quickly), and it is hard to draw circles and other curvey terrain. Nothing that makes it impossible to use the map editor, just a little painstaking.
Anyway, under the theory that some other people might find it useful, I'd like to share this terrain editor that I made.
I say terrain editor because all that my program can do is
edit the 70x48 grid of elevations. It is possible (though highly unlikely) that I could extend it to modifying emitters or walls or the like, but I just don't see the need (the current map editor works well enough).
Edit - by request, version 0.5 and higher can now edit emitters.A side note on terminology: I use the terms cell, grid, square, and sometimes pixel to refer to the 70x48 elements of the map.
Basic features / use:
- As expected, there are 5 distinct elevations represented by colors: 1=dark=low, 5=light=high. But as I found out, since the game will sort of display elevations 0 and 6, there are actually 7 distinct levels.
- The basic interaction is using a particular brush (square, diamond, or circle of various sizes), the paintbrush tool, and the set elevation action. This is similar to how the current map editor works.
- Tools other than the paintbrush will apply the same operation, just using using a different method to decide which portion of the map to apply the operation to. Using the rectangle tool will have the same effect as clicking individually on each of the cells in the same shape.
- There are various actions besides just painting elevation values, such as raise/lower terrain and smooth terrain. Note that all the actions are applied once at the start of each brush stroke (repeatedly dragging the tool over the same area doesn't apply the tool multiple times in one brush stroke).
- Finally, there is the selection tool. "Selectedness" can be painted using all of the brushes. To move the selection, use the Move Selection tool to drag the selected pixels around, sort of like copy and paste. Additionally there is an option to only paint inside the selection.
Random list of other comments:
- There is a custom brush editor - if you want to define a stick-figure as your brush, you can.
- There is a paintbucket tool, which applies the given operation to contiguous regions or to the entire map.
- The program can read and write CWM, XML, and raw CSV files. You can even ignore the terrain editing bits, and just use the program to decompress the CWM files to XML, manually edit them, then compress the XML back to CWM.
- You can open a CWM file, edit the terrain, save it again in CWM format, and the editor will have remembered all the non-terrain details (even though it doesn't display them).
- You can export to an image, or to a series of layer masks (one per level) for making your own fancy backgrounds.
- Shortcuts Ctrl + 0,1,2,3,4,5,6 jump to the paintbrush tool with that set elevation.
- Scrolling the mouse wheel adjusts the size of the brush.
Here's a screenshot of the program in action, and then the game with the corresponding map.
(http://knucklecracker.com/forums/index.php?action=dlattach;topic=6585.0;attach=3377;image)
(http://knucklecracker.com/forums/index.php?action=dlattach;topic=6585.0;attach=3379;image)
Known limitations:You can't [yet] set a custom image as a (temporary or permenant) background.
Very little documentation.
Can edit only terrain, which means
you will still need to use the original custom map editor for the non-terrain elements.
On a technical note:The program is a jar file, which means that for most people you can just double-click to run it. (
you'll need java 6)
Jar files are zip files with a different name, so you can extract their contents. In particular, the
source code (the raw .java files) is included. Feel free to look / modify / reuse for any purpose - I'm placing the code in the public domain, but that doesn't mean that it is well-organized or easily reusable.
Feedback I'd like:
- Let me know if the program doesn't even run.
- If you can, I'm interested in feedback on how easy the program is use, whether everything works correctly, and (most importantly) whether the program is helpful for making maps.
TL;DR:Download and try my new java terrain editor! You can draw circles and stuff!
I've updated the editor! (the new version, in TerrainEdit-Latest.zip, is now v0.6).See here (http://knucklecracker.com/forums/index.php?topic=6585.msg39608#msg39608) for new features in 0.4, here (http://knucklecracker.com/forums/index.php?topic=6585.msg40343#msg40343) for 0.5a (emitters), and here (http://knucklecracker.com/forums/index.php??) for 0.6 (random terrain).
Edit - minor formatting, added note about scroll wheelEdit - Changed TerrainEdit-Latest.zip to 0.6
Wow... Nice work!
Even a Custom brush choice.
In the second shot, what is that glowing orb?
wow, this guy works miracles
Amazing. Great job! This could be very helpfull for lots of people...
Quote from: Blaze on April 02, 2011, 05:15:11 PM
In the second shot, what is that glowing orb?
It is the rift right as it opens. (I forgot to add a totem, so the map was almost over before I grabbed the screenshot).
Very nice! I was actually done with CW1 map making, but I guess I'll have to try at least one more time.... :)
I can't save my maps
for reasons of security and paranoia, can I see the source code for the program?
Quote from: J on April 03, 2011, 07:12:18 AM
I can't save my maps
Can you tell me exactly what steps you are taking?
(my guess as to what the problem is: you have to type in the file extension yourself. The program's not smart enough to add one itself)
Quote from: thepenguin on April 03, 2011, 02:45:00 PM
for reasons of security and paranoia, can I see the source code for the program?
The source is included in the jar file, but you have to extract it yourself.
One way of doing that is to rename TerrainEdit.jar to contents.zip, then open the zip file. Inside you'll see a bunch of .class files (the compiled java files, the ones that get run), and a bunch of .java files (the source code). The images directory is also important - the program looks for /images/rock.jpg.
The main file is CreeperWorldTerrainEditor.java.
thanks, good to know
It even has the elusive circle brush! Where were you when I was trying to that myself? ;)
works fabulously
great job
you are going to update it right? ;)
Quote from: DarthVader12 on April 04, 2011, 02:37:28 PM
works fabulously
great job
you are going to update it right? ;)
what is there to update?
1. Functions
2. Interface
3. More pre buildt brushes
4. Terrains
I'm glad you guys like the editor. I wasn't sure about releasing it, with CW2 almost out, but thought that there was no penalty for just putting it out there if anyone wanted to use it.
Quote from: DarthVader12 on April 04, 2011, 02:37:28 PM
you are going to update it right? ;)
Yes. I plan to keep working on the editor until it is as useful and complete as I can make it.
But to do that, I need to know what broken features to fix and what new features people would like me to add.
Here's my short list of stuff I want to add:
- Ability to read and display the custom background image when opening an existing map file
- Ability to set the custom background to a new image (and have it show up if you save to a cwm file
- Save dialogs that add the appropriate file extension so you don't have to type it yourself
- Help / documentation, like an example of what happens when you use each tool
Quote from: MadMag on April 09, 2011, 01:35:56 PM
1. Functions
2. Interface
3. More pre buildt brushes
4. Terrains
Can you be more specific? What new brushes should I add?
So in general, if you guys can suggest improvements or new tools or whatever, there's a good chance I'll add them to the code.
First update is here!
(download TerrainEdit-Latest.zip on the first post).
New features:
- Documentation!
- Displays the custom background of a map (and you can set it to a new custom background image).
- New tool option - pick elevation to paint from first click.
- File chooser dialogs now add the appropriate file extension if you don't type it.
- Layer shading method is closer to how the game displays them (multiply instead of alpha composite, if that makes sense).
- Can change the visual style of the application (to look more like windows or a bluer java look).
I'd like to add some more tools/actions/brushes, but I don't know what else to add.
If you suggest something, I can probably have it in the next update.
Could you let us create emitters with special futures?
You mean like 5/4/5/4/5/4/5/4 amounts emitters?
Quote from: J on April 14, 2011, 02:02:36 PM
Could you let us create emitters with special futures?
Do you mean stacked emitters? And seeing and editing a "timeline" like thing for what the cumulative effect of the stacked emitter is?
Quote from: mopa42 on April 18, 2011, 12:58:51 AM
Quote from: J on April 14, 2011, 02:02:36 PM
Could you let us create emitters with special futures?
Do you mean stacked emitters? And seeing and editing a "timeline" like thing for what the cumulative effect of the stacked emitter is?
YES! YES! YES! that will make this something worth looking into
Or an emitter that starts when it's hit by creeper
It is a map editor, not a mechanism to change the game mechanics.
Quote from: mopa42 on April 18, 2011, 12:58:51 AM
Do you mean stacked emitters? And seeing and editing a "timeline" like thing for what the cumulative effect of the stacked emitter is?
This would be totally awesome. I always had to use MS Excel to calculate all emitter increases and delay times. Please keep in mind that stacked emitters are emitting from bottom to top when emitting in the same frame, so only the last one has an effect when intervals coincide. This effect can also be used to stop an emitter.
Ok, I've got a preliminary release that lets you edit emitters.
Here's what's new:
- Displays the emitters in a map
- Can handle multiple emitters
- Add new emitters using a brush system similar to terrain
- Select emitters to move around and edit details
- A timeline view of the selected emitters
In order to make that happen, I've come up with an algorithm that I hope simulates how the game behaves accurately enough.
Here's a snippet of the actual code:
creeperDepth = new float[frameCount];
float lastValue = 0;
for (int frame = 0; frame < frameCount; frame++) {
// apply each emitter in turn (the last one in the list - the one on top - overrides others)
float thisValue = 0;
boolean anyFired = false;
for (int i = 0; i < N; i++) {
if (frame >= starts[i] && (frame - starts[i]) % intervals[i] == 0) {
thisValue = intensities[i];
anyFired = true;
}
}
// determine any special behavior when no emitters are active this frame
switch (mode) {
case DROP:
default:
if (!anyFired) thisValue = simParam; // simParam is value to drop to
break;
case HOLD:
if (!anyFired) thisValue = lastValue;
break;
case DECREASE:
if (!anyFired) thisValue = Math.max(0, lastValue - simParam); // simParam is decrease rate per frame
break;
}
// record the depth
creeperDepth[frame] = thisValue;
lastValue = thisValue;
}
In each frame, I apply each emitter in order (which will be from bottom to top, low Z to high Z). This means that only the topmost emitter applies when they overlap.
I've given a couple of options for the simulation. They specify what happens when no emitters emit in a given frame. In the actual game, the creeper will spread out following the whole creeper flow model with the terrain and everything. There's no way I'd be able to duplicate that in-editor. Instead, you can choose between having the emitter level drop immediately to zero (or another number), hold at its old value until changed by another emitter, or decrease at a constant rate per frame (which sort-of simulates creeper flow). These options should give some flexibility to have the simulation give you a useful model for what actually happens.
There is one detail which I haven't included. In the game, creeper is only updated every 7 frames. I'm not exactly sure how to model that, or if modeling it would be useful.
Other know bugs:
- Moving or deleting hundreds of emitters at once is really slow
- There's no easy way to reorder emitters up and down - fixed in 0.6
- You can't undo/redo emitter changes like you can terrain changes
I'd like some feedback on this tentative release.
- If you've already got a map that you've tuned with stacked emitters, does the program display the timeline accurately? Does the map remain the same when you open it in my program then save it again?
- Is the timeline understandable? Useful? Does it need to be more configurable or do something differently?
- Are any of the new user interface elements hard to use or confusing?
Edit - spelling, known bugsEdit - updated bugs/features for now 0.6, added screenshot
i just tried that out: Awesome!!!! now i can do what upper, and fish and other people did with absolutely no knowledge of how to code. thanks
One more update (maybe the last). I've added a really slick new feature: random terrain generation!
It is similar to Chronom maps in that both generate terrain starting from a seed value, but it uses a different algorithm. I used the diamond-square (http://www.gameprogrammer.com/fractal.html#diamond) algorithm, Chronom uses Perlin noise (http://knucklecracker.com/forums/index.php?topic=5501.0).
There are three fun sliders to play with and a bunch of presets for different behavior.
The cool thing is you can set how similar the generated terrain is to the start terrain, so you can either generate all-new terrain or just add some randomness to the edges of your existing terrain.
I think you'll really like it. I had lots of fun playing with it.
(http://knucklecracker.com/forums/index.php?action=dlattach;topic=6585.0;attach=3853;image)
Other new stuff:
- The option to link columns when editing emitters in the table (changing the interval of one will change the interval of all).
- Show Z-value (height in stack) of emitters in the table.
- Drag emitters in the list to reorder them (the Z-value and index update automatically).
- Make a fancy custom brush by copying the shape of the selection in the editor.
We're now at version 0.6.
Download it as TerrainEdit-Latest.zip on my first post.
very nice, :)
awesome!
Mopa42, you rock! 8)
@ Moderation team: I suggest this post gets stickied, because it's of great value to any CW1 player.
When i open the program why it opens nokia ovi suite:P?
Hey i cant get the program open.
Quote from: mopa42 on May 05, 2011, 08:33:43 PM
Quote from: thepenguin on May 05, 2011, 08:18:56 PM
I finally crashed it! :P
How? What did you do?
fill the whole map with emitters and delete them all at once :P
Quote from: thepenguin on May 06, 2011, 07:48:47 AM
fill the whole map with emitters and delete them all at once :P
Quote from: mopa42 on April 25, 2011, 01:58:39 PM
Other know bugs:
- Moving or deleting hundreds of emitters at once is really slow
Yeah, the way the program keeps track of emitters is really inefficient, which means that dealing with many at once takes a lot of time. This isn't a
huge deal because that many emitters would probably crash the game too. And the program should eventually delete them all - I timed 94 seconds to delete a full map of emitters.
If the program actually crashes instead of just hanging for a while, well, that is a bug and I don't know how to fix it.
Quote from: mopa42 on May 06, 2011, 01:58:48 PM
If the program actually crashes instead of just hanging for a while, well, that is a bug and I don't know how to fix it.
Welcome to the wonderful world of software development. :D
Quote from: Grauniad on May 06, 2011, 02:03:15 PM
Quote from: mopa42 on May 06, 2011, 01:58:48 PM
If the program actually crashes instead of just hanging for a while, well, that is a bug and I don't know how to fix it.
Welcome to the wonderful world of software development. :D
make sure you get the tee-shirt "I survived the devving process"
Seeing how CW2 is out, I'm going to stop working on the editor. However, a new version might appear if:
1) Sudden inspiration strikes me for something really cool
2) Someone requests a specific feature in order to make a map, and I'm able to implement that feature.
3) Someone finds a serious, I-can't-use-the-program-anymore bug.
There's also a bundle available with CW1 + CW2 for just $15, so you may get more new users anyway. :)