The rules of ExPilot as one pure value, run by Cauldron2D.World.
Ships turn, thrust, fire and shield on held actions — thrust as hard as the input's
strength says, its exhaust as long; gravity from the map and its
points pulls on them; a wall bounces a ship, at a cost in fuel, unless the ship hits it
unshielded faster than @wall_crash_speed, which is a crash; fuel
stations refill a ship near them; wormholes move a ship elsewhere; cannons on the map
fire at ships in front of them; a shot kills an unshielded ship it meets unless armour
takes it; two ships that meet crash unless shielded, and shielded ships bounce apart.
A ship whose tank has been empty for ten seconds, flying or sitting on its base, is
lost as if it had crashed. A dead ship comes back on its base a few seconds later.
Watchers join with spectate: true and see the arena without a ship.
A player without a base to join takes a robot's: the robot's ship is removed and the player seated there. A player joining without a team goes to the team with fewer ships.
Map rules
The map's header sets the rules ExPilot.Map.option/2 reads: allowshields,
initialfuel and the initial… kit every ship spawns with, shotswallbounce,
shotsgravity, friction, allowplayerkilling, allowplayercrashes and
allowplayerbounces, playerwallbouncebrakefactor, targetkillteam (a team whose
last target falls is destroyed) and treasurekillteam (a team whose ball is scored
against is destroyed), dropitemonkillprob, laserisstungun, minefusetime,
firerepeatrate, shieldeditempickup, shieldedmining, ballswallbounce,
checkpointradius, playersonradar, and gravity's gravityangle or, with
gravitypointsource, a pull toward gravitypoint.
Items appear on the map (ExPilot.Items) and are used with keys (ExPilot.Gear);
missiles, mines and lasers are ExPilot.Weapons. With teamplay, teammates' shots
pass through each other when the map has teamimmunity, team scores add up, targets
(ExPilot.Targets) and balls in treasures (ExPilot.Ball) score for a team. With
racemode, ships pass the checkpoints in order (ExPilot.Race). What happens is told
in messages the view carries.
Actions
:turn_left, :turn_right, :thrust, :fire, :shield, then the item keys of
ExPilot.Gear.actions/0. An aim in the input turns the ship toward that world point
instead of the turn keys. :next_watch, pressed by a player who is out or by a
watcher, moves the view to the next ship flying, by name; the view's watching names
it.
Events
Every event carries a position: {:fire, pos}, {:explosion, pos}, {:bounce, pos},
{:shot_wall, pos}, {:refuel, pos}, {:wormhole, pos}, {:cannon, pos},
{:respawn, pos}, {:kill, pos}, {:round, pos}, {:pick_up, pos}, {:missile, pos},
{:mine, pos}, {:laser, pos}, {:cloak, pos}, {:ecm, pos}, {:transporter, pos},
{:hyperjump, pos}, {:target_hit, pos}, {:target_destroyed, pos}, {:goal, pos},
{:checkpoint, pos}, {:finish, pos}.
Rounds
A ship on its base sits still until it thrusts, and for three seconds after it appears
there — on joining, on respawning and at a new round — nothing can hit it; it shows
its shield meanwhile. With limited lives, a ship whose lives are
gone stays out until the round ends: when one ship (one team, with teamplay) is left
standing among two or more, it is told it won and round_over_in counts down four
seconds; then, or at once when nobody is left, a new round starts and everyone is back
on their base with their lives, scores kept.
Summary
Functions
A new game on an arena.
What kind of arena a map makes: :ctf (teams and treasures), :race, :team (teams
without treasures) or :dogfight (everyone for themselves); a game with first_to
is a :duel.
Whether the round is over for the player a view belongs to.
Types
@type t() :: %ExPilot.Game{ arena: term(), balls: term(), beams: term(), cannons: term(), events: term(), fields: term(), items: term(), lasered: term(), messages: term(), next_id: term(), particles: term(), rng: term(), round_over_in: term(), settings: term(), ships: term(), shots: term(), targets: term(), team_bonus: term(), time: term(), watchers: term(), won_by: term() }
Functions
A new game on an arena.
Options
:arena— anExPilot.Map, or a path to a map file. Required:seed— for the game's own randomness. Default: unique:lives— lives per ship, or:unlimited. Default: the map'slimitedlivesandworldlives:only— the names allowed to fly; anyone else may only watch (:not_invited). Default: everyone:first_to— a duel: the first ship to that many kills in the round wins it, the match is over for good, andoutcome/1tells both sides. Default: none
@spec mode(ExPilot.Map.t() | t()) :: :ctf | :race | :team | :dogfight | :duel
What kind of arena a map makes: :ctf (teams and treasures), :race, :team (teams
without treasures) or :dogfight (everyone for themselves); a game with first_to
is a :duel.
Whether the round is over for the player a view belongs to.
nil while it goes on: the player flies, or is out of lives but others still fly and
the view follows the nearest. Once every other ship is out, or the round has ended
with one ship standing, %{title: title, lines: lines, next: next} with the standings
as lines: "Victory" with next: :next_arena while the player still flies, "Defeat"
with next: :same_arena when they are out. A watcher's view, or one with unlimited
lives, is never over.