User Tools

Site Tools


cw4:cpack:docs:d1438b81-d09d-47ae-bb40-9bcd87316f99

qople - Autopilot

canonical link to CPACK - where to get the author-maintained version

Autopilot is an AI that builds and controls player units. It was inspired by Creeper World 3's Sleeper mode and the Play as Creeper rebuild script.

It's current abilities are:

  • Build out a network of towers, pylons, and micro-rifts
  • Respond to parts of the network getting destroyed
  • It can build:
    • Basic weapons (cannons, mortars, sprayers, shields)
    • Miners
    • Snipers
    • Missile launchers
    • The factory
    • Nullifiers
  • Move basic weapons
  • Supports stationary units

The Control Panel

After importing the CPACK, a unit appears in the bottom middle of the map labeled “Autopilot Options.” Selecting it brings up a UI menu that can be used to change units' movement modes. In order for it to work properly, there must be an ADA message channel called “message” with a single text block in it.

The debug toggle shows whether a unit is stationary or is movable by the AI over all weapons, and how close movable units are to being moved. If a weapon does not have text over it when it is turned on, the AI is not running any movement checks on it, making it stationary.

The “Select and Set” button allows you to select units, then confirm on the game message that appears to set their movement modes to whatever the “Set to” toggle is on.

The “Set All” button does the same as the last button, but it sets all units' movement modes instead of selected units.

RiftLab.4rpl: AI Settings

The main AI script is RiftLab.4rpl, which can be found in the “Global Control” menu of the CPACK. Its script settings are the main way to change how autopilot acts during gameplay. There are a lot of them, so they have been put into smaller groups.

Unit Limits

The first settings are the AI's unit limits. They are soft caps, not hard caps. The AI will still build units after reaching the cap, but only if it needs to, so it usually won't build many. They help reduce lag by keeping unit count low while still allowing the AI to build units where they're needed.

The hard caps are the game's unit build limits.

Stationary Units

These settings control how the AI places snipers, missiles, and micro-rifts. The spacing options control how many cells apart units are placed by base, with values of 0 disabling that unit type.

“ProtectionAmt” is how much closer together snipers and missiles are built when close to the rift lab or a micro-rift. A value of 0 is no effect (all units are placed equally far apart), a value of 1 makes them twice as close, 2 makes them 3 times closer, and so on.

“ProcectionDist” controls how far out the effect of ProtectionAmt extends from the rift lab or micro-rift.

Delays

These settings are fairly self-explanatory. They control how fast the AI tries to build the various kinds of units. The delay times are in updates, which are 1/30 of a second of in-game time. It's worth noting that the AI doesn't build a unit every time it tries to.

Building Weapons

WeaponBuildRequirement is the energy surplus needed to build a weapon. Higher values make it less likely to build more during a deficit, with values over 1 making it impossible.

WeaponSwapTargetDist is how close creeper has to be to the network for the AI to focus there and start building weapons.

WeaponSelectDist is how far out the AI checks to decide what weapon to place. The deepest creeper within this range of where it builds a unit is the main decider of what it builds. Higher values make it more likely to build mortars and shields.

Moving weapons

Weapon movement is one of the more performance-intensive parts of the script, so take some care when changing these not to cause more lag than necessary.

MoveTime is roughly how long a unit must be inactive for it to move up. The AI does its best to balance this with performance, so it isn't followed exactly. Higher values reduce lag at the cost of slowing advances.

MoveOptiMin and MoveOptiMax are the numbers of weapons where the AI starts and ends performance optimization. The effect of this is that over the min number of units, they respond less quickly to fast changes. The main place this is noticeable is when a unit needs to be moved because it is inside of creeper.

MaxMoveAmt is the maximum number of unit move checks that can happen in one update.

Other Settings

AggressiveRebuild toggles an alternate way of responding to losing ground. When it is 0, the AI responds by changing its focus to wherever a tower is destroyed. Otherwise, it creates a weapon around every tower that gets destroyed without changing its focus. The second method usually does better.

TowerRefreshRate is how much time the AI spends double-checking the inside of the network. It's recommended to keep this at either 1 or 0, with 1 being occasionally going through it and 0 being not going through it at all. It still reacts when a tower on the inside is destroyed, regardless of this setting.

CustomNullifiables is a comma-separated list of unit GUIDs for units other than the vanilla ones that the AI will build nullifiers around. If there aren't any in a level, this setting can be ignored.

List of Units (CMODS) in this CPACK

cw4/cpack/docs/d1438b81-d09d-47ae-bb40-9bcd87316f99.txt · Last modified: 2021/04/03 19:23 by qople