[CW3] Decayable Terrain (DT) Mapping Template

Started by Grabz, September 23, 2018, 03:36:40 PM

Previous topic - Next topic

Grabz


In Creeper World 3, two things are certain: the Creeper and the terrain
Now it's just the Creeper



Introduction
This template was inspired by Creeper World 4 Alpha 11 which introduced decaying terrain.

Terrain will begin to decay in contact with the Creeper. Contact is defined by the 5 nearest cells to a decaying cell - itself, and the four adjacent cells. The more of these cells have Creeper on them, the faster the decaying cell will decay, up to five times faster.

The rate of decay as well as the minimum terrain level can be customized.

Notes to Mapmakers
This template was designed to be as seamless as possible. This means that, if all goes well, it should not break (and behave as expected) if you resize the map/recompile all scripts/reload. So there's not much you actually need in terms of instructions - just don't delete any CRPL cores in top left of the level.

Settings
There are two things you can edit: Decay Rate and Decay Depth.
To edit these, click the core on (-2,-2) coordinates, click the script, edit the values you want to edit and hit "Apply values & recompile":



  • iDecayTime - The time in frames that a cell takes to decay. A second is 30 frames. This is the time it takes if there is only 1 creeper bordering the cell. For 2 creeper, the cell will decay twice as fast as this. For 3 creeper - thrice as fast, up to 5 times speed.
  • iDecayDepth - 0-10. The minimum depth that decaying terrain cells go to. Decaying will not occur below this value. Value 0 will decay all the way down to void.

Painting the terrain
In order to create decaying terrain, you have to paint it in the editor.

Decaying terrain will not be painted on terrain that is higher or equal Decay Depth. Changing Decay Depth to a higher value will erase all decaying terrain from terrain heights that no longer can decay as per the new setting.

In order to paint, make sure you are in the editor but not in edit mode. To exit edit mode, hit this red X:


Press and hold Shift+Number to paint decaying terrain. The number corresponds to the brush size.
Press and hold Ctrl+Number to erase decaying terrain.

There can only be 10 000 decaying cells in a level at a time. This limit exists because with more cells, the load times for a map become very long. You can see the number of cells you have painted in the bottom left side of the screen, along with some other debug information.

Decay visibility toggle
With V0.2 I added a decay toggle that turns off the visual images. This drastically improves save/load times and is recommended players use it before saving if they save->load frequently. However, I have disabled the option to do this in edit mode, because the images are required to be enabled in order for the map to function correctly after being finalized.

Decay texture
The texture used for the decaying tile is customizable. Just replace `Custom0` with your texture. I will attach some textures to this post that I have experimented with. You can also come up with your own if you wish.

Lag/freezes/etc
This script was designed to be fast. However, the most important CRPL function here, SetTerrain, is extremely slow by design. When a lot of terrain is decaying all at once, the game will be laggy. Keep this in mind when designing your maps. A workaround for this does not exist.

Download
Click the attachment at the bottom of this post to download the map file (save.cw3). Do not rename it. Then, go to
C:\Users\%USERNAME%\Documents\creeperworld3\WorldEditor
Create a new folder with the name of your project, and then put the save.cw3 file inside that folder. Your project should now be visible in-game in the Projects menu.

Bug reporting
If you run into any bug/issue, please let me know. If your problem requires immediate attention, write to me on Discord at Grabz#4707. I'm also a member of the KC discord if you'd like to ask me there instead.

In the editor, you will see a trace log appear. This log will not appear on the finalized map. It should look like this:

If you see an error here that says that the opcode limit (1000000) has been reached, your map will now be broken. This should never happen, but please report it to me if it does (and send me the map file). Thanks!

Maps using this template
Below is a list of my maps using this template. Others might have made levels as well.
For quicker response, reply to me directly at Grabz#4707 on Discord. Find me on the KC server: https://discord.gg/knucklecracker

Grabz

#1
Changelog:
2018-09-24: Version 0.2

  • Added a button toggle to the custom side panel that lets the player toggle decay cell visibility on and off.

2018-09-23: Version 0.1

  • Initial release.
For quicker response, reply to me directly at Grabz#4707 on Discord. Find me on the KC server: https://discord.gg/knucklecracker