User Tools

Site Tools


cw4:scripting

This is an old revision of the document!


Scripting and Making Custom Maps

Creeper World 4, in the same tradition as Creeper World 3 and Particle Fleet, has extensive scripting capabilities. It uses the same Reverse Polish Notation and associated “warp” notation as it's predecessors.

Breaking with tradition, there is now separate sections for the Core or Base language and the Game-specific APIs. The core language components are similar in all games and covers control flow, conditionals and basic math operations. The language-specific APIs interact with the game and game objects to provide extensive customization of custom maps and of custom units.

Workflow

Overview

There are 3 components to a custom map

  • The map terrain
  • Custom units
  • Scripts

Map Trerrain

This includes Heights, textures, images, decals applied to the terrain as well as the placement of resources and enemy units.

Custom units

Pre-built custom units are places on the map by the map maker and can either be friendly or enemies. Player-built units are included on the build menus and are built by the player during the game. Most units will have one or more scripts associated with them, unless they are purely of a decorative nature.

Units are contained in custom packs (CPACKs).Each CPACK is a collection of meshes, textures, color specifications that together make up one or more models. Each model typically has scripted behavior to control its mode of operation. CPACKs can be exported from a map and shared with other map makers who can import the CPACK into a map they made.

Each CPACK has a unique identifier (GUID) that is associated with the CPACK from creation onward. The only way to alter the GUID of a CPACK is to *branch* the CPACK in the game's custom module editor.

Scripts

4RPL scripts control the behavior of units. as well as aspects of the map. As such, they can be associated with a unit, or with the Global Control embedded in the CPACK. Global Controls can be specified to either run before or after FIXME [some event]

Scripts are compiled into a map, and will execute when the map is played. When the map is opened in the editor, the editor will extract all the scripts from each CPACK and place them in a folder under the map folder with a name that is made up of the name of the CPACK and the GUID of the CPACK

For testing purposes, or for use during map creation, scripts can also be run in the 4RPL Console

FIXME is an image needed here?

Scripts will be recompiled into the map when FIXME

  • the Compile all button in the package Manager is clicked.
  • The map is loaded into the editor
  • The Map is Finalized for upload/sharing
  • Note that you must explicitly save the map if you want the recompiled scripts to be saved. If you don't, and reload the map, the previous version of the scripts will again be extracted and recompiled. FIXME This doesn't sound right??
cw4/scripting.1575644296.txt.gz · Last modified: 2019/12/06 09:58 by Karsten75