Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions wiki/CreatingFormations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# CreatingFormations

The syntax for the definition of a formation is:

```html
formation <name>
flippable x y
rotatable <degree of symmetry>
arc
start <x> <y>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An arc also has an anchor point (which defaults to 0,0 relative to the ship around which the formation is formed).

angle <angle>
skip (first | last)
positions <positions>
repeat
start <x> <y>
angle <angle>
positions <positions>
line
start <x> <y>
end <x> <y>
positions <positions>
skip (first | last)
repeat
start <x> <y>
end <x> <y>
positions <positions>
position <x> <y>
repeat <x> <y>
```

# Symmetry

If a formation is symmetrical, the definition can include an axis or degree of symmetry. In the event of escorts losing their formation, such as when the flagship rotates faster than the escorts can move, they will re-establish the formation referenced from the nose or one of the symmetry directions, whichever is closer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formation is relative to the flagships movement direction, not to the flagships rotation. (Except when the flagship is not moving at all, then it is relative to its rotation.)


```html
flippable x y
```

The `flippable` attribute allows the x or y (or both) axis to be specified as an axis of symmetry.

```html
rotatable <degree>
```

`rotatable` specifies a degree of rotational symmetry for the formation, such as 90 for squares, and 1 for circles.

Both attributes essentially add reference directions for the formation, from only one pointing out the nose to any axis or multiple of degrees thereof.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flippable attribute does not add directions, but allows formations patterns to mirror themselves over an axis if the flagship suddenly changes direction. (For example by revere thrusting.)


# Repeats

```html
repeat
<start> <x> <y>
...
```

To make formations scalable to any number of ships, a repeat attribute must be applied to the block. Any attribute that exists in a block can be used as a child attribute in `repeat`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to describe that the attributes in repeat are added on top of the original values, so repeating with a position of 1 will make each repeat iteration one larger than the previous one. While repeating an arc with an non-zero angle in the repeat section will make the repeat sections have larger angles.


When a block is fully populated with ships, if it has `repeat`, the block will be rendered again with any children of `repeat` added to their corresponding attributes in the block.

For instance,
```html
position 0 200
repeat 0 200
```
Will render the first position at 0,200 and then 0,400; 0,600; etc.

If no repeat attribute is present, all positions will be filled, and any remaining ships will group at 0,0 underneath the flagship.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description for "remaining ships at 0.0" is correct for the current implementation, but do we want this? We might want to consider such "remaining ships" behavior to be undesirable, and file a feature request to let those ships beyond the end position return to the default "flocking" behavior. What do you think?


# Positions
```html
positions 2
repeat
positions 2
```

The `positions` attribute is used in `arc` or `line` to specify the number of positions that can be filled along the shape. Positions are spread out evenly across the shape, starting at each end.

# Blocks

Blocks can be one of three types: `arc`, `line`, and `position`.

<degrees> are clockwise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

positive degrees are clockwise, negative degrees are counter-clockwise.

<x> is positive right, negative left
<y> is positive back, negative forward

```html
arc
start <x> <y>
angle <degrees>
skip (first | last)
positions <positions>
repeat
...
```
`arc` populates an arc around the player.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Around the flagship of the formation. (Formations can also be applied to NPC ships.)

`start`: Specifies the start location of the arc.
`angle`: Arc distance, referenced clockwise around the player at a constant distance.
`skip (first | last)`: Prevents the filling of either the first or last position in a block. Useful for when starting points overlap, such as a 360 arc.
`positions`: Number of positions in the shape, modified by `skip`

```html
line
start <x> <y>
end <x> <y>
skip (first | last)
positions <positions>
repeat
...
```
`line` specifies a line along which escorts are located.
`start`: Starting point of the line
`end`: Ending point of the line
`skip (first | last)`: Prevents the filling of either the first or last position.
`positions`: Number of spots for ships along the line.

```html
position <x> <y>
repeat <x> <y>
```
`position` blocks render a single position at the given coordinates.
`repeat` Unlike other blocks, repeat criteria are written directly onto `repeat`. Both `<x>` and `<y>` must be specified whenever `repeat` is used.

All blocks are rendered from top to bottom before any block is repeated, and all will repeat top to bottom.
1 change: 1 addition & 0 deletions wiki/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ These pages generally describe the game syntax in accordance with the [data form
* [Creating phrases](CreatingPhrases)
* [Creating starts](Creating-Starts)
* [Creating text substitutions](CreatingSubstitutions)
* [Creating formations](CreatingFormations)
* [Editing interfaces](CreatingInterfaces)
* [Player Conditions](Player-Conditions)

Expand Down
1 change: 1 addition & 0 deletions wiki/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* [Creating phrases](CreatingPhrases)
* [Creating starts](Creating-Starts)
* [Creating text substitutions](CreatingSubstitutions)
* [Creating formations](CreatingFormations)
* [Editing interfaces](CreatingInterfaces)
* [Player conditions](Player-Conditions)
* [Ship personalities](ShipPersonalities)
Expand Down