<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="main.css">
	<TITLE>Project::OSiRiON - Editing the world</TITLE>
</head>

<body>
<div class="banner">
	<img src="images/banner.png" ALT="Project::OSiRiON">
	<br>
	Editing the world
</div>

<div class="text">
<p>
	One of the goals of the project is to create a game world that is
	easy to adapt and extend. At the moment of writing, the game reads the 
	world description from <i>ini/world.ini</i> and a list of buyable ships 
	from <i>ini/ships.ini</i>. These ini-files are plain text files that can be
	edited with any text editor.
</p><p>
	The world description files are server-side. If you run	your own server
	you can modify the world to your and clients will automaticly join your
	modified world.
</p><p>
	I recommend you do not edit the original game data, copy the files you want
	to edit to your personal osirion directory. The files found in this directory will
	get precedence over the original game data. Your modified files will be used
	and the original files can still be updated when a new version is available.
</p><p>
	On Linux and other Unix-systems your personal osirion is a hidden directory called
	<i>.osirion</i> in your home directory.	On windows, your personal osirion directory
	is <i>My Documents\My Games\Osirion</i>.
</p>
</div>

<!-- =============================================================== -->
<div class="title">
	File structure
</div>

<div class="text">
<p>
	World description files use the windows ini-file syntax. These files contain one or more sections.
	Every section starts with a section name enclosed in square brackets and contains a list of 
	<i>value=key</i> pairs to describe the properties for the current section. 
	Lines starting with a semicolon are considered comments and are ignored.
</p><p>	
	For example, a section describing a planet called Seymour:
</p>

<pre class="code">
[planet]
label=seymour
name=planet Seymour
location=-128 1024 -32
color=1 .9 .5
texture=planets/seymour
radius=68
</pre>
</div>

<!-- =============================================================== -->

<div class="title">
	Textures
</div>
<div class="text">
<p>
	The engine supports textures in the TGA, PNG and JPG file formats, where required.
	The filename extension should be lowercase and in 24bit RGB or 32bit RGBA format.
</p>
</div>

<!-- =============================================================== -->

<div class="title">
	World
</div>
<div class="text">
<p>
	The file <i>world.ini</i> contains a list of zone labels. A zone is a seperate compartment in the gameworld,
	like a solar system or a remote sector in space. It contains a single <i>world</i> section containting multiple
	<i>zone</i> keys.
</p>
</div>

<div class="subtitle">
    [world] section
</div>

<div class="text">
<table>
	<tr>
		<td class="wide"><i>zone =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>the in-game label of a zone</td>
	</tr>
</table>
<p>
	<i>Note:</i> a label can only contain letters, numbers and underscores. Any other character is deleted. This applies to any label in any .ini-file.
</p>
<pre class="code">
; a world.ini with two zones
[world]
zone=ghant
zone=brogha
</pre>
</div>

<!-- =============================================================== -->

<div class="title">
	Zones
</div>

<div class="text">
<p>
	Each zone has its own zone description file. The actual name of the file depends on the zone label. 
	If your <i>world.ini</i> contains the line <i>zone=ghant</i>, the content of the zone with 
	the label <i>ghant</i> would be described in the file <i>zones/ghant.ini</i>.
</p><p>
	The .ini-file containts a list of objects populating that zone, and the basic properties of those
	objects. In the context of the engine, such an object is called an <i>entity</i>.
</p>
</div>

<div class="subtitle">
    [zone] section
</div>

<div class="text">
<p>
	Every zone description file has a <i>zone</i> section describing a few of its basic properties:
</p>
<table>
	<tr>
		<td class="wide"><i>name =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>the in-game name of the entity</td>
	</tr>
	<tr>
		<td class="wide"><i>sky =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>name of the skybox in the <i>textures/sky</i> directory</td>
	</tr>
	<tr>
		<td class="wide"><i>default =</i></td>
		<td class="narrow"><strong>[bool]</strong></td>
		<td>mark this zone as the default zone for the game, only one zone should have this key set to yes, can be omitted elsewhere</td>
	</tr>
</table>

<pre class="code">
; ghant.ini
; zone description file for the Ghant system
[zone]
name=Ghant system
sky=sky12
default=yes
</pre>

<p>
	If you use a skybox, the engine will look in the <i>textures/sky</i> directory for six images named
	<i>skybox_up</i>, <i>skybox_down</i>, <i>skybox_left</i>, <i>skybox_right</i>, <i>skybox_front</i> and <i>skybox_back</i>.
	The coordinates are setup to match the output of the <A href="http://alexcpeterson.com/spacescape">Spacescape</a> skybox generator
</p>
<p>
	If you want to use skyboxes made for quake3 you will have to convert them:
<ul>
	<li>The _left and _right images have to be swapped
	<li>The _up image has to be rotated, 90 degrees clockwise
	<li>The _down image has to be rotated, 90 degrees counter-clockwise
</ul>
</p>
</div>

<div class="subtitle">
	[entity] section
</div>

<div class="text">
<p>
	You can add several <i>entity</i> sections to define the objects occupying your zones. Entities come in two flavours: basic geometrical shapes and entities with models. Both have a similar	definition and set of properties. A simple <i>entity</i> is considered decoration by the engine and won't change direction or location.
</p><p>
	Every in-game entity should have a <i>label</i> key. If the entity in question is going to be used as a base, or any object the could be referenced in possible scripting, it should have a unique label. The label should be lowercase and not contain spaces. A player-friendly name can be provided through the <i>name</i> key.
</p>
<table>
	<tr>
		<td class="wide"><i>label =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>the in-game label of the entity</td>
	</tr>
	<tr>
		<td class="wide"><i>name =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>the in-game name of the entity</td>
	</tr>
	<tr>
		<td class="wide"><i>info =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>the in-game description, multiple <i>info</i> key can be used to add long descriptions </td>
	</tr>
</table>

<p>
	Set the <i>shape</i> key to define a basic geometrical shape:
</p>
<table>
	<tr>
		<td class="wide"><i>shape =</i></td>
		<td class="narrow"><strong>axis</strong></td>
		<td>a 3d-axis with X, Y and Z lines.
	</tr>
	<tr>
		<td class="wide"></td>
		<td class="narrow"><strong>cube</strong></td>
		<td>a cube</td>
	</tr>
	<tr>
		<td class="wide"></td>
		<td class="narrow"><strong>diamond</strong></td>
		<td>a rotating octahedron with an axis</td>
	</tr>
	<tr>
		<td class="wide"></td>
		<td class="narrow"><strong>sphere</strong></td>
		<td>a polyhedron approximation of a sphere</td>
	</tr>
</table>
<p>
	The size of the entity can be set with the <i>radius</i> key:
</p>
<table>
	<tr>
		<td class="wide"><i>radius =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>the radius of the entity in game units</td>
	</tr>
</table>
<p>
	1 game unit translates to 100m in-game, an entity with a radius of 0.5 
	would fit into a sphere with a diameter of 100m.
<p>

<p>
	An entity with a model can be created by setting the <i>model</i> key. The radius is automaticly calculated.
	A model can be a .map file or a .ase model.
</p>
<table>
	<tr>
		<td class="wide"><i>model =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>filename of the model, without extension</td>
	</tr>
</table>

<p>
	The <i>color</i> key sets the primary color of the entity. This color will be used to draw the entity in case of 
	a geometrical shape, or to draw model faces that have the <i>common/entity</i> texture. The default entity colour is white.
	The <i>colorsecond </i> key can be used to set the secondary color of entities with a model.
</p>
<table>
	<tr>
		<td class="wide"><i>color =</i></td>
		<td><strong>[float] [float] [float]</strong></td>
		<td>primary entity color RGB values with in the 0.0 - 1.0 or 0 - 255 range</td>
	</tr>
	<tr>
		<td class="wide"><i>colorsecond =</i></td>
		<td><strong>[float] [float] [float]</strong></td>
		<td>secondary entity color</td>
</table>
<p>
	The <i>location</i> sets the in-game position:
</p>

<table>
	<tr>
		<td class="wide"><i>location =</i></td>
		<td><strong>[float] [float] [float]</strong></td>
		<td>x, y, z values of the entity location, z is up</td>
	</tr>
</table>
<p>
	1 game unit on the x, y, or z-axis translates to 100m in-game.
</p><p>
	Orientation can be set thought the <i>direction</i>, <i>pitch</i>, and <i>roll</i> keys:
</p>
<table>
	<tr>
		<td class="wide"><i>direction =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>direction angle the entity is pointing to. 0 degrees is north, 90 degrees is west, default is 0
	</tr>
	<tr>
		<td class="wide"><i>pitch =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>pitch angle, default is 0<td>
	</tr>
	<tr>
		<td class="wide"><i>roll =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>roll angle, default is 0<td>
	</tr>
</table>
<p>
	An example of an entity with a basic shape:
</p>

<pre class="code">
[entity]
label=origin
name=Galactic origin
shape=axis
radius=1
location=0 0 0
; yellow
color=1 1 0
; description
info=The Galactic origin is a turbulent area filled with hot plasma, ion storms and magnetic radiation.
info=Travelers entering this region do so on their own risk.
</pre>

<p>
	An example of an entity with a model:
</p>
<pre class="code">
[entity]
label=ikarus
name=Ikarus satellite
model=maps/satellites/ikarus
; blue
color=100 100 230
location=64 0 0
direction=120
pitch=15
</pre>
</div>

<div class="subtitle">
	[station]
</div>

<div class="text">
<p>
	A <i>station</i> section defines an entity that can be visited by a player. This section
	can contain the same keys as the <i>entity</i> section, but the entity will be marked as 
	dockable and the player will be able to target it for docking.
</p>

<pre class="code">
[station]
label=alexandria
name=Alexandria outpost
model=maps/stations/alexandria
location=-192 -704 32
; brown
color=222 192 145
direction=45
</pre>
</div>

<div class="subtitle">
	[navpoint]
</div>
<div class="text">
<p>
	Space is huge and barren wasteland.  Navigation points are an easy way to provide players
	with landmarks. The default navigation point is a diamond-shaped entity.
</p>
<pre class="code">
[navpoint]
label=navpoint_east
name=Navigation point East
location=716 -1008 20
</pre>
</div>

<div class="subtitle">
	[jumppoint]
</div>
<div class="text">
<p>
	Jumppoints are the key to interstellar travel. A ship equiped with a hyperspace
	jump drive can use it to travel to other starsystems. A jumppoint looks like a
	navigation point, but needs the <i>target</i> key to indicate where it is leading to.
</p>

<table>
	<tr>
		<td class="wide"><i>target =</i></td>
		<td class="narrow"><strong>[string]:[string]</strong></td>
		<td><i>zone</i>:<i>entity</i> the label of the target zone and jumppoint.
		<td>
	</tr>
</table>
</div>
<div class="subtitle">
	[jumpgate]
</div>
<div class="text">
<p>
	Jumpgates are build on top of jumppoints and can be docked by smaller ships
	to travel to other starsystems. Just like the jumppoint section, the <i>jumpgate</i>
	section needs a <i>target</i> to indicate where it is leading to.
<p>
	Jumppoints and jumpgates can target each other and ships equiped with a hyperspace
	jumpdrive can still use the jumpgate to jump as usual.
</p>
<pre class="code">
[jumpgate]
label=jumpgate_brogha
name=Jumpgate Ghant -> Brogha
model=maps/satellites/jumpgate
target=brogha:jumpgate_ghant
location=716 -1024 24
direction=90
color=222 192 145
</pre>
</div>

<div class="subtitle">
	[planet]
</div>
<div class="text">
<p>
	A planet is spherical entity with a texture and a default radius of 64. The planet globe will
	be rendered with lighting enabled. A planet can be marked as dockable. In this case it can be
    visited by a player and menu descriptions will be loaded.
</p>
<table>
	<tr>
		<td class="wide"><i>texture =</i></td>
		<td class="narrow"><strong>[string]</strong></td>
		<td>name of the planet texture in <i>textures</i> directory</td>
	</tr>
	<tr>
		<td class="wide"><i>rotationspeed =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>rotation speed in degrees per second</td>
	</tr>
	<tr>
		<td class="wide"><i>dock =</i></td>
		<td class="narrow"><strong>[bool]</strong></td>
		<td>set to true to create a planet the players can visit</td>
	</tr>
</table>

<pre class="code">
; The iceworld, a very dark and cold place
[planet]
label=iceworld
name=The World of Ice
texture=planets/iceworld
rotationspeed=1
; a grey-blue colour
color=0.5 0.5 0.8
</pre>
</div>

<div class="subtitle">
	[star]
</div>
<div class="text">
<p>
	A star is a spherical entity with a default radius of 96. The star globe 
	will be rendered fullbright and serves as the main source of light for a zone. 
	At the moment only one system light source is supported. If you define multiple stars, 
	the last one will serve as light source. Stars can have a texture like planets.
</p>

<pre class="code">
; a white dwarf
[star]
label=whitedwarf
name=White Dwarf
color=1.0 1.0 0.9
radius=96
</pre>

<p>
	Consult the <a href="http://en.wikipedia.org/wiki/Stellar_classification">wikipedia article on stellar classification</a>
	and <a href="http://en.wikipedia.org/wiki/File:Morgan-Keenan_spectral_classification.png">this image</a>.
</p>
</div>

<div class="subtitle">
	[ship]
</div>
<div class="text">
<p>
	Some planets and stations have ship dealers where players can buy a new ship. [station] and [planet]
	sections can be followed by one or more [ship] sections to add ship models that can be purchased 
	on that location.
</p>
<pre class="code">
; station definition
[station]
label=alexendria
.
. more station definitions
.

	; the Micron Vector is sold here
	[ship]
	label=vector

	; the P.O.D. is sold here
	[ship]
	label=pod
</pre>
<p>
	Indenting the [ship] sections like in the example above is not required,
	but it improves readability. The <i>label</i> key is mandatory and referes to
	a ship type as defined in ships.ini.
</p>
</div>

<div class="subtitle">
	[cargo]
</div>
<div class="text">
<p>
	Cargo trade is defined similar to ship dealers. [station] and [planet] sections can be followed 
	by one or more [cargo] section to add specific items to the trader's inventory. The <i>label</i>
	key is mandatory and referes to a cargo type as defined in cargo.ini. 
	The <i>price</i> and <i>amount</i> keys> can be used to set the most important trading parameters.
</p>
<table>
	<tr>
		<td class="wide"><i>price =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>price this type of cargo is bought and sold at</td>
	</tr>
	<tr>
		<td class="wide"><i>amount =</i></td>
		<td class="narrow"><strong>[float]</strong></td>
		<td>initial amount of available cargo. The default is -1 and means unlimited. 
		   0 means this type of cargo can only be sold here.</td>
	</tr>
</table>

<pre class="code">
; station definition
[station]
label=alexendria
.
. more station definitions
.
	; this station buys and sells crates at 25 credits per unit
	[cargo]
	label=crates
	price=25

	; this station buys niobium at 200 credits per unit
	[cargo]
	label=niobium
	price=200
	amount=0
</pre>
</div>

<!-- =============================================================== -->

<div class="title">
	Ship definitions
</div>
<div class="text">
	
<p>
	The list of a available ship types is read from the file <i>ships.ini</i>.
</p>
<p>
	<i>TODO: add more text</i>
</p>
</div>

<!-- =============================================================== -->

<div class="title">
	Cargo definitions
</div>
<div class="text">
<p>
	The list of available cargo types is read from the file <i>cargo.ini</i>.
</p>
<p>
	<i>TODO: add more text</i>
</p>
</div>

<!-- =============================================================== -->

</body>
</html>