Command-Line Options
- -f Use fullscreen mode.
- -w Specify width.
- -h Specify height.
- -m Play a specific mapfile ("filename.xml").
- -s Use a specific random seed value.
- -k Do not spawn hunter/killers.
- -r Recover a level based on an input filename ("ASIMOV 1280-B").
- -l Play a specific level number from the current map list.
- -d Reset save data and game options.
- -e Immediately skip to the ending sequence of the game.
- -a Allow debug keys to be used in the application.
- -y Use the development resources directory instead of the resources in the installation.
- -b Break into debugger if an assertion is hit.
In-Game Debug Keys
- [ Toggle single frame advance.
- ] Advance a single frame while single frame advance is on.
- \ Toggle FPS display.
- p Cycle debug displays.
- y Toggle invulnerability.
- n End level immediately, as if the player had escaped the maze.
- f Kill the player.
- t The player takes one point of damage.
- z Zoom camera out.
- c Give the player $20000 cash.
- r Fill the player's inventory with random equipment.
- e Put the secret level keys into the player's inventory.
- x One point of shields is restored.
- b Advance to the next stage of the final boss battle.
XML Documentation
General Notes
When an entity type is specified in XML, multiple types can be specified by separating them with commas: "world,player,bullet". All types can be
specified with "all" and none with "none".
Colors are specified in hexadecimal, as #RRGGBB or #RRGGBBAA. If alpha isn't specified, it will be set to 1.0.
Many arguments are "ranged," which means you can optionally specify a range of values and a random choice within that range will be made every time
the argument is polled. For example, "3,5.5" is a ranged value from 3.0 to 5.5.
Map Lists
- maplist Outer element defining a list of maps that makes up a game. Attributes:
- numlevels How many levels are in the game.
- ending How the game should end once all levels are complete. The options are maingame, which spawns the final boss as the last level
(regardless of any other specified level information in the list of levels), rolls the credits and ends the game after the boss is defeated, and records
high scores normally; and alternate, which merely plays the intermission animation while displaying a text message and does not record high scores.
- message1, message2 Two strings which are displayed during an alternate ending.
Children:
- baseinfo Outer element defining basic information about each level. Children:
- level One of these must be present for each level in the game. The name attribute defines the default name
for this level -- it will be used when constructing the level name if not overridden.
- levelset Outer element defining a level range. Levels can be referred to multiple times. The range attribute defines
a range of levels. Children:
- map Describes a map that could potentially be constructed for this level. Attributes:
- probability The chance of constructing this type of map. The default is 1.0.
- filename Filename of a map definition (see Maps below.)
- name Optional, this is a name that will override the name set in baseinfo when this level is presented
to the player. Useful for calling out rare levels.
Sounds
- sounds Outer element defining a list of sounds. The name of each child in the list is the tag used in-game (or by a playsound AI behavior)
to choose a sound from this list. Children have the following attributes:
- filename .wav filename on disk. Multiple sounds can refer to the same .wav.
- volume Default 1.0. Adjusts sound volume.
- importance Default 0. Determines this sound's importance relative to other sounds; if all sound sources are used, less important sounds get
killed first.
- looping Default false. Makes the sound loop forever. Be careful calling a looping sound from an AI script, as there's no way to stop the sound
unless the enemy in question is destroyed or otherwise removed from the world.
- singlecopy Default false. Indicates only one copy of this sound can play at a time; newer copies will replace older ones if they're located closer
to the player.
- noattenuation Default false. This sound will not attenuate with distance.
- playwhilepaused Default false. This sound continues to play while the game is paused.
Maps
- map Outer element defining a map. Attributes:
- numrooms is a range indicating the number of "rooms" in the map. Each "room" is a construction
consisting of one corridor and a room at its terminus; additional looping or dead-end corridors may also be present. Special rooms aren't
counted against this limit. This value can be safely set to 0 to make a maze which contains only special rooms.
- hktime The amount of time that will pass before hunter-killers start spawning to hurry the player along. The default is 180 seconds,
and setting this to 0 means HKs will never spawn.
- bounty The bounty that will be paid out for defeating the level. The default is $1000 + 100 times the level number minus 1.
- smallloot A float value. If present, small loot items will be scattered around the edges of rooms; the higher the number, the more
loot. Much above .002 will make the level run too slowly to play!
- saleitem The short name of a shop item. This item will be made available for sale in the shop after the level is completed.
- base Specifies the filename of another map. If present, the body of that map will be pulled in, but the map attributes from this map
will be used when generating it. This is mainly useful for re-using another map and only changing the number of rooms. Even if you specify a base,
you can then list more rooms and corridors; they will be merged into the base for purposes of generating the map.
Children:
- room A room definition. If multiple room types are present, we randomly choose between them. Attributes:
- probability The chance of constructing this type of room relative to others, each time we try to build a new room. The default is 1.0.
- required A number indicating how many examples of this room we are required to create. The default is 0. Required rooms are
created first, and so will generally appear towards the center of the maze; they will also be created in the order in which they appear.
It's often a good idea to set the probability of required rooms to 0.0 so no additional instances of them will be created.
- max Maximum number of rooms of this type that can be created. The default is 0, indicating an unlimited number.
- type The basic type of the room: rectangular, regular (a regular polygon), or irregular (a random polygon).
- width A range indicating the width of rectangular rooms.
- height A range indicating the height of rectangular rooms.
- sides A range indicating the number of sides on regular or irregular rooms.
- radius A range indicating the radius of points on regular or irregular rooms.
- randomrotation For regular or rectangular rooms, if true indicates that the room should be rotated to a random angle. Default false.
Children:
- population Populates the room with enemies. When populating a room, we start at the top of the list and go down, placing
(or at least trying to place) each requested enemy type in turn -- be aware that placement success is never guaranteed! Attributes:
- type Filename of XML describing the requested enemy (see Enemies below).
- num A range indicating the number of enemies of that type to place. The default is 1.
- probability Chance (0-1) that we will try to place this enemy group at all.
- placement Flags indicating where in this room the enemy should be placed. Default is interior. Flags:
- wall Attach the enemy to a wall.
- interior Place the enemy somewhere inside the room.
- sametype Place the enemy next to another enemy of the same type (filename). If no other enemies of
that type exist yet it will be placed as if sametype was not set.
- deadend Default false. If true, this object will only be considered for placement if the room it's in has only one exit.
This is useful for ensuring that dead ends in the maze have items to reward the player.
- clearance There must be this much clear space around the placement point in all directions to place the enemy.
Note that this isn't added on to the physics radius or anything like that. The arbitrary default is 70.
- flag If present, the specified flag will be set to true on the enemy's AI when created.
- corridor A corridor definition. If multiple corridor types are present, we randomly choose between them. Attributes:
- probability The chance of constructing this type of corridor. The default is 1.0.
- required A number indicating how many examples of this corridor we are required to create. Details are similar to
how this parameter works for rooms -- required corridors will be created first, and in the order they appear.
- max Maximum number of corridors of this type that can be created, same as with rooms.
- segments Default 1. A range indicating the number of segments this corridor could have.
- width The width of the corridor.
- length A range indicating the possible length of a corridor segment. Note that the final segment connecting to
a new room will be less than the full length, depending on the shape of the new room. Corridor segments less than 100
units long may have trouble attaching to new rooms.
- clearance Default 10.0. The amount of clearance required to either side of the corridor as it departs a room.
- leave Flags indicating where this corridor can start from. Default is room, corridor. Flags:
- room Corridor can start from a room.
- corridor Corridor can start from another corridor.
- join Flags indicating where this corridor can lead to. Default is room, corridor, new. Flags:
- room Corridor can join an existing room.
- corridor Corridor can join an existing corridor.
- new Corridor can end at a newly created room.
- loop Corridor can rejoin the same room or corridor it departed from.
- center Indicates that this corridor must depart from the center of whatever wall it leaves. Default is false. (Note that
when a new room is created at the end of a corridor, the corridor joining it will always be centered.)
- angle A range indicating the angle at which corridor segments meet each other.
- fixedcurve Indicates that this corridor must always curve in the same direction. Default is false, which means it
can randomly veer left or right as it proceeds.
- deadend The chance that this corridor could dead-end (if it doesn't join existing geometry.) Default is 0.0.
Corridors can have population entries as children in order to populate the corridor with enemies. Keep in mind that the
population for a corridor will be evaluated separately for each segment of a corridor that has multiple segments.
- special Defines custom geometry. The special list is handled after the rest of the map has been
created, and the items in it don't count against the room limit. Attributes:
- probability The one-time chance that this particular special room will be created, default 1.0.
Note that creation of special rooms, assuming they pass this check, is guaranteed.
- center Default false. If true, the exit leading to the special room will always be in the center of
whatever wall it's on.
- placement Describes where map generation will attempt to place this room. Note that a special room will never
be created attached to an already-created one. Legal values are:
- random The room will be placed randomly. This is the default.
- reactor The room will be placed in an appropriate place for the reactor: as far away as possible from the entrance room.
If no entrance rooms have been placed yet, map creation will fail.
- exit The room will be placed in a logical place for the exit: about a third of the maze size away from the
reactor room. If no reactor rooms have been placed, map creation will fail.
- entrance Two points indicating where this room should attempt to join onto existing map geometry. This will
not be needed if there are no other rooms in the world, but it must be present otherwise.
Children:
- geometry Lists some convex geometry. Multiple geometry entries can be present, and will be
created in the order they appear; the first one should represent the connection between this special room and
the rest of the maze geometry, and thus should include the points in the entrance attribute for the room.
The points attribute is a list of points
(as x,y values separated by spaces) that defines a hunk of convex geometry; these points must be clockwise around
the circumference of the polygon. Children:
- population Populates the room with enemies. This is the same as for ordinary rooms.
- item Specifies a special gameplay object that should be placed. The type attribute
indicates which one: reactor, entrance, exit, or text. Note that for
best results you should place the reactor before any other special objects in the room with it; otherwise, they
might overlap with the reactor's substations. Attributes:
- position The object's location in room space.
- rotation The object's rotation in room space.
- text For text objects, a message which will be displayed when the player approaches the object.
- range For text objects, this is how close the player has to get before the message will be
displayed.
- substations For reactor objects, this ranged value is the number of substations around the reactor.
- time For reactor objects, this is the amount of time the player will have to escape once the
reactor has been destroyed. The default is 30 seconds.
- type Indicates whether this section of geometry should be rendered as a corridor (solid background)
or a room (gradient background). The default is room.
- exit Defines an exit that connects this section of the special room with a previously defined section. The
geometry attribute is the two coordinates that define the exit, and the target attribute is the index of
the section to connect with. Note that the exit coordinates must be present in the points for each section.
- navnode Adds an additional navigation node to this section at position. This is helpful for allowing
AIs to explore large spaces the player might hide in.
- graphics Defines map graphics. Attributes:
- wallcolor The wall color.
- roomcolor The color of room and corridor interiors.
- rockcolor The color of the enclosing rock.
- minrockdepth Minimum depth of enclosing rock polygons. Default is 60.
- maxrockdepth Maximum depth of enclosing rock polygons. Default is 150.
Graphics
- geometry Outer element defining geometry to render. The geometry will be represented as a series
of strokes, rendered in the order in which they appear. This element has the following attributes:
- offset Default 0, 0. Will apply an offset to the geometry after it is read in.
- scale Default 1. Will scale the geometry after it is read in.
- center Default true. Will recenter the geometry about the origin after it is read in.
- linecolor Color used for lines if one isn't explicitly specified. The default is white.
- pointcolor Color used for points if one isn't explicitly specified. The default is white.
- fillcolor Color used for fill if one isn't explicitly specified. The default is black.
Several children are the different types of strokes. All strokes have an optional id attribute
to attach a name to the stroke; this identifies the stroke for animation purposes. They also have optional
boundstl and boundsbr arguments, which allow you to manually specify the bounding box for
this stroke. Since animations are performed with respect to the center point of the stroke, this is handy
for off-center scaling or rotation.
- fill A filled shape will be drawn. The points must make up a convex shape for correct results.
- color The shape color. Default is black.
- data Specifies the series of points, as "X1,Y1 X2,Y2 X3,Y3" and so on.
- line A connected series of lines from one point to the next. Attributes:
- color What color to draw the lines. Default is white.
- data Specifies the series of points, as "X1,Y1 X2,Y2 X3,Y3" and so on.
- linelist A list of lines. Attributes:
- color What color to draw the lines. Default is white.
- data Specifies the series of lines, as "X1,Y1-X2,Y2 X3,Y3-X4,Y4" and so on.
- linefill Draw a filled shape and then outline it. Two strokes will actually be created. Attributes:
- color What color to draw the filled shape. Default is black.
- linecolor What color to draw the lines. Default is white.
- data Specifies the series of lines, as "X1,Y1-X2,Y2 X3,Y3-X4,Y4" and so on.
- points Draw a series of points. Attributes:
- color What color to draw the points. Default is white.
- data Specifies a list of points, as "X1,Y1 X2,Y2 X3,Y3" and so on.
Other children:
- anchor This sets up a list of anchor points
on the model which client code can read later. These anchor points will be conveniently pre-adjusted by the
offset, scale, etcetera attributes of the model. Attributes:
- data Specifies the anchor points, as "X1,Y1 X2,Y2 X3,Y3" and so on.
- animations Outer element for listing animations that can play on this model.
- anim Outer element defining an animation. If looping (default false) is true, the animation will loop endlessly once
started. If starton (default false) is true, the animation will start playing when the entity is created. If holdend
(default false) is true, the animation will reach its last frame and then hold on that frame without ever officially ending; this is
useful for "permanent" changes in the model's appearance.
- stroke Defines a stroke from the graphics file which will be animated. name is the id value of the stroke. track
indicates the tracks that are animated: it can be any or all of color, position, rotation, and scale.
interpolate, default true, indicates whether we should blend smoothly between keyframes during playback.
- key Defines a keyframe for animating this stroke. Attributes:
- time The time of the keyframe.
- color Color value.
- position Position value.
- rotation Rotation value, in degrees. Rotation is about the center of the stroke's bounding box.
- scale Scale value (both axes.). Scaling is about the center of the stroke's bounding box.
- xscale X scale value.
- yscale Y scale value.
Enemies
- enemy Outer element defining an enemy.
- ai The enemy's AI. Maintains an array of flags and the current pathing information.
- machine An AI machine. AIs can have as many machines running at the same time as you want. Each machine maintains its own
currently set target entity. The active attribute, default true, specifies whether or not this machine is active on startup.
- behaviors The list of behaviors this AI machine can switch between. All behaviors have a name attribute. This is how
conditions specify their target behavior. A behavior doesn't have to have a name (for example, behaviors that are children of an "and"
behavior.) Available behaviors are:
- navigate The AI will use the navigation graph to fly around the maze. The type attribute defines how it will move:
- target The AI will fly towards whatever this machine's currently set Target is using the optimal navigation path.
If the target is visible, it will directly home in on it. randomoffset, a ranged float value, can be set; if present,
it will add a random offset within that range from the target it's homing in on. If that isn't set, then targetoffset,
a vector, can be used to add a fixed offset. These offsets are relative to the target's facing direction.
- home The AI will fly back to the location it was first spawned at. When it reaches that location, it will stop moving.
- retreat The AI will move to the center of the farthest possible room from its currently set Target. If the Target moves
such that the a farthest room is more than twice as far away as the current one, it will switch to the new farthest room.
- random The AI will randomly wander around the map, picking a new node whenever it reaches an old one. Attributes:
- doubleback If set, the AI will be permitted to return to the node it just left. The default is false.
- deadend If set, the AI will be permitted to wander into a dead end (defined as any series of nodes that leads
to a single final room with no branches along the way.) The default is false.
In addition to these options, the AI will prefer to choose nodes that take it out of the room it is currently in, and it will
prefer to avoid returning to the last eight or so nodes that it has visited. As well, if it loses line of sight on the current
destination it will choose a new one.
- patrol The AI will cycle through the navigation nodes in its starting room, in order. If the AI leaves the room for
whatever reason it will return to it and resume patrolling when the patrol behavior runs once more. The randomoffset
value can be used to add a random offset to the nav node position.
- movestraight The AI will move in the direction it is facing.
- movetotarget The AI will move directly towards its target. If parentdestination (default false) is true, it will move
towards its parent's set destination instead of its own. This is useful for child enemies that are sometimes supposed to rotate towards their
parent's destination.
- circletarget The AI will attempt to reach points at a certain distance from its target. Attributes:
- distance A ranged value for the desired distance from the target.
- anglechange A ranged value specified in degrees. When a new point is chosen, this is the permitted angle delta from
the previous point.
- maintaindirection Default 0.5. This is the chance that, when a new point is chosen, the AI will continue to move in
the same direction it was moving in before.
- timeintarget Default 2.0. This is the maximum time the AI will spend trying to reach its next point before choosing
another destination. Note that if an AI has to choose another destination due to this timeout, it will ignore the anglechange
and maintaindirection restrictions.
- randomwalk The AI will select a destination at random and fly towards it, ignoring anything that might be in the way.
Attributes:
- distance A ranged value for the distance to the new destination.
- radius The direction to the next destination will be within this radius, in degrees, of the direction
the AI is facing. The default is 90 degrees.
- constantrotation The AI will constantly rotate at a certain rate. This rate will be limited by the AI's turnrate,
set in its physics. Attributes:
- rate The starting rotation rate, in degrees per second.
- reverseoncollision Default false. If true, the AI will rotate in the other direction at its current rate whenever it
collides with anything.
- randomcollisiondelta Default 0.0. The rotation rate will be changed by a random value of up to this magnitude whenever
the AI collides with anything.
- bouncelimits Default false. If true, the AI will rotate in the other direction when it reaches the minimum or maximum
rotation limit set in its physics.
- applyimpulse When this behavior starts, will apply a physics impulse to the AI of magnitude. The type attribute
indicates what kind of impulse: random is in a random direction, and awayfromcollision is away from the first object
the AI collided with this frame.
- setmovement Modifies the AI's movement characteristics. This change is permanent and won't pop back once
the behavior ends. Attributes:
- maxspeed Change the maximum speed.
- acceleration Change the acceleration.
- turnrate Change the turn rate.
- damping Change the damping.
- attack The AI will fire one of its weapons. The weapon attribute is the index of the weapon to fire. The default
is to use Weapon 0.
- die The AI will be destroyed. It will go through its normal destruction code path.
- collisiondamage hp points of damage will be applied to everything of entity type or types the AI is colliding
with this frame. The default is to apply damage to all entity types.
- collect The AI will pick up every object of entity type or types that it collided with this frame.
- steal The AI will steal an inventory item from the player. Note this can be successfully executed at any time, no matter where
the AI and the player are located.
- spawn The AI will spawn a new enemy. Attributes:
- entity XML file of the enemy to spawn.
- disablecollisions Default 0. If non-zero, the newly spawned enemy will have its collisions disabled with the spawner
and all parent enemies up to the top of the hierarchy for that number of seconds. Not any sibling enemies in the hierarchy, though.
- anchor Index of the anchor point to spawn the enemy from. If not specified, the enemy will be spawned at the position of
the spawner.
- child Default false. If true, the enemy will be added as a child of the spawner instead of being released into the world.
In this case, "impulse" and "disablecollisions" will be ignored.
- top Default false. If true, the enemy will be added as a child of the top of the hierarchy instead of a child of the spawner.
This will be ignored unless "child" is set to true.
- angle Default 0. Ranged value specifying the angle at which the enemy will be rotated when first spawned. This is added
to the spawner's current rotation.
- impulse Default 0. Ranged value specifying the magnitude of the impulse, in its facing direction, which will be applied
when the enemy is spawned.
- broadcast The enemy's current target will be broadcast to all other enemies within a distance of radius (if that
attribute is not present, it will be broadcast to all enemies on the map.) If these enemies have the receive condition, they
can then use that target themselves. detecttime (default 2.0 seconds) is how long it takes to successfully lock on to the
target before broadcasting happens. anchor (default 0) is the anchor on the enemy the detection beam should be broadcast from.
- playanimation Animation number index will start playing from the beginning, if it isn't already.
- resetanimation Animation number index will stop playing if it is currently playing. Visually, the graphics will
pop back to whatever their state would be without this particular animation running.
- playsound Plays sound with the tag sound (see "Sounds" for more) at the AI's current location.
- idle The AI will take no action.
- and This behavior can have any number of children. All children will be executed in order when this behavior is called upon.
- execute Has a target attribute naming another behavior which will be executed when this behavior is called upon. Note
that, in the context of an and list, after the other behavior is executed the AI will return and continue on with the other
behaviors in the list.
- setflag Sets flags on the AI, which get read by the "checkflag" condition. All machines share the same flags. Attributes:
- flag The flag to set on the AI brain (flags are numbered 0-7).
- value Default to true, indicating what it should be set to.
- parent Allows setting flags on a parent, grandparent, etc. instead of this particular AI. Works the same as the "parent"
attribute on the checkflag condition.
- global Default false. If set, we'll set the flag in the global flag array that all AIs have access to, instead of setting
it on the AI specifically. This array is reset every new level.
- settimer Sets a timer to expire after length (a ranged value) seconds. The "timerexpired" condition will check this. Each machine has
its own timer.
- setactive Sets machine number index to be active or not based on the value of active. Any activity changes take place immediately,
including terminating execution on the current machine (so any "and" children after a deactivation will never get executed.) The machine will be reset into
its initial state the next time it is activated.
- conditions The list of conditions. Conditions are tested in order and the first one which is true will cause the behavior
named in the target attribute to be immediately executed; condition evaluation will then stop. Available conditions are:
- start True if this machine was just activated. This is always the case on the first frame when an enemy is placed in the world (assuming the machine
in question starts out active, of course.)
- circulardetection True if an item of the entity type or types is detected within range units. The detected item will be set
as the machine's current target.
- fandetection True if an item of the entity type or types is within a fan extending from the AI's front, range units
long and with a far end width units across.
Note that detection
isn't limited to entities that belong to opposing factions -- anything can be detected.
All detection conditions have the following optional attributes:
- los Default true. If true, a detected item must also be in a direct line of sight -- there can't be any walls in the way.
- enemytype The filename of a specific enemy that's being searched for, such as "ai_buzzbomb.xml". If this value is set, the
entity can only be Enemy.
- enemyflag Indicates a flag which must be set on the enemy.
- flagvalue The desired value of enemyflag. The default is true.
- autotarget Default false. If true, detection will be limited to autotargetable entities: any enemy that doesn't have its
autotarget attribute under "misc" set to false, and enemy guided missiles.
- countenemies True if the number of type enemies (such as "ai_buzzbomb.xml") in the world is less than count, default
1. If the optional attribute greaterthan is set to true, we check if the number of enemies is greater than count instead. If
the optional attribute maxcount is set to true, the number we check against is the number of enemies originally present when the map
was started.
- countchildren True if the number of child entities on the enemy is less than count, default 1. If the optional attribute
greaterthan is set to true, we check if the number of children is greater than count instead.
- receive True if targeting information is currently being broadcast from another enemy using the broadcast behavior.
If this condition is executed, the AI will be given the other enemy's target. los (default false) indicates whether the AI must
still have line of sight to the target. range, if set, indicates that the target must still be within a certain minimum distance
from the enemy.
- arrival True if the AI is within distance units of its navigation target. (Note that if you are using the home
navigation type, once the AI has reached its home and stopped moving arrival will not be true as it is no longer trying to navigate. If
something should happen when the AI returns home, it should be triggered by arrival.)
- collide True if, last frame, the AI collided with an item of the specified entity type or types. The default will be true
for all collisions. Of course, the collision filtering on the AI's physics will get first crack at this.
- damaged True if the AI has taken more than amount (default 1) points of damage. Note that this condition will always be true
once the AI has taken that amount of damage.
- findplayer True if the player's ship has not been destroyed. The player's ship will be set as the target. If los (default false)
is true, the enemy must also have line of sight to the player for this to be true.
- canfire True if weapon number weapon (default 0) can fire right now. A weapon might not be able to fire if its time between shots
has not expired yet.
- animationfinished True if, last frame, animation number index finished playing.
- checkflag True if the AI's flag number flag is currently set to value (default true). Flags are shared across all machines.
If parent (default 0, indicating don't use it) is set, we'll check that many items up the parent chain instead of checking on the AI itself.
So a "parent" of 1 indicates check the immediate parent, and 2 indicates check the grandparent. If global (default false) is set, an array
of global flags that all AIs access will be checked instead. This array is reset every new level.
- inbehavior True if this machine was in the behavior behavior last time the AI ran. The optional time attribute
means that the machine must have been in the specified behavior for at least a particular length of time. Note that you can't count on "inbehavior"
timers and animation lengths playing out precisely in sync.
- timerexpired True if the timer set by the settimer behavior has expired. Each machine has its own timer.
- random True if a random number between 0 and 1 is less than chance.
- checkplayerinventory True if the player's inventory contains more than numitems (default 0) items. If greaterthan, default
true, is false, we'll check if the inventory has less than that number of items.
- and, or, not Boolean operators. You can then list more conditions as the condition's child.
- true This condition is always true. One of these should always be present as the last item on the list.
- graphics Defines the AI's graphics and sets some related options. If this is absent, the AI will be invisible. Attributes:
- file Names an XML file for this AI's geometry. Again, if absent the AI will be invisible.
- drawchildrenfirst Default false. If true, child entities will be drawn before (underneath) the parent's graphics, instead of afterwards (on top).
- usemapcolor Default false. If true, this entity's graphics will have the same line and fill colors as the map itself.
- physics Defines the AI's physics and movement characteristics. Attributes:
- maxspeed Maximum speed. If present, the AI's speed will be hard clamped to this value no matter how heavy of an impulse it
receives. This can have odd physical effects so generally it's better to manage the AI's motion speed by balancing acceleration and damping.
- acceleration Acceleration rate. The default is 0, which means the AI cannot move. Use this value for turrets.
- damping Determines how quickly the AI will slow to a halt; the higher the value, the quicker it will stop. If set to 0, the default,
there will be no damping.
- turnrate The AI can turn this many degrees per second. The default is 0, which means the AI cannot turn.
- minangle, maxangle In degrees, define the maximum distance the AI is permitted to rotate. The default is no limits. This is useful for turrets.
These values should be specified as relative to 0 degrees representing directly forward, and can't exceed a half-circle's distance in either direction
from zero.
- scale The AI will be scaled to this size when spawned. Default is 1.
- mass The mass of the AI. Default is 10.0, which happens to be the same mass as the player's ship. Set this to 0 to give the
AI infinite mass (it will be fixed in place unless it decides to move, and nothing will be able to obstruct it.)
- radius Collision radius for this AI. The default is 0, which will also make the AI ethereal.
- collision Collisions with the specified entity types will be detected. The default is enemy, world, shots, and playership.
- kinematics After a collision, kinematics will only be performed if the other entity is in this list. The default is to always
do kinematics. Note that kinematics is what causes an object to actually bounce off things -- so if you don't do kinematics, a collision
will be detected but the AI will pass straight through whatever it hit.
- collidesamefaction True if collisions are detected between this AI and other objects of the same faction. The default is false.
- misc Miscellaneous stuff. Attributes:
- faction Indicates what faction the AI belongs to: "enemy", "player", "neutral". The AI's weapon fire will pass right through
anything of the same faction and it won't collide with same-faction entities unless specifically requested to above. Note that the world
map belongs to a fourth "null" faction which you cannot specify. The default value is "enemy".
- hp How many hit points this AI has. When HP is reduced to 0, the AI will be destroyed. If HP starts out as 0, the AI will not
take damage for any reason and so cannot be destroyed by the player's weapons (weakspots can still destroy it.) The default is 0.
- autotarget Default true. If set to false, this enemy will not be deliberately shot at by autotargeting weapons such as the
ally drone and the spark powerup.
- damageparticles Default false. If set to true, this enemy will start throwing off sparks when damaged. The geometry
of the enemy, or of its first child if the parent has no geometry, will be used to place the sparks.
- code Optional. Used to match enemies with an internal encyclopedia code for record-keeping purposes. If the player is killed by
an enemy with no encyclopedia code, it will just be identified as "unknown enemy" in the high score table.
- destroyed Defines what happens when an AI is destroyed, for any reason. Attributes:
- style Indicates the style of destruction effect played when the enemy blows up. Available styles are smallexplosion
(the default) and largeexplosion.
Children of the "destroyed" element mostly define what loot gets dropped when this enemy is destroyed. If not present, no loot is dropped. Attributes:
- chance Indicates the chance of dropping this item (0-1, default 1).
- count Indicates the number of items dropped (default 1).
- flag, value If present, the specified flag on the AI must be set to to the specified value for there to be any chance
of this loot dropping.
- stop If true, then if this loot is dropped (it passes the flag and probability tests) we will not try to drop any loot after it in the list.
- ejectstyle Can be one of three values: normal (the default) ejects the loot slowly in a random direction, fast ejects
the loot rapidly in a random direction, and fromcenter ejects the loot even more rapidly and on a vector directly away from the center
of the top-level entity.
Child names:
- behavior Not a loot type, but an AI behavior which will be triggered upon destruction. If not present, no behavior is triggered.
Note that you can't count on any particular data being present in the AI context at this point, such as a valid target or pathing information.
If flag and value (default true for the latter) are present, the behavior will only run if the flag in question is set to the desired value.
Any number of behaviors can be present, all of which will be tested/run when the entity is destroyed.
- small Drops a small piece of loot which, when collected, awards the player cash.
- rareelement Drops a rare element.
- powerup Drops a powerup.
- weapon Drops a weapon.
- random Drops a randomly selected rare element, powerup, or junk, with about a 1/3 chance of each of those major categories.
- specific Drops a specific powerup or rare element as specified by the shortname attribute. The name must match the
powerup's short name in the encyclopedia, including case sensitivity. A list of items, separated by commas, can be supplied; in this case,
a random item will be chosen from the list.
- inventory Drops any objects that were picked up by this enemy, presumably by the "collect" or "steal" behaviors.
- ultrarare Drops an ultra-rare prize: a unique rare element, fifty small loot, an installable item, or four of a random weapon.
- hunterkiller Spawns a hunter/killer which immediately attacks the player.
- children Lists other enemies that will be children of this enemy. This allows foes with independently rotating turrets, or other
even more creative effects. Child enemies can be destroyed separately from the parent, although destroying a parent will destroy all children.
Each child in the list can have these attributes:
- name Names an XML file defining the child enemy.
- anchor An anchor in this enemy's graphics that is used to position the child.
- x The X position of the child, if no anchor is present.
- y The Y position of the child.
- rotation The rotation of the child.
- xscale The X scale of the child.
- yscale The Y scale of the child.
- ignoreparentrotation Default false. If this is true, the child will not rotate along with the parent.
- wantsparentcollisions Default false. If this is true, the child will receive the same collision notifications as the parent.
- weakspot Default false. If true, this child will be counted as a "weak spot." When all children tagged as weak spots are
destroyed, the parent will automatically be destroyed.
- weapons Outer element for a list of weapons this AI is armed with. Each weapon in the list can have any number of muzzle entries as children, all of which will launch
a bullet when the weapon fires. Each muzzle has either an anchor, identifying an anchor from the graphics file to launch the bullet from,
or a position, explicitly indicating the location from which it fires (in this enemy's local space, default 0, 0) and angle, indicating
the angle away from vertical at which it fires (default 0). If no explicit muzzle entries are present, a single default muzzle will be created at
position 0, 0 and angle 0. Each weapon also has these attributes:
- type Type of bullet fired from this weapon. This can be bullet, an ordinary enemy bullet that does 1 point of damage; missile, a
guided missile that does 1.5 points of damage; or player, a player bullet that does 1 point of damage to enemy forces only.
- speed Speed of the bullet.
- firetime Minimum interval in seconds between firing. Default is 1. This includes the time spent firing bursts as described below.
- lifespan How long the bullet lives before disappearing.
- burstcount How many bullets are launched each time the weapon is fired. The default is 1 (just fire a single bullet.)
- bursttime When firing a burst, this is the time delay in seconds between bullets in the burst. The default is 0.25.
- attractmode Information about how this AI is displayed during the attract mode. spin, default true, indicates whether or not this
object will rotate when displayed.