[CW3] CW2.25 & Field Only Mapping Template

Started by Grabz, January 07, 2020, 11:04:55 AM

Previous topic - Next topic

Grabz


CW2.25
The ultimate "CW2 in CW3" template



Originally known as CW2.5, now featuring CW2.25 - more hours poured in, more goodies, more CW2, it's all in here, maybe.


Version control: https://github.com/grabz-dev/CW3-Fields-CW2.25/

Features:

  • UI support for gravity. (in CW3 called wind)
  • Optional module for slowly rotating gravity.
  • Gateways and drones.
  • Units are forced to move around terrain blocks, and cannot cut through them.
  • Areas with no direct path to any CN cannot be operated in.
  • Terrain blocks with various properties and manual excavation.
  • Custom terrain skin/theme support.
  • Full field support with a UI based editor.
Most of the template should be fairly user friendly, nevertheless, any do's, dont's, and tips are described below.

List of tips and tricks related to this mode:

  • Units can be nullified through walls. I can't get around this. To prevent sneaky tactics, either place crazonium walls, or embrace said tactics.
  • Mortars can fire over walls. This is unfortunately also something I can't do anything about. Have to embrace it.
  • Gateways choose path to CN for their drones. If a gateway is gone before its existing drones, they become blind.
  • Sprayers in Always On mode don't stop working when you forget about them ;)
  • Hide fields before saving to drastically improve save/load times with many fields present.
  • Other tips to come as I remember them...

1. Important notes:
Spoiler


  • Do not make the map too large. 256x256 is not supported. I have not thoroughly tested the limits but keeping the size of the map to up to ~20000 max cells is preferable.
  • If the map is too large, an error might be displayed. This error is also briefly displayed upon map load and should promptly disappear if everything is fine. Unfortunately this is the only way to errorcheck opcode limit issues in CW3.
  • Your primary method of placing units should be through cloning. The map will automatically position units within the 3x3 grid for you. Moving units is fine but you have to be precise.
  • Do not move or delete invisible cores in the top left corner of the screen - they all serve a purpose and in some cases their positioning is also playing a role.
  • Fields in editor mode might be wrong after recompiles. If you are testing the behavior of fields in your map, save->load the map after recompiling.
[close]

2. Global map properties:
Spoiler

The CRPL core you care about is this one:

The scripts you can modify the properties of are Map.crpl and MapRotatingWind.crpl.

Map.crpl

  • iWindRL - Gravity: Positive values push to the right, negative to the left. 10000 is equal to 1G of gravity on the display.
  • iWindUD - Gravity: Positive values push downwards, negative upwards.
  • iCreeperColorR - The red channel of creeper color. -1 to leave default. Valid amounts are between 1 and 255.
  • iCreeperColorG - The green channel of creeper color.
  • iCreeperColorB - The blue channel of creeper color.
  • iACColorR - The red channel of AC color.
  • iACColorG - The green channel of AC color.
  • iACColorB - The blue channel of AC color.

MapRotatingWind.crpl
  • fStartingRotation - The starting rotation, in radians.
  • fSecondsPerRotation - The amount of seconds it will take for the gravity arrow to perform full circle. 0 disables gravity rotation.


This indicator lets players see the current wind. 1G is 10000 of wind.
[close]

3. Tile properties:
Spoiler

Tile.crpl

  • iDecayableType - If 0, the tile doesn't decay in contact with Creeper. 1 is fast decay. 2 is medium decay. 3 is slow decay.
  • bStrong - If 0, the tile takes 6 ammo to destroy. If 1, it takes 30.
  • bCrazonium - If 0, the tile can be excavated. If 1, the tile cannot be excavated and is indestructible.
  • sSpecial - Special properties of this tile.

    • ORE - The tile becomes indestructible, and four ore deposits are spawned adjacent to it.
    • TECHNYTES - Hides a 50 Aether crystal.
    • GEM_RED - Hides a 60 energy crystal.
    • GEM_GREEN - Hides a 80 energy crystal.
    • GEM_BLUE - Hides a 100 energy crystal.
    • GEM_WHITE - Hides a 200 energy crystal.
  • sSkinImage - Leave empty to use the default image. Provide an image name to use that image as the background for this tile.
  • bIsSkinImageTiled - If 0, the background image is randomly rotated to reduce pattern repetition. If 1, the image is not rotated, which can be useful for tiled images.
[close]

4. Emitter properties:
Spoiler

Emitter.crpl
  • fPower - The amount of spawn (using AddCreeper).
  • iInterval - The amount of frames between emits (30 frames - emit every second).
  • iDelay - The amount of frames until the emitter should start working.
  • bFlip - Whether this is a flip emitter, and will turn C to AC and AC to C when nullified.
[close]

5. Gateway properties:
Spoiler

Gateway.crpl
  • iCommandNodeUID - -1, Do not touch.
  • iDronesMax - The maximum amount of drones that can be spawned by this gateway at once.
  • iDroneSpawnInterval - The interval in frames between drone spawns.
  • fDroneSpeed - The speed of the drones, in cells traversed per second.
  • iDroneHealth - The health of the drone. Snipers deal 20 damage per hit.
[close]

6. Field editor:
Spoiler


It is important to note that the editor must be closed for the field editor to work. This has the unfortunate consequence that inputs might be caught by other things, so be careful.

  • Don't Paint - Turn off field painting.
  • Paint Fields - Enable field painting.
  • Erase Fields - Enable field erasing.
You can paint either only C (creeper) fields, AC or All (both). When choosing field direction, the center option is a pin field, which lets creeper enter but not leave - with the exception of wind, which does not respect pin fields. The option with the mouse icon will paint fields based on how you move your mouse.


This button lets players turn off field visuals. This cannot be used in the editor, because the existence of images is impervious to proper functioning of the map after it is finalized.
[close]

7. Field rotator:
Spoiler


This fella will rotate fields under its influence periodically. Any fields painted inside the rotator's range will be affected depending on the rotator's type.

FieldRotator.crpl
  • iWidthRadius - The half width of the rectangle size. 4 means the width is 9 (4*2+1).
  • iHeightRadius - The half height of the rectangle size.
  • sRotateMode

    • C - Only affects Creeper fields - blue.
    • AC - Only affects AC fields - white.
    • Any (or leave empty) - Affects all fields - green.
  • iInitialDelay - The starting delay of the rotator.
  • sAction0/1/2... - Starting from 0, this is the full list of actions the rotator will perform in order, before rotating back around in perpetuity.
    For example, if action 0 and 1 are set, the rotator will keep performing 0 1 0 1 0 1...
    The syntax is a comma delimited list of two entries, for example: 45,120 - which means rotate 45 degrees clockwise, then wait 120 game frames (4 seconds).
    Do not make the interval something extremely low (like 1 frame) or the game will lag.
    Some more examples:
    • 90,240 - Rotate 90 degrees clockwise, then wait 240 game frames (8 seconds)
    • -8,300 - Rotate 8 degrees anticlockwise, then wait 300 game frames (10 seconds)
[close]

Grabz

#1
Changelog:

  • 1.1

    • Added field rotator.
    • Fixed a glitch that only affected the editor where painting AC fields would accidentally mess up internal holding of C fields. Save load would fix it so uploaded maps were unaffected.

See attachments for releases:

teknotiss

cheers dude, nice one, and good notes too!

question though:  with the "wind" i am assuming a value of 0 in both will give a zero gravity effect, yes?
"Is God willing to prevent evil, but not able? Then he is not omnipotent.... Is he able, but not willing? Then he is malevolent.... Is he both able and willing? Then whence cometh evil?.... Is he neither able nor willing? Then why call him God?" --- Epicurus

Grabz

Yep, wind by default is 0 on every regular CW3 map.

Grabz