The Complete Geek's Guide

to

Creating Plugins

for

Event Horizon

NOTE: This is not updated very frequently.

Plugins for Event Horizon consist of ".bundle" files, packages that contain both executable code and data resources. The default executable code for a plugin goes through its internal file hierarchy and loads every ".evh" file into Event Horizon's plugin memory. The files may be organized in any fashion desired; in the Default plugin they are organized according to what type of resource they describe. However, an alternative format such as grouping a system together with it's planets, or organizing by government, would work just as well (with regard to the code, anyway).

IDs

Every data resource in Event Horizon has a unique ID of the form namespace.types.ID. Each plugin can and should have its own "namespace." For example, resource IDs from the Default plugin look something like: default.planets.Earth. To change your plugin's name, modify the CFBundleExecutable field in the Info.plist file to whatever name you would like, and then change the executable in the MacOS folder to the same name. Namespaces are automatically used as lowercase in code, regardless of executable capitalization. The last part of the ID, however, is case-sensitive. Trying to use default.planets.earth will result in a failure.

Flags

There are two kinds of flag fields in Event Horizon resources, flag requirement fields, and flag definition fields. Flag requirements are Strings in RPN Boolean format. For example, "human tech1 tech2 OR AND unwanted NOT" would require objects to have the flag "human" and also have either the flag "tech1" or the flag "tech2" but not the flag "unwanted". Flag definition fields, on the other hand, are Arrays of Strings, each string containing one flag which applies to that object. Flags are case-sensitive.

Resource Descriptions

Event Horizon resources are stored in ".evh" files, which are XML files compatible with Apple's PLIST DTD. Each type of resource has its own specific format to follow in describing its various attributes. Every resource type has some required fields, and some also have optional fields. Each resource type format will be described below, organized alphabetically by field name.

Systems

Systems in Event Horizon represent areas of normal space, separated from other systems by such a distance that a hyperspace jump is required to get from one to another. Systems may contain planets, asteroids, and spaceships.

Asteroids Number (integer) OPTIONAL
This represents the number of asteroids present in this system.

Backdrops Array OPTIONAL
Backdrops are pictures that can be added to the backgrounds of specific systems. Up to 4 backdrops are allowed in each system. Each entry in this array is a dictionary with 3 children:
  • Angle Number (integer): the angle this should be displayed at. Light comes from 180°, so this is where a sun graphic should be placed.
  • Height Number (integer): the number of pixels above the center of the screen this should be displayed.
  • Path String: path relative to the Resources folder of the graphic to be displayed.
Currently all backdrops must be squares 2^N pixels on a side.

Coords Array
This represents the location of the system when displayed on the map. The array has two entries, each a floating point or integer number. The first entry represents the x-value of system's location, the second represents the y-value. (Technically it's the z-value, but that only concerns code developers.)

Flags Array OPTIONAL
Array of Strings, each containing a flag for this system. Currently unused.

Government String
This string contains the ID of the government resource representing this system.

ID String
The last part of the complete ID (i.e., not the namespace or the type.), unique to this type in the plugin.

Links Array
Each entry in this array is a string containing the full ID of every system to which this system has a hyperlink. Actually, whenever one system links to another system, a link is automatically generated from the second system back to the first, so only one side of each link really needs to be represented in the system resource, but it is simpler to keep track of your links if you list them on each side.

Name String
This is the name of the system as displayed to the player while in the game. It doesn't have to be the same as the ID.

Planets Array OPTIONAL
This is an array containing every planet that should be in this system. Each entry is a string containing the full ID of the desired planet.

ShipCount Number (integer)
The average number of ships in this system at any given time. When the number of ships in a system drops below this value, Event Horizon will begin to add more.

ShipTypes Array
This is used to define what kinds of ships will show up in a system. Each entry is a Dictionary with two fields: Probability Number and TypeID String. The TypeID string contains the full ID of a Type resource defining classes of ships. The Probability is a fraction defining how likely each ship is to belong to the associated TypeID. The sum of the Probability's should be 1.

Start Boolean OPTIONAL
This should be set to true if this is the system where players should begin in a new game.

Type String
This must be set to "System".

Planets

Planets are spherical bodies inside a system that the player may land on or bounce off of. Planets may have missions, trading, spaceships, or spaceship mods available for the player to purchase. Planets may either remain in the same location, orbit the center of their system, or orbit another planet.

Coords Array
This sets the initial position of this planet the first time the player jumps into its system. Each entry is a float representing one coordinate, the first one is the x-coordinate, the second one is the y-coordinate. (As with systems, it's actualy the z-coordinate, but again, that only matters to code developers).

Description String
This is the description that is displayed when the player lands on this planet.

Flags Array OPTIONAL
Each entry is a String containing a flag for this planet. This field is currently unused.

Goods Array OPTIONAL
This array contains all the items which may be traded at this planet. Each entry is a Dictionary with two elements: Name String, and Price Number (integer).

ID String
The ID of this planet.

Inclination Number OPTIONAL
This defines how much the orbit of this planet is tilted from the ecliptic, in degrees.

Mass Number (integer)
This defines how heavy this planet is. The mass of the planet is used in determining orbital speeds of other planets that orbit this one, and of the player when in orbit mode.

MissionFlags String OPTIONAL
This field is used to determine what missions to show for employment on this planet. Note that once missions that fulfill the planets flag requirements are selected, each mission gets the chance to determine if this planet fulfills its flag requirements.

Model String OPTIONAL
If this Planet is actually a space station, then this field must be present, and set to the path for the OBJ model file to use. NOTE: this field will be ignored if the PicturePath field is present.

ModFlags String OPTIONAL
This is a flag requirement field used to determine what mods will be displayed. This automatically includes Weapon resources as well as Mod resources.

Name String
This is the name of the planet as displayed while playing the game.

Orbit String | Number (integer)
This defines how the planet moves. If you want the planet to orbit another planet, set this field to be a String with its value being the full ID of the planet you want it to orbit around. If you want this planet to orbit around the point <0, 0>, set the field to be a Number with the value representing the theoretical mass at the origin. If you don't want the planet to move, set the field to be a String with the value "nil".

PicturePath String OPTIONAL
This is the path to the image of the planet, relative to the "Resources" folder in your plugin. The image should be a square, the sides being of length 2^N, where N is any integer (e.g., 256x256). However, if this Planet is a space station, this field must not be present, the Model field must be used, instead.

ShipFlags String OPTIONAL
Determines what ships can be bought at this planet.

Size Number
This sets the radius of this planet

Speed Number OPTIONAL
Sets the speed at which this planet rotates around its vertical axis. This number may be negative to spin in the opposite direction.

Tilt Number OPTIONAL
This defines how much the axis of rotation of this planet is tilted from the vertical, in degrees.

Type String
This must be set to "Planet".

Governments

Governments are associations of systems, planets, and ships that are somehow related. Systems of different governments show up different colors on the player's map.

Color Data
This value representing the color of this government, as shown on the map for system colors. It is a 3-byte value representing an RGB color. I.E., the first byte (the first two characters) represents red, with 00 as a minimum, and ff as a maximum. The second byte is green, and the third byte is blue. For example, <ff0000> represents red.

Enemies Array OPTIONAL
Each entry in this array is the ID of an enemy government. This government is automatically added as an enemy of any government included here.

ID String
The plugin-unique government ID for this resource.

InitialRecord Number (integer) OPTIONAL
This sets the initial value of the player's status with this government. If not present, it is assumed to be 0. Higher numbers mean the government starts off more tolerant.

Name String
The name to be displayed during gameplay

Type String
This must be set to "Government".

Spaceships

Spaceships are drawn using 3D models, but for all collisions they are taken to be spheres. Disabled spaceships may be boarded and ransacked for money, fuel, cargo, and ammo.

AngularAcceleration Number
This value represents how quickly a spaceship can change its spin, in °/sec.

Armor Number (integer)
This is how much armor the ship has. After a ship's shields are destroyed, its armor will begin to be destroyed.

Cargo Dictionary OPTIONAL
If this ship already has cargo on it by default (doesn't apply to player), this array should be present. Each entry has the name of cargo as it's key, and a Number (integer) representing the amount of cargo as the value.

CargoSpace Number (integer)
This is how much space in tons the ship has for carrying cargo, such as trade items or missions.

Data String
This tells Event Horizon where the 3D model data for this spaceship is located, relative to the "Resources" folder. This may be in either WaveFront OBJ format with a .obj or .OBJ extension or Event Horizon's .evh format.

DefaultAI String
This tells Event Horizon how the spaceship should behave. There are three available AI's currently:
  • WimpAI - Runs away and jumps to another system or lands on a nearby planet when attacked, does not use weapons at all.
  • MerchantAI - Fights back when its attacker is close, but jumps out or lands when it is farther away.
  • AggressorAI - Attacks any ship of a different government, jumps out if none are present.

Description String
This is the text that is shown when the player is selecting ships for possible purchase.

Flags Array OPTIONAL
This is a flag definition list. Each entry should be a String containing one flag for this ship. These flags are used to determine what planets this ship can be bought at.

Fuel Number (integer)
This sets the fuel capacity of this spaceship, i.e., the number of hyperjumps it can make before it needs to refuel.

Hardpoints Dictionary OPTIONAL
The entries in this Dictionary tell Event Horizon where weapons should be fired from on the ship. Each entry must have the weapon type it applies to as the key (one of PrimaryStraight, PrimaryTurret, SecondaryStraight, SecondaryTurret) and the value is an Array containing the locations of the points to be fired from. Each entry in this Array is another Array, where the first item is a Number representing the x-coordinate, and the second item is a Number representing the y-coordinate (actually the z-coordinate). When a ship fires a weapon, if hardpoints are defined shots will originate from those locations, one from each applicable hardpoint in turn. See default.ships.AssaultShuttle for an example.

ID String
The unique spaceship ID.

Mass Number (integer)
This is the empty mass of this spaceship in tons. This affects acceleration.

MaxAngularVelocity Number
This represents the maximum rate at which a spaceship may turn, in °/sec.

MaxSpeed Number
The fastest this spaceship may go.

Mods Dictionary OPTIONAL
If a spaceship comes with any mods or weapons already, this is where they belong. Each entry has for its key the full ID of the mod or weapon and a Number (integer) for its value, the number of this item that comes with the ship.

ModSpace Number (integer)
This tell Event Horizon how much space to give each ship for mods and weapons, in addition to the space taken up by items in Mods.

Name String
This is what is displayed for the ship name in the game.

PicturePath String
This is the path to the texture for the 3D model, relative to the "Resources" folder.

Price Number (integer)
This is how much you will pay to buy this ship.

Shields Number (integer)
The amount of shields this spaceship comes with.

Size Number
The radius of this ship. Although spacehips in general are not spherical, they are treated that way in Event Horizon for collision detection.

Thrust Number
This represents how much thrust the engines of this spaceship produce. The acceleration of the spaceship is calculated by dividing the thrust by the mass, including any cargo or mods.

Type String
This must be set to "Spaceship".
Types

Types are used to populate systems with specific spaceships. Each Type defines a list of spaceships, each with an associated government and probability. When a system needs to create a new ship, it selects one according to the probabilities in its Type. Systems can make use of multiple Types, each having its own overarching probability.

AI String OPTIONAL
If present, this value overrides the default AI of this spaceship.

Data Array
Each entry in the array is a Dictionary containing 3 elements: an object of type String for key GovernmentID whose value is equal to the full ID of the government this spaceship should belong to, a Number for key Probability which indicates the fractional value of how likely any new spaceship is to be this one, and a String for key ShipID whose value is the full ID of this kind of spaceship. The sum total of all the probabilities in the array must be equal to 1.

ID String
The unique ID of this Type.

Type String
This must be set to "Type".
Weapons

Weapons are anything that may be fired at another ships. Generally with intent to do harm. Weapons have both 3D models and 2D graphics associated with them. A Weapon can either be a primary weapon, which doesn't require ammo, or it can be ammo for a secondary weapon, which requires a Mod launcher to fire it.

Acceleration Number OPTIONAL
If this field is defined, then the weapon will accelerate to MaxSpeed. Otherwise, it will simply be launched at MaxSpeed.

AngularAcceleration Number OPTIONAL
This value represents how quickly a weapon can change its spin, in °/sec. Event Horizon assumes weapons with this field set to a non-zero value are guided weapons.

Data String
This String contains the path relative to the "Resources" folder of the 3D model data for this weapon. This may be in either WaveFront OBJ format with a .obj or .OBJ extension or Event Horizon's .evh format.

Description String
The description is what is shown when a player clicks on this item in the "Ship Mods" section of a planet.

DisableLighting Boolean OPTIONAL
If this is set to "Yes," then this weapon will be fully illuminated, without shadows. This is useful for weapons that glow, such as lasers.

Flags Array
This a flag definition field. These flags are used by planets to determine whether this weapon should be sold there.

Force Number (integer)
This represents the amount by which the shields or armor of the ship this hits will be decreased.

ID String
The unique ID of this weapon.

Inaccuracy Number OPTIONAL
This is the maximum angle in ° that this weapon will deviate from where it should go when it is fired.

LaunchStyle String
This is one of the fields that defines what type of weapon this is. Allowable values are: STRAIGHT, which fires straight ahead; TURRET, which fires at the target ship; and SPACESHIP, which means it launches an escort ship.

Launcher String OPTIONAL
This is used for secondary weapons only, the full ID of the mod required to launch this type of weapon.

Life Number
How long a shot from this weapon should last, in seconds. Note that this is not required for weapons whose Launch Style is SPACESHIP.

Mass Number (integer)
For weapons that don't require individual ammo, i.e., primary weapons, this value represents the mass of weapon on board the ship. For weapons which consist of ammo needing a launcher, this value represents the mass of each individual ammo charge.

Max Number (integer)
The maximum number of this weapon that may be on a ship. For unlimited, set this to -1.

MaxAngularVelocity Number OPTIONAL
The max rotational rate for a guided weapon in °/s.

MaxSpeed Number
The maximum speed this weapon may go, equivalent to the MaxSpeed field in a Spaceship.

ModPicture String
This is the path relative to the "Resources" folder of the picture to be displayed in the "Ship Mods" section of a planet. The graphic should be 64x64 pixels.

Name String
The name of the weapon as displayed to the player.

PicturePath String
This is the path to the texture for the 3D model data, different from the ModPicture field. This is not used for SPACESHIP type weapons.

Price Number (integer)
This is how much the player must pay to purchase each of this weapon.

Primary Boolean
If this is set to yes, then this weapon will fire when the player presses the FIRE PRIMARY key. If this is set to no, then it will fire when its launcher is selected and the player presses the FIRE SECONDARY key. Each time a secondary weapon is fired, the amount of ammo remaining decreases by one. The amount of ammo for a primary weapon is infinite, so having multiple primary weapons simply increases the rate of fire.

Proximity Number OPTIONAL
A weapon can be set to detonate before hitting a ship using this value, the distance at which it should detonate.

ProximityMass Number (integer) OPTIONAL
If this value is present, this weapon will not explode until until a ship with mass greater than or equal to this value comes within range.

Reload Number
This is the amount of time in seconds required between shots. Adding additional primary weapons or launchers for secondary weapons decreases this time.

Size Number
This is the radius of the weapon when fired. Not used for SPACESHIP weapons.

Sound String OPTIONAL
This is the path relative to the "Resources" folder of the sound to be played when this weapon is fired.

Spaceship String OPTIONAL
This is the full ID of the Spaceship which should be launched if this is a SPACESHIP type weapon.

Type String
This must be set to "Weapon".

Mods

Mods are additions to spaceships. Currently the only supported type of mod is a secondary weapon launcher.

Ammo String OPTIONAL
This is the full ID of the weapon type for which this mod serves as a launcher. This is only used if ModType is LAUNCHER.

Description String
This is the text seen when the player clicks on this mod in the "Ship Mods" section of a planet.

Flags Array
This is a flag definition field. Each entry is one String containing a flag that applies to this mod.

ID String
This is the unique ID of this mod.

Mass Number (integer)
The mass of this mod in tons.

Max Number (integer)
The maximum number of this mod which may be on a ship, or -1 if there is no limit.

ModPicture String
The path relative to the "Resources" folder of the 64x64 picture for display in the "Ship Mods" section of a planet.

ModType String
This tells Event Horizon what type of mod this is.
  • LAUNCHER: This is a secondary weapon launcher.
  • COMPENSATOR: This is an inertial compensator, reducing the effective mass of the spaceship.
  • FUELTANK: This is a tank for additional hyperspace fuel storage.

Name String
The name of the mod as displayed to the user.

Price Number (integer)
How much the player must pay to buy each of this item.

Type String
This must be set to "Mod".

Value Number (float) OPTIONAL
The meaning of this field varies depending upon the ModType.
  • LAUNCHER: N/A
  • COMPENSATOR: The fraction of inertia remaining. I.E., 0.0 means full compensation, 1.0 means no compensation.
  • FUELTANK: Number of additional units of fuel to allow ship to store.
Missions

Missions involve the player accepting a task, and then attempting to complete it for possible payment. When a player clicks "Employment" on a planet, Event Horizon first selects every mission that meets the planets requirements, and then removes those missions which have additional requirements that the player has not met. Missions can set and clear player flags upon acceptance and completion.

Available String
This is used in conjunction with the AvailableType field to determine where this mission may be made available to the player. Its value may either be "any", or the full ID of the type of resource given in AvailableType.

AvailableType String
This must be one of "government", "planet", or "system". For "government", any planet in a system belonging to the government defined in Available may offer this mission. For "system", any planet in the system given in Available may offer this mission. For "planet", only the planet with the ID given in Available may offer this mission. If you wish your mission to be available anywhere, this may be set to any of these three values, with the Available field set to "any".

AvailFlags String OPTIONAL
This is a flag requirement field. This mission will not be made available if the player's flags do not meet these requirements.

ClearFlags String OPTIONAL
This string consists of flags separated by spaces that should be cleared when the player completes this mission.

Description String
This is the text displayed to the player when selecting this mission for possible acceptance. Event Horizon will replace every instance of <PLANET>, <SYSTEM>, <DATE> respectively with the name of the destination planet, the name of the destination system, and the date on which this mission expires.

Destination String
This is the same as Available accept it applies to the destination.

DestType String
Same as AvailableType, but applies to destination.

EndText String
This is the text shown to the user upon completion of the mission.

EndTime Number (integer) OPTIONAL
The number of days allowed to elapse before the player must complete this mission.

Flags Array
This is a flag definition field. These flags are used by planets to determine if this mission should be offered there.

Frequency Number
The fraction of the time that this mission should be made available.

ID String
The unique ID of this mission.

Payment Number (integer)
The amount of money to be paid to the player upon completion of this mission.

SetFlags String OPTIONAL
Player flags to set when the player completes this mission. Flags should be separated by a single space.

Size Number (integer)
The amount of mass in tons that will be placed on the player's ship upon accepting this mission.

StartFlags String OPTIONAL
Flags to set upon the player's accepting this mission. This string consists of one or more flags separated by spaces.

StartClearFlags String OPTIONAL
Flags to clear upon the player's accpeting this mission.

Title String
This is the text shown as the name of the mission on a planet and in the inventory view. Event Horizon will replace every instance of <PLANET>, <SYSTEM>, <DATE> respectively with the name of the destination planet, the name of the destination system, and the date on which this mission expires.

Type String
This must be set to "Mission".