= How to create Orxonox Levels =
[[TracNav(TracNav/TOC_CC_Tut)]]
== Create the basic file ==
1. Go to the folder __../data/levels__. The level files ending with .oxw are simple XML files and can be opened with any editor. Each level file stored in this folder can be selected later in Orxonox.
2. Copy „empty_level.oxw“ and paste it again in the folder.
3. Rename the copy. Try to use a name that sounds good. Avoid whitespace – use „_“ or CamelCase instead.
4. Open your level with your favourite editor.
== About XML ==
XML is a description language that looks similar to HTML. We use tags to describe objects:
{{{
#!xml
}}}
A tag can contain several attributes. An attribute is the place where a value is set.
{{{
#!xml
}}}
The syntax is attribute=“vaule(s)“. If only one value is set, the quotation marks are not necessary.
Tip: XML files do not have to be compiled. If you changed a level file (and didn't forget to save it), you simply have to reload the level to view the changes. In Linux you can switch between the game and the editor by pressing [alt] + [tab]. If you insert only a little error and try to load a level the game will „stuck“. By pressing [alt] + [tab] you can leave the game and view the error message on the terminal.
== First steps ==
1. Define the level's name in the menu. The "description" will be displayed, when a player hovers his mouse over your level's "name". This should be the first tag in the XML file.
{{{
#!xml
}}}
2. Decide wether you create a level for a gametype or a single player mission. A gametype is set in the tag.
{{{
#!xml
}}}
3. Set the levels backgroud. The level's background is called skybox and is an image of what you can seen on the horizon. You can add an new skybox by changing the corresponding parameter:
{{{
#!xml
}}}
Possible values for skybox are:
|| "Orxonox/Starbox" || "Orxonox/skypanoramagen1" || "Orxonox/skypanoramagen2" || "Orxonox/skyBoxMoreNebula" ||
== Basics ==
* Worldentity: Point in space with orientation ( ~point with a vector attached to it).
* Static Entity: Worldentity with a fixed position and fixed orientation.
* Movable Entity: Worldentity that can rotate or move constantly.
* Controllable Entity: Completely freely movable point. Usually steered by a controller.
* Model: Each visible 3d-Object. A model consists of a mesh (the form) and a material (the surface colouring).
* Collisionshape: A Collisionshape is the physical representation of a model. Currently collisionshapes only have the form of a sphere, cube/ashlar, cone or plain. For StaticEntities the collisionType is „static“. Movable Entities have the collisionType "dynamic". At the moment static collisionshapes do not provide a shield against bullets. The collision of projectiles is only detected by dynamic collisionshapes.
== Worldentity + Model + Collisionshape = adding objects to the level ==
{{{
#!xml
}}}
The StaticEntity defines the model's place and orientation (and some other values). The Model (a cube) is attached to the StaticEntity. With the proper sized collisionshape attached to the StaticEntity you have a "solid" cube. Without a collisionshape, the cube wouldn't be solid and your spaceship could just fly through it. This exampe is quite useful, since you usually can't see a collisionshape's size. If you combine a invisible collisionshape with a fitting model you can see where a collisionshape is for testing purposes.
== MovalbeEntity - Let's get the world moving==
Worldentities can be attached to other worldentities. If you want a model to move in circles, you can create a MovableEntity that rotates and a StaticEntity attached to it. The model that should be rotating is attached to the StaticEntity.
{{{
#!xml
}}}
Note that in this example there Model is created by a lua script that is called in a lua tag. Lua is a scripting language that is a very powerful tool for level design.
== Spawpoints ==
A Spawnpoint is the entrance point for controllable entities (spaceships). Without a spawnpoint no level can work!
{{{
#!xml
}}}
You can define which kind of spacecraft a player/ bots can use. Additionally the corresponding template has to be included:
|| '''pawndesign''' || '''include()''' || '''additional information'''||
||spaceshipassff||"templates/spaceship_assff.oxt"||default spaceship - equiped with rockets||
||spaceshippirate||"templates/spaceship_pirate.oxt"|| ||
||spaceshipswallow||"templates/spaceship_swallow.oxt"||fast||
||spaceshipHtwo||"templates/spaceship_H2.oxt"|| ||
||spaceshipghost||"templates/spaceship_ghost.oxt"||stealth aircraft ||
||spaceshipHXY||"templates/spaceship_HXY.oxt"||'''diffenrent steering''': you have to press the right mouse button to steer!||
||spaceshipHXYSL||"templates/spaceship_HXY_SL.oxt"||normal steering, really fast||
||spaceshipTransporterSL||"templates/spaceship_Transporter_SL.oxt"||slow transporter||
||spaceshipTransporter||"templates/spaceship_Transporter.oxt"||slow transporter, equal to SL version||
If the level is designed for several teams you have to use team spawn points.
{{{
#!xml
}}}
== [http://www.orxonox.net/doxygen/classorxonox_1_1_pickup_spawner.html Pickups] ==
Pickups give a player a tomporary bonus, if he is able to flight through the pickup. Bonuses are invisibility, health, boost, shield, a drone, ...
1. Include the pickups.
{{{
#!xml
}}}
2. Add a PickupSpawner. An invisible device that puts pickups in the level.
{{{
#!xml
}}}
* triggerDistance: Distance to collect the pickup. The larger the triggerDistance, the easier it is to get the pickup.
* respawnTime: After respawntime seconds a new pickup will appear, if the pickup had been collected.
* maxSpawnedItems: After maxSpawnedItems no further pickup will appear.