Difference between revisions of "OXP howto"

From Elite Wiki
(Models)
(Tools: Added Long Range Scanner as a useful tool)
Line 156: Line 156:
 
*[[List of Planets used in OXPs]] for planets already used by other OXPs. Helps authors avoid overlapping with or breaking other OXPs.
 
*[[List of Planets used in OXPs]] for planets already used by other OXPs. Helps authors avoid overlapping with or breaking other OXPs.
 
*[[OXP_howto_Game_Balance|OXP howto Game Balance]] to avoid conflicts from accidental gameplay changes.
 
*[[OXP_howto_Game_Balance|OXP howto Game Balance]] to avoid conflicts from accidental gameplay changes.
 +
*[[Long Range Scanner]] is an OXP which allows you to jump around the star system to objects you have placed there - or to jump around within the galaxy. A "cheat" for players, but a useful tool for some OXP designers.
  
 
==== Tutorials for Tools ====
 
==== Tutorials for Tools ====

Revision as of 21:28, 11 July 2021

OXP icon

Overview

An Oolite Expansion Pack can cause many big changes or additions to Oolite's gameplay, or it may represent just a small, subtle alteration. By first appearances, there is no way to tell what is inside, as it's merely a folder with the added extension .oxp. Oolite Version 1.79 onwards supports also compressed files in ZIP format with extension .oxz.

To learn starting with a non-compressed version have a look at OXP_tutorial.

OXZ

The new OXZ distribution format is strongly recommended. It makes version control and distribution just so much easier.

To make an OXZ file, use a ZIP program to compress the contents of the OXP folder, so that the manifest.plist file is in the root of the ZIP file, and the folders (AI, Config, etc) are folders in the ZIP file. Then, rename the ZIP file so that its extension is .oxz. To inspect an OXZ file, open it with your ZIP program.

Here is a sample: Media:X.0.1.oxz - just rename all "X" within to the title of your idea and put your name into the author fields.

You can use Total Commander or Krusader to edit files within .oxz directly, without unpacking.

For more details read The All-in-One Guide to OXZ Packaging and Distribution.

Structure

Inside the .oxp folder, or the .oxz file, it will at least contain a folder (Config, AIs, Models, Textures, etc...) that holds scripts, plists or other things like textures or models. It is down to the goal of the OXP, which ways to combine elements to the OXP's contents. To get a feeling for it, simply take a look in other oxps. (If they are in .oxz format, any normal unzip program can inspect their contents - many will even let you edit the contents without having to unzip and rezip the file)

The structure for OXPs:

AddOns (folder)
-.oxp (folder) - Holds requires.plist, manifest.plist and the other folders
--> AIs (folder) - Holds AI plists
--> Config (folder) - Holds all other plists
--> Images (folder) - Holds background images
--> Models (folder) - Holds the .dat files
--> Music (folder) - Surprise - holds music files
--> Scenarios (folder) - Holds new game scenarios (v1.79)
--> Scripts (folder) - Holds scripts (worldScripts and shipScripts)
--> Shaders (folder) - Holds Vertex and Fragment shaders (v1.69)
--> Sounds (folder) - Holds sound files
--> Textures (folder) - Holds models textures

If the OXP is in the uncompressed OXP folder format, the .oxp folder must contain a requires.plist file. If it is in the compressed OXZ single-file format, it must contain a manifest.plist file.

AIs

The folder named AIs contains any AI.plist additions the OXP might use.

In Oolite 1.79 AIs may be written in Javascript using .js files in this folder. A helper library is provided to make writing complex JS AIs simpler.

Config

All plist files except for those introducing new AIs, requires.plist, manifest.plist or info.plist, belong in Config.

In its simplest form, an OXP could contain only a Config with an altering script.plist or planetinfo.plist. An OXP that adds a new ship needs a shipdata.plist entry, and unless it is based entirely on existing Oolite data, would include a model and texture.


This folder contains Property lists such as:

Deprecated:

  • demoships.plist that selects demoships to show on startup (replaced - approximately - by shiplibrary.plist in 1.79 and later)
  • script.plist to handle conditional script actions. (deprecated)
  • script.oos was briefly introduced during 1.70 development but is now deprecated in favour of JS.)

Models

Oolite models need to be in an Oolite specific format using the the .dat file extension. There are utilities available that convert models made in Wings 3D (.obj) and Meshwork (.mesh) into this. A .dat file can be opened in a plain text editor to view the object's assigned texture names and see that they correspond with the actual file names in the Textures folder. The .dat file must be named exactly as it is referenced in the shipdata model entry - case sensitive!!!

Scripts

Scripts are in text format. In this folder you can put both js scripts as well as legacy scripts. New OXPs should only use Javascript here.

Textures

Oolite's textures are in the .png format, usually at a standard 512x512 size, and must be named exactly as they are named in the .dat file.

Viewing a specific texture and / or model in Oolite. "I made one. How do I proof it?"

OXP Verifier

Oolite has what amounts to a spell checker for shipdata.plist and other some plists, called the OXP verifier. The verifier detects unknown keys or wrong use of keys etc. It can currently only be invoked from the command line.

On Windows or Linux: Code: oolite.app/oolite --verify-oxp <path to OXP>

On Mac OS X: Code: Oolite.app/Contents/MacOS/Oolite --verify-oxp <path to OXP>

Most mac users will not be familiar to using the command line. Look inside your application folder for a utilities folder. Inside that you will find a program called terminal. Run it to open a terminal window. Now drop the oolite application on that window. That will generate the path to oolite on the command line. Delete the trailing space and paste the following text - including the trailing space- behind it: "/Contents/MacOS/Oolite --verify-oxp ". Now drop the oxp you want to verify on the window. That will again create the path to the oxp behind the last entry. When you select the window and hit the <return> key, the verification will start. It should now open the console program, showing the results.

Unique names

On loading the oxps, Oolite will add all files in the AIs, Models, Sound and Scripts folders in one big folder for its own use. That means that all files need unique names or one file will overwrite another with the same name. Files in Textures are not pre-loaded, but when looking for a specific texture Oolite looks in all Texture folders until it finds a texture file with a matching name. If another oxp contains a texture with identical name, Oolite could use that texture.

For the Config folder something similar happens. Here the plists all have the same name, but the content of all oxp plists is loaded per type in one big plist. e.g. all individual shipData.plist go in one big shipData.plist file. And within a single plist, all keys must be unique. When two plists use the same key, the later loading key will overwrite the former.

Generally it is a good habit to precede your chosen filenames and keys with the name of the oxp, or another unique prefix, to make sure the names stay unique and no other oxp will use the same names.

Scripting with JavaScript

Older OXPs (from Aegidian's day were written in Legacy Script: see Methods. Modern OXPs are written in JavaScript. Specifically oolite.jsVersion 185, an Oolite specific variant of ECMAv5. It is the same Spidermonkey version that Firefox 4 shipped with many years ago, but it is a special build for Oolite. This is the version that we have almost always had and it has not changed between versions of the game. It is unlikely to change in the future.

JavaScript is the preferred scripting interface for worldScripts and shipScripts. The legacy scripting interface (see script.plist) still works, but is not supported. See Scripting Oolite with JavaScript for more information.

Hidden settings

There are several Hidden_Settings_in_Oolite that make life for an oxp creator easier. One of them is the setting always-flush-cache. It makes every startup a bit slower, but it prevents Oolite working with cached data instead of your newly changed file. For someone that only does occasional oxp changes it will be enough to flush the cache by holding the shift key when starting Oolite but if you are writing oxps, this is the way to prevent frustrations.

See Also

Tools

  • List of software that is helpful for creating OXPs (eg. editorial packages for javascript or 3D model creators)
  • List of Planets used in OXPs for planets already used by other OXPs. Helps authors avoid overlapping with or breaking other OXPs.
  • OXP howto Game Balance to avoid conflicts from accidental gameplay changes.
  • Long Range Scanner is an OXP which allows you to jump around the star system to objects you have placed there - or to jump around within the galaxy. A "cheat" for players, but a useful tool for some OXP designers.

Tutorials for Tools

OXP tutorials

Oolite changes affecting different varieties of OXPs happened with v.1.76 (2011), v.1.80 (2014) & v1.82 (2015).

  • Escape Pod Locator OXP has notes on programming on the bottom of the page regarding beacon transmission & location

Packaging and distribution

  • Gameplay Balance Indicator and Difficulty Indicator. Add these to your wiki page to show effects on Game Balance and the Difficulty Level of your OXP/OXZ. The first indicates the impact on play (equipment making the game easier/more difficult), the second indicates the suggested Elite Rating needed to attempt the mission/defeat the ship etc.