Difference between revisions of "OXP howto"
Eric Walch (talk | contribs) (Added link to the new hud.plist page) |
(Updating BB links) |
||
(102 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
+ | :''Shortcut: EW:OXP and EW:HOWDS redirect here''</br> | ||
[[Image:oolite-oxp-icon.png|100px|right|OXP icon]] | [[Image:oolite-oxp-icon.png|100px|right|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 appearances, there is no way to tell what is inside, as it's merely a folder with the added | + | 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]]. | |
− | = | + | {{QuoteText|Text=It's worth saying I think that compared with a lot of game addon architectures, the OXP architecture as designed by Giles is already very good at avoiding conflicts compared with a lot of other games |
+ | - you can save your game, add, remove and upgrade lots of OXPs, load your game, and have it work | ||
+ | - you can do this repeatedly, while incrementally upgrading the core game, for years | ||
+ | - as a player you basically never have to care about load order; as an OXP developer, rarely | ||
+ | It's also worth noting that a lot of types of OXP conflicts are inevitable due to resource conflicts - a planet can only have one diffuse map, a ship can only have one AI - or due to conceptual conflicts - OXP A removes all stations from a system; OXP B expects the player to dock there.|Source=([https://bb.oolite.space/viewtopic.php?p=241733#p241733 Cim (3rd Lead Developer)])}} | ||
+ | |||
+ | === Oolite TR version === | ||
+ | The Oolite Developer Release/Test Release version is specially developed for testing out OXPs. It comes with a [[Debug OXP]]/Debug Console allowing one to spawn ships/station on demand, award oneself a test ship, detect the mass of another ship ''etc''. | ||
+ | |||
+ | It is downloaded from the main Oolite website - currently http://www.oolite.space/download/ | ||
+ | |||
+ | == 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 [http://www.ghisler.com/download.htm Total Commander] or [http://en.wikipedia.org/wiki/Krusader Krusader] to edit files within '''.oxz''' directly, without unpacking. | ||
+ | |||
+ | For more details read [https://bb.oolite.space/viewtopic.php?f=4&t=16688 The All-in-One Guide to OXZ Packaging and Distribution]. | ||
+ | |||
+ | === Creating an .oxz on an AppleMac === | ||
+ | When you compress the files/folders on the AppleMac to create the .oxz ''do not'' select them with your mouse! This way lies misery! | ||
+ | |||
+ | Rather, ensure the relevant files/folders are inside one overall folder. Then, use '''command-a''' to select all the ''contents'' of this overall folder and then select '''compress''' from the file menu on the finder's menu bar. Finally, rename your newly-created .zip file as an .oxz | ||
+ | |||
+ | ==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 | ||
+ | --> [[info.plist]] (file) | ||
+ | --> [[manifest.plist]] (file) | ||
+ | |||
+ | *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. | ||
+ | |||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=13134 Nested OXPs in AddOns folder] (2012) - some OXZ's do this (Station spotter oxp inside [[Stations for Extra Planets]]) | ||
+ | |||
+ | ===AIs=== | ||
The folder named AIs contains any AI.plist additions the OXP might use. | The folder named AIs contains any AI.plist additions the OXP might use. | ||
* [[OXP howto AI|Making Oolite AI]] | * [[OXP howto AI|Making Oolite AI]] | ||
− | + | 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. | |
+ | |||
+ | * [[Oolite PriorityAI Documentation]] | ||
+ | * [[Oolite PriorityAI Tutorial]] | ||
− | All plist files except for those introducing new AIs, ''[[requires.plist]]'' or ''[[info.plist]]'', belong in Config. | + | ===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. | 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. | ||
* [[OXP howto plist|Making Oolite plists]] | * [[OXP howto plist|Making Oolite plists]] | ||
+ | * Usually irrelevant: The Config folder isn't cached in the same way as the rest of an oxp because usually its contents merge rather than overwriting (See [https://bb.oolite.space/viewtopic.php?f=3&t=16927 here]) | ||
<br> | <br> | ||
This folder contains [[Property lists]] such as: | This folder contains [[Property lists]] such as: | ||
* ''[[characters.plist]]'' that adds non-player characters to Oolite. | * ''[[characters.plist]]'' that adds non-player characters to Oolite. | ||
− | * ''[[commodities.plist]]'' that contains information for each commodity in a market. | + | * ''[[commodities.plist]]'' that contains information for each commodity in a market in 1.80 or earlier |
* ''[[crosshairs.plist]]'' that contains the look for your weapons (v1.73). | * ''[[crosshairs.plist]]'' that contains the look for your weapons (v1.73). | ||
* ''[[customsounds.plist]]'' that contains references to ingame used sounds. | * ''[[customsounds.plist]]'' that contains references to ingame used sounds. | ||
− | * ''[[ | + | * ''[[descriptions.plist]]'' that adds vocabulary to Oolite texts. |
− | * ''[[ | + | * ''[[effectdata.plist]]'' defines custom visual effects (v1.77). |
* ''[[equipment.plist]]'' lists upgrades available from the Shipyard. | * ''[[equipment.plist]]'' lists upgrades available from the Shipyard. | ||
+ | * ''[[explosions.plist]]'' customises things blowing up (v1.81) | ||
+ | * ''[[global-settings.plist]]'' sets a few miscellaneous universal settings (v1.81) | ||
+ | * ''[[gui-settings.plist]]'' settings for reformatting the GUI screens (v1.81) | ||
* ''[[hud.plist]]'' and ''[[hud.plist|hud-small.plist]]'' that allows for changes or a radically new ''Head-Up Display''. | * ''[[hud.plist]]'' and ''[[hud.plist|hud-small.plist]]'' that allows for changes or a radically new ''Head-Up Display''. | ||
− | * ''[[ | + | * ''[[illegal_goods.plist]]'' that contains a list of banned/forbidden items in 1.80 or earlier. GalCop has an eye on that. |
+ | * ''[[Oolite_Keyboard_Controls|keyconfig.plist]]'' that allows for changes of the keymapping. | ||
* ''[[missiontext.plist]]'' contains texts for the mission screens. | * ''[[missiontext.plist]]'' contains texts for the mission screens. | ||
− | * ''[[ | + | * ''[[OXPMessages.plist]]'' adds warnings to testversions of an oxp. |
− | * ''[[ | + | * ''[[pirate-victim-roles.plist]]'' that defines which roles should act as traders. (deprecated in v1.79) |
* ''[[planetinfo.plist]]'' that plots system specific changes from the default. May also contain ''script actions''. | * ''[[planetinfo.plist]]'' that plots system specific changes from the default. May also contain ''script actions''. | ||
+ | * ''[[role-categories.plist]]'' for specifying groups of roles with similar properties (v1.79) | ||
+ | * ''[[scenarios.plist]]'' lists the starting scenarios in the Scenarios folder (v1.79). | ||
* ''[[screenbackgrounds.plist]]'' that contains references to background images (v1.74). | * ''[[screenbackgrounds.plist]]'' that contains references to background images (v1.74). | ||
− | * ''[[script. | + | * ''[[Scripting Oolite with JavaScript|script.js]]'' is the successor of [[script.plist]] in JavaScript. It will be loaded in preference to script.plist if both exist and offers more flexibility and improved possibilities. |
* ''[[shipdata.plist]]'' that introduces any new entity (ships, stations, objects etc.) to Oolite. | * ''[[shipdata.plist]]'' that introduces any new entity (ships, stations, objects etc.) to Oolite. | ||
* ''[[shipdata-overrides.plist]]'' that selectively can replace shipentries in other shipdata.plists | * ''[[shipdata-overrides.plist]]'' that selectively can replace shipentries in other shipdata.plists | ||
+ | * ''[[shiplibrary.plist]]'' that gives information for the ship description library viewable from the startup screen (v1.79) | ||
* ''[[shipyard.plist]]'' that introduces new ships available for player purchase. | * ''[[shipyard.plist]]'' that introduces new ships available for player purchase. | ||
* ''[[shipyard-overrides.plist]]'' that selectively can replace shipentries in other shipyard.plists | * ''[[shipyard-overrides.plist]]'' that selectively can replace shipentries in other shipyard.plists | ||
* ''[[speech_pronunciation_guide.plist]]'' is another of the other custom methods. | * ''[[speech_pronunciation_guide.plist]]'' is another of the other custom methods. | ||
− | * ''[[ | + | * ''[[trade-goods.plist]]'' defines trade goods in 1.81 and later |
+ | * ''[[world-scripts.plist]]'' that contains a list of scripts (if more than one worldScript should be used). | ||
Deprecated: | Deprecated: | ||
− | * ''[[script.oos]]'' was briefly introduced during 1.70 development but is now | + | * ''[[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!!! | ||
+ | |||
+ | * [[OXP howto model|Making Oolite models]] - tutorials for Wings3D & Blender, notes on sub-entities, links ''etc''. | ||
+ | * [https://bb.oolite.space/viewtopic.php?f=4&t=12165 Model Converter utilities] (2012-17) | ||
+ | * Video: [https://bb.oolite.space/viewtopic.php?f=4&t=16123 From scratch to Mamba in under an hour] ([[Dertien]], 2013) | ||
+ | |||
+ | ===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. | ||
+ | * [[Scripting_Oolite_with_JavaScript|Scripting Oolite with Javascript]] | ||
+ | * [[Oolite_JavaScript_object_model|Scripting reference]] | ||
+ | |||
+ | ===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. | ||
+ | |||
+ | * [[OXP howto texture|Making Oolite textures]] | ||
− | + | * [[Smivs'_texture_tutorial|Smivs' guide to making Oolite textures]] | |
− | Oolite has what amounts to a spell checker for | + | * [[Texturing tips and tricks by Theta Seven]] |
+ | |||
+ | Viewing a specific texture and / or model in Oolite. | ||
+ | "I made one. How do I proof it?" | ||
+ | |||
+ | * [[Viewing a Texture or Model]] | ||
+ | |||
+ | ==OXP Verifier== | ||
+ | |||
+ | Oolite has what amounts to a spell checker for shipdata.plist and some other plists, called the OXP verifier. It does not work with OXZ's. 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: | On Windows or Linux: | ||
Code: | Code: | ||
− | oolite.app/oolite --verify-oxp <path to OXP> | + | '''oolite.app/oolite --verify-oxp <path to OXP> ''' |
On Mac OS X: | On Mac OS X: | ||
Code: | Code: | ||
− | Oolite.app/Contents/MacOS/Oolite --verify-oxp <path to OXP> | + | '''Oolite.app/Contents/MacOS/Oolite --verify-oxp <path to OXP>''' |
− | |||
− | + | Most Mac users will not be familiar with using the command line. Look inside your application folder for a '''utilities folder'''. Inside that you will find a program called [https://en.wikipedia.org/wiki/Terminal_(macOS) Terminal]. <br> | |
+ | 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. <br> | ||
+ | When you select the window and hit the <return> key, the verification will start. It should now open the Console program, showing the results. <br> | ||
+ | '''Console''' is a log viewer developed by Apple Inc. and included with macOS, also in the utilities folder. It allows users to search through all of the system's logged messages, and can alert the user when certain types of messages are logged. The Console is generally used for troubleshooting when there is a problem with the computer. MacOS itself, as well as any applications that are used, send a constant stream of messages to the system in the form of log files. The console allows you to read the system logs, help find certain ones, monitor them, and filter their contents. See [[Debug OXP]] for more information. | ||
− | + | There is a lengthy file - '''OXP verifier design.txt''' tucked inside your Oolite installation with more information about it | |
− | == | + | Note that it is possible to [https://bb.oolite.space/viewtopic.php?f=2&t=21443 obtain graphical output] from Graphviz for OXP Verifier. |
− | + | === Verifier BB threads === | |
+ | *[https://bb.oolite.space/viewtopic.php?f=8&t=13400 plist Editor Pro for Windows] (2013 - full of relevant Red Herrings) | ||
+ | *[https://bb.oolite.space/viewtopic.php?f=3&t=16865 lite --verify-oxp fails when path has spaces in it] (2014) | ||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=21359 OXP Develoopment and Plist files] (2023 - quick introduction) | ||
− | + | === Correcting with plutil (Apple Macintosh Terminal utility) === | |
+ | Since a very small mistake is enough to stop a .plist from being accepted, it's important to be exact about every letter and sign. The Mac Terminal utility has a very practical tool for catching parser errors. After opening Terminal, simply type plutil, add one space, and drag and drop the plist in question onto the Terminal window. This will cause the 'address' of the plist to be shown. Hit return, and Terminal will reveal whether or not the plist is OK. If it's not, you might be given a clue to what is wrong, and the line number of the error - or just a general note that "Unexpected character { at line 1"! | ||
− | + | ==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 [[User:Aegidian|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. [https://bb.oolite.space/viewtopic.php?p=256623#p256623 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. | |
− | + | Note that most of the [[Legacy Scripting]] still works perfectly well (XML & OpenStep)! | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | ==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. | ||
− | + | ==Cookbook== | |
+ | * How to add dials to a HUD: https://bb.oolite.space/viewtopic.php?p=290352#p290352 | ||
+ | * How to limit a station's shipyard to only offer a defined set of ships: https://bb.oolite.space/viewtopic.php?p=293174#p293174 | ||
+ | * Ship/Station design with external docking ports: https://bb.oolite.space/viewtopic.php?f=4&t=21574&p=293777 | ||
== See Also == | == See Also == | ||
− | *[[OXP_tutorial|OXP Tutorial]] | + | *'''Context''': [https://bb.oolite.space/viewtopic.php?p=275434#p275434 What can OXP's ''not'' change?] (2021) |
− | *[[OXP howto dockable stations|How to create | + | *It is often helpful to dip one's toes (claws?) in the water by experimenting with tweaking oxp's first: see [[How to tweak OXZ's]] |
− | *[[ | + | *[[:Category:Oolite scripting]] |
+ | *[[Javascript Operators]] | ||
+ | *[[:Category:Oolite JavaScript Reference]] | ||
+ | *[[:Category:Oolite Development]] | ||
+ | *[[User:Montana05|Montana05]] recommends https://www.w3schools.com/js/js_array_sort.asp for better knowledge of the js on Oolite. | ||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=12149 OXP Development Best Practices] (2012-7) | ||
+ | *Some older oxp's are written in [[Legacy Scripting]] | ||
+ | *[https://github.com/OoliteProject/oolite/find/master Github] vanilla game code repository - the resources section at the bottom of the page contains possibly useful parts of vanilla game coding, with occasional annotations. | ||
+ | === 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|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. | ||
+ | |||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=13422 What Tools Are Good For Windows OXP Programming?] (2013) | ||
+ | |||
+ | ==== Tutorials for Tools ==== | ||
+ | *[https://web.archive.org/web/20050317033938/http://oolite.aegidian.org/cyoship/ Oolite Tutorial - Meshwork Shipbuilding (OSX only)] via WayBack Machine | ||
+ | *[https://web.archive.org/web/20060621211940/http://oolite.aegidian.org/cyoship2/ Oolite Tutorial - Wings 3D Shipbuilding (Cross-platform)] via WayBack Machine | ||
+ | |||
+ | === OXP tutorials === | ||
+ | Oolite changes affecting different varieties of OXPs happened with v.1.76 (2011), v.1.80 (2014) & v1.82 (2015). | ||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=20937 MasterClass: How to OXP (updating SoThisTC)] by [[User:Spara|Spara]] who teaches computing in Helsinki! (2021) | ||
+ | *[https://archive.org/details/GettingStartedWithOoliteOXZDevelopment Getting started with OXZ Development] ''An .odt for Open Office'': By Bugbear (2012). 2 example OXPs: a pirate-ridden solar systems warning tool & Witchspace Blockades [https://bb.oolite.space/viewtopic.php?f=4&t=17731 BB Thread (2015)] | ||
+ | *[[OXP_tutorial|OXP Tutorial]] creating a new spaceship - and then tweaking it in different ways (2007-13) | ||
+ | *[[OXP howto dockable stations|Creating a dockable station]] (2009-10) | ||
+ | *[[User:Shipbuilder|Shipbuilder]] wrote a Shaders tutorial with resource packs (2013) | ||
+ | |||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=18837 OXP Performance] BB thread (mostly 2017-8): improving your OXP (speed, ''etc'') | ||
+ | |||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=18284 The bare minimum for a game-recognizable ship OXP] (thread: 2016) | ||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=14135 How to make a simple OXP?] (thread: 2013) 3 OXPs - pop-up message at docking, set only Pythons for sale at Lave shipyard, create a new ship. | ||
+ | |||
+ | *[[Escape Pod Locator OXP]] has notes on programming on the bottom of the page regarding beacon transmission & location | ||
+ | |||
+ | === Helpful OXPs for your OXP=== | ||
+ | There are a number of OXPs which have been specifically written to allow your OXP to use them: | ||
+ | *[[Library OXP|Library]]: a collection of useful snippets and helpers. Its main purpose is to simplify or unify some common tasks used by OXPers. | ||
+ | :*It can add dynamic maps, music & animation. | ||
+ | :*It adds a Personal Assistant Device for the player with details of people met, medals awarded, Guild rankings, ''etc''. | ||
+ | :*It allows in-game configuration of an oxp by the player. | ||
+ | :*Add-on modules allows inspection of models and materials for creation of ship & station oxps. | ||
+ | *[[GalCop Missions]] introduces many new pieces of equipment with wide varieties of use (Cargo Stoppers, Ejection Dampers, Range Finders, Solar Radiation Disrupter Missiles, Seismic Resonance Scanners, Patient Transport Modules ''etc''). It can also help with managing missions. | ||
+ | *[[Diplomancy]] can be used to make states of war impact personally on the player | ||
+ | *[[System Data Config]] helps re-organise the F7 screen to squeeze more information onto it | ||
+ | |||
+ | ==== While docked/stations ==== | ||
+ | *[[HD Backgrounds]] can provide a High Definition screenshot of a station lobby or other such for interaction with the player | ||
+ | *[[BGS]] can help organise a customised docking or launching sequence (see the [[Riredi OXP]] or the [[Kiota Stations]]). | ||
+ | *[[GNN]] can broadcast your news alerts (see how [[Diplomancy]] uses it for war & peace declarations). GNN also contains '''PhraseGen''' which can be used for randomizing text descriptions. | ||
+ | *[[Station Validator]] will remember that a station has been destroyed and stop Oolite automatically replacing it on the next visit to the system | ||
+ | *[[Station Dock Control]] can help interraction with other ships docked at the station | ||
+ | *[[Bulletin Board System]] can help manage interractions at the station | ||
+ | *[[Email System OXP]] can also help manage interractions at the station | ||
+ | *[[Ship Storage Helper]] allows storage of the player's ship whilst doing other things (such as flying another ship!) | ||
+ | *[[Equipment Storage OXP]] allows storage of equipment/goods whilst doing other things | ||
+ | *[[Ship's Library]] allows reading documents with illustrations while docked (see the included Ship's Manual) | ||
+ | *[[Station Options]] allows complex configurations of equipment, but could potentially also be used for managing dialogue with NPCs | ||
+ | *[[Life in the Frontier]] was being expanded to cover more stations (Dodo/Ico/Rock Hermits and potentially OXP stations), but is currently mothballed. | ||
+ | |||
+ | ==== In-flight ==== | ||
+ | *[[MFD - Broadcast Comms]] can be used for in-flight interaction with NPC's | ||
+ | *[[Bigships]] can be used to help with the AI for massive space ships which cannot dock at orbital stations | ||
+ | *[[Montanas Resource Pack 01]] contains a number of resources for use (treasures, containers, escape/survival equipment) | ||
+ | *[[Star System Lane Indicator]] - the older version contains a very graphical dynamic display (does not function properly, but boy! does it look good!) | ||
+ | *[[SOTL Exploration]] contains exploration equipment and a non-automatic hyperspace jump | ||
+ | *[[SOTL Altmap]] contains different politics, markets and NPCs with Torus Drives. | ||
+ | *[[Resistance Commander]] & [[EscortDeck]] contain mechanisms for "managing" allied ships. | ||
− | == | + | ==== Planet Surfaces ==== |
+ | *[[Planetfall OXP]] allows landing on the planet (used by [[Feudal States]] for access to the Royal Court, and by [[Astronaut]] for space-jumping) | ||
+ | *[[Lave is Earth 8k]] contains night-time city lighting | ||
− | *[ | + | === Packaging and distribution === |
− | *[ | + | *[https://bb.oolite.space/viewtopic.php?f=4&t=16688 The All-in-One Guide to OXZ Packaging and Distribution]. |
+ | ::And see [https://bb.oolite.space/viewtopic.php?p=279034#p279034 this post] for AppleMac issues with the above. | ||
+ | * Cim created [https://github.com/cim--/oxp-build-scripts some scripts to ease packaging] a project. | ||
+ | *[[OXP Distribution]] The All-in-One Guide to OXP Packaging and Distribution (and [[OXP_standards]] for advice on which ways of doing things are supported and which are not). | ||
+ | * Since the domain change to [https://oolite.space] the distribution of expansions has changed slightly. The new version is still subject to discussions and might change again. Here is a [[Publishing Procedure Comparison]]. | ||
+ | *[[Gameplay_and_Balance_Indicator|Gameplay Balance Indicator]] and [[OXP_Levelindicators|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''. | ||
[[Category:Oolite]] | [[Category:Oolite]] | ||
[[Category:Oolite scripting]] | [[Category:Oolite scripting]] |
Revision as of 02:16, 29 February 2024
- Shortcut: EW:OXP and EW:HOWDS redirect here
Contents
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.
It's worth saying I think that compared with a lot of game addon architectures, the OXP architecture as designed by Giles is already very good at avoiding conflicts compared with a lot of other games
- you can save your game, add, remove and upgrade lots of OXPs, load your game, and have it work - you can do this repeatedly, while incrementally upgrading the core game, for years - as a player you basically never have to care about load order; as an OXP developer, rarely It's also worth noting that a lot of types of OXP conflicts are inevitable due to resource conflicts - a planet can only have one diffuse map, a ship can only have one AI - or due to conceptual conflicts - OXP A removes all stations from a system; OXP B expects the player to dock there. |
(Cim (3rd Lead Developer)) |
Oolite TR version
The Oolite Developer Release/Test Release version is specially developed for testing out OXPs. It comes with a Debug OXP/Debug Console allowing one to spawn ships/station on demand, award oneself a test ship, detect the mass of another ship etc.
It is downloaded from the main Oolite website - currently http://www.oolite.space/download/
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.
Creating an .oxz on an AppleMac
When you compress the files/folders on the AppleMac to create the .oxz do not select them with your mouse! This way lies misery!
Rather, ensure the relevant files/folders are inside one overall folder. Then, use command-a to select all the contents of this overall folder and then select compress from the file menu on the finder's menu bar. Finally, rename your newly-created .zip file as an .oxz
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 --> info.plist (file) --> manifest.plist (file)
- 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.
- Nested OXPs in AddOns folder (2012) - some OXZ's do this (Station spotter oxp inside Stations for Extra Planets)
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.
- Making Oolite plists
- Usually irrelevant: The Config folder isn't cached in the same way as the rest of an oxp because usually its contents merge rather than overwriting (See here)
This folder contains Property lists such as:
- characters.plist that adds non-player characters to Oolite.
- commodities.plist that contains information for each commodity in a market in 1.80 or earlier
- crosshairs.plist that contains the look for your weapons (v1.73).
- customsounds.plist that contains references to ingame used sounds.
- descriptions.plist that adds vocabulary to Oolite texts.
- effectdata.plist defines custom visual effects (v1.77).
- equipment.plist lists upgrades available from the Shipyard.
- explosions.plist customises things blowing up (v1.81)
- global-settings.plist sets a few miscellaneous universal settings (v1.81)
- gui-settings.plist settings for reformatting the GUI screens (v1.81)
- hud.plist and hud-small.plist that allows for changes or a radically new Head-Up Display.
- illegal_goods.plist that contains a list of banned/forbidden items in 1.80 or earlier. GalCop has an eye on that.
- keyconfig.plist that allows for changes of the keymapping.
- missiontext.plist contains texts for the mission screens.
- OXPMessages.plist adds warnings to testversions of an oxp.
- pirate-victim-roles.plist that defines which roles should act as traders. (deprecated in v1.79)
- planetinfo.plist that plots system specific changes from the default. May also contain script actions.
- role-categories.plist for specifying groups of roles with similar properties (v1.79)
- scenarios.plist lists the starting scenarios in the Scenarios folder (v1.79).
- screenbackgrounds.plist that contains references to background images (v1.74).
- script.js is the successor of script.plist in JavaScript. It will be loaded in preference to script.plist if both exist and offers more flexibility and improved possibilities.
- shipdata.plist that introduces any new entity (ships, stations, objects etc.) to Oolite.
- shipdata-overrides.plist that selectively can replace shipentries in other shipdata.plists
- shiplibrary.plist that gives information for the ship description library viewable from the startup screen (v1.79)
- shipyard.plist that introduces new ships available for player purchase.
- shipyard-overrides.plist that selectively can replace shipentries in other shipyard.plists
- speech_pronunciation_guide.plist is another of the other custom methods.
- trade-goods.plist defines trade goods in 1.81 and later
- world-scripts.plist that contains a list of scripts (if more than one worldScript should be used).
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!!!
- Making Oolite models - tutorials for Wings3D & Blender, notes on sub-entities, links etc.
- Model Converter utilities (2012-17)
- Video: From scratch to Mamba in under an hour (Dertien, 2013)
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 some other plists, called the OXP verifier. It does not work with OXZ's. 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 with 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.
Console is a log viewer developed by Apple Inc. and included with macOS, also in the utilities folder. It allows users to search through all of the system's logged messages, and can alert the user when certain types of messages are logged. The Console is generally used for troubleshooting when there is a problem with the computer. MacOS itself, as well as any applications that are used, send a constant stream of messages to the system in the form of log files. The console allows you to read the system logs, help find certain ones, monitor them, and filter their contents. See Debug OXP for more information.
There is a lengthy file - OXP verifier design.txt tucked inside your Oolite installation with more information about it
Note that it is possible to obtain graphical output from Graphviz for OXP Verifier.
Verifier BB threads
- plist Editor Pro for Windows (2013 - full of relevant Red Herrings)
- lite --verify-oxp fails when path has spaces in it (2014)
- OXP Develoopment and Plist files (2023 - quick introduction)
Correcting with plutil (Apple Macintosh Terminal utility)
Since a very small mistake is enough to stop a .plist from being accepted, it's important to be exact about every letter and sign. The Mac Terminal utility has a very practical tool for catching parser errors. After opening Terminal, simply type plutil, add one space, and drag and drop the plist in question onto the Terminal window. This will cause the 'address' of the plist to be shown. Hit return, and Terminal will reveal whether or not the plist is OK. If it's not, you might be given a clue to what is wrong, and the line number of the error - or just a general note that "Unexpected character { at line 1"!
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.
Note that most of the Legacy Scripting still works perfectly well (XML & OpenStep)!
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.
Cookbook
- How to add dials to a HUD: https://bb.oolite.space/viewtopic.php?p=290352#p290352
- How to limit a station's shipyard to only offer a defined set of ships: https://bb.oolite.space/viewtopic.php?p=293174#p293174
- Ship/Station design with external docking ports: https://bb.oolite.space/viewtopic.php?f=4&t=21574&p=293777
See Also
- Context: What can OXP's not change? (2021)
- It is often helpful to dip one's toes (claws?) in the water by experimenting with tweaking oxp's first: see How to tweak OXZ's
- Category:Oolite scripting
- Javascript Operators
- Category:Oolite JavaScript Reference
- Category:Oolite Development
- Montana05 recommends https://www.w3schools.com/js/js_array_sort.asp for better knowledge of the js on Oolite.
- OXP Development Best Practices (2012-7)
- Some older oxp's are written in Legacy Scripting
- Github vanilla game code repository - the resources section at the bottom of the page contains possibly useful parts of vanilla game coding, with occasional annotations.
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
- Oolite Tutorial - Meshwork Shipbuilding (OSX only) via WayBack Machine
- Oolite Tutorial - Wings 3D Shipbuilding (Cross-platform) via WayBack Machine
OXP tutorials
Oolite changes affecting different varieties of OXPs happened with v.1.76 (2011), v.1.80 (2014) & v1.82 (2015).
- MasterClass: How to OXP (updating SoThisTC) by Spara who teaches computing in Helsinki! (2021)
- Getting started with OXZ Development An .odt for Open Office: By Bugbear (2012). 2 example OXPs: a pirate-ridden solar systems warning tool & Witchspace Blockades BB Thread (2015)
- OXP Tutorial creating a new spaceship - and then tweaking it in different ways (2007-13)
- Creating a dockable station (2009-10)
- Shipbuilder wrote a Shaders tutorial with resource packs (2013)
- OXP Performance BB thread (mostly 2017-8): improving your OXP (speed, etc)
- The bare minimum for a game-recognizable ship OXP (thread: 2016)
- How to make a simple OXP? (thread: 2013) 3 OXPs - pop-up message at docking, set only Pythons for sale at Lave shipyard, create a new ship.
- Escape Pod Locator OXP has notes on programming on the bottom of the page regarding beacon transmission & location
Helpful OXPs for your OXP
There are a number of OXPs which have been specifically written to allow your OXP to use them:
- Library: a collection of useful snippets and helpers. Its main purpose is to simplify or unify some common tasks used by OXPers.
- It can add dynamic maps, music & animation.
- It adds a Personal Assistant Device for the player with details of people met, medals awarded, Guild rankings, etc.
- It allows in-game configuration of an oxp by the player.
- Add-on modules allows inspection of models and materials for creation of ship & station oxps.
- GalCop Missions introduces many new pieces of equipment with wide varieties of use (Cargo Stoppers, Ejection Dampers, Range Finders, Solar Radiation Disrupter Missiles, Seismic Resonance Scanners, Patient Transport Modules etc). It can also help with managing missions.
- Diplomancy can be used to make states of war impact personally on the player
- System Data Config helps re-organise the F7 screen to squeeze more information onto it
While docked/stations
- HD Backgrounds can provide a High Definition screenshot of a station lobby or other such for interaction with the player
- BGS can help organise a customised docking or launching sequence (see the Riredi OXP or the Kiota Stations).
- GNN can broadcast your news alerts (see how Diplomancy uses it for war & peace declarations). GNN also contains PhraseGen which can be used for randomizing text descriptions.
- Station Validator will remember that a station has been destroyed and stop Oolite automatically replacing it on the next visit to the system
- Station Dock Control can help interraction with other ships docked at the station
- Bulletin Board System can help manage interractions at the station
- Email System OXP can also help manage interractions at the station
- Ship Storage Helper allows storage of the player's ship whilst doing other things (such as flying another ship!)
- Equipment Storage OXP allows storage of equipment/goods whilst doing other things
- Ship's Library allows reading documents with illustrations while docked (see the included Ship's Manual)
- Station Options allows complex configurations of equipment, but could potentially also be used for managing dialogue with NPCs
- Life in the Frontier was being expanded to cover more stations (Dodo/Ico/Rock Hermits and potentially OXP stations), but is currently mothballed.
In-flight
- MFD - Broadcast Comms can be used for in-flight interaction with NPC's
- Bigships can be used to help with the AI for massive space ships which cannot dock at orbital stations
- Montanas Resource Pack 01 contains a number of resources for use (treasures, containers, escape/survival equipment)
- Star System Lane Indicator - the older version contains a very graphical dynamic display (does not function properly, but boy! does it look good!)
- SOTL Exploration contains exploration equipment and a non-automatic hyperspace jump
- SOTL Altmap contains different politics, markets and NPCs with Torus Drives.
- Resistance Commander & EscortDeck contain mechanisms for "managing" allied ships.
Planet Surfaces
- Planetfall OXP allows landing on the planet (used by Feudal States for access to the Royal Court, and by Astronaut for space-jumping)
- Lave is Earth 8k contains night-time city lighting
Packaging and distribution
- And see this post for AppleMac issues with the above.
- Cim created some scripts to ease packaging a project.
- OXP Distribution The All-in-One Guide to OXP Packaging and Distribution (and OXP_standards for advice on which ways of doing things are supported and which are not).
- Since the domain change to [1] the distribution of expansions has changed slightly. The new version is still subject to discussions and might change again. Here is a Publishing Procedure Comparison.
- 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.