Index: code/trunk/data/defaultConfig/keybindings.ini
===================================================================
--- code/trunk/data/defaultConfig/keybindings.ini	(revision 8952)
+++ code/trunk/data/defaultConfig/keybindings.ini	(revision 9016)
@@ -71,6 +71,6 @@
 KeyNumLock=
 KeyNumRow0=
-KeyNumRow1=
-KeyNumRow2=
+KeyNumRow1="toggleFormationFlight"
+KeyNumRow2="FFChangeMode"
 KeyNumRow3=
 KeyNumRow4=
Index: code/trunk/data/gui/layouts/CreditsMenu.layout
===================================================================
--- code/trunk/data/gui/layouts/CreditsMenu.layout	(revision 8952)
+++ code/trunk/data/gui/layouts/CreditsMenu.layout	(revision 9016)
@@ -7,5 +7,5 @@
         <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
         <Window Type="MenuWidgets/StaticText" Name="orxonox/CreditsWindow" >
-            <Property Name="Text" Value="Keybindings" />
+            <Property Name="Text" Value="Credits" />
             <Property Name="Alpha" Value="0.8" />
             <Property Name="InheritsAlpha" Value="False" />
@@ -15,5 +15,4 @@
             <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" />
             <Window Type="MenuWidgets/StaticText" Name="orxonox/CreditsMenuWrapper" >
-                <Property Name="TextColours" Value="FF4444FF" />
                 <Property Name="InheritsAlpha" Value="False" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
@@ -27,5 +26,5 @@
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                     <Property Name="HorzOverlapSize" Value="0.01" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.997,0},{0.997,0}}" />
                     <Property Name="VertOverlapSize" Value="0.01" />
                     <Property Name="HorzScrollPosition" Value="0" />
@@ -38,14 +37,13 @@
                         <Property Name="VertFormatting" Value="TopAligned" />
                         <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
-                        <Property Name="Text">wird sowieso nicht gelesen
-Orxonox version 0.0.3
-
-Programming Language:  C++ - lua - tcl
-Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE
-Licence:  GNU General Public Licence - Creative Commons
-
-das ist mein text höhö
-
-http://www.orxonox.net
+                        <Property Name="Text">Orxonox version 0.0.3
+    
+    Programming Language:  C++ - lua - tcl
+    Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE
+    Licence:  GNU General Public Licence - Creative Commons
+    
+    http://www.orxonox.net
+    
+    Credits:
                       </Property>
                     </Window>
@@ -61,7 +59,2 @@
     </Window>
 </GUILayout>
-
-
-
-
-
Index: code/trunk/data/gui/layouts/MiscConfigMenu.layout
===================================================================
--- code/trunk/data/gui/layouts/MiscConfigMenu.layout	(revision 8952)
+++ code/trunk/data/gui/layouts/MiscConfigMenu.layout	(revision 9016)
@@ -2,8 +2,10 @@
 
 <GUILayout >
-    <Window Type="DefaultWindow" Name="orxonox/MiscConfigMenu/Background" >
+    <Window Type="MenuWidgets/StaticImage" Name="orxonox/MiscConfigMenu/Background" >
+        <Property Name="FrameEnabled" Value="False" />
         <Property Name="InheritsAlpha" Value="False" />
         <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
         <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
         <Window Type="MenuWidgets/StaticText" Name="orxonox/MicsConfigMenu/ConfigWindow" >
             <Property Name="Text" Value="Miscellaneous" />
@@ -34,9 +36,15 @@
             </Window>
         </Window>
-        <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/MiscConfigBackButton" >
-            <Property Name="Text" Value="Back" />
+        <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/CancelButton" >
+            <Property Name="Text" Value="Cancel" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
-            <Event Name="Clicked" Function="MiscConfigMenu.MiscConfigBackButton_clicked"/>
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.725,0},{0.4,0},{0.775,0}}" />
+            <Event Name="Clicked" Function="MiscConfigMenu.MiscConfigCancelButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/MiscConfigMenu/OKButton" >
+            <Property Name="Text" Value="OK" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" />
+            <Event Name="Clicked" Function="MiscConfigMenu.MiscConfigOKButton_clicked"/>
         </Window>
     </Window>
Index: code/trunk/data/gui/layouts/SingleplayerConfigMenu.layout
===================================================================
--- code/trunk/data/gui/layouts/SingleplayerConfigMenu.layout	(revision 9016)
+++ code/trunk/data/gui/layouts/SingleplayerConfigMenu.layout	(revision 9016)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="MenuWidgets/StaticImage" Name="orxonox/SingleplayerConfigMenu/Background" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Window Type="MenuWidgets/StaticText" Name="orxonox/SingleplayerConfigMenu/ConfigWindow" >
+            <Property Name="Text" Value="Config" />
+            <Property Name="Alpha" Value="0.8" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="VertFormatting" Value="TopAligned" />
+            <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" />
+            <Window Type="MenuWidgets/StaticText" Name="orxonox/SingleplayerConfigMenu/Wrapper" >
+                <Property Name="TextColours" Value="FF4444FF" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="HorzFormatting" Value="HorzCentred" />
+                <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
+                <Window Type="MenuWidgets/ScrollablePane" Name="orxonox/SingleplayerConfigMenu/MiscConfigPane" >
+                    <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
+                    <Property Name="HorzStepSize" Value="0.005" />
+                    <Property Name="VertStepSize" Value="0.005" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="HorzOverlapSize" Value="0.01" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" />
+                    <Property Name="VertOverlapSize" Value="0.01" />
+                    <Property Name="HorzScrollPosition" Value="0" />
+                    <Property Name="VertScrollPosition" Value="0" />
+                </Window>
+            </Window>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerConfigMenu/CancelButton" >
+            <Property Name="Text" Value="Cancel" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.725,0},{0.4,0},{0.775,0}}" />
+            <Event Name="Clicked" Function="SingleplayerConfigMenu.SingleplayerConfigCancelButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerConfigMenu/OKButton" >
+            <Property Name="Text" Value="OK" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" />
+            <Event Name="Clicked" Function="SingleplayerConfigMenu.SingleplayerConfigOKButton_clicked"/>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/trunk/data/gui/layouts/SingleplayerMenu.layout
===================================================================
--- code/trunk/data/gui/layouts/SingleplayerMenu.layout	(revision 8952)
+++ code/trunk/data/gui/layouts/SingleplayerMenu.layout	(revision 9016)
@@ -15,14 +15,22 @@
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="VertFormatting" Value="TopAligned" />
-            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
-            <Window Type="MenuWidgets/Listbox" Name="orxonox/SingleplayerLevelListbox" >
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.15,0},{0.8,0},{0.7,0}}" />
+            <Window Type="MenuWidgets/TabControl" Name="orxonox/SingleplayerTabControl" >
+                <Property Name="TabHeight" Value="{0,26.4388}" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
+                <Property Name="TabPanePosition" Value="Top" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.95,0},{0.925,0}}" />
             </Window>
-            <Window Type="MenuWidgets/Checkbox" Name="orxonox/SingleplayerShowAllCheckbox" >
-                <Property Name="Text" Value="show all" />
+            <Window Type="MenuWidgets/StaticImage" Name="orxonox/SingleplayerLevelImage" >
+                <Property Name="AlwaysOnTop" Value="True" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.65,0},{0.87,0},{0.8,0},{.97,0}}" />
-                <Event Name="CheckStateChanged" Function="SingleplayerMenu.SingleplayerShowAll_clicked"/>
+                <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.25,0},{0.9,0},{0.675,0}}" />
+            </Window>
+            <Window Type="MenuWidgets/StaticText" Name="orxonox/SingleplayerLevelDescription" >
+                <Property Name="AlwaysOnTop" Value="True" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="VertScrollbar" Value="True" />
+                <Property Name="HorzScrollbar" Value="True" />
+                <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.725,0},{0.9,0},{0.875,0}}" />
             </Window>
         </Window>
@@ -30,11 +38,18 @@
             <Property Name="Text" Value="Start" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.725,0},{0.4,0},{0.775,0}}" />
             <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerStartButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerConfigButton" >
+            <Property Name="Text" Value="Configure" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.425,0},{0.725,0},{0.575,0},{0.775,0}}" />
+            <Property Name="Disabled" Value="True" />
+            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerConfigButton_clicked"/>
         </Window>
         <Window Type="MenuWidgets/Button" Name="orxonox/SingleplayerBackButton" >
             <Property Name="Text" Value="Back" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" />
             <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/>
         </Window>
Index: code/trunk/data/gui/scripts/CreditsMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/CreditsMenu.lua	(revision 8952)
+++ code/trunk/data/gui/scripts/CreditsMenu.lua	(revision 9016)
@@ -14,16 +14,7 @@
 function P.onShow()
     local description = winMgr:getWindow("orxonox/CreditsText")
-    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
-    description:setProperty("VertFormatting", "TopAligned")
-    description:setText("                                   Orxonox version 0.0.3 \n \
-      Programming Language:  C++ - lua - tcl  \
-      Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE  \
-      Licence:  GNU General Public Licence - Creative Commons \n  \
-      http://www.orxonox.net \n \
-      Credits:")
 
-    description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
     height = getStaticTextWindowHeight(description)
-    description:setHeight(CEGUI.UDim(0, height))
+    description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(0.0, height)))
 end
 
Index: code/trunk/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/InGameMenu.lua	(revision 8952)
+++ code/trunk/data/gui/scripts/InGameMenu.lua	(revision 9016)
@@ -43,10 +43,9 @@
 -- events for ingamemenu
 function P.button_quit_clicked(e)
-    openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback )
+    openDecisionPopup( "Do you really want to quit the game?", InGameMenu.exitCallback )
 end
 
 function P.button_mainmenu_clicked(e)
-    orxonox.execute("startMainMenu")
-    hideMenuSheet("InGameMenu")
+    openDecisionPopup( "Do you really want to return to the main menu?", InGameMenu.mainMenuCallback )
 end
 
@@ -59,5 +58,14 @@
 end
 
-function P.callback(doExit)
+function P.mainMenuCallback(doExit)
+    if doExit then
+        orxonox.execute("startMainMenu")
+        hideMenuSheet("InGameMenu")
+    else
+        P.onShow()
+    end
+end
+
+function P.exitCallback(doExit)
     if doExit then
         hideMenuSheet("InGameMenu")
Index: code/trunk/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MiscConfigMenu.lua	(revision 8952)
+++ code/trunk/data/gui/scripts/MiscConfigMenu.lua	(revision 9016)
@@ -11,5 +11,5 @@
 P.lineHeight = 0
 P.commandWidth = 0
-P.configWidth = 0
+P.editboxWidth = 0
 P.resetWidth = 0
 P.spaceWidth = 0
@@ -36,4 +36,6 @@
     table.insert(P.commandList, "ChatOverlay displayTime_")
     table.insert(P.commandList, "Core bDevMode_")
+    table.insert(P.commandList, "HUDNavigation MarkerLimit_")
+    table.insert(P.commandList, "HUDNavigation showDistance")
 
     P.nameList = {}
@@ -56,4 +58,6 @@
     table.insert(P.nameList, "Chat: display time")
     table.insert(P.nameList, "Developer's Mode")
+    table.insert(P.nameList, "Marker Limit")
+    table.insert(P.nameList, "Show Distance next to cursor")
 
     P.linesList = {}
@@ -75,19 +79,24 @@
     end
 
-    P.sampleWindow:setText("configure")
-    size = getMinTextSize(P.sampleWindow)
-    P.configWidth = size[2]+20
-
     P.sampleWindow:setText("reset")
     size = getMinTextSize(P.sampleWindow)
     P.resetWidth = size[2]+20
 
-    P.spaceWidth = math.floor(1/8*P.configWidth)
+    P.spaceWidth = 10
+    
+    local pane = tolua.cast(winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane")
+    size = pane:getViewableArea()
+    P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth
 
     P.createLines()
 
     P:setButton(1, 1, {
-            ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigBackButton"),
-            ["callback"]  = P.MiscConfigBackButton_clicked
+            ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/CancelButton"),
+            ["callback"]  = P.MiscConfigCancelButton_clicked
+    })
+    
+    P:setButton(1, 2, {
+            ["button"] = winMgr:getWindow("orxonox/MiscConfigMenu/OKButton"),
+            ["callback"]  = P.MiscConfigOKButton_clicked
     })
 end
@@ -95,8 +104,10 @@
 function P.createLine(k)
     local offset = 0
+    -- content window for the entire line
     local line = winMgr:createWindow("DefaultWindow", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k)
     line:setHeight(CEGUI.UDim(0, P.lineHeight))
     line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
 
+    -- config name
     local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")
     command:setText(P.nameList[k])
@@ -106,29 +117,22 @@
     offset = offset + P.commandWidth + P.spaceWidth
 
+    -- config value (editable)
     local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
     configvalue:setProperty("ReadOnly", "set:False")
     local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])
     configvalue:setText(value)
-    P.sampleWindow:setText(value)
-    local size = getMinTextSize(P.sampleWindow)
-    local configvalueWidth = 2*size[2]
-    configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, configvalueWidth), CEGUI.UDim(0.9, 0)))
+    configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))
     configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
+    -- enable the reset button if the value changed
+    orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".MiscConfigEditbox_textAccepted")
     line:addChildWindow(configvalue)
-    offset = offset + configvalueWidth + P.spaceWidth
-
-    local config = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Config")
-    config:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.configWidth), CEGUI.UDim(0.9, 0)))
-    config:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
-    config:setText("configure")
-    orxonox.GUIManager:subscribeEventHelper(config, "Clicked", P.name .. ".MiscConfigConfigure_clicked")
-    line:addChildWindow(config)
-    offset = offset + P.configWidth + P.spaceWidth
-
+    offset = offset + P.editboxWidth + P.spaceWidth
+
+    -- reset button (only available when value changed)
     local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
     reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
     reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
     reset:setText("reset")
-    orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigReset_clicked")
+    orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".MiscConfigResetButton_clicked")
     line:addChildWindow(reset)
     reset:setEnabled(false)
@@ -153,5 +157,21 @@
 end
 
-function P.MiscConfigReset_clicked(e)
+function P.MiscConfigOKButton_clicked(e)
+    for k,v in pairs(P.commandList) do
+        -- save the changes
+        local editbox = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
+        orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText())
+        local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
+        resetButton:setEnabled(false)
+    end
+    
+    hideMenuSheet("MiscConfigMenu")
+end
+
+function P.MiscConfigCancelButton_clicked(e)
+    hideMenuSheet("MiscConfigMenu")
+end
+
+function P.MiscConfigEditbox_textAccepted(e)
     local we = CEGUI.toWindowEventArgs(e)
     local name = we.window:getName()
@@ -160,8 +180,9 @@
     local commandNr = tonumber(match())
 
-    -- TODO: Implement reset.
-end
-
-function P.MiscConfigConfigure_clicked(e)
+    local resetButton = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
+    resetButton:setEnabled(true)
+end
+
+function P.MiscConfigResetButton_clicked(e)
     local we = CEGUI.toWindowEventArgs(e)
     local name = we.window:getName()
@@ -170,13 +191,10 @@
     local commandNr = tonumber(match())
 
-    local window = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
-
-    orxonox.CommandExecutor:execute("config " .. P.commandList[commandNr] .. " " .. window:getText())
+    -- reload the old value
+    local editbox = winMgr:getWindow("orxonox/MiscConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
     local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr])
-    window:setText(value)
-end
-
-function P.MiscConfigBackButton_clicked(e)
-    hideMenuSheet("MiscConfigMenu")
+    editbox:setText(value)
+    
+    we.window:setEnabled(false)
 end
 
Index: code/trunk/data/gui/scripts/SingleplayerConfigMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/SingleplayerConfigMenu.lua	(revision 9016)
+++ code/trunk/data/gui/scripts/SingleplayerConfigMenu.lua	(revision 9016)
@@ -0,0 +1,198 @@
+-- SingleplayerMenu.lua
+
+local P = createMenuSheet("SingleplayerConfigMenu")
+
+P.commandList = {}
+P.nameList = {}
+P.linesList = {}
+
+P.sampleWindow = nil
+
+P.lineHeight = 0
+P.commandWidth = 0
+P.editboxWidth = 0
+P.resetWidth = 0
+P.spaceWidth = 0
+
+function P.onLoad()
+    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/SampleWindow")
+    P.sampleWindow:setText("SampleText")
+
+    P:setButton(1, 1, {
+            ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/CancelButton"),
+            ["callback"]  = P.SingleplayerConfigCancelButton_clicked
+    })
+    
+    P:setButton(1, 2, {
+            ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/OKButton"),
+            ["callback"]  = P.SingleplayerConfigOKButton_clicked
+    })
+end
+
+function P.loadConfig(level)
+    P.commandList = {}
+    table.insert(P.commandList, "Gametype initialStartCountdown_")
+    table.insert(P.commandList, "Gametype bAutoStart_")
+    table.insert(P.commandList, "Gametype numberOfBots_")
+    table.insert(P.commandList, "Dynamicmatch gameTime_")
+    table.insert(P.commandList, "Dynamicmatch friendlyfire")
+    table.insert(P.commandList, "Dynamicmatch tutorial")
+    table.insert(P.commandList, "LastManStanding lives")
+    table.insert(P.commandList, "LastManStanding respawnDelay")
+    table.insert(P.commandList, "LastManStanding bNoPunishment")
+    table.insert(P.commandList, "LastManStanding bHardPunishment")
+    table.insert(P.commandList, "LastTeamStanding lives")
+    table.insert(P.commandList, "LastTeamStanding respawnDelay")
+    table.insert(P.commandList, "LastTeamStanding bNoPunishment")
+    table.insert(P.commandList, "LastTeamStanding bHardPunishment")
+    table.insert(P.commandList, "TeamDeathmatch teams_")
+    table.insert(P.commandList, "UnderAttack gameTime_")
+
+    P.nameList = {}
+    table.insert(P.nameList, "Start countdown")
+    table.insert(P.nameList, "Autostart")
+    table.insert(P.nameList, "Number of Bots")
+    table.insert(P.nameList, "Dynamicmatch: game time")
+    table.insert(P.nameList, "Dynamicmatch: friendly fire")
+    table.insert(P.nameList, "Dynamicmatch: tutorial")
+    table.insert(P.nameList, "LastManStanding: lives")
+    table.insert(P.nameList, "LastManStanding: respawn delay")
+    table.insert(P.nameList, "LastManStanding: no punishment")
+    table.insert(P.nameList, "LastManStanding: hard punishment")
+    table.insert(P.nameList, "LastTeamStanding: lives")
+    table.insert(P.nameList, "LastTeamStanding: respawn delay")
+    table.insert(P.nameList, "LastTeamStanding: no punishment")
+    table.insert(P.nameList, "LastTeamStanding: hard punishment")
+    table.insert(P.nameList, "TeamDeathmatch: Number of teams")
+    table.insert(P.nameList, "UnderAttack: game time")
+
+    P.linesList = {}
+    
+    --Calculate design parameters:
+    local size = getMinTextSize(P.sampleWindow)
+    P.lineHeight = size[1]
+
+    P.commandWidth = 0
+    for k,v in pairs(P.commandList) do
+        P.sampleWindow:setText(P.nameList[k])
+        size = getMinTextSize(P.sampleWindow)
+        if size[2] > P.commandWidth then
+            P.commandWidth = size[2]
+        end
+    end
+
+    P.sampleWindow:setText("reset")
+    size = getMinTextSize(P.sampleWindow)
+    P.resetWidth = size[2]+20
+
+    P.spaceWidth = 10
+    
+    local pane = tolua.cast(winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane")
+    size = pane:getViewableArea()
+    P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth
+
+    P.createLines()
+end
+
+function P.createLine(k)
+    local offset = 0
+    -- destroy config line, if it already exists (otherwise would cause an error)
+    if winMgr:isWindowPresent("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) then
+        winMgr:destroyWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)
+    end
+    -- content window for the entire line
+    local line = winMgr:createWindow("DefaultWindow", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)
+    line:setHeight(CEGUI.UDim(0, P.lineHeight))
+    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
+
+    -- config name
+    local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")
+    command:setText(P.nameList[k])
+    command:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
+    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
+    line:addChildWindow(command)
+    offset = offset + P.commandWidth + P.spaceWidth
+
+    -- config value (editable)
+    local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
+    configvalue:setProperty("ReadOnly", "set:False")
+    local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])
+    configvalue:setText(value)
+    configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))
+    configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
+    -- enable the reset button if the value changed
+    orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".SingleplayerConfigEditbox_textAccepted")
+    line:addChildWindow(configvalue)
+    offset = offset + P.editboxWidth + P.spaceWidth
+
+    -- reset button (only available when value changed)
+    local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
+    reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
+    reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
+    reset:setText("reset")
+    orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".SingleplayerConfigResetButton_clicked")
+    line:addChildWindow(reset)
+    reset:setEnabled(false)
+    offset = offset + P.resetWidth + P.spaceWidth
+
+    line:setWidth(CEGUI.UDim(0, offset))
+
+    return line
+end
+
+function P.createLines()
+    local window = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane")
+
+    for k,v in pairs(P.commandList) do
+        local line = P.createLine(k)
+        table.insert(P.linesList, line)
+        window:addChildWindow(line)
+    end
+
+    local pane = tolua.cast(window, "CEGUI::ScrollablePane")
+    pane:setVerticalStepSize(getScrollingStepSize(window))
+end
+
+function P.SingleplayerConfigOKButton_clicked(e)
+    for k,v in pairs(P.commandList) do
+        -- save the changes
+        local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
+        orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText())
+        local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
+        resetButton:setEnabled(false)
+    end
+    
+    hideMenuSheet("SingleplayerConfigMenu")
+end
+
+function P.SingleplayerConfigCancelButton_clicked(e)
+    hideMenuSheet("SingleplayerConfigMenu")
+end
+
+function P.SingleplayerConfigEditbox_textAccepted(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+
+    local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
+    resetButton:setEnabled(true)
+end
+
+function P.SingleplayerConfigResetButton_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "%d+")
+    local commandNr = tonumber(match())
+
+    -- reload the old value
+    local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
+    local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr])
+    editbox:setText(value)
+    
+    we.window:setEnabled(false)
+end
+
+return P
Index: code/trunk/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/SingleplayerMenu.lua	(revision 8952)
+++ code/trunk/data/gui/scripts/SingleplayerMenu.lua	(revision 9016)
@@ -4,14 +4,23 @@
 
 P.levelList = {}
-P.itemList = {}
-P.showAll = false
+P.activeTabIndexes = {}
+P.scrollbarWidth = 13
 
 function P.onLoad()
-    local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
-    local button = tolua.cast(window,"CEGUI::Checkbox")
-    button:setSelected(false)
     P.createLevelList()
-
-    --buttons are arranged in a 1x2 matrix
+    
+    -- create tabs with desired tab as argument (nil for all)
+    P.createFilterTab("Gametypes", "gametype")
+    P.createFilterTab("Missions", "mission")
+    P.createFilterTab("Minigames", "minigame")
+    P.createFilterTab("Showcases", "showcase")
+    P.createFilterTab("Presentations", "presentation")
+    P.createFilterTab("Tests", "test")
+    P.createFilterTab("Show All", nil)
+    
+    -- update description and screenshot boxes
+    P.SingleplayerSelectionChanged()
+    
+    --buttons are arranged in a 1x3 matrix
     P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
@@ -20,4 +29,9 @@
 
     P:setButton(1, 2, {
+            ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigButton"),
+            ["callback"]  = P.SingleplayerConfigButton_clicked
+    })
+
+    P:setButton(1, 3, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
             ["callback"]  = P.SingleplayerBackButton_clicked
@@ -25,21 +39,6 @@
 end
 
-function P.onShow()
-    if P.showAll ~= orxonox.GUIManager:inDevMode() then
-        local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
-        local button = tolua.cast(window,"CEGUI::Checkbox")
-        P.showAll = not P.showAll
-        button:setSelected(P.showAll)
-        P.createLevelList()
-    end
-end
-
 function P.createLevelList()
     P.levelList = {}
-    P.itemList = {}
-    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))
-    listbox:resetList()
-    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
-    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
     local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
     local index = 0
@@ -48,43 +47,111 @@
         level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
         if level ~= nil then
-            if P.showAll or not level:hasTag("test") then
-                table.insert(P.levelList, level)
+            local levelXMLFilename = level:getXMLFilename()
+            -- create an imageset for each screenshot
+            local imageName = level:getScreenshot()
+            if imageName ~= "" then
+                CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, imageName)
+            else
+                CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile(levelXMLFilename..imageName, "noscreenshot.png")
             end
+            table.insert(P.levelList, level)
         end
         index = index + 1
     end
+end
 
+function P.createFilterTab(name, tag)
+    -- create unique tab window name
+    local tabName = "orxonox/SingleplayerLevelTab"
+    if tag ~= nil then
+        tabName = tabName..tag
+    end
+    -- create new tab window with desired name
+    local listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
+    listbox:setText(name)
+    listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
+    listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}")
+    -- fill listbox with items
+    listbox:resetList()
+    orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
+    local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
+    local tabIndexes = {}
     for k,v in pairs(P.levelList) do
-        local item = CEGUI.createListboxTextItem(v:getName())
-        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
-        listbox:addItem(item)
-        if v:getXMLFilename() == preselect then
-            listbox:setItemSelectState(item, true)
+        -- only add level if it has desired tag
+        if tag == nil or v:hasTag(tag) then
+            local item = CEGUI.createListboxTextItem(v:getName())
+            item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+            listbox:addItem(item)
+            table.insert(tabIndexes, k)
+            if v:getXMLFilename() == preselect then
+                listbox:setItemSelectState(item, true)
+            end
+            orxonox.GUIManager:setTooltipTextHelper(item, v:getDescription())
         end
-        P.itemList[k] = listbox:getListboxItemFromIndex(k-1)
-        orxonox.GUIManager:setTooltipTextHelper(P.itemList[k], v:getDescription())
+    end
+    table.insert(P.activeTabIndexes, tabIndexes)
+    -- listen to selection changes
+    orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".SingleplayerSelectionChanged")
+    local tabControl = winMgr:getWindow("orxonox/SingleplayerTabControl")
+    orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".SingleplayerSelectionChanged")
+    if listbox:getItemCount() > 0 then
+        tabControl:addChildWindow(tabName)
+    end
+end
+
+function P.SingleplayerGetSelectedLevel()
+    -- choose the active listbox
+    local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/SingleplayerTabControl"))
+    local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex()))
+    local choice = listbox:getFirstSelectedItem()
+    if choice ~= nil then
+        -- get the right tab and the right index
+        local tabIndexes = P.activeTabIndexes[tabControl:getSelectedTabIndex()+1]
+        local index = tabIndexes[listbox:getItemIndex(choice)+1]
+        return P.levelList[index]
+    else
+        return nil
+    end
+end
+
+function P.SingleplayerSelectionChanged(e)
+    local levelImage = winMgr:getWindow("orxonox/SingleplayerLevelImage")
+    local levelDescription = winMgr:getWindow("orxonox/SingleplayerLevelDescription")
+    local configButton = winMgr:getWindow("orxonox/SingleplayerConfigButton")
+    local level = P.SingleplayerGetSelectedLevel()
+    if level ~= nil then
+        local levelXMLFilename = level:getXMLFilename()
+        local imageName = level:getScreenshot()
+        -- set the screenshot and the description for the selected level
+        levelImage:setProperty("Image", "set:"..levelXMLFilename..imageName.." image:full_image")
+        levelDescription:setText(level:getDescription())
+        -- only enable config button for "gametype" levels
+        if level:hasTag("gametype") then
+            configButton:setProperty("Disabled", "False")
+        else
+            configButton:setProperty("Disabled", "True")
+        end
+    else
+        -- also take care of "no level selected"
+        levelImage:setProperty("Image", nil)
+        levelDescription:setText("")
+        configButton:setProperty("Disabled", "True")
     end
 end
 
 function P.SingleplayerStartButton_clicked(e)
-    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/SingleplayerLevelListbox"))
-    local choice = listbox:getFirstSelectedItem()
-    if choice ~= nil then
-        local index = listbox:getItemIndex(choice)
-        local level = P.levelList[index+1]
-        if level ~= nil then
-            orxonox.execute("startGame " .. level:getXMLFilename())
-            hideAllMenuSheets()
-        end
+    local level = P.SingleplayerGetSelectedLevel()
+    if level ~= nil then
+        orxonox.execute("startGame " .. level:getXMLFilename())
+        hideAllMenuSheets()
     end
 end
 
-function P.SingleplayerShowAll_clicked(e)
-    local checkbox = tolua.cast(winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox"), "CEGUI::Checkbox")
-    local show = checkbox:isSelected()
-    if show ~= P.showAll then
-        P.showAll = show
-        P.createLevelList()
-   end
+function P.SingleplayerConfigButton_clicked(e)
+    local level = P.SingleplayerGetSelectedLevel()
+    if level ~= nil then
+        local configMenu = showMenuSheet("SingleplayerConfigMenu")
+        configMenu:loadConfig(level)
+    end
 end
 
@@ -94,3 +161,2 @@
 
 return P
-
Index: code/trunk/data/levels/FPSTest.oxw
===================================================================
--- code/trunk/data/levels/FPSTest.oxw	(revision 8952)
+++ code/trunk/data/levels/FPSTest.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level to test First Person Shooter"
  tags = "test"
+ screenshot = "fpstestlevel.png"
 />
 
@@ -14,8 +15,5 @@
 ?>
 
-<Level
- name         = "fps"
- description  = "tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/Spacerace2.oxw
===================================================================
--- code/trunk/data/levels/Spacerace2.oxw	(revision 9016)
+++ code/trunk/data/levels/Spacerace2.oxw	(revision 9016)
@@ -0,0 +1,207 @@
+<LevelInfo
+ name = "Spacerace 2"
+ description = "New Spacerace with Multiple Paths."
+ tags = "gametype"
+ screenshot = "spacerace2.png"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+
+  include("templates/spaceshipAssff.oxt")
+ 
+?>
+
+<?lua
+  include("templates/spaceshipAssff2.oxt")
+  include("templates/spaceshipPirate.oxt")
+?>
+
+<Level
+ name         = "Spacerace2"
+ description  = "Just a few tests"
+gametype = SpaceRace
+>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+  <?lua include("includes/notifications.oxi") ?>
+
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+  >
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+
+	
+	<SpaceRaceManager>
+<checkpoints>	
+	<RaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false" nextcheckpoints="1,2,-1">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+        </collisionShapes>
+    </RaceCheckPoint>
+
+<RaceCheckPoint name="checkpoint2" position="0,2100,2300" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false" nextcheckpoints="3,-1,-1">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+        </collisionShapes>
+    </RaceCheckPoint>
+
+<RaceCheckPoint name="checkpoint3" position="0,700,2700" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false" nextcheckpoints="3,-1,-1">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+        </collisionShapes>
+    </RaceCheckPoint>
+
+<RaceCheckPoint name="checkpoint4" position="0,-400,300" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="true">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+        </collisionShapes>
+    </RaceCheckPoint>
+</checkpoints>
+</SpaceRaceManager>
+
+ 
+<SpaceShip position="0,0,200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=0 team=10>
+          <waypoints>
+            <Model mesh="cube.mesh" scale=0 position="0,-2000,1000" />
+            <Model mesh="cube.mesh" scale=0 position="0,2100,2300" />
+            <Model mesh="cube.mesh" scale=0 position="0,-400,300" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+
+    <!-- ------------------Planet----------------- -->
+    <Planet position="0,0,0" scale=300 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+    <StaticEntity position="0,0,0" collisionType=static>
+        <collisionShapes>
+            <SphereCollisionShape radius="399" />
+        </collisionShapes>
+    </StaticEntity>
+
+    <!-- ---------------asteroid ellipse----------------- -->
+    <?lua
+    max = 20
+    for i = 0, max, 1
+    do
+    y = math.sin(i/max*6)*2000
+    z = math.cos(i/max*6)*2500
+    x = 0
+    ?>
+    <?lua
+    for k = 1, 15, 1
+    do
+    j = math.random()
+    ?>
+
+    <MovableEntity
+      position = "<?lua print(x + math.random() * 500) ?>,<?lua print(y + math.random() * 500) ?>,<?lua print(z + math.random() * 1000) ?>"
+      collisionType = "dynamic"
+      linearDamping = "0.5"
+      angularDamping = "0.01"
+      collisiondamage = "0.01"
+      enablecollisiondamage = "true"
+      scale="<?lua print(j * 5) ?>" >
+      <attached>
+        <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
+      <?lua if k == 5 then ?><attached><!-- ---------asteroid fog----- -->
+            <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+          </attached> <?lua end ?>
+        </Model>
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="<?lua print(j * 80) ?>" />
+      </collisionShapes>
+    </MovableEntity>
+    <?lua
+    end
+    ?>
+    <?lua end ?>
+
+    <!-- ---------------ForceFields----------------- -->
+    <ForceField position="0,-700,2700" direction="0,1,0" diameter=500 velocity=2000 length=600 />
+        <MovableEntity position="0,-400,2700">
+            <attached>
+                <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+                <?lua for i=0,15,1 do ?>
+                    <Billboard position="-200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua end ?>
+                </attached>
+        </MovableEntity>
+
+     <ForceField position="0,2500,2000" direction="0,0,-1" diameter=250 velocity=2000 length=600 />
+        <MovableEntity position="0,2500,2000">
+            <attached>
+                <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+                <?lua for i=0,15,1 do ?>
+                    <Billboard position="-100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua end ?>
+                </attached>
+        </MovableEntity>
+
+    <ForceField position="0,1300,-800" direction="0,-1,-1" diameter=250 velocity=2000 length=800 />
+        <MovableEntity position="0,1300,-800">
+            <attached>
+                <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+                <?lua for i=0,20,1 do ?>
+                    <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua end ?>
+                </attached>
+        </MovableEntity>
+
+    <ForceField position="0,-1400,-700" direction="0,-1,1" diameter=250 velocity=2000 length=600 />
+        <MovableEntity position="0,-1400,-700">
+            <attached>
+                <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+                <?lua for i=0,15,1 do ?>
+                    <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                    <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+                <?lua end ?>
+                </attached>
+        </MovableEntity>
+
+
+    
+  </Scene>
+</Level>
+
Index: code/trunk/data/levels/asteroidField.oxw
===================================================================
--- code/trunk/data/levels/asteroidField.oxw	(revision 9016)
+++ code/trunk/data/levels/asteroidField.oxw	(revision 9016)
@@ -0,0 +1,100 @@
+<LevelInfo
+ name = "asteroidFieldTest"
+ description = "Test of the asteroidField generator."
+  screenshot = "asteroidFieldTest.png"
+ tags = "test, showcase"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipAssff.oxt")
+  include("templates/spaceshipPirate.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+  <?lua include("includes/notifications.oxi") ?>
+
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+    hasPhysics   = true
+  >
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+
+
+
+    <!-- Belt that's far away  *** TURNED OFF FOR PERFORMANCE REASONS *** -->
+    <!-- Generate asteroid field and asteroid belt -->    
+    <!--
+    <?lua
+    	dofile("includes/asteroidField.lua")
+    	asteroidBelt(0, 0, 0, -48, -34, 70, 100, 200, 219900, 210000, 900, 1)
+    ?>
+    -->
+
+
+    <!-- triple large belt around the planet  -->
+    <?lua
+    	dofile("includes/asteroidField.lua")
+    	asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
+    ?>
+    <?lua
+    	dofile("includes/asteroidField.lua")
+    	asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
+    ?>
+    <?lua
+    	dofile("includes/asteroidField.lua")
+    	asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
+    ?>
+
+
+
+    <!-- Planet close to spawn point -->
+    <Planet
+      position="15000,0,0"
+      scale="5000"
+      collisionType="dynamic"
+      linearDamping="0.8"
+      angularDamping="0"
+      mass="10000000"
+      pitch="0"
+      mesh="planets/muunilinst.mesh"
+      atmosphere="atmosphere1"
+      rotationaxis="1,0,0"
+      rotationrate="1.0"
+      atmospheresize="80.0f"
+      imagesize="1024.0f"
+      collisiondamage = 2
+      enablecollisiondamage = true
+    >
+      <attached>
+        <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="5000" position="0,0,0" />
+      </collisionShapes>
+    </Planet>
+
+
+
+
+
+
+    
+  </Scene>
+</Level>
+
Index: code/trunk/data/levels/asteroids.oxw
===================================================================
--- code/trunk/data/levels/asteroids.oxw	(revision 8952)
+++ code/trunk/data/levels/asteroids.oxw	(revision 9016)
@@ -1,2 +1,9 @@
+<LevelInfo
+ name = "Asteroids Race"
+ description = "Reach the checkpoints and avoid asteroids."
+ tags = "gametype"
+ screenshot = "asteroids.png"
+/>
+
 <?lua
   include("HUDTemplates3.oxo")
@@ -7,7 +14,5 @@
 
 <Level
- name         = "Asteroids Race"
- description  = "testmap for gametype asteroid race"
- gametype     =  Asteroids
+ gametype = "Asteroids"
 >
   <templates>
Index: code/trunk/data/levels/docking.oxw
===================================================================
--- code/trunk/data/levels/docking.oxw	(revision 8952)
+++ code/trunk/data/levels/docking.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Transporter"
  description = "Level with a Transporter. Demonstrates the docking system."
- tags = ""
+ tags = "showcase"
+ screenshot = "transporter.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Transporter"
- description  = "Docking example level"
->
+<Level>
   <templates>
     <Template link="lodtemplate_default" />
Index: code/trunk/data/levels/dynamicMatch.oxw
===================================================================
--- code/trunk/data/levels/dynamicMatch.oxw	(revision 8952)
+++ code/trunk/data/levels/dynamicMatch.oxw	(revision 9016)
@@ -1,2 +1,9 @@
+<LevelInfo
+ name = "Dynamic Match"
+ description = "Dynamicmatch: Take care of what you're shooting at."
+ tags = "gametype"
+ screenshot = "dynamicMatch.png"
+/>
+
 <?lua
   include("HUDTemplates3.oxo")
@@ -9,7 +16,5 @@
 
 <Level
- name         = "Dynamic Match"
- description  = "In progress -level for dynamicmatch"
- gametype     = "Dynamicmatch"
+ gametype = "Dynamicmatch"
 >
   <templates>
@@ -33,4 +38,5 @@
 
 <!-- -----------12-Spawnpoints around the planet------------- -->
+<!-- inner Spawnpoints -->
 <TeamSpawnPoint team=0 position="1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
 <TeamSpawnPoint team=0 position="-1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff/>
Index: code/trunk/data/levels/earth.oxw
===================================================================
--- code/trunk/data/levels/earth.oxw	(revision 8952)
+++ code/trunk/data/levels/earth.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "1:100 Scale Model of Earth with Gravity"
  tags = "showcase"
+ screenshot = "earthdemonstration.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Planet Earth"
- description  = "1:100 Scale Model of Earth with Gravity"
->
+<Level>
   <templates>
     <Template link="lodtemplate_default" />
Index: code/trunk/data/levels/emptyLevel.oxw
===================================================================
--- code/trunk/data/levels/emptyLevel.oxw	(revision 8952)
+++ code/trunk/data/levels/emptyLevel.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "A level with absolutely nothing in it."
  tags = "test"
+ screenshot = "emptylevel.png"
 />
 
@@ -16,8 +17,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/events.oxw
===================================================================
--- code/trunk/data/levels/events.oxw	(revision 8952)
+++ code/trunk/data/levels/events.oxw	(revision 9016)
@@ -2,5 +2,6 @@
   name = "Events showcase"
   description = "Level to test and showcase events."
-  tags = "test, showcase" 
+  tags = "test, showcase"
+  screenshot = "eventsshowcase.png"
 />
 
@@ -13,8 +14,5 @@
 ?>
 
-<Level
- name         = "Event testing"
- description  = "A simple level to test the event-system (with comments)"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/fightInOurBack.oxw
===================================================================
--- code/trunk/data/levels/fightInOurBack.oxw	(revision 8952)
+++ code/trunk/data/levels/fightInOurBack.oxw	(revision 9016)
@@ -2,5 +2,6 @@
   name = "Fight in our Back"
   description = "Our fleet is far ahead of us. We need to get rid of all the enemies in its back, because we do not want our enemies to attack from everywhere. So let us clear this Sector!"
-  tags = "singleplayer" 
+  screenshot = "fightinourback.png"  
+  tags = "mission" 
 />
 
@@ -110,5 +111,5 @@
   name="Fight in our back"
   description="Our fleet is far ahead of us. We need to get rid of all the enemies in its back, because we do not want our enemies to attack from everywhere. So let us clear this Sector!"
-  gametype=TeamDeathmatch
+  gametype=Mission
 >
   <templates>
@@ -214,5 +215,5 @@
 <?lua for i=0,0,1 do
 x=800
-health=2050
+health=1500
 ?>
     <!--Transporter 1-->
@@ -239,5 +240,5 @@
 
 <?lua for j=0,1,1 do
-health=1600
+health=1300
 x=800
 z=j*300
Index: code/trunk/data/levels/includes/asteroidField.lua
===================================================================
--- code/trunk/data/levels/includes/asteroidField.lua	(revision 9016)
+++ code/trunk/data/levels/includes/asteroidField.lua	(revision 9016)
@@ -0,0 +1,103 @@
+--[[ fog generator
+generates fog
+	posX, posY, posZ - position in space
+	size - size of billboard
+	brightness - [0,1] fog brightness
+--]]
+function generateFog(posX, posY, posZ, size, brightness)
+		print("<Billboard ")
+			print("position = \"") 
+				print(posX) print(",") 
+				print(posY) print(",") 
+				print(posZ) print("\" ") 
+			print("colour=\"")
+				print(brightness) print(",") 
+				print(brightness) print(",") 
+				print(brightness) print("\" ") 
+			print("material=\"Smoke/Smoke\" scale=")
+			print(size)
+			print(" />")
+end
+
+--[[ asteroid field generator
+generates asteroid field
+	posX, posY, posZ - position in space
+	minSize, maxSize - size boundaries of each asteroid
+	radius - size of the cube around position in space
+	count - number of asteroids
+	fog - enable fog 0/1
+--]]
+function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count, fog)
+	for i = 1, count, 1
+	do
+		size = (math.random() * (maxSize - minSize)) + minSize
+		pX = (2 * math.random() * radius) - radius + posX
+		pY = (2 * math.random() * radius) - radius + posY
+		pZ = (2 * math.random() * radius) - radius + posZ
+		print("<StaticEntity ")
+		
+		print("position = \"") 
+		print(pX) print(",") 
+		print(pY) print(",") 
+		print(pZ) print("\" ")
+		
+		print("scale = \"") print(size) print("\" ")
+		
+		print("collisionType = static linearDamping = 0.8 angularDamping = 1 ") 
+		print("collisiondamage = 1000 enablecollisiondamage = true>")
+		
+		print("<attached>")
+			print("<Model mass=\"") print(size * 10) print("\" ")
+			print("mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" />")
+		print("</attached>")
+		
+		print("<collisionShapes> ")
+			print("<SphereCollisionShape radius=\"") 
+			print(size * 2.5) print("\" />")
+		print("</collisionShapes>")
+		
+		print("</StaticEntity>")
+		
+		if fog == 1 and i % 5 == 0 then
+			generateFog(pX, pY, pZ, radius*0.04, 0.2)
+		end
+	end
+end
+
+
+--[[ asteroid belt generator
+generates asteroid belt
+	posX, posY, posZ - position in space
+	yaw, pitch - rotation
+	minSize, maxSize - size boundaries of each asteroid
+	radius0, radius1 - inner/outer radius
+	count - number of asteroids
+	fog - enable fog 0/1
+--]]
+function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog)
+	dPhi = (2 * math.pi) / segments
+	width = math.abs(radius1 - radius0)
+	radius = (radius1 + radius0) / 2
+	segmentCount = count / segments
+	
+	print("<StaticEntity collisionType=static yaw=") print(yaw) 
+	print(" pitch=") print(pitch)
+	
+	print(" position = \"") 
+		print(centerX) print(",") 
+		print(centerY) print(",") 
+		print(centerZ) print("\"") 
+	print(">")
+	
+	print("<attached>")
+	
+	for i = 0, segments - 1, 1
+	do
+		asteroidField((radius * math.cos(i * dPhi)),
+					(radius * math.sin(i * dPhi)),
+					0, minSize, maxSize, width, segmentCount, fog)
+	end
+	
+	print("</attached>")
+	print("</StaticEntity>")
+end
Index: code/trunk/data/levels/includes/weaponSettingsSpacecruiser.oxi
===================================================================
--- code/trunk/data/levels/includes/weaponSettingsSpacecruiser.oxi	(revision 8952)
+++ code/trunk/data/levels/includes/weaponSettingsSpacecruiser.oxi	(revision 9016)
@@ -1,11 +1,10 @@
     <weaponslots>
-      <WeaponSlot position="-20,-15,-108" />
-      <WeaponSlot position=" 20,-15,-108" />
-      <WeaponSlot position="  0, -7,-110" />
-      <WeaponSlot position="-14,-31,-184" />
-      <WeaponSlot position=" 14,-31,-184" />
-      <WeaponSlot position="-34,-30,-169" />
-      <WeaponSlot position=" 34,-30,-169" />
-
+      <WeaponSlot position="-20,10,2" />
+      <WeaponSlot position=" 20,10,2" />
+      <WeaponSlot position="  0,18,0" />
+      <WeaponSlot position="-14,-6,-74" />
+      <WeaponSlot position=" 14,-6,-74" />
+      <WeaponSlot position="-34,-5,-59" />
+      <WeaponSlot position=" 34,-5,-59" />
     </weaponslots>
     <weaponsets>
Index: code/trunk/data/levels/lastManStanding.oxw
===================================================================
--- code/trunk/data/levels/lastManStanding.oxw	(revision 8952)
+++ code/trunk/data/levels/lastManStanding.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Last Man Standing"
  description = "Be the sole survivor."
- tags = ""
+ tags = "gametype"
+ screenshot = "lastmanstanding.png"
 />
 
@@ -16,7 +17,5 @@
 
 <Level
- name         = "Last Man Standing"
- description  = "testmap for gametype last man standing"
- gametype     =  "LastManStanding"
+ gametype = "LastManStanding"
 >
   <templates>
@@ -51,5 +50,5 @@
                     <Model position="0,0,0" scale=140 mesh="asteroid_UV.mesh" shadow=true />
                     <Model position="-160,40,28.4" scale=1 mesh="sphere.mesh" /><!--EasterEgg indicator-->
-                    <PickupSpawner position="-160,40,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="15"><!--EasterEgg-->
+                    <PickupSpawner position="-160,40,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="15"><!--EasterEgg : invisible pickup is hidden inside the asteroid -->
                         <pickup>
                             <InvisiblePickup template=hugeinvisiblepickup />
Index: code/trunk/data/levels/lastTeamStanding.oxw
===================================================================
--- code/trunk/data/levels/lastTeamStanding.oxw	(revision 8952)
+++ code/trunk/data/levels/lastTeamStanding.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Last Team Standing"
  description = "Survive as a team."
- tags = "singleplayer"
+ tags = "gametype"
+ screenshot = "lastteamstanding.png"
 />
 <?lua
@@ -17,5 +18,5 @@
  name         = "Last Team Standing"
  description  = "testmap for gametype last team standing"
- gametype     =  "LastTeamStanding"
+ gametype     =  "TeamGametype"
 >
   <templates>
Index: code/trunk/data/levels/lastTeamStandingII.oxw
===================================================================
--- code/trunk/data/levels/lastTeamStandingII.oxw	(revision 8952)
+++ code/trunk/data/levels/lastTeamStandingII.oxw	(revision 9016)
@@ -1,6 +1,7 @@
 <LevelInfo
- name = "On the fly"
- description = "Survive as a team."
- tags = ""
+ name = "Last Team Standing II"
+ description = "Last Team Standing in an abstract level."
+ screenshot = "onthefly.png"
+ tags = "gametype"
 />
 <?lua
@@ -15,6 +16,4 @@
 
 <Level
- name         = "On the fly"
- description  = "testmap for gametype last team standing"
  gametype     = "LastTeamStanding"
 >
@@ -95,4 +94,5 @@
    </StaticEntity>
 <!-- END of CUBE-->
+
 <!-------------- Centered Thin Gate -------------->
 
@@ -412,5 +412,5 @@
     <TeamSpawnPoint team=3 position="845,350,835" direction="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshipassff />
     <TeamSpawnPoint team=3 position="845,-300,835" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
-<Bot />
+<Bot /><!-- at least one bot is needed to stat the game properly. Else the game finishes. This could be avoided, if the menue allows a preselection of the number of players. --> 
 
   </Scene>
Index: code/trunk/data/levels/missionOne.oxw
===================================================================
--- code/trunk/data/levels/missionOne.oxw	(revision 8952)
+++ code/trunk/data/levels/missionOne.oxw	(revision 9016)
@@ -1,6 +1,7 @@
 <LevelInfo
  name = "Mission One"
- description = "First guided steps in the orxonoxian universe."
- tags = "singleplayer"
+ description = "First Guided Steps in the Orxonoxian Universe."
+ screenshot = "missionOne.png"
+ tags = "mission"
 />
 
@@ -20,6 +21,5 @@
 
 <Level
- name         = "Mission One"
- description  = "How to steer a spaceship."
+ gametype     = "Mission"
 >
   <templates>
@@ -47,55 +47,291 @@
     ?>
 
-    <WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" /> <!-- AlphaCentauri.ogg-->
+    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" /> <!-- AlphaCentauri.ogg, Mars.ogg-->
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
-    <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
-
-
 <!-- END OF INCLUDES & NECESSARITIES -->
 
+<!-- SPAWNPOINT & START OF QUESTS via spawntrigger -->
+    <EventMultiTrigger name=spawntrigger>
+        <events>
+            <trigger>
+                <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff>
+                  <EventTrigger invert=true>
+                    <events>
+                      <trigger>
+                        <EventListener event="attack" />
+                      </trigger>
+                    </events>
+                  </EventTrigger>
+                </TeamSpawnPoint>
+            </trigger>
+        </events>
+    </EventMultiTrigger>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <AddQuest questId="missionOne.basicFlying" />
+                <!--AddQuestHint hintId ="quest1hint3" /-->
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=spawntrigger />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.basicFlying" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event="flying4" />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.navigation" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event="navigationend" />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!--helper trigger to end the weaponsystemI quest -->
+    <DistanceTrigger name="boxend" position="0,0,0" distance=950 target="SpaceShip" stayActive="false" delay=0.1>
+              <EventTrigger>
+                <events>
+                  <trigger>
+                    <EventListener event="boxtrigger4" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+    </DistanceTrigger>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.weaponsystemI" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event="boxend" />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!--helper trigger to end the weaponsystemII quest -->
+    <DistanceTrigger name="piratesend" position="0,0,0" distance=2000 target="SpaceShip" stayActive="false" delay=0.1>
+              <EventTrigger>
+                <events>
+                  <trigger>
+                    <EventListener event="movingpirates2" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+    </DistanceTrigger>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.weaponsystemII" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=piratesend />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!--helper trigger to end the DuBallStation quest -->
+    <DistanceTrigger name="duballend" position="-1000,-300,700" distance=2000 target="SpaceShip" stayActive="false" delay=0.1>
+              <EventTrigger>
+                <events>
+                  <trigger>
+                    <EventListener event="duball3" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+    </DistanceTrigger>
+
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.DuballStation" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=duballend />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+        <QuestEffectBeacon times=1> <!--  alternative quest end  -->
+            <effects>
+                <CompleteQuest questId="missionOne.DuballStation" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=toHydroFarmer />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!--helper trigger to end the getHelp quest -->
+    <DistanceTrigger name="getHelpEnd" position="-47000,-1000,1300" distance=1400 target="SpaceShip" stayActive="false" delay=0.1>
+              <EventTrigger>
+                <events>
+                  <trigger>
+                    <EventListener event="ondock" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+    </DistanceTrigger>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.getHelp" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=getHelpEnd />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!--helper trigger to end the getHome quest -->
+    <DistanceTrigger name="getHomeEnd" position="0,0,0" distance=4000 target="SpaceShip" stayActive="false" delay=0.1>
+              <EventTrigger>
+                <events>
+                  <trigger>
+                    <EventListener event="attack" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+    </DistanceTrigger>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.getHome" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=getHomeEnd />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!--helper trigger to end the defence quest -->
+    <DistanceTrigger name="defenceEnd" position="0,0,0" distance=4000 target="SpaceShip" stayActive="false" delay=0.1>
+              <EventTrigger>
+                <events>
+                  <trigger>
+                    <EventListener event="attacktrigger6" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+    </DistanceTrigger>
+
+        <QuestEffectBeacon times=1>
+            <effects>
+                <CompleteQuest questId="missionOne.defence" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=defenceEnd />
+                </execute>
+            </events>
+        </QuestEffectBeacon>
+
+<!-- End the quest after own destruction of spacecruiser -->
+        <QuestEffectBeacon position="-100,0,0" times=1>
+            <effects>
+                <FailQuest questId="missionOne.getHelp" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event="failQuest" />
+                </execute>
+            </events>
+            <attached>
+                <DistanceTrigger name="failQuest" position="-47000,-1000,1300" distance=2300 target="SpaceShip">
+                  <EventTrigger>
+                    <events>
+                      <trigger>
+                        <EventListener event="gameEnd" />
+                      </trigger>
+                    </events>
+                  </EventTrigger>
+                </DistanceTrigger>
+            </attached>
+        </QuestEffectBeacon>
+
+
+
+
     <LocalQuest id="missionOne.basicFlying">
-        <QuestDescription title="Flying" description="INSERT STORY HERE. The first thing you have to learn is flying. Use 'W' to accelerate and steer with your mouse. In order to know where to fly there are two detection systems. The navigation markers highlite important objects directly in the level. If you can't directly see those objects, there are arrows which indicate how you have to steer. The second device is the radar. There you get an overview of all objects near you. In order to find an object that you spotted on radar, you have to steer in a way that the corresponding dot is in the center of the radar. Now you can find the corresponding object straight ahead. Your goal is to fly to the first waypoint. It's that orange dot on the radar." failmessage="" completeMessage="Well done." />
+        <QuestDescription title="Flying" description="Can you see the blinking light straight ahead? Your goal is to fly through it.
+Use (W) to accelerate and steer with your mouse.
+
+Further flying moves:
+break (S)
+roll     (Q) and (E)
+boost (Space)
+
+Whenever a new quest is added you can view it by pressing (F3). Quit this menu via (Esc)." failmessage="" completeMessage="" />
         <complete-effects>
-            <AddQuest questId="missionOne.weaponsystem" />
+            <AddQuest questId="missionOne.navigation" />
         </complete-effects>
     </LocalQuest>
 
-    <LocalQuest id="missionOne.weaponsystem">
-        <QuestDescription title="Weaponsystem" description="INSERT STORY HERE." failmessage="" completeMessage="All right." />
-        <subquests>
+    <LocalQuest id="missionOne.navigation">
+        <QuestDescription title="Navigation" description="The next goal is to find and move towards the test targets for your weaponsystem. The three arrows that just appeared down in the right corner of your screen indicate in which direction you have to turn your spacefighter to find your next targets.
+
+Alternative navigation: There's a green circle in the left corner - the radar. The red dots on the radar represent your targets. If you manage to move your spaceship in a way such that a dot is at the center of the radar, you will be able to see the concerning object straight ahead." failmessage="" completeMessage="" />
+        <complete-effects>
+            <AddQuest questId="missionOne.weaponsystemI" />
+        </complete-effects>
+    </LocalQuest>
+
             <LocalQuest id ="missionOne.weaponsystemI">
-                <QuestDescription title="Destroy Boxes" description="Test your four different weapons on the four boxes. The four weapons are laser (left click), plasma (right click), self targeting rockets (middle click) and manual rockets (press 'T'). Attention if you use manual rockets: Press 'T' only once to start the rocket. If you miss your target you can get out of the rocket, by clicking or pressing 'T' once more." failmessage="" completeMessage="" />
+                <QuestDescription title="Destroy the Boxes" description="Test your four different weapons on the four boxes:
+1. laser (left click)
+2. plasma (right click)
+3. target seeking rockets (middle click)
+4. manual rockets (T)
+
+Attention if you use manual rockets: Press (T) only once to start the rocket. If you miss your target you can get out of the rocket, by clicking or pressing (T) once more." failmessage="" completeMessage="" />
+                    <hints>
+                        <QuestHint id="missionOne.weaponsystem.laser">
+                            <QuestDescription title="Laser" description="The laser is a standard weapon. It is fast and precise but does not deal much damage." />
+                        </QuestHint>
+                        <QuestHint id="missionOne.weaponsystem.lightningGun">
+                            <QuestDescription title="Lightninggun" description="That was the lightning gun. Its plasma munition is quite slow, but a normal spaceship can't take more than three hits of such a strong weapon. That could be your favourite weapon for close range combat or if you want to hit a really slow enemy." />
+                        </QuestHint>
+                        <QuestHint id="missionOne.weaponsystem.targetSeekingRocket">
+                            <QuestDescription title="Target Seeking Rocket" description="The target seeking rockets follow slow targets on their own." />
+                        </QuestHint>
+                        <QuestHint id="missionOne.weaponsystem.manualrocket">
+                            <QuestDescription title="Manual Rocket" description="Manual rockets are your most powerful weapon. But since you have to steer it to your target yourself, you will leave your spaceship unprotected for a while. The total amount of both manual and target seeking rockets is limited to 10." />
+                        </QuestHint>
+                    </hints>
                 <complete-effects>
                     <AddQuest questId="missionOne.weaponsystemII" />
                 </complete-effects>
             </LocalQuest>
+
             <LocalQuest id="missionOne.weaponsystemII">
-                <QuestDescription title="" description="" failmessage="" completeMessage="" />
+                <QuestDescription title="Kill the pirates" description="Get rid of the patrolling pirates.
+Find out which weapon is best to tackle moving targets. Get close enough." failmessage="" completeMessage="" />
                 <complete-effects>
                     <AddQuest questId="missionOne.DuballStation" />
                 </complete-effects>
             </LocalQuest>
-        </subquests>
-        <hints>
-            <QuestHint id="missionOne.weaponsystem.laser">
-              <QuestDescription title="Laser" description="The laser is a standard weapon. It is fast and precise but does not deal much damage." />
-            </QuestHint>
-            <QuestHint id="missionOne.weaponsystem.lightningGun">
-              <QuestDescription title="Lightninggun" description="That was the lightning gun. Its plasma munition is quite slow, but a normal spaceship can't take more than three hits of such a strong weapon. That could be your favourite weapon for close range combat or if you want to hit a really slow enemy." />
-            </QuestHint>
-            <QuestHint id="missionOne.weaponsystem.targetSeekingRocket">
-              <QuestDescription title="Target Seeking Rocket" description="The target seeking rockets follow slow targets on their own." />
-            </QuestHint>
-            <QuestHint id="missionOne.weaponsystem.manualrocket">
-              <QuestDescription title="Manual Rocket" description="Manual rockets are your most powerful weapon. But since you have to steer it to your target yourself, you will leave your spaceship unprotected for a while. The total amount of both manual and target seeking rockets is limited to 10." />
-            </QuestHint>
-        </hints>
-        <complete-effects>
-        </complete-effects>
-    </LocalQuest>
 
     <LocalQuest id="missionOne.DuballStation">
-        <QuestDescription title="Duball Space Station" description="Fly towards the Duball Space Station. The grey radar marker will lead you to its position." failmessage="" completeMessage="Well done." />
+        <QuestDescription title="Duball Space Station" description="Fly towards the Duball Space Station. The grey radar marker will lead you to its position." failmessage="" completeMessage="" />
         <complete-effects>
             <AddQuest questId="missionOne.getHelp" />
@@ -104,5 +340,10 @@
 
     <LocalQuest id="missionOne.getHelp">
-        <QuestDescription title="Get Help" description="There are enemies approaching. You can't handle it on your own. Fortunately there's a shortcut to the next friendly unit. Use the portal (grey dot) to get near the Hydrogen Farmer. There you might get help - as far as we know there should be a stronger spaceship docked to the Hydrogen Farmer. In order to be able to use that stronger spaceship you have to dock to the Hydrogen Farmer. Simply fly to the center of the Hydrogen Farmer, which is between its three legs." failmessage="" completeMessage="Well done." />
+        <QuestDescription title="Get Help" description="There are several enemies approaching. You can't handle it on your own. Fortunately there's a shortcut to the next friendly unit. Use the portal (grey dot) to get near the Hydrogen Farmer.
+The Hydrogen Farmer is a large spaceship with three legs.
+There you might get help - as far as we know there should be a strong spaceruiser docked to the Hydrogen Farmer. In order to be able to use that stronger spaceship, you have to dock to the Hydrogen Farmer.
+Simply fly to the center of the Hydrogen Farmer, which is between its three legs.
+
+How to dock: Accept the dialogue, take your hands off the keyboard and watch." failmessage="" completeMessage="" />
         <complete-effects>
             <AddQuest questId="missionOne.getHome" />
@@ -111,5 +352,6 @@
 
     <LocalQuest id="missionOne.getHome">
-        <QuestDescription title="Return ASAP" description="" failmessage="" completeMessage="Well done." />
+        <QuestDescription title="Return ASAP" description="So you managed to get the spacecruiser. Use the portal to return to the DuBall Space Station.
+Hurry! Your help is desperately needed." failmessage="" completeMessage="" />
         <complete-effects>
             <AddQuest questId="missionOne.defence" />
@@ -118,37 +360,14 @@
 
     <LocalQuest id="missionOne.defence">
-        <QuestDescription title="Defence" description="" failmessage="" completeMessage="Well done." />
+        <QuestDescription title="Defence" description="Seven enemies were detected that seem to launch a coordinated attack.
+Do not hesitate to fight or you will be the target.
+
+Always take care of the enemy that is the closest to you." failmessage="" completeMessage="Yeah! You did it." />
     </LocalQuest>
-
-
-        <QuestEffectBeacon position="800,700,600" times="1">
-            <effects>
-                <AddQuest questId="missionOne.basicFlying" />
-            </effects>
-            <events>
-                <execute>
-                    <EventListener event="questStart"/>
-                </execute>
-            </events>
-            <attached>
-                <DistanceTrigger name="questStart" position="0,0,0" distance="50" target="Pawn" beaconMode="identify" targetname="PlayerDistanceTrigger" delay="2" />
-            </attached>
-        </QuestEffectBeacon>
-
-
-<!-- TUTORIAL-TODO: -->
-<!-- 1. Flying & manoeuvring (basic flying, using pickups, forcefields, docks & portals) --> <!-- "W","S","SPACE"-->
-<!-- 2. Aiming & Weapons (static targets, moving targets, dangerous targets)--> <!-- 3 Mouse buttons + "T"-->
-<!-- 3. Game handling (quests, knowing when a game is over :-), pausing, chat, ... ) --> <!--"F3", "F2", "ESC" -->
-<!-- 4. Extras (other things to discover) --> <!-- "Q","E","A","D","C", "CTRL", "", ... -->
-
-<!--
-
-"Lets start flying. Use W to accelerate and S to brake. The goal is to reach the spacestation which is displayed on the radar. If you want to be faster you can temporarily boost by hitting additionally the space button. If you use too much boost your engine heats up and you won't be able to use boost for a while. By the way boost could be useful during combat .."
-
--->
-
-    <DistanceTrigger name="spawndelaytrigger0" position="800,700,600" target="Pawn" distance=10 stayActive="true"/>
-    <SimpleNotification message="Welcome to the Orxonox Tutorial.">
+<!-- --------------------- END OF QUESTS -------------------------- -->
+
+
+    <DistanceTrigger name="spawndelaytrigger0" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=2/>
+    <SimpleNotification message="Press (F3) to see your mission briefing.">
         <events>
             <trigger>
@@ -158,5 +377,6 @@
     </SimpleNotification>
 
-<BlinkingBillboard position="-900,640,600" frequency=0.4 amplitude=2 material="Flares/lensflare" colour="1,1,0">
+<!-- Blinking Billboard should be replaced with WAYPOINT -->
+<BlinkingBillboard position="-900,640,600" frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,1,0.05">
           <events>
             <visibility>
@@ -184,6 +404,8 @@
           </events>
 </Billboard>
+
 <!-------------------------------------- PART ZERO: How to fly --------------------------------------->
-    <DistanceTrigger name="flying1" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=4/>
+
+    <DistanceTrigger name="flying1" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=6/>
     <SimpleNotification message="Let's fly to the blinking light.">
         <events>
@@ -194,6 +416,6 @@
     </SimpleNotification>
 
-    <DistanceTrigger name="flying2" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=8/>
-    <SimpleNotification message="Use 'W' to accelerate and the mouse to steer.">
+    <DistanceTrigger name="flying2" position="800,700,600" target="Pawn" distance=10 stayActive="true" delay=10/>
+    <SimpleNotification message="Use (W) to accelerate and the mouse to steer.">
         <events>
             <trigger>
@@ -203,15 +425,11 @@
     </SimpleNotification>
 
-    <!--DistanceTrigger name="flying3" position="800,700,600" target="Pawn" distance=20 stayActive="true" delay=12/>
-    <SimpleNotification message="Point with the mouse to the blinking light.">
-        <events>
-            <trigger>
-                <EventListener event="flying3" />
-            </trigger>
-        </events>
-    </SimpleNotification-->
-
-    <DistanceTrigger name="flying4" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=1/>
-    <SimpleNotification message="Three red arrows just appeared.">
+<!-- QUEST-Trigger && Message Trigger: navigationend is activated after flying4 was triggered -->
+    <DistanceTrigger name="navigationend" position="0,0,0" distance=950 target="SpaceShip" stayActive="false" delay=1.1>
+        <DistanceTrigger name="flying4" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=1/>
+    </DistanceTrigger>
+
+
+    <SimpleNotification message="Three arrows just appeared.">
         <events>
             <trigger>
@@ -222,5 +440,5 @@
 
     <DistanceTrigger name="flying5" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=5/>
-    <SimpleNotification message="Follow those red arrows.">
+    <SimpleNotification message="Follow those arrows.">
         <events>
             <trigger>
@@ -230,9 +448,41 @@
     </SimpleNotification>
 
-
-
 <!-------------------------------------- PART ONE : Destroy boxes --------------------------------------->
-    <DistanceTrigger name="spawndelaytrigger1" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=9 />
-    <SimpleNotification message="Destroy the four boxes.">
+<!-- @ triggers: spawndelaytriggerX: textoutput only if no box was destroyed -->
+    <Trigger name="spawndelaytrigger1" mode="and" stayActive="true">
+        <DistanceTrigger position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=9 />
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="boxtrigger1" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
+    <Trigger name="spawndelaytrigger2" mode="and" stayActive="true">
+        <DistanceTrigger position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=13 />
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="boxtrigger1" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
+    <Trigger name="spawndelaytrigger3" mode="and" stayActive="true">
+        <DistanceTrigger position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=17 />
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="boxtrigger1" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
+<!-- @Text: How to shoot-->
+    <SimpleNotification message="Destroy the four boxes." broadcast="true">
         <events>
             <trigger>
@@ -242,6 +492,5 @@
     </SimpleNotification>
 
-    <DistanceTrigger name="spawndelaytrigger2" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=13 />
-    <SimpleNotification message=" 1. Aim the a red cycle.">
+    <SimpleNotification message=" 1. Aim the a red cycle." broadcast="true">
         <events>
             <trigger>
@@ -251,6 +500,5 @@
     </SimpleNotification>
 
-    <DistanceTrigger name="spawndelaytrigger3" position="-900,640,600" target="Pawn" distance=60 stayActive="true" delay=17 />
-    <SimpleNotification message="2. Click! (hold the left mouse button)">
+    <SimpleNotification message="2. Click! (hold the left mouse button)" broadcast="true">
         <events>
             <trigger>
@@ -261,57 +509,59 @@
 
 <!-- @Objects: 4 boxes (uncontrolled pawns) -->
-                <Pawn health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
-                    <events>
-                      <visibility>
-                        <EventListener event="flying4" />
-                      </visibility>
-                    </events>
-                    <attached>
-                        <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
-                    </attached>
-                    <collisionShapes>
-                        <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
-                    </collisionShapes>
-                </Pawn>
-
-                <Pawn health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box visible="true">
-                    <events>
-                      <visibility>
-                        <EventListener event="flying4" />
-                      </visibility>
-                    </events>
-                    <attached>
-                        <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
-                    </attached>
-                    <collisionShapes>
-                        <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
-                    </collisionShapes>
-                </Pawn>
-                <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
-                    <events>
-                      <visibility>
-                        <EventListener event="flying4" />
-                      </visibility>
-                    </events>
-                    <attached>
-                        <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
-                    </attached>
-                    <collisionShapes>
-                        <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
-                    </collisionShapes>
-                </Pawn>
-                <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
-                    <events>
-                      <visibility>
-                        <EventListener event="flying4" />
-                      </visibility>
-                    </events>
-                    <attached>
-                        <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
-                    </attached>
-                    <collisionShapes>
-                        <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
-                    </collisionShapes>
-                </Pawn>
+    <Pawn team=1 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 4" >
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
+
+    <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 3">
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+           <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
+
+    <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1 RVName = "Box 2">
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+           <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
+
+    <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1 RVName = "Box 1">
+        <events>
+          <visibility>
+            <EventListener event="flying4" />
+          </visibility>
+        </events>
+        <attached>
+            <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+        </attached>
+        <collisionShapes>
+           <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
+    </Pawn>
 
 <!-- @Triggers: boxtrigger1 <-> one   box   destroyed
@@ -365,6 +615,5 @@
     </SimpleNotification>
 
-
-  <SimpleNotification message="Aim at the last target and press 'T'." broadcast="true">
+  <SimpleNotification message="Aim at the last target and press (T)." broadcast="true">
         <events>
             <trigger>
@@ -386,5 +635,5 @@
 
 <!-- @Objects: 2 pirates moving in squares, nonlethal -->
-                <SpaceShip position="0,2000,200" lookat="0,0,0" name="movingtarget" >
+                <SpaceShip position="0,2000,200" lookat="0,0,0" name="movingtarget" RVName="Pirate">
                             <events>
                                 <visibility>
@@ -396,5 +645,5 @@
                     </templates>
                     <controller>
-                      <WaypointController>
+                      <WaypointController team=1>
                          <waypoints>
                           <Model mesh="cube.mesh" scale=8 position="  0,1700,-200" />
@@ -407,5 +656,5 @@
                 </SpaceShip>
 
-                <SpaceShip position="0,2000,400" lookat="0,0,0" name="movingtarget">
+                <SpaceShip position="0,2000,400" lookat="0,0,0" name="movingtarget" RVName="Pirate">
                             <events>
                                 <visibility>
@@ -417,5 +666,5 @@
                   </templates>
                   <controller>
-                    <WaypointController>
+                    <WaypointController team=1>
                       <waypoints>
                         <Model mesh="cube.mesh" scale=8 position="  0,2400,1000" />
@@ -473,19 +722,38 @@
     </DistanceTrigger>
 
-    <EventTrigger name="duball2" activations="1" stayactive="true" delay=4 >
-      <events>
-        <trigger>
-          <EventListener event="duball1" />
-        </trigger>
-      </events>
-    </EventTrigger>
-
-    <EventTrigger name="duball3" activations="1" stayactive="true" delay=4 >
-      <events>
-        <trigger>
-          <EventListener event="duball2" />
-        </trigger>
-      </events>
-    </EventTrigger>
+    <Trigger name="duball2" mode="and" stayActive="true">
+        <EventTrigger activations="1" stayactive="true" delay=4 >
+           <events>
+              <trigger>
+                 <EventListener event="duball1" />
+              </trigger>
+           </events>
+        </EventTrigger>
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="toHydroFarmer" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
+    <Trigger name="duball3" mode="and" stayActive="true">
+        <EventTrigger activations="1" stayactive="true" delay=4 >
+           <events>
+              <trigger>
+                 <EventListener event="duball2" />
+              </trigger>
+           </events>
+        </EventTrigger>
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="toHydroFarmer" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
 
     <SimpleNotification message="Welcome to the Duball Space Station!">
@@ -520,5 +788,5 @@
         <Model scale=13 mesh="DuBall2.mesh" position = "100,0,0"/>
         <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "-100,0,0"/>
-        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>        
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
       </attached>
       <collisionShapes>
@@ -657,5 +925,5 @@
 
 
-    <SimpleNotification message="Dock to the Hydrogen Farmer.">
+    <SimpleNotification message="Dock to the Hydrogen Farmer." broadcast="true">
         <events>
             <trigger>
@@ -665,7 +933,29 @@
     </SimpleNotification>
 
-<!-------------------------------------- PART FOUR : Get Help --------------------------------------->   
-    <DistanceTrigger name="famer1" position="-48200,100,0" target="Pawn" distance=650 stayActive="true" delay=0 />
-    <SimpleNotification message="We just received a message from DuBall.">
+<!-------------------------------------- PART FOUR : Get Help --------------------------------------->
+
+    <Trigger name="famer1" mode="and" stayActive="true">
+        <DistanceTrigger position="-48200,100,0" target="Pawn" distance=650 stayActive="true" delay=0 />
+        <EventTrigger name="notGameEnd" activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="gameEnd" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
+    <Trigger name="famer2" mode="and" stayActive="true">
+        <DistanceTrigger position="-48200,100,0" target="Pawn" distance=650 stayActive="true" delay=4 />
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="gameEnd" />
+            </trigger>
+          </events>
+        </EventTrigger>
+    </Trigger>
+
+    <SimpleNotification message="We just received a message from DuBall." broadcast="true">
         <events>
             <trigger>
@@ -675,6 +965,6 @@
     </SimpleNotification>
 
-    <DistanceTrigger name="famer2" position="-48200,100,0" target="Pawn" distance=650 stayActive="true" delay=4 />
-    <SimpleNotification message="We will lend you our strongest ship.">
+
+    <SimpleNotification message="We will lend you our strongest ship." broadcast="true">
         <events>
             <trigger>
@@ -686,5 +976,12 @@
 
 <!-- @Objects: HYDROGEN FARMER & DOCKING -->
-    <SpaceShip position="-48900,100,0" roll=90 yaw=0 pitch=20 mass=10000 health=100000 name="HydroFarmer">
+    <SpaceShip
+        team     = 0
+        position = "-48900,100,0"
+        roll     = 90   yaw=0  pitch=20
+        mass     = 10000
+        health   = 100000 initialhealth=100000 maxhealth="100000"
+        name     = "HydroFarmer"
+        RVName   = "Hydrogen Farmer" >
       <attached>
         <!-- Docking -->
@@ -730,5 +1027,4 @@
     </SpaceShip>
 
-    <Billboard position="-48900,0,0" material="Examples/Flare" colour="0.6,0,0" scale=3/>
     <Dock position="-48900,0,0" roll=90 yaw=180 >
         <animations>
@@ -742,4 +1038,7 @@
                 <EventListener event="dockMe" />
             </execute>
+            <activity>
+                <EventListener event=notGameEnd />
+            </activity>
         </events>
         <attached>
@@ -748,7 +1047,24 @@
             />
         </attached>
+
     </Dock>
 
-    <SpaceShip template="spaceshipspacecruiser" position="-48900,800,0" orientation="-0.14, 0.68, 0.68, 0.223" health="300" maxhealth="400" initialhealth="300" name="cruiser" >
+<!--@Objects: SpaceCruiser as docking target -->
+    <SpaceShip
+        template            = "spaceshipspacecruiser"
+        team                = "0"
+        position            = "-48900,800,0"
+        orientation         = "-0.14, 0.68, 0.68, 0.223"
+        health              = "400"
+        initialhealth       = "400"
+        maxhealth           = "500"
+        shieldhealth        = "80"
+        initialshieldhealth = "80"
+        maxshieldhealth     = "120"
+        shieldabsorption    = "0.8"
+        reloadrate          = "1"
+        reloadwaittime      = "1"
+        name                = "cruiser"
+        RVName              = "Spacecruiser" >
       <attached>
         <DockingTarget name="spaceShip" />
@@ -756,8 +1072,6 @@
     </SpaceShip>
 
-<!-- TESTBOX-->
-
-<!-- TESTBOX-->
-
+
+<!-- cruiserKilled: if cuiser is killed & player hasn't taken control of spacecrusier -->
           <Trigger name="cruiserKilled" mode="and" stayActive="true">
             <EventTrigger  stayActive="true">
@@ -778,8 +1092,27 @@
 
 
+<!-- triggers when either hydrofarmer or cruiser is killed -->
+            <Trigger mode=or name="gameEnd">
+                <EventTrigger activations="1">
+                  <events>
+                    <trigger>
+                      <EventListener event="HydroFarmer" />
+                    </trigger>
+                  </events>
+                </EventTrigger>
+                <EventTrigger activations="1">
+                  <events>
+                    <trigger>
+                      <EventListener event="cruiserKilled" />
+                    </trigger>
+                  </events>
+                </EventTrigger>
+            </Trigger>
+
+<!-- triggers delayed when either hydrofarmer or cruiser is killed -->
             <EventTrigger delay=4 name="earlyEnd">
               <events>
                 <trigger>
-                  <EventListener event="cruiserKilled" />
+                  <EventListener event="gameEnd" />
                 </trigger>
               </events>
@@ -791,18 +1124,4 @@
             </EventTrigger>
 
-            <EventTrigger delay=4 name="earlyEnd">
-              <events>
-                <trigger>
-                  <EventListener event="HydroFarmer" />
-                </trigger>
-              </events>
-              <events>
-                <activity>
-                  <EventListener event="movingpirates2" />
-                </activity>
-              </events>
-            </EventTrigger>
-
-
 
     <SimpleNotification message="Oh no! You killed the Hydrogen Farmer!" broadcast="true">
@@ -822,5 +1141,5 @@
     </SimpleNotification>
 
-    <SimpleNotification message="Press 'Esc' and restart the mission." broadcast="true">
+    <SimpleNotification message="Press (Esc) and restart the mission." broadcast="true">
         <events>
             <trigger>
@@ -829,5 +1148,4 @@
         </events>
     </SimpleNotification>
-
 
 <!-- hydrogen farmer & docking END -->
@@ -872,5 +1190,5 @@
     >
       <!--attached>
-        <ForceField position="0,0,0" mode="sphere" diameter="10000" velocity="-50" /> 
+        <ForceField position="0,0,0" mode="sphere" diameter="10000" velocity="-50" />
       </attached-->  <!-- Forcefield kills HYDROGEN FARMER-->
       <collisionShapes>
@@ -881,9 +1199,17 @@
 
 <!-------------------------------------- The attack --------------------------------------->
-
 <!-- TODO:
      - update spaceshipTransporter
-     - bots do friendly fire (is drone function reusable?) 
+     - bots do friendly fire (is drone function reusable?)
 -->
+
+<!-- Fallback Spawnpoint: on cruiserdeath caused by pirates. Unfortunately unstable behaviour concerning activity. -->
+    <TeamSpawnPoint team=0 position="2000,1500,-1500" direction="-1,-1,1" spawnclass=SpaceShip pawndesign=spaceshipspacecruiser>
+        <events>
+            <activity>
+                <EventListener event="attack" />
+            </activity>
+        </events>
+    </TeamSpawnPoint>
 
 <!-- @Triggers: toHydroFamer <-> first  portal usage
@@ -891,5 +1217,5 @@
                 attack       <-> second portal usage -->
 
-    <DistanceTrigger name="attack" position="-1400,-500,800" target="Pawn" distance=100 stayActive="true" >
+    <DistanceTrigger name="attack" position="-1400,-500,800" target="Pawn" distance=100 stayActive="true" mode="and">
         <EventTrigger name="ondock" activations="1" stayactive="true" delay=6>
           <events>
@@ -898,9 +1224,25 @@
             </trigger>
           </events>
-            <DistanceTrigger name="toHydroFarmer" position="-47000,-1000,1300" target="Pawn" distance=100 stayActive="true" />
+            <Trigger mode=and>
+              <DistanceTrigger name="toHydroFarmer" position="-47000,-1000,1300" target="Pawn" distance=100 stayActive="true" />
+              <EventTrigger activations="1" invert="true">
+                <events>
+                  <trigger>
+                    <EventListener event="gameEnd" />
+                  </trigger>
+                </events>
+              </EventTrigger>
+            </Trigger>
+        </EventTrigger>
+        <EventTrigger activations="1" invert="true">
+          <events>
+            <trigger>
+              <EventListener event="earlyEnd" />
+            </trigger>
+          </events>
         </EventTrigger>
     </DistanceTrigger>
 
-    <SimpleNotification message="Return before it's too late. Boost with 'Space'." broadcast="true">
+    <SimpleNotification message="Return before it's too late. Boost with (Space)." broadcast="true">
         <events>
             <trigger>
@@ -919,6 +1261,6 @@
 
 
-
 <!-- @Objects: 6 pirates, heading towards DuBall, attacking  -->
+<!-- TODO: re-hide pirates on early end-->
 <!-- 1 -->
     <SpaceShip position="3000,-4000,4000" lookat="-1300,-600,900" name="attacker"visible="true">
@@ -1065,4 +1407,5 @@
         </controller>
     </SpaceShip>
+
 
 <!-- @Triggers: attacktriggerX <-> X enemies destroyed , X is an element of [1,6] -->
@@ -1142,4 +1485,5 @@
       </events>
     </SimpleNotification>
+
     <SimpleNotification message="One enemy left!" broadcast="true">
       <events>
@@ -1149,4 +1493,5 @@
       </events>
     </SimpleNotification>
+
     <SimpleNotification message="Well done. You finished this tutorial." broadcast="true">
       <events>
@@ -1158,5 +1503,5 @@
 
 <!-- @Triggers: postAttack <-> delayed attacktrigger6 -->
-    <EventTrigger name="postAttack1" activations="1" stayactive="true" delay=3>
+    <EventTrigger name="postAttack1" activations="1" stayactive="true" delay=4.1>
       <events>
         <trigger>
@@ -1166,5 +1511,5 @@
     </EventTrigger>
 
-    <EventTrigger name="postAttack2" activations="1" stayactive="true" delay=6>
+    <EventTrigger name="postAttack2" activations="1" stayactive="true" delay=8.2>
       <events>
         <trigger>
@@ -1174,5 +1519,5 @@
     </EventTrigger>
 
-    <SimpleNotification message="Either quit by pressing 'Esc' or ..." broadcast="true">
+    <SimpleNotification message="Either quit by pressing (Esc) or ..." broadcast="true">
       <events>
         <trigger>
@@ -1192,5 +1537,5 @@
 <!-------------------------------------- |Bonus Part| --------------------------------------->
 <!-- @Triggers: "bonusX" <->  delayed "attacktrigger6" -->
-    <EventTrigger name="bonus1" activations="1" stayactive="true" delay=10>
+    <EventTrigger name="bonus1" activations="1" stayactive="true" delay=12.3>
       <events>
         <trigger>
@@ -1199,5 +1544,5 @@
       </events>
     </EventTrigger>
-    <EventTrigger name="bonus2" activations="1" stayactive="true" delay=16>
+    <EventTrigger name="bonus2" activations="1" stayactive="true" delay=16.4>
       <events>
         <trigger>
@@ -1213,5 +1558,5 @@
       </events>
     </EventTrigger>
-    <EventTrigger name="bonus4" activations="1" stayactive="true" delay=28>
+    <EventTrigger name="bonus4" activations="1" stayactive="true" delay=28.1>
       <events>
         <trigger>
@@ -1220,5 +1565,5 @@
       </events>
     </EventTrigger>
-    <EventTrigger name="bonus5" activations="1" stayactive="true" delay=32.1>
+    <EventTrigger name="bonus5" activations="1" stayactive="true" delay=32.3>
       <events>
         <trigger>
@@ -1227,5 +1572,5 @@
       </events>
     </EventTrigger>
-    <EventTrigger name="bonus6" activations="1" stayactive="true" delay=36.2>
+    <EventTrigger name="bonus6" activations="1" stayactive="true" delay=36.5>
       <events>
         <trigger>
@@ -1234,5 +1579,5 @@
       </events>
     </EventTrigger>
-    <EventTrigger name="bonus7" activations="1" stayactive="true" delay=4>
+    <EventTrigger name="bonus7" activations="1" stayactive="true" delay=4.1>
       <events>
         <trigger>
@@ -1244,5 +1589,5 @@
 
 
-    <SimpleNotification message="Rotate your ship. Press 'Q' or 'E'. "  broadcast="true">
+    <SimpleNotification message="Rotate your ship. Press (Q) or (E). "  broadcast="true">
         <events>
             <trigger>
@@ -1252,5 +1597,5 @@
     </SimpleNotification>
 
-    <SimpleNotification message="Switch the camera's position. Press 'C'. "  broadcast="true">
+    <SimpleNotification message="Switch the camera's position. Press (C). "  broadcast="true">
         <events>
             <trigger>
@@ -1260,5 +1605,5 @@
     </SimpleNotification>
 
-    <SimpleNotification message="360° view: press 'Ctrl' + use the mouse "  broadcast="true">
+    <SimpleNotification message="360° view: press (Ctrl) + use the mouse "  broadcast="true">
         <events>
             <trigger>
@@ -1292,5 +1637,5 @@
     </SimpleNotification>
 
-    <SimpleNotification message="Press 'Esc' and return to the main menu."  broadcast="true">
+    <SimpleNotification message="Press (Esc) and return to the main menu."  broadcast="true">
         <events>
             <trigger>
@@ -1319,9 +1664,10 @@
   </Scene>
 </Level>
-<!-- TODO: 
-! Quest Interface
-- Foolproof text messages (e.g. verspätete Nachrichten unterdrücken)
-- Radar visibility & Hud Markers (done)
+
+<!-- TODO:
+- Story & more precise Questmessages; more quest hints; fail-quest;
+- Colouring: Show who is friend or foe via the colour
+- Waypoints: show the player the way
+- Foolproof text messages (e.g. verspätete Nachrichten unterdrücken ~done )
 - End Tutorial, if either the Hydrogen Farmer or the SpaceCruiser gets destroyed. (~done)
-
  -->
Index: code/trunk/data/levels/myTestLevel.oxw
===================================================================
--- code/trunk/data/levels/myTestLevel.oxw	(revision 8952)
+++ code/trunk/data/levels/myTestLevel.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "A level to test the Class SpaceBoundaries."
  tags = "test"
+ screenshot = "mytestlevel.png"
 />
 
@@ -16,8 +17,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/notifications.oxw
===================================================================
--- code/trunk/data/levels/notifications.oxw	(revision 8952)
+++ code/trunk/data/levels/notifications.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level to test and showcase notifications."
  tags = "test, showcase"
+ screenshot = "notificationsshowcase.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Presentation"
- description  = "A simple testlevel"
->
+<Level>
     <templates>
         <Template link=lodtemplate_default />
Index: code/trunk/data/levels/pickups.oxw
===================================================================
--- code/trunk/data/levels/pickups.oxw	(revision 8952)
+++ code/trunk/data/levels/pickups.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level to test and showcase pickups."
  tags = "test, showcase"
+ screenshot = "pickupsshowcase.png"
 />
 
@@ -16,8 +17,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/pirateAttack.oxw
===================================================================
--- code/trunk/data/levels/pirateAttack.oxw	(revision 8952)
+++ code/trunk/data/levels/pirateAttack.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Pirate Attack"
  description = "Dani's Testlevel"
- tags = "test"
+ tags = "mission"
+ screenshot = "pirateattack.png"
 />
 
@@ -28,5 +29,5 @@
 name="Dani's Testlevel"
 description="Erste Versuche mit den Quests"
-gametype=TeamDeathmatch
+gametype=Mission
 >
 
Index: code/trunk/data/levels/planets.oxw
===================================================================
--- code/trunk/data/levels/planets.oxw	(revision 8952)
+++ code/trunk/data/levels/planets.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Demonstration of Planets"
  tags = "showcase"
+ screenshot = "planetdemonstration.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Planet"
- description  = "Demonstration of Planets"
->
+<Level>
   <templates>
     <Template link="lodtemplate_default" />
Index: code/trunk/data/levels/pong.oxw
===================================================================
--- code/trunk/data/levels/pong.oxw	(revision 8952)
+++ code/trunk/data/levels/pong.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Pong"
  description = "Pong in space!"
- tags = ""
+ tags = "minigame"
+ screenshot = "pong.png"
 />
 
@@ -49,7 +50,5 @@
 
 <Level
- name         = "Presentation"
- description  = "A simple testlevel"
- gametype     = Pong
+ gametype = "Pong"
 >
   <templates>
Index: code/trunk/data/levels/portals.oxw
===================================================================
--- code/trunk/data/levels/portals.oxw	(revision 8952)
+++ code/trunk/data/levels/portals.oxw	(revision 9016)
@@ -3,5 +3,6 @@
  name = "Portals"
  description = "Level for testing portals"
- tags = "tutorial"
+ tags = "test"
+ screenshot = "portals.png"
 />
 
@@ -14,8 +15,5 @@
 ?>
 
-<Level
- name         = "Presentation"
- description  = "A simple testlevel"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/presentation.oxw
===================================================================
--- code/trunk/data/levels/presentation.oxw	(revision 8952)
+++ code/trunk/data/levels/presentation.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Presentation Level"
  tags = "presentation"
+ screenshot = "presentation.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/presentation09.oxw
===================================================================
--- code/trunk/data/levels/presentation09.oxw	(revision 8952)
+++ code/trunk/data/levels/presentation09.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "3rd Presentation level for Orxonox Convention X"
  tags = "presentation"
+ screenshot = "presentationx3rd.png"
 />
 
@@ -13,9 +14,5 @@
 ?>
 
-<Level
- name         = "Presentation09"
- description  = "presentation level for Orxonox Convention X"
-
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/presentation09b.oxw
===================================================================
--- code/trunk/data/levels/presentation09b.oxw	(revision 8952)
+++ code/trunk/data/levels/presentation09b.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "2nd Presentation level for Orxonox Convention X"
  tags = "presentation"
+ screenshot = "presentationx2.png"
 />
 
@@ -16,7 +17,5 @@
 
 <Level
- name         = "Presentation09"
- description  = "presentation level for Orxonox Convention X"
- gametype     = TeamDeathmatch
+ gametype = "TeamDeathmatch"
 >
   <templates>
Index: code/trunk/data/levels/presentationDM.oxw
===================================================================
--- code/trunk/data/levels/presentationDM.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationDM.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Presentation Level"
  tags = "presentation"
+ screenshot = "presentationdm.png"
 />
 
@@ -14,7 +15,5 @@
 
 <Level
- name         = "Presentation"
- description  = "A simple testlevel"
- gametype     = Deathmatch
+ gametype = "Deathmatch"
 >
   <templates>
Index: code/trunk/data/levels/presentationFS10.oxw
===================================================================
--- code/trunk/data/levels/presentationFS10.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationFS10.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "1st Presentation level for Orxonox Convention XI"
  tags = "presentation"
+ screenshot = "presentationxi.png"
 />
 
@@ -19,7 +20,5 @@
 
 <Level
- name         = "Sample"
- description  = "Just a few tests"
- gametype     = TeamDeathmatch
+ gametype = "TeamDeathmatch"
 >
   <templates>
Index: code/trunk/data/levels/presentationFS102.oxw
===================================================================
--- code/trunk/data/levels/presentationFS102.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationFS102.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "2nd Presentation level for Orxonox Convention XI, FPS"
  tags = "presentation"
+ screenshot = "presentationxifps1st.png"
 />
 
@@ -14,8 +15,5 @@
 ?>
 
-<Level
- name         = "fps"
- description  = "tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/presentationFS10Ed.oxw
===================================================================
--- code/trunk/data/levels/presentationFS10Ed.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationFS10Ed.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "3rd Presentation level for Orxonox Convention XI, FPS"
  tags = "presentation"
+ screenshot = "presentationxifps2nd.png"
 />
 
@@ -14,8 +15,5 @@
 ?>
 
-<Level
- name         = "fps"
- description  = "tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/presentationFS11.oxw
===================================================================
--- code/trunk/data/levels/presentationFS11.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationFS11.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Presentation FS11"
  description = "Presentation level spring semester '11"
- tags = "test"
+ tags = "presentation"
+ screenshot = "presentationfs11.png"
 />
 
@@ -21,8 +22,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/presentationHS09.oxw
===================================================================
--- code/trunk/data/levels/presentationHS09.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationHS09.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "1st Presentation level for Orxonox Convention X"
  tags = "presentation"
+ screenshot = "presentationx1st.png"
 />
 
@@ -16,7 +17,5 @@
 
 <Level
- name         = "Presentation09"
- description  = "presentation level for Orxonox Convention X"
- gametype     = TeamDeathmatch
+ gametype = "TeamDeathmatch"
  hasPhysics = true
 >
Index: code/trunk/data/levels/presentationHS09b.oxw
===================================================================
--- code/trunk/data/levels/presentationHS09b.oxw	(revision 8952)
+++ code/trunk/data/levels/presentationHS09b.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "2nd Presentation level for Orxonox Convention X"
  tags = "presentation"
+ screenshot = "presentationx2nd.png"
 />
 
@@ -22,7 +23,5 @@
 
 <Level
- name         = "Sample"
- description  = "Just a few tests"
- gametype     = TeamDeathmatch
+ gametype = "TeamDeathmatch"
 >
   <templates>
Index: code/trunk/data/levels/presentationHS11.oxw
===================================================================
--- code/trunk/data/levels/presentationHS11.oxw	(revision 9016)
+++ code/trunk/data/levels/presentationHS11.oxw	(revision 9016)
@@ -0,0 +1,152 @@
+<LevelInfo
+ name = "Presentation HS 2011"
+ description = "Oxonox Proudly Presents New Features From HS 2011"
+ tags = "presentation"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipAssff.oxt")
+  include("templates/spaceshipPirate.oxt")
+  include("templates/spaceshipSwallow.oxt")
+  include("templates/spaceshipTransporter.oxt")
+?>
+
+<Level
+ gametype = "Mission"
+>                      <!--ALTERNATIVE: TeamGametype-->
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+  <?lua include("includes/notifications.oxi") ?>
+
+  <NotificationQueueCEGUI
+    name="narrative"
+    targets="simpleNotification"
+    size=3
+    displayTime=3.9
+    position="0.2, 0, 0.1, 0"
+    fontSize="23"
+    fontColor="0.3, 1, 0.2, 0.8"
+    alignment="HorzCentred"
+    displaySize="0.6, 0, 0, 0"
+    />
+
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/skyBoxMoreNebula"
+  >
+
+  <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+
+  <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipswallow/>
+
+  <!-- TRIGGERS -->
+    <DistanceTrigger name="FormationInit" position="800,700,600"  target="Pawn" distance=60 stayActive="true" delay=0.1 />
+    <DistanceTrigger name="LetsGo"        position="200,-200,1000" target="Pawn" distance=180 stayActive="true" delay=0.1 />
+      <BlinkingBillboard colour="1,1,0.05"position="200,-200,1000" frequency=0.6 amplitude=3 material="Flares/lensflare" >
+      </BlinkingBillboard>
+
+
+
+
+    <Script code="formationcontroller formationflight true" onLoad="false">
+        <events>
+            <trigger>
+                <EventListener event=FormationInit />
+            </trigger>
+        </events>
+    </Script> <!-- !!! activates formation behaviour !!! -->
+
+    <Script code="artificialcontroller setbotlevel 0.1" onLoad="false">
+        <events>
+            <trigger>
+                <EventListener event=FormationInit />
+            </trigger>
+        </events>
+    </Script> <!-- make bots "friendly", doesn't work yet :-( -->
+
+    <SimpleNotification message="Let's go!">
+        <events>
+            <trigger>
+                <EventListener event="LetsGo" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+
+<!-- ADDING FORMATION: 5 Swallows -->
+<?lua for i=0,4,1 do
+?>
+    <SpaceShip position="<?lua print(400+i*200) ?>,-200,1000" lookat="-1300,-600,900" visible="true">
+        <!--events>
+            <visibility>
+                <EventListener event="ondock" />
+            </visibility>
+        </events-->
+        <templates>
+            <Template link=spaceshipswallow /> <!--spaceshipTransporter spaceshippirate-->
+        </templates>
+        <controller>
+            <AIController team=0>
+                <events>
+                    <activity>
+                        <EventListener event="LetsGo" />
+                     </activity>
+                </events>
+            </AIController>
+        </controller>
+    </SpaceShip>
+<?lua end ?>
+
+<?lua for i=0,2,1 do
+?>
+
+
+<!-- ENEMY TRANSPORTER -->
+    <SpaceShip position="<?lua print(-400+i*200) ?>,3000,-2000" lookat="-1300,-600,900" visible="true">
+        <!--events>
+            <visibility>
+                <EventListener event="LetsGo" />
+            </visibility>
+        </events-->
+        <templates>
+            <Template link=spaceshipTransporter />
+        </templates>
+        <controller>
+            <AIController team=1>
+                <events>
+                    <activity>
+                        <EventListener event="LetsGo" />
+                     </activity>
+                </events>
+            </AIController>
+        </controller>
+    </SpaceShip>
+<?lua end ?>
+
+
+
+
+
+
+
+<!-- Generate asteroid field and asteroid belt -->
+<!-- asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) --> 
+    <?lua
+    	dofile("includes/asteroidField.lua")
+    	asteroidBelt(20000, 0, 13000, -48, -34, 70, 100, 200, 22000, 20000, 500, 1)
+
+    ?>
+
+
+
+
+  </Scene>
+</Level>
+
Index: code/trunk/data/levels/princessAeryn.oxw
===================================================================
--- code/trunk/data/levels/princessAeryn.oxw	(revision 8952)
+++ code/trunk/data/levels/princessAeryn.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "The Tale of Princess Aeryn"
  description = "The Tale of the elusive but beautiful Princess Aeryn"
- tags = ""
+ tags = "mission"
+ screenshot = "thetaleofprincessaeryn.png"
 />
 
@@ -16,8 +17,5 @@
 ?>
 
-<Level
- name     = "The Tale of Princess Aeryn"
- description  = "The Tale of Princess Aeryn"
->
+<Level>
 
   <templates>
Index: code/trunk/data/levels/quests.oxw
===================================================================
--- code/trunk/data/levels/quests.oxw	(revision 8952)
+++ code/trunk/data/levels/quests.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level to test and showcase quests."
  tags = "test, showcase"
+ screenshot = "questsshowcase.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Questsystem"
- description  = "Just a few tests"
->
+<Level>
     <templates>
         <Template link=lodtemplate_default />
Index: code/trunk/data/levels/screenshot.oxw
===================================================================
--- code/trunk/data/levels/screenshot.oxw	(revision 8952)
+++ code/trunk/data/levels/screenshot.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Screenshot"
  description = "Level to make awesome screenshots in."
- tags = "test"
+ tags = "test, showcase"
+ screenshot = "screenshot.png"
 />
 
@@ -15,7 +16,5 @@
 
 <Level
- name         = "Waypoints"
- description  = "Testing waypoings for AI controlled spaceships."
- gametype     = TeamDeathmatch
+ gametype = "TeamDeathmatch"
 >
   <templates>
Index: code/trunk/data/levels/shieldTest.oxw
===================================================================
--- code/trunk/data/levels/shieldTest.oxw	(revision 8952)
+++ code/trunk/data/levels/shieldTest.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "A simple Level with one shielded drone to shoot at"
  tags = "test"
+ screenshot = "shieldtestlevel.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "shieldTL"
- description  = "LEVEL-DESCRIPTION"
->
+<Level>
 
 <templates>
Index: code/trunk/data/levels/sound.oxw
===================================================================
--- code/trunk/data/levels/sound.oxw	(revision 8952)
+++ code/trunk/data/levels/sound.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Sound showcase"
  description = "Level to test and showcase sound."
- tags = "test"
+ tags = "test, showcase"
+ screenshot = "soundshowcase.png"
 />
 
@@ -16,8 +17,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/spaceRace.oxw
===================================================================
--- code/trunk/data/levels/spaceRace.oxw	(revision 8952)
+++ code/trunk/data/levels/spaceRace.oxw	(revision 9016)
@@ -1,6 +1,7 @@
 <LevelInfo
- name = "Space Race"
- description = "Test level for the gametype Space Race."
- tags = "test"
+ name = "Old Space Race"
+ description = "Have a furious Race in Space: Reach the checkpoints as fast as possible."
+ tags = "gametype"
+ screenshot = "spacerace.png"
 />
 
@@ -17,7 +18,5 @@
 
 <Level
- name         = "Space Race"
- description  = "Test level for the gametype Space Race."
- gametype     = SpaceRace
+ gametype = "OldSpaceRace"
 >
   <templates>
@@ -53,17 +52,17 @@
     
     <!-- ------------------CheckPoints----------------- -->
-    <RaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
-        <attached>
-            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
-        </attached>
-        <collisionShapes>
-            <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
-            <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
-            <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
-            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
-        </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint2" position="0,-900,2300" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false">
+    <OldRaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="0,0,55"      halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="0,0,-55"     halfExtents="55, 10, 10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
+            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
+        </collisionShapes>
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint2" position="0,-900,2300" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -97,7 +96,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint3" position="0,700,2700" stayActive="true" direction="0,0,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint3" position="0,700,2700" stayActive="true" direction="0,0,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -131,7 +130,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint4" position="0,2100,2300" stayActive="true" direction="0,1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint4" position="0,2100,2300" stayActive="true" direction="0,1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -166,7 +165,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint5" position="0,2200,500" stayActive="true" direction="0,1,0" collisionType="static" scale="1" distance="40" checkpointindex="4" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint5" position="0,2200,500" stayActive="true" direction="0,1,0" collisionType="static" scale="1" distance="40" checkpointindex="4" islast="false">
         <attached>
         <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -201,7 +200,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint6" position="0,1500,-800" stayActive="true" direction="0,1,-1" collisionType="static" scale="1" distance="40" checkpointindex="5" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint6" position="0,1500,-800" stayActive="true" direction="0,1,-1" collisionType="static" scale="1" distance="40" checkpointindex="5" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -236,7 +235,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint7" position="0,200,-1900" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="6" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint7" position="0,200,-1900" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="6" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -271,7 +270,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint8" position="0,-700,-1400" stayActive="true" direction="0,-1,-1" collisionType="static" scale="1" distance="40" checkpointindex="7" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint8" position="0,-700,-1400" stayActive="true" direction="0,-1,-1" collisionType="static" scale="1" distance="40" checkpointindex="7" islast="false">
         <attached>
         <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -306,7 +305,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint9" position="0,-1300,-800" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="8" islast="false">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint9" position="0,-1300,-800" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="8" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -332,7 +331,7 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
-
-    <RaceCheckPoint name="checkpoint10" position="0,-2100,0" collisionType="static" scale="1" distance="40" checkpointindex="9" islast="true" timelimit="150">
+    </OldRaceCheckPoint>
+
+    <OldRaceCheckPoint name="checkpoint10" position="0,-2100,0" collisionType="static" scale="1" distance="40" checkpointindex="9" islast="true" timelimit="150">
         <attached>
         <   Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -344,5 +343,5 @@
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </RaceCheckPoint>
+    </OldRaceCheckPoint>
 
     <!-- ------------------Planet----------------- -->
Index: code/trunk/data/levels/teamBaseMatch.oxw
===================================================================
--- code/trunk/data/levels/teamBaseMatch.oxw	(revision 8952)
+++ code/trunk/data/levels/teamBaseMatch.oxw	(revision 9016)
@@ -1,6 +1,7 @@
 <LevelInfo
  name = "Teambase Match"
- description = "Fight for the bases."
- tags = ""
+ description = "Fight for the bases. Capture bases by shooting at them and defend them against attackers."
+ tags = "gametype"
+ screenshot = "teambasematch.png"
 />
 
@@ -15,7 +16,5 @@
 
 <Level
- name         = "Presentation"
- description  = "A simple testlevel"
- gametype     = TeamBaseMatch
+ gametype = "TeamBaseMatch"
 >
 
Index: code/trunk/data/levels/teamDeathMatch.oxw
===================================================================
--- code/trunk/data/levels/teamDeathMatch.oxw	(revision 8952)
+++ code/trunk/data/levels/teamDeathMatch.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Team Deathmatch"
  description = "Fight against each other in teams."
- tags = ""
+ tags = "gametype"
+ screenshot = "teamdeathmatch.png"
 />
 
@@ -15,7 +16,5 @@
 
 <Level
- name         = "Waypoints"
- description  = "Testing waypoings for AI controlled spaceships."
- gametype     = TeamDeathmatch
+ gametype = "TeamDeathmatch"
 >
   <templates>
Index: code/trunk/data/levels/templates/spaceshipSpacecruiser.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipSpacecruiser.oxt	(revision 8952)
+++ code/trunk/data/levels/templates/spaceshipSpacecruiser.oxt	(revision 9016)
@@ -11,8 +11,8 @@
    initialhealth     = 300
 
-   shieldhealth        = 60
-   initialshieldhealth = 60
-   maxshieldhealth     = 80
-   shieldabsorption    = 0.8
+   shieldhealth        = 75
+   initialshieldhealth = 75
+   maxshieldhealth     = 90
+   shieldabsorption    = 0.9
    reloadrate          = 1
    reloadwaittime      = 1
@@ -45,5 +45,5 @@
     </engines>
     <attached>
-      <Model position="12,-30,-120" yaw=90 pitch=-90 roll=0 scale=6 mesh="spacecruiser.mesh" />
+      <Model position="12,-5,-10" yaw=90 pitch=-90 roll=0 scale=6 mesh="spacecruiser.mesh" />
       <!--Model mesh="cube.mesh" mass=10 position="0,-30,-108" scale3D="38,6,62" />
       <Model mesh="cube.mesh" mass=10 position="0,-20,-108" scale3D="20,6,40" />
@@ -57,15 +57,15 @@
     </attached>
     <collisionShapes>
-      <BoxCollisionShape position="0,-30,-108"   halfExtents="38,6,62" />
-      <BoxCollisionShape position="0,-20,-108"   halfExtents="20,6,40" />
-      <BoxCollisionShape position="-16,-35,-112"  halfExtents="15,5,57" roll=-14 pitch=3.5/>
-      <BoxCollisionShape position="16,-35,-112"   halfExtents="15,5,57" roll=14 pitch=3.5/>
-      <BoxCollisionShape position="19,-21.5,-108" halfExtents="18,5,52" roll=-21 />
-      <BoxCollisionShape position="-19,-21.5,-108"halfExtents="18,5,52" roll=21 />
-      <BoxCollisionShape position="0,-21,-169"halfExtents="18,1,16" pitch=-30x />
+      <BoxCollisionShape position="0,-5,2"     halfExtents="38,6,62" />
+      <BoxCollisionShape position="0,5,2"      halfExtents="20,6,40" />
+      <BoxCollisionShape position="-16,-10,-2" halfExtents="15,5,57" roll=-14 pitch=3.5/>
+      <BoxCollisionShape position="16,-10,-2"  halfExtents="15,5,57" roll=14  pitch=3.5/>
+      <BoxCollisionShape position="19,3.5,2"   halfExtents="18,5,52" roll=-21 />
+      <BoxCollisionShape position="-19,4.5,2"  halfExtents="18,5,52" roll=21  />
+      <BoxCollisionShape position="0,4,-59"    halfExtents="18,1,16" pitch=-30/>
 
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsSpacecruiser.oxi")
+  include("../includes/weaponSettingsSpacecruiser.oxi")
 ?>
   </SpaceShip>
@@ -75,14 +75,7 @@
   <SpaceShip>
     <camerapositions>
-      <CameraPosition position="0,10,  40" drag=true mouselook=true />
-      <CameraPosition position="0,20,  80" drag=true mouselook=true />
-      <CameraPosition position="0,30, 120" drag=true mouselook=true />
-      <CameraPosition position="0,20,-260" drag=true mouselook=true yaw=180/>
-      <CameraPosition position="0,30,-350" drag=true mouselook=true yaw=180/>
-      <!--CameraPosition position="0,150,-25" pitch=-90 drag=true />
-      <CameraPosition position="0,0,-40" yaw=180 drag=true />
-      <CameraPosition position="0,3,-14" yaw=0 />
-      <CameraPosition position="-50,5,-8" yaw=-90 drag=true />
-      <CameraPosition position="50,5,-8" yaw=90 drag=true /-->
+      <CameraPosition position="0,40, 170" drag=true mouselook=true />
+      <CameraPosition position="0,55, 230" drag=true mouselook=true />
+      <CameraPosition position="0,65, 460" drag=true mouselook=true />
     </camerapositions>
   </SpaceShip>
@@ -93,8 +86,8 @@
    boostfactor    = 2
 
-   speedfront     = 150
-   speedback      =  50
-   speedleftright =  50
-   speedupdown    =  50
+   speedfront     = 200
+   speedback      =  70
+   speedleftright =  70
+   speedupdown    =  70
 
    defEngineSndNormal = "sounds/Engine_low.ogg"
@@ -111,6 +104,6 @@
     </EffectContainer>
     <EffectContainer condition="not idle">
-      <FadingBillboard mainstate=activity active=false scale=0.1 position="20, -25, -40" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
-      <FadingBillboard mainstate=activity active=false scale=0.1 position="-20, -25, -40" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.1 position="20,  0, 70" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.1 position="-20, 0, 70" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
     </EffectContainer>
     <EffectContainer condition="normal or brake">
@@ -118,16 +111,16 @@
     </EffectContainer>
     <EffectContainer condition="normal or boost">
-      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 20, -25, -40" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1300 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
-      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-20, -25, -40" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1300 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 20, 0, 70" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1300 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-20, 0, 70" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1300 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
     </EffectContainer>
     <EffectContainer condition="boost">
-      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 20, -25, -40" colour="0.6, 0.75, 0.8, 0.7" width=40 length=800 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
-      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-20, -25, -40" colour="0.6, 0.75, 0.8, 0.7" width=40 length=800 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 20, 0, 70" colour="0.6, 0.75, 0.8, 0.7" width=40 length=800 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-20, 0, 70" colour="0.6, 0.75, 0.8, 0.7" width=40 length=800 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
     </EffectContainer>
 <!--    <EffectContainer condition="brake">
-      <FadingBillboard mainstate=activity active=false scale=0.3 position=" 20, -25, -40" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
-      <FadingBillboard mainstate=activity active=false scale=0.3 position="-20, -25, -40" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
-      <FadingBillboard mainstate=activity active=false scale=0.15 position="20, -25, -40" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
-      <FadingBillboard mainstate=activity active=false scale=0.15 position="-20, -25, -40" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.3 position=" 20,  0, 70" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.3 position="-20,  0, 70" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.15 position="20,  0, 70" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.15 position="-20, 0, 70" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
     </EffectContainer>
 -->
Index: code/trunk/data/levels/testStars.oxw
===================================================================
--- code/trunk/data/levels/testStars.oxw	(revision 8952)
+++ code/trunk/data/levels/testStars.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level to test stars"
  tags = "test"
+ screenshot = "starstestlevel.png"
 />
 
@@ -16,8 +17,5 @@
 ?>
 
-<Level
- name         = "Sample"
- description  = "Just a few tests"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/testSwallow.oxw
===================================================================
--- code/trunk/data/levels/testSwallow.oxw	(revision 8952)
+++ code/trunk/data/levels/testSwallow.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level to test the swallow spaceship."
  tags = "test"
+ screenshot = "swallowtestlevel.png"
 />
 
@@ -13,9 +14,5 @@
 ?>
 
-<Level
- name         = "Presentation_swallow"
- description  = "presentation level for Orxonox Convention X"
-
->
+<Level>
 
   <templates>
Index: code/trunk/data/levels/tetris.oxw
===================================================================
--- code/trunk/data/levels/tetris.oxw	(revision 8952)
+++ code/trunk/data/levels/tetris.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "Tetris"
  description = "Tetris in space!"
- tags = ""
+ tags = "minigame"
+ screenshot = "tetris.png"
 />
 
@@ -30,7 +31,5 @@
 
 <Level
- name         = "Presentation"
- description  = "A simple testlevel"
- gametype     = "Tetris"
+ gametype = "Tetris"
 >
   <templates>
Index: code/trunk/data/levels/theTimeMachine.oxw
===================================================================
--- code/trunk/data/levels/theTimeMachine.oxw	(revision 8952)
+++ code/trunk/data/levels/theTimeMachine.oxw	(revision 9016)
@@ -2,5 +2,6 @@
  name = "The Time Machine"
  description = "A simple level. The only goal is to defeat as much enemies as you can."
- tags = "singleplayer"
+ tags = "gametype"
+ screenshot = "thetimemachine.png"
 />
 
@@ -61,7 +62,5 @@
 
 <Level
-    name="The Time Machine"
-    description="A simple level. The only goal is to defeat as much enemies as you can."
-    gametype=TeamDeathmatch
+ gametype = "TeamDeathmatch"
 >
     <templates>
Index: code/trunk/data/levels/tutorial.oxw
===================================================================
--- code/trunk/data/levels/tutorial.oxw	(revision 8952)
+++ code/trunk/data/levels/tutorial.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Level for the coding tutorial."
  tags = "tutorial"
+ screenshot = "codingtutorial.png"
 />
 
@@ -12,8 +13,5 @@
 ?>
 
-<Level
- name         = "Presentation"
- description  = "A simple testlevel"
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/levels/underAttack.oxw
===================================================================
--- code/trunk/data/levels/underAttack.oxw	(revision 8952)
+++ code/trunk/data/levels/underAttack.oxw	(revision 9016)
@@ -1,14 +1,19 @@
+<LevelInfo
+ name = "Under Attack"
+ description = "Fight the transporter."
+ tags = "gametype"
+ screenshot = "underattack.png"
+/>
+
 <?lua
   include("HUDTemplates3.oxo")
   include("stats.oxo")
-  include("underAttackHUD.oxo")
   include("templates/spaceshipAssff.oxt")
   include("templates/lodInformation.oxt")
 ?>
+<!--OUTDATED: include("underAttackHUD.oxo") -->
 
 <Level
- name         = "UnderAttack testing"
- description  = "A simple testlevel"
- gametype     = UnderAttack
+ gametype = "UnderAttack"
 >
   <templates>
@@ -51,4 +56,5 @@
       maxhealth         = 10000
       initialhealth     = 10000
+      RVName            = "Transporter"
     >
 
Index: code/trunk/data/levels/waypoints.oxw
===================================================================
--- code/trunk/data/levels/waypoints.oxw	(revision 8952)
+++ code/trunk/data/levels/waypoints.oxw	(revision 9016)
@@ -3,4 +3,5 @@
  description = "Testing waypoings for AI controlled spaceships."
  tags = "test"
+ screenshot = "waypointstestlevel.png"
 />
 
@@ -14,8 +15,5 @@
 ?>
 
-<Level
- name         = "Waypoints"
- description  = "Testing waypoings for AI controlled spaceships."
->
+<Level>
   <templates>
     <Template link=lodtemplate_default />
Index: code/trunk/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/trunk/data/overlays/HUDTemplates3.oxo	(revision 8952)
+++ code/trunk/data/overlays/HUDTemplates3.oxo	(revision 9016)
@@ -78,4 +78,25 @@
     </HUDBoostBar>
 
+    <HUDEnemyHealthBar
+     name              = "EnemyHealthBar"
+     background        = "Orxonox/HealthBarBackground"
+     size              = "0.35, 0.0875"
+     position          = "1.0 , 0.1 "
+     pickpoint         = "1, 1"
+     bartexture        = "healthbar_bar.png"
+     textfont          = "VeraMono"
+     textusebarcolour  = true
+     textsize          = 0.039
+     textoffset        = "0.315, 0.05"
+     textpickpoint     = "0, 0"
+     textalign         = "right"
+     correctaspect     = false
+     textcorrectaspect = false
+    >
+      <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+      <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+      <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+    </HUDEnemyHealthBar>
+
     <HUDNavigation
      name          = "Navigation"
Index: code/trunk/data/overlays/underAttackHUD.oxo
===================================================================
--- code/trunk/data/overlays/underAttackHUD.oxo	(revision 8952)
+++ code/trunk/data/overlays/underAttackHUD.oxo	(revision 9016)
@@ -1,5 +1,5 @@
-<Template name="UnderAttackHUD">
+< Template name="UnderAttackHUD">
   <OverlayGroup name="UnderAttackHUD" scale = "1, 1">
-    <UnderAttackHealthBar
+    <OUTDATED-- UnderAttackHealthBar
      name                 = "HealthBar"
      background           = "Orxonox/HealthBarBackground"
Index: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc	(revision 8952)
+++ code/trunk/src/libraries/core/GUIManager.cc	(revision 9016)
@@ -223,5 +223,5 @@
 
     GUIManager* GUIManager::singletonPtr_s = 0;
-    /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen";
+    /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen"; //Alternative: Orxonox (not fully complete yet, see the graphics menu)
 
     SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false);
Index: code/trunk/src/libraries/util/SignalHandler.cc
===================================================================
--- code/trunk/src/libraries/util/SignalHandler.cc	(revision 8952)
+++ code/trunk/src/libraries/util/SignalHandler.cc	(revision 9016)
@@ -70,5 +70,5 @@
 
       catchSignal( SIGSEGV );
-      catchSignal( SIGABRT );
+      catchSignal( SIGABRT );  
       catchSignal( SIGILL );
     }
@@ -675,5 +675,5 @@
 
     /// Returns a description of the given exception.
-    // Based on code from Dr. Mingw by José Fonseca
+    // Based on code from Dr. Mingw by Jos\E9 Fonseca
     /* static */ std::string SignalHandler::getExceptionType(PEXCEPTION_POINTERS pExceptionInfo)
     {
@@ -745,5 +745,5 @@
 
     /// Retrieves the base address of the module that contains the specified address.
-    // Code from Dr. Mingw by José Fonseca
+    // Code from Dr. Mingw by Jos\E9 Fonseca
     /* static */ DWORD SignalHandler::getModuleBase(DWORD dwAddress)
     {
Index: code/trunk/src/modules/gametypes/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/gametypes/CMakeLists.txt	(revision 8952)
+++ code/trunk/src/modules/gametypes/CMakeLists.txt	(revision 9016)
@@ -2,4 +2,7 @@
   SpaceRace.cc
   RaceCheckPoint.cc
+  SpaceRaceManager.cc
+  OldSpaceRace.cc
+  OldRaceCheckPoint.cc
 )
 
Index: code/trunk/src/modules/gametypes/GametypesPrereqs.h
===================================================================
--- code/trunk/src/modules/gametypes/GametypesPrereqs.h	(revision 8952)
+++ code/trunk/src/modules/gametypes/GametypesPrereqs.h	(revision 9016)
@@ -66,4 +66,5 @@
 {
     class SpaceRace;
+    class OldSpaceRace;
 }
 
Index: code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc
===================================================================
--- code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc	(revision 9016)
+++ code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc	(revision 9016)
@@ -0,0 +1,120 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OldRaceCheckPoint.h"
+
+#include "util/Convert.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "chat/ChatManager.h"
+
+#include "OldSpaceRace.h"
+
+namespace orxonox
+{
+    CreateFactory(OldRaceCheckPoint);
+
+    OldRaceCheckPoint::OldRaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+    {
+        RegisterObject(OldRaceCheckPoint);
+
+        this->bCheckpointIndex_ = 0;
+        this->bIsLast_ = false;
+        this->bTimeLimit_ = 0;
+
+        this->setRadarObjectColour(ColourValue::Blue);
+        this->setRadarObjectShape(RadarViewable::Triangle);
+        this->setRadarVisibility(false);
+    }
+
+    OldRaceCheckPoint::~OldRaceCheckPoint()
+    {
+    }
+
+    void OldRaceCheckPoint::tick(float dt)
+    {
+        SUPER(OldRaceCheckPoint, tick, dt);
+
+        OldSpaceRace* gametype = orxonox_cast<OldSpaceRace*>(this->getGametype().get());
+        assert(gametype);
+        if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
+            this->setRadarVisibility(true);
+        else
+            this->setRadarVisibility(false);
+    }
+
+    void OldRaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(OldRaceCheckPoint, XMLPort, xmlelement, mode);
+
+        XMLPortParam(OldRaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
+        XMLPortParam(OldRaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
+        XMLPortParam(OldRaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
+    }
+
+    void OldRaceCheckPoint::triggered(bool bIsTriggered)
+    {
+        DistanceTrigger::triggered(bIsTriggered);
+
+        OldSpaceRace* gametype = orxonox_cast<OldSpaceRace*>(this->getGametype().get());
+        if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
+        {
+            gametype->clock_.capture();
+            float time = gametype->clock_.getSecondsPrecise();
+            if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
+            {
+                gametype->timeIsUp();
+                gametype->end();
+            }
+            else if (this->getLast())
+                gametype->end();
+            else
+            {
+                gametype->newCheckpointReached();
+                this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
+            }
+        }
+    }
+
+    void OldRaceCheckPoint::setTimelimit(float timeLimit)
+    {
+        this->bTimeLimit_ = timeLimit;
+        if (this->bTimeLimit_ != 0)
+        {
+            OldSpaceRace* gametype = orxonox_cast<OldSpaceRace*>(this->getGametype().get());
+            if (gametype)
+            {
+                const std::string& message =  "You have " + multi_cast<std::string>(this->bTimeLimit_)
+                            + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1);
+                const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
+                ChatManager::message(message);
+            }
+        }
+    }
+
+}
Index: code/trunk/src/modules/gametypes/OldRaceCheckPoint.h
===================================================================
--- code/trunk/src/modules/gametypes/OldRaceCheckPoint.h	(revision 9016)
+++ code/trunk/src/modules/gametypes/OldRaceCheckPoint.h	(revision 9016)
@@ -0,0 +1,77 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _OldRaceCheckPoint_H__
+#define _OldRaceCheckPoint_H__
+
+#include "gametypes/GametypesPrereqs.h"
+
+#include "objects/triggers/DistanceTrigger.h"
+#include "interfaces/RadarViewable.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        The OldRaceCheckPoint class enables the creation of a check point to use in a OldSpaceRace level.
+        !!! Don't forget to control the indexes of your check points and to set one last check point!!!
+    */
+    class _GametypesExport OldRaceCheckPoint : public DistanceTrigger, public RadarViewable
+    {
+        public:
+            OldRaceCheckPoint(BaseObject* creator);
+            virtual ~OldRaceCheckPoint();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+
+            protected:
+            virtual void triggered(bool bIsTriggered);
+            inline void setLast(bool isLast)
+                { this->bIsLast_ = isLast; }
+            inline bool getLast()
+                { return this->bIsLast_; }
+            inline void setCheckpointIndex(int checkpointIndex)
+                { this->bCheckpointIndex_ = checkpointIndex; }
+            inline int getCheckpointIndex()
+                { return this->bCheckpointIndex_; }
+            virtual void setTimelimit(float timeLimit);
+            inline float getTimeLimit()
+                { return this->bTimeLimit_;}
+            inline const WorldEntity* getWorldEntity() const
+                { return this; }
+
+        private:
+            int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
+            bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
+            float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+      
+    };
+}
+
+#endif /* _OldRaceCheckPoint_H__ */
Index: code/trunk/src/modules/gametypes/OldSpaceRace.cc
===================================================================
--- code/trunk/src/modules/gametypes/OldSpaceRace.cc	(revision 9016)
+++ code/trunk/src/modules/gametypes/OldSpaceRace.cc	(revision 9016)
@@ -0,0 +1,104 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *     Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OldSpaceRace.h"
+
+#include "core/CoreIncludes.h"
+#include "chat/ChatManager.h"
+#include "util/Convert.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(OldSpaceRace);
+
+    OldSpaceRace::OldSpaceRace(BaseObject* creator) : Gametype(creator)
+    {
+        RegisterObject(OldSpaceRace);
+        this->checkpointsReached_ = 0;
+        this->bTimeIsUp_ = false;
+        this->numberOfBots_ = 0;
+    }
+
+    void OldSpaceRace::end()
+    {
+        this->Gametype::end();
+
+        if (this->bTimeIsUp_)
+        {
+            this->clock_.capture();
+            int s = this->clock_.getSeconds();
+            int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
+            const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
+                        + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1)
+                        + " before the time limit. You lose!";
+            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            ChatManager::message(message);
+        }
+        else
+        {
+            this->clock_.capture();
+            int s = this->clock_.getSeconds();
+            int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
+            const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
+                        + "." + multi_cast<std::string>(ms) + " seconds.";
+            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            ChatManager::message(message);
+/*
+            float time = this->clock_.getSecondsPrecise();
+            this->scores_.insert(time);
+            std::set<float>::iterator it;
+            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
+                orxout(level::message) << multi_cast<std::string>(*it) << endl;
+*/
+        }
+    }
+
+    void OldSpaceRace::start()
+    {
+        Gametype::start();
+
+        std::string message("The match has started! Reach the check points as quickly as possible!");
+        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+        ChatManager::message(message);
+    }
+
+    void OldSpaceRace::newCheckpointReached()
+    {
+        this->checkpointsReached_++;
+        this->clock_.capture();
+        int s = this->clock_.getSeconds();
+        int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
+        const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
+                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+                        + " seconds.";
+        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+        ChatManager::message(message);
+    }
+
+}
Index: code/trunk/src/modules/gametypes/OldSpaceRace.h
===================================================================
--- code/trunk/src/modules/gametypes/OldSpaceRace.h	(revision 9016)
+++ code/trunk/src/modules/gametypes/OldSpaceRace.h	(revision 9016)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _OldSpaceRace_H__
+#define _OldSpaceRace_H__
+
+#include "gametypes/GametypesPrereqs.h"
+
+#include <set>
+#include <string>
+
+#include <util/Clock.h>
+
+#include "gametypes/Gametype.h"
+
+#include "OldRaceCheckPoint.h"
+
+namespace orxonox
+{
+  /**
+  @brief
+    The OldSpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
+  */
+    class _GametypesExport OldSpaceRace : public Gametype
+    {
+        friend class OldRaceCheckPoint;
+
+        public:
+            OldSpaceRace(BaseObject* creator);
+            virtual ~OldSpaceRace() {}
+
+            virtual void start();
+            virtual void end();
+
+            virtual void newCheckpointReached();
+
+            inline void setCheckpointsReached(int n)
+                { this->checkpointsReached_ = n;}
+            inline int getCheckpointsReached()
+                { return this->checkpointsReached_; }
+            inline void timeIsUp()
+                { this->bTimeIsUp_ = true;}
+
+        protected:
+
+        private:
+            int checkpointsReached_; //The current number of check points reached by the player.
+            std::set<float> scores_; //The times of the players are saved in a set.
+            bool bTimeIsUp_; //True if one of the check points is reached too late.
+            Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
+    };
+}
+
+#endif /* _OldSpaceRace_H__ */
Index: code/trunk/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.cc	(revision 8952)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.cc	(revision 9016)
@@ -34,4 +34,7 @@
 #include "chat/ChatManager.h"
 
+#include <infos/PlayerInfo.h>
+#include <worldentities/ControllableEntity.h>
+
 #include "SpaceRace.h"
 
@@ -39,11 +42,14 @@
 {
     CreateFactory(RaceCheckPoint);
+    
+     
 
-    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+    RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
     {
         RegisterObject(RaceCheckPoint);
-
-        this->bCheckpointIndex_ = 0;
-        this->bIsLast_ = false;
+        this->setDistance(100);
+        this->setBeaconMode("off");
+        this->setBroadcast(false);
+        this->setSimultaneousTriggerers(100);
         this->bTimeLimit_ = 0;
 
@@ -51,9 +57,14 @@
         this->setRadarObjectShape(RadarViewable::Triangle);
         this->setRadarVisibility(false);
+        this->settingsChanged();
+        this->reached_=NULL;
+      
     }
+    
 
-    RaceCheckPoint::~RaceCheckPoint()
-    {
-    }
+   RaceCheckPoint::~RaceCheckPoint()
+   {
+    
+   }
 
     void RaceCheckPoint::tick(float dt)
@@ -63,8 +74,4 @@
         SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
         assert(gametype);
-        if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
-            this->setRadarVisibility(true);
-        else
-            this->setRadarVisibility(false);
     }
 
@@ -72,32 +79,23 @@
     {
         SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
-
+        Vector3 v= Vector3(0,0,0);
         XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
         XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
         XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
+    XMLPortParamTemplate(RaceCheckPoint, "nextcheckpoints", setNextcheckpoint, getNextcheckpoint, xmlelement, mode,const Vector3&).defaultValues(v);
     }
 
-    void RaceCheckPoint::triggered(bool bIsTriggered)
+    void RaceCheckPoint::fire(bool bIsTriggered,BaseObject* player)
     {
-        DistanceTrigger::triggered(bIsTriggered);
-
+        DistanceMultiTrigger::fire((bool)bIsTriggered,player);
+        
         SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
-        if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
-        {
-            gametype->clock_.capture();
-            float time = gametype->clock_.getSecondsPrecise();
-            if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
-            {
-                gametype->timeIsUp();
-                gametype->end();
-            }
-            else if (this->getLast())
-                gametype->end();
-            else
-            {
-                gametype->newCheckpointReached();
-                this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
-            }
-        }
+        assert(gametype);
+        ControllableEntity* entity = (ControllableEntity*) player;
+     
+        PlayerInfo* player2 = entity->getPlayer();
+     
+        if(bIsTriggered)
+            this->reached_=player2;
     }
 
@@ -108,4 +106,5 @@
         {
             SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+            assert(gametype);
             if (gametype)
             {
Index: code/trunk/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.h	(revision 8952)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.h	(revision 9016)
@@ -32,5 +32,7 @@
 #include "gametypes/GametypesPrereqs.h"
 
-#include "objects/triggers/DistanceTrigger.h"
+
+
+#include "objects/triggers/DistanceMultiTrigger.h"
 #include "interfaces/RadarViewable.h"
 
@@ -40,7 +42,7 @@
     @brief
         The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
-        !!! Don't forget to control the indexes of your check points and to set one last check point!!!
+         Don't forget to control the indexes of your check points and to set one last check point
     */
-    class _GametypesExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
+    class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable
     {
         public:
@@ -50,26 +52,38 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             virtual void tick(float dt);
+            inline void setCheckpointIndex(int checkpointIndex)
+                { this->bCheckpointIndex_ = checkpointIndex; }
+            inline int getCheckpointIndex()
+                { return this->bCheckpointIndex_; }
 
-            protected:
-            virtual void triggered(bool bIsTriggered);
+            inline void setNextcheckpoint(const Vector3& checkpoints)
+                { this->nextcheckpoints_=checkpoints; }
+            inline void setNextcheckpoint(float x, float y, float z)
+                { this->setNextcheckpoint(Vector3(x, y, z)); }
+            inline const Vector3& getNextcheckpoint() const
+                { return this->nextcheckpoints_; }
             inline void setLast(bool isLast)
                 { this->bIsLast_ = isLast; }
             inline bool getLast()
                 { return this->bIsLast_; }
-            inline void setCheckpointIndex(int checkpointIndex)
-                { this->bCheckpointIndex_ = checkpointIndex; }
-            inline int getCheckpointIndex()
-                { return this->bCheckpointIndex_; }
+
+            bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
+            float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+            PlayerInfo* reached_;
+                
+            inline float getTimeLimit()
+                { return this->bTimeLimit_; }
+    
+        protected:
+            virtual void fire(bool bIsTriggered,BaseObject* player);
             virtual void setTimelimit(float timeLimit);
-            inline float getTimeLimit()
-                { return this->bTimeLimit_;}
+            
             inline const WorldEntity* getWorldEntity() const
                 { return this; }
 
         private:
-            int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
-            bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
-            float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
-      
+            int bCheckpointIndex_; //The index of this check point. The race starts with the check point with the index 0
+            Vector3 nextcheckpoints_; //the indexes of the next check points
+            
     };
 }
Index: code/trunk/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.cc	(revision 8952)
+++ code/trunk/src/modules/gametypes/SpaceRace.cc	(revision 9016)
@@ -29,8 +29,13 @@
 #include "SpaceRace.h"
 
+
+#include "items/Engine.h"
+
 #include "core/CoreIncludes.h"
 #include "chat/ChatManager.h"
 #include "util/Convert.h"
 #include "util/Math.h"
+
+#include "items/Engine.h"
 
 namespace orxonox
@@ -41,8 +46,15 @@
     {
         RegisterObject(SpaceRace);
-        this->checkpointsReached_ = 0;
+        
         this->bTimeIsUp_ = false;
         this->numberOfBots_ = 0;
+        this->cantMove_=false;
+        
     }
+       
+    
+  // void SpaceRace::SetConfigValues(){
+    //SUPER(Gametype,setConfigValues);
+    //this->Gametype::SetConfigValue(initialStartCountdown_, 3.0f);}
 
     void SpaceRace::end()
@@ -56,6 +68,5 @@
             int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
             const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
-                        + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1)
-                        + " before the time limit. You lose!";
+                        + "You didn't reach the check point  before the time limit. You lose!";
             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
             ChatManager::message(message);
@@ -70,11 +81,10 @@
             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
             ChatManager::message(message);
-/*
+
             float time = this->clock_.getSecondsPrecise();
             this->scores_.insert(time);
             std::set<float>::iterator it;
-            for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
-                orxout(level::message) << multi_cast<std::string>(*it) << endl;
-*/
+            
+
         }
     }
@@ -82,23 +92,100 @@
     void SpaceRace::start()
     {
-        Gametype::start();
 
-        std::string message("The match has started! Reach the check points as quickly as possible!");
+        this->spawnPlayersIfRequested();
+        Gametype::checkStart(); 
+        this->cantMove_=true; 
+        
+        for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 
+        {
+            it->setActive(false);
+            
+        } 
+        this->addBots(this->numberOfBots_); 
+    }
+    
+    void SpaceRace::tick(float dt)
+    {
+        SUPER(SpaceRace,tick,dt);
+    
+        if(!this->isStartCountdownRunning() && this->cantMove_)
+        {
+            for(ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it) 
+            { 
+                it->setActive(true);
+                
+            }
+            this->cantMove_= false;
+            
+            std::string message("The match has started! Reach the check points as quickly as possible!");
+            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+            ChatManager::message(message);            
+        }
+   
+    }
+
+    
+    
+    void SpaceRace::newCheckpointReached(SpaceRaceManager* p, int index,PlayerInfo* pl)
+    {
+        this->checkpointReached_[pl]=index;
+        this->clock_.capture();
+        int s = this->clock_.getSeconds();
+        int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
+        const std::string& message = "Checkpoint " + multi_cast<std::string>(index)
+            + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+            + " seconds.";// Message is too long for a normal screen.
         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
         ChatManager::message(message);
     }
-
-    void SpaceRace::newCheckpointReached()
-    {
-        this->checkpointsReached_++;
+   
+    void SpaceRace::newCheckpointReached(RaceCheckPoint* p, PlayerInfo* pl)
+    {   
+        int index = p->getCheckpointIndex();
+        this->checkpointReached_[pl]=index;
         this->clock_.capture();
         int s = this->clock_.getSeconds();
         int ms = static_cast<int>(this->clock_.getMilliseconds()-1000*s);
-        const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
-                        + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
-                        + " seconds.";
+        const std::string& message = "Checkpoint " + multi_cast<std::string>(index)
+            + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+            + " seconds.";
         const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
         ChatManager::message(message);
     }
+        
+    
+    void SpaceRace::playerEntered(PlayerInfo* player)
+    {
+        Gametype::playerEntered(player);
+    
+        this->checkpointReached_[player]=-1;
+        //this->playersAlive_++;
+    }
+    
+    bool SpaceRace::playerLeft(PlayerInfo* player)
+    {
+        return Gametype::playerLeft(player);
+        // bool valid_player = true;
+        //if (valid_player)
+       // {
+        //    this->playersAlive_--;
+        //}
 
+       // return valid_player;
+    }
+    
+    bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
+    {
+        return false;
+    }
+
+    bool SpaceRace::allowPawnDamage(Pawn* victim, Pawn* originator)
+    {
+        return false;
+    }
+
+    bool SpaceRace::allowPawnDeath(Pawn* victim, Pawn* originator)
+    {
+        return false;
+    }
 }
Index: code/trunk/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.h	(revision 8952)
+++ code/trunk/src/modules/gametypes/SpaceRace.h	(revision 9016)
@@ -34,4 +34,5 @@
 #include <set>
 #include <string>
+# include <vector>
 
 #include <util/Clock.h>
@@ -39,5 +40,5 @@
 #include "gametypes/Gametype.h"
 
-#include "RaceCheckPoint.h"
+#include "SpaceRaceManager.h"
 
 namespace orxonox
@@ -50,4 +51,5 @@
     {
         friend class RaceCheckPoint;
+       
 
         public:
@@ -58,20 +60,33 @@
             virtual void end();
 
-            virtual void newCheckpointReached();
+            virtual void newCheckpointReached(SpaceRaceManager* p, int index,PlayerInfo* pl);
+            virtual void newCheckpointReached(RaceCheckPoint* p, PlayerInfo* pl);
 
-            inline void setCheckpointsReached(int n)
-                { this->checkpointsReached_ = n;}
-            inline int getCheckpointsReached()
-                { return this->checkpointsReached_; }
+            inline void setCheckpointReached(int n, PlayerInfo* p)
+                { this->checkpointReached_[p] = n;}
+            inline int getCheckpointReached(PlayerInfo* p)
+                { return this->checkpointReached_[p]; }
+
             inline void timeIsUp()
                 { this->bTimeIsUp_ = true;}
+            void tick(float dt);
+            Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
 
+
+            bool allowPawnHit(Pawn* victim, Pawn* originator);
+
+            bool allowPawnDamage(Pawn* victim, Pawn* originator);
+
+            bool allowPawnDeath(Pawn* victim, Pawn* originator);
         protected:
-
+            virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
+            virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
         private:
-            int checkpointsReached_; //The current number of check points reached by the player.
+            bool cantMove_;
+            std::map<PlayerInfo*, int>checkpointReached_; //The number of the last check point reached by each player.
             std::set<float> scores_; //The times of the players are saved in a set.
             bool bTimeIsUp_; //True if one of the check points is reached too late.
-            Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
+            
+            int playersAlive_;
     };
 }
Index: code/trunk/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceManager.cc	(revision 9016)
+++ code/trunk/src/modules/gametypes/SpaceRaceManager.cc	(revision 9016)
@@ -0,0 +1,195 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *     Celine Eggenberger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "SpaceRaceManager.h"
+#include "SpaceRace.h"
+#include "infos/PlayerInfo.h"
+
+#include "core/XMLPort.h"
+
+#include "core/CoreIncludes.h"
+
+#include "util/Convert.h"
+#include "util/Math.h"
+
+
+
+namespace orxonox
+{
+    CreateFactory(SpaceRaceManager);
+
+    SpaceRaceManager::SpaceRaceManager(BaseObject* creator) : BaseObject(creator)
+    {
+        RegisterObject(SpaceRaceManager);
+         
+        this->firstcheckpointvisible_=false;
+         
+    }
+
+    SpaceRaceManager::~SpaceRaceManager()
+    {
+        if (this->isInitialized())
+        {
+            for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+                this->checkpoints_[i]->destroy();
+        }
+    }
+   
+    void SpaceRaceManager::addCheckpoint(RaceCheckPoint* checkpoint)
+    {
+        this->checkpoints_.push_back(checkpoint);
+    }
+
+    RaceCheckPoint* SpaceRaceManager::getCheckpoint(unsigned int index) const
+    {
+        if (index < this->checkpoints_.size())
+            return this->checkpoints_[index];
+        else
+            return 0;
+    }
+    
+    int SpaceRaceManager::getIndex(RaceCheckPoint* r) 
+    {
+        for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+            if (this->checkpoints_[i]==r) {return i;}
+           
+        return -1;
+    }
+    
+    void SpaceRaceManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SpaceRaceManager, XMLPort, xmlelement, mode);
+
+        
+        XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint,  xmlelement, mode);
+    }
+    
+    void SpaceRaceManager::tick(float dt)
+    {
+        SUPER(SpaceRaceManager,tick,dt);
+     
+        if(this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_)
+        {
+            this->checkpoints_[0]->setRadarVisibility(true);
+            this->firstcheckpointvisible_=true;
+        }
+         
+        for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+        {
+            if(this->checkpoints_[i]->reached_!=NULL)
+                this->checkpointReached(this->checkpoints_[i],this->checkpoints_[i]->reached_);
+        }
+    }
+    
+    
+    void SpaceRaceManager::checkpointReached(RaceCheckPoint* check, PlayerInfo* player)
+    {
+        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+        assert(gametype);
+        
+        bool b =false;    
+            
+        int index=gametype->getCheckpointReached(player);
+        Vector3 v=Vector3 (-1,-1,-1);
+        if (index>-1)
+        {
+            RaceCheckPoint* tmp= this->getCheckpoint(index);
+            v= tmp->getNextcheckpoint();
+       
+            if (this->getCheckpoint(v.x) == check)
+            {
+                b = true;
+            }    
+       
+            if (this->getCheckpoint(v.y) == check)
+            {
+                b = true;
+            }    
+            if (this->getCheckpoint(v.z) == check)
+            {
+                b = true;
+            }    
+        }
+        else
+        {
+            b = (this->getIndex(check) == 0);
+        }
+            
+        if (gametype && b)
+        {
+            gametype->clock_.capture();
+            float time = gametype->clock_.getSecondsPrecise();
+            if (check->getTimeLimit()!=0 && time > check->getTimeLimit())
+            {
+                gametype->timeIsUp();
+                gametype->end();
+            }
+            else if (check->getLast())
+                gametype->end();
+            else
+				{
+                if (index > -1)this->setRadVis(player,false);
+                	else this->getCheckpoint(0)->setRadarVisibility(false);
+                gametype->newCheckpointReached(check,player);
+               
+                
+                this->setRadVis(player, true);
+            }
+        }
+        check->reached_=NULL;
+    }
+    
+    void SpaceRaceManager::setRadVis(PlayerInfo* player, bool b)
+    {
+        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+        assert(gametype);
+        int index = gametype->getCheckpointReached(player);
+        Vector3 v = Vector3(-1,-1,-1);
+        RaceCheckPoint* tmp = this->getCheckpoint(index);
+        v = tmp->getNextcheckpoint();
+    
+        if(v.x > -1)
+        {
+            this->getCheckpoint(v.x)->setRadarVisibility(b);
+            this->getCheckpoint(v.x)->settingsChanged();
+        }
+        if(v.y > -1)
+        {
+            this->getCheckpoint(v.y)->setRadarVisibility(b);
+            this->getCheckpoint(v.y)->settingsChanged();
+        }
+        if(v.z > -1)
+        {
+            this->getCheckpoint(v.z)->setRadarVisibility(b);
+           this->getCheckpoint(v.z)->settingsChanged();
+        }
+        
+        
+    }
+    
+}
Index: code/trunk/src/modules/gametypes/SpaceRaceManager.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceManager.h	(revision 9016)
+++ code/trunk/src/modules/gametypes/SpaceRaceManager.h	(revision 9016)
@@ -0,0 +1,79 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Mauro Salomon
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SpaceRaceManager_H__
+#define _SpaceRaceManager_H__
+
+#include "gametypes/GametypesPrereqs.h"
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include <util/Clock.h>
+
+#include "gametypes/Gametype.h"
+#include "tools/interfaces/Tickable.h"
+#include "RaceCheckPoint.h"
+
+
+
+namespace orxonox
+{
+  /**
+  @brief
+    The SpaceRaceManager class controls a space race level, where the player has to reach check points in a given order.
+  */
+    class _GametypesExport SpaceRaceManager : public BaseObject, public Tickable
+    {
+        friend class RaceCheckPoint;
+    
+        public:
+            SpaceRaceManager(BaseObject* creator);
+            virtual ~SpaceRaceManager() ;
+
+            void XMLPort(Element& xmlelement, XMLPort::Mode mode); 
+            int getIndex(RaceCheckPoint* r);
+            void addCheckpoint(RaceCheckPoint* checkpoint);
+            RaceCheckPoint* getCheckpoint(unsigned int index) const;
+        
+            void checkpointReached(RaceCheckPoint* check, PlayerInfo* player);
+        
+            void tick(float dt);
+    
+        protected:
+            void setRadVis(PlayerInfo* player, bool b);//sets RadarVisibility of the checkpoints the player can reach.
+    
+        private:
+            std::vector<RaceCheckPoint*> checkpoints_;
+            bool firstcheckpointvisible_;//true if the first check point is visible.
+        
+    };
+}
+
+#endif /* _SpaceRaceManager_H__ */
Index: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h	(revision 8952)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h	(revision 9016)
@@ -91,5 +91,5 @@
     @ingroup MultiTrigger
     */
-    class _ObjectsExport DistanceMultiTrigger : public MultiTrigger
+    class _ObjectsExport DistanceMultiTrigger : public MultiTrigger 
     {
 
Index: code/trunk/src/modules/objects/triggers/MultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.h	(revision 8952)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.h	(revision 9016)
@@ -157,5 +157,5 @@
             bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.
 
-            void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
+            virtual void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
             void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target.
 
Index: code/trunk/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/overlays/hud/CMakeLists.txt	(revision 8952)
+++ code/trunk/src/modules/overlays/hud/CMakeLists.txt	(revision 9016)
@@ -7,4 +7,5 @@
   HUDHealthBar.cc
   HUDTimer.cc
+  HUDEnemyHealthBar.cc
   ChatOverlay.cc
   AnnounceMessage.cc
Index: code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc	(revision 9016)
+++ code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc	(revision 9016)
@@ -0,0 +1,210 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Matthias Spalinger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "HUDEnemyHealthBar.h"
+
+#include <OgreCamera.h>
+
+#include "util/Convert.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "infos/PlayerInfo.h"
+#include "overlays/OverlayGroup.h"
+#include "CameraManager.h"
+#include "graphics/Camera.h"
+#include "util/Math.h"
+#include "HUDNavigation.h"
+#include "core/input/InputManager.h"
+#include "controllers/HumanController.h"
+#include "core/GraphicsManager.h"
+#include "Scene.h"
+#include "Radar.h"
+#include "controllers/NewHumanController.h"
+
+namespace orxonox
+{
+    CreateFactory(HUDEnemyHealthBar);
+
+    HUDEnemyHealthBar::HUDEnemyHealthBar(BaseObject* creator) : HUDHealthBar(creator)
+    {
+        RegisterObject(HUDEnemyHealthBar);
+
+        this->setConfigValues();
+        setSensibility(0.1f);
+        this->owner_ = 0;
+        markerLimit_ = 3; //TODO connect with markerLimit_ from the settings / from HUDNavigation.cc
+        currentYaw = 0;
+        currentPitch = 0;
+
+        this->getOverlayText()->setCaption("");
+    }
+
+    HUDEnemyHealthBar::~HUDEnemyHealthBar()
+    {
+        sortedObjectList_.clear();
+    }
+
+    void HUDEnemyHealthBar::setConfigValues()
+    {
+        SetConfigValue(useEnemyBar_, true);
+    }
+
+    void HUDEnemyHealthBar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(HUDEnemyHealthBar, XMLPort, xmlelement, mode);
+
+        XMLPortParam ( HUDEnemyHealthBar, "sensibility", setSensibility, getSensibility, xmlelement, mode );
+    }
+
+    bool compareDist ( std::pair<RadarViewable*, unsigned int > a, std::pair<RadarViewable*, unsigned int > b )
+    {
+        return a.second<b.second;
+    }
+
+    void HUDEnemyHealthBar::tick(float dt)
+    {
+        if (!useEnemyBar_){
+            this->setValue(0); //TODO hide it instead of setting it to 0
+            this->getOverlayText()->setCaption("");
+            return;
+        }
+
+        Camera* cam = CameraManager::getInstance().getActiveCamera();
+        if ( cam == NULL )
+            return;
+        const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
+
+        unsigned int markerCount_ = 0;
+
+        for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++listIt )
+        {
+            listIt->second = ( int ) ( ( listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition() ).length() + 0.5f );
+        }
+    
+        sortedObjectList_.sort ( compareDist );
+
+        for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
+        {
+            if ( markerCount_ < markerLimit_ )
+            {        
+                // Transform to screen coordinates and reverse x-axis
+                Vector3 pos = (camTransform * listIt->first->getRVWorldPosition());
+                pos.x = -pos.x;                
+
+                // get mouse position
+                if(this->getOwner() && dynamic_cast<ControllableEntity*>(this->getOwner())->getController() && dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController()))
+                {
+                    currentYaw = dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController())->getCurrentYaw();
+                    currentPitch = dynamic_cast<NewHumanController*>(dynamic_cast<ControllableEntity*>(this->getOwner())->getController())->getCurrentPitch();
+                }
+                // Compare cursor position to object position
+                if ( fabs(pos.x - currentYaw) < sens_ && fabs(pos.y - currentPitch) < sens_ )
+                {
+                    this->owner_ = orxonox_cast<Pawn*>(listIt->first);
+                    break;
+                }
+            }
+            this->owner_ = 0;
+        }
+
+
+
+        if (this->owner_)
+        {
+            this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
+            this->getOverlayText()->setCaption(multi_cast<std::string>(static_cast<int>(this->owner_->getHealth())));
+        }
+        else
+        {
+            this->setValue(0);      //TODO hide it instead of setting it to zero
+            this->getOverlayText()->setCaption("");
+        }
+
+        if (this->getTextUseBarColour())
+            this->getOverlayText()->setColour(this->getCurrentBarColour());
+    }
+
+    void HUDEnemyHealthBar::addObject ( RadarViewable* object )
+    {
+        if( showObject(object)==false )
+            return;
+    
+        if ( sortedObjectList_.size() >= markerLimit_ )
+            if ( object == NULL )
+                return;
+    
+        sortedObjectList_.push_front ( std::make_pair ( object, ( unsigned int ) 0 ) );
+
+        //remove duplicates
+        sortedObjectList_.unique();
+    }
+
+    bool HUDEnemyHealthBar::showObject(RadarViewable* rv)
+    {
+        if ( rv == dynamic_cast<RadarViewable*> ( this->getOwner() ) )
+            return false;
+        assert( rv->getWorldEntity() );
+        if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false )
+            return false;
+        return true;
+    }
+
+    void HUDEnemyHealthBar::removeObject ( RadarViewable* viewable )
+    {
+        for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++listIt )
+        {
+            if ( (listIt->first) == viewable )
+            {
+                sortedObjectList_.erase ( listIt );
+                break;
+            }
+    
+        }
+
+    }
+
+    void HUDEnemyHealthBar::objectChanged(RadarViewable* viewable)
+    {
+        // TODO: niceification neccessary - and while you're at it: the same function exists in HUDNavigation.cc ;)
+        removeObject(viewable);
+        addObject(viewable);
+    }
+
+    void HUDEnemyHealthBar::changedOwner()
+    {
+    
+        const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects();
+        for ( std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it )
+        {
+            if ( ! ( *it )->isHumanShip_ )
+                this->addObject ( *it );
+        }
+    }
+
+}
Index: code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h	(revision 9016)
+++ code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h	(revision 9016)
@@ -0,0 +1,83 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Matthias Spalinger
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _HUDEnemyHealthBar_H__
+#define _HUDEnemyHealthBar_H__
+
+#include "interfaces/RadarViewable.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "HUDHealthBar.h"
+#include "interfaces/RadarListener.h"
+
+namespace orxonox
+{
+    class _OverlaysExport HUDEnemyHealthBar : public HUDHealthBar, public RadarListener
+    {
+        public:
+            HUDEnemyHealthBar(BaseObject* creator);
+            virtual ~HUDEnemyHealthBar();
+            void setConfigValues();
+
+            bool compareDistance ( std::pair<RadarViewable*, unsigned int > a, std::pair<RadarViewable*, unsigned int > b );
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
+
+            //RadarListener interface
+            void addObject ( RadarViewable* object );
+            void removeObject ( RadarViewable* viewable );
+            void objectChanged(RadarViewable* viewable);
+            virtual void radarTick ( float dt ) {}
+            inline float getRadarSensitivity() const
+                { return 1.0f; }
+
+            void changedOwner();
+
+        private:
+
+            void setSensibility (float sense){
+                this->sens_ = sense;}
+            float getSensibility(){
+                return this->sens_;}
+
+            bool showObject(RadarViewable* rv);
+        
+            typedef std::list < std::pair<RadarViewable*, unsigned int > > sortedList;
+            sortedList sortedObjectList_;
+
+            Pawn* owner_;
+            float sens_;
+            bool useEnemyBar_;
+            unsigned int markerLimit_;
+
+            float currentYaw;
+            float currentPitch;
+    };
+}
+#endif /* _HUDEnemyHealthBar_H__ */
Index: code/trunk/src/modules/overlays/hud/HUDHealthBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDHealthBar.h	(revision 8952)
+++ code/trunk/src/modules/overlays/hud/HUDHealthBar.h	(revision 9016)
@@ -110,4 +110,9 @@
                 { return this->textoverlay_->getSpaceWidth(); }
 
+            inline void setOverlayText(SmartPtr<OverlayText> textoverlay)
+                { this->textoverlay_ = textoverlay; }
+            inline SmartPtr<OverlayText> getOverlayText() const
+                {return this->textoverlay_; }
+
         private:
             WeakPtr<Pawn> owner_;
Index: code/trunk/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.cc	(revision 8952)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.cc	(revision 9016)
@@ -25,4 +25,5 @@
  *      Reto Grieder
  *      Oliver Scheuss
+ *      Matthias Spalinger
  *
  */
@@ -63,5 +64,5 @@
 {
   SetConfigValue(markerLimit_, 3);
-
+  SetConfigValue(showDistance, false);
 }
 
@@ -75,8 +76,8 @@
 
     // Set default values
-    setFont ( "Monofur" );
-    setTextSize ( 0.05f );
-    setNavMarkerSize ( 0.05f );
-    setDetectionLimit( 10000.0f );
+    this->setFont ( "Monofur" );
+    this->setTextSize ( 0.05f );
+    this->setNavMarkerSize ( 0.05f );
+    this->setDetectionLimit( 10000.0f ); 
 }
 
@@ -97,8 +98,8 @@
     SUPER ( HUDNavigation, XMLPort, xmlelement, mode );
 
-    XMLPortParam ( HUDNavigation, "font",           setFont,           getFont,           xmlelement, mode );
-    XMLPortParam ( HUDNavigation, "textSize",       setTextSize,       getTextSize,       xmlelement, mode );
-    XMLPortParam ( HUDNavigation, "navMarkerSize",  setNavMarkerSize,  getNavMarkerSize,  xmlelement, mode );
-    XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode );
+    XMLPortParam ( HUDNavigation, "font",          setFont,          getFont,          xmlelement, mode );
+    XMLPortParam ( HUDNavigation, "textSize",      setTextSize,      getTextSize,      xmlelement, mode );
+    XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode );
+    XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode ); 
 }
 
@@ -144,5 +145,17 @@
 }
 
-
+float HUDNavigation::getArrowSizeX(int dist)
+{    
+    if (dist < 600) 
+        dist = 600;
+    return this->getActualSize().x * 900 * navMarkerSize_ / dist;
+}
+
+float HUDNavigation::getArrowSizeY(int dist)
+{    
+    if (dist < 600)
+        dist = 600;   
+    return this->getActualSize().y * 900 * navMarkerSize_ / dist;
+}
 
 void HUDNavigation::tick ( float dt )
@@ -165,4 +178,5 @@
     unsigned int markerCount_ = 0;
     bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
+
 //         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
     for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
@@ -170,5 +184,6 @@
         ObjectMap::iterator it = activeObjectList_.find ( listIt->first );
         closeEnough_ = listIt->second < detectionLimit_ ;
-        if ( markerCount_ < markerLimit_ && (closeEnough_ ||  detectionLimit_ < 0) ) // display on HUD if the statement is true
+        // display radarviewables on HUD if the marker limit and max-distance is not exceeded 
+        if ( markerCount_ < markerLimit_ && (closeEnough_ ||  detectionLimit_ < 0) ) 
         {
 
@@ -176,6 +191,17 @@
             // Get Distance to HumanController and save it in the TextAreaOverlayElement.
             int dist = listIt->second;
+            float textLength = 0.0f;
+
+            //display distance next to cursor
+            if (showDistance){
             it->second.text_->setCaption ( multi_cast<std::string> ( dist ) );
-            float textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f;
+            textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f;
+            }
+
+            //display name next to cursor
+            else{
+            it->second.text_->setCaption(it->first->getRVName()); 
+            textLength = it->first->getRVName().size() * it->second.text_->getCharHeight() * 0.3f;
+            }
 
             // Transform to screen coordinates
@@ -194,6 +220,4 @@
             else
                 outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0;
-            // Get Distance to HumanController and save it in the TextAreaOverlayElement.
-            it->second.text_->setCaption ( multi_cast<std::string> ( dist ) );
 
             if ( outOfView )
@@ -207,4 +231,10 @@
                     it->second.wasOutOfView_ = true;
                 }
+
+                //float xDistScale = this->getActualSize().x * 1000.0f * navMarkerSize_ / dist;
+                //float yDistScale = this->getActualSize().y * 1000.0f * navMarkerSize_ / dist;
+
+                // Adjust Arrowsize according to distance
+                it->second.panel_->setDimensions(getArrowSizeX(dist),getArrowSizeY(dist));
 
                 // Switch between top, bottom, left and right position of the arrow at the screen border
@@ -263,4 +293,5 @@
                   //it->second.panel_->setMaterialName ( "Orxonox/NavTDC" );
                     it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "tdc.png", it->first->getRadarObjectColour()) );
+                    it->second.panel_->setDimensions ( navMarkerSize_ * this->getActualSize().x, navMarkerSize_ * this->getActualSize().y );
                     it->second.wasOutOfView_ = false;
                 }
@@ -280,5 +311,5 @@
             it->second.text_->show();
         }
-        else // do not display on HUD
+        else // do not display on HUD 
         {
             it->second.panel_->hide();
@@ -312,5 +343,5 @@
 void HUDNavigation::addObject ( RadarViewable* object )
 {
-    if( showObject(object) == false )
+    if( showObject(object)==false )
         return;
 
@@ -399,5 +430,5 @@
         return false;
     assert( rv->getWorldEntity() );
-    if ( rv->getWorldEntity()->isVisible() == false || rv->getRadarVisibility() == false )
+    if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false )
         return false;
     return true;
Index: code/trunk/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.h	(revision 8952)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.h	(revision 9016)
@@ -24,4 +24,5 @@
  *   Co-authors:
  *      Reto Grieder
+ *      Matthias Spalinger
  *
  */
@@ -54,4 +55,5 @@
     virtual void tick ( float dt );
 
+    // RadarListener interface
     virtual void addObject ( RadarViewable* object );
     virtual void removeObject ( RadarViewable* viewable );
@@ -66,4 +68,6 @@
     inline float getRadarSensitivity() const
     { return 1.0f; }
+
+    unsigned int getMarkerLimit() { return this->markerLimit_; }
 
 private:
@@ -81,12 +85,11 @@
     // XMLPort accessors
     void setNavMarkerSize ( float size )
-    { navMarkerSize_ = size; this->sizeChanged(); }
+        { navMarkerSize_ = size; this->sizeChanged(); }
     float getNavMarkerSize() const
-    { return navMarkerSize_; }
-
-    void setDetectionLimit( float limit )
-    { this->detectionLimit_ = limit; }
-    float getDetectionLimit() const
-    { return this->detectionLimit_; }
+        { return navMarkerSize_; }
+    void setDetectionLimit( float limit ) 
+        { this->detectionLimit_ = limit; } 
+    float getDetectionLimit() const 
+        { return this->detectionLimit_; }
 
     void setTextSize ( float size );
@@ -102,12 +105,15 @@
     sortedList sortedObjectList_;
 
+    float getArrowSizeX(int dist);    
+    float getArrowSizeY(int dist);
 
     float navMarkerSize_;
     std::string fontName_;
     float textSize_;
+    bool showDistance;
 
-    unsigned int markerLimit_; //TODO: is it possible to set this over the console and/or the IG-Setting
-    float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.
-                           //!< In order to bypass this behaviour, set a negative detectionLimit_. Then the detection range is "infinite".
+    unsigned int markerLimit_;
+    float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. 
+
 };
 }
Index: code/trunk/src/modules/pong/Pong.cc
===================================================================
--- code/trunk/src/modules/pong/Pong.cc	(revision 8952)
+++ code/trunk/src/modules/pong/Pong.cc	(revision 9016)
@@ -37,6 +37,8 @@
 #include "core/EventIncludes.h"
 #include "core/command/Executor.h"
+#include "core/ConfigValueIncludes.h"
 
 #include "gamestates/GSLevel.h"
+#include "chat/ChatManager.h"
 
 #include "PongCenterpoint.h"
@@ -45,5 +47,4 @@
 #include "PongBot.h"
 #include "PongAI.h"
-
 namespace orxonox
 {
@@ -75,4 +76,6 @@
         // Set the type of Bots for this particular Gametype.
         this->botclass_ = Class(PongBot);
+	this->scoreLimit_ = 10;
+	this->setConfigValues();
     }
 
@@ -280,6 +283,26 @@
         }
 
+        // If a palyer gets 21 points, he won the game -> end of game
+        
+        PlayerInfo* player1 = this->getLeftPlayer();
+        PlayerInfo* player2 = this->getRightPlayer();
+        if(player1==NULL||player2==NULL) return; //safety
+        if(this->getScore(player1) >= scoreLimit_)
+        {
+            std::string name1=player1->getName();
+            std::string message(name1 + " has won!");
+            ChatManager::message(message);
+            this->end();
+        }
+        else if(this->getScore(player2) >= scoreLimit_)
+        {
+             std::string name2=player2->getName();
+             std::string message2(name2 + " has won!");
+             ChatManager::message(message2);
+             this->end();
+        }
         // Restart the timer to start the ball.
         this->starttimer_.startTimer();
+
     }
 
@@ -321,3 +344,12 @@
             return 0;
     }
+
+    /**
+     @brief
+         Make scoreLimit_ configurable e.g. in the menu.
+     */
+    void Pong::setConfigValues()
+    {
+        SetConfigValue(scoreLimit_, 10).description("The player first reaching those points wins.");
+    }
 }
Index: code/trunk/src/modules/pong/Pong.h
===================================================================
--- code/trunk/src/modules/pong/Pong.h	(revision 8952)
+++ code/trunk/src/modules/pong/Pong.h	(revision 9016)
@@ -81,6 +81,7 @@
             void setCenterpoint(PongCenterpoint* center)
                 { this->center_ = center; }
-
-            PlayerInfo* getLeftPlayer() const; //!< Get the left player.
+            void setConfigValues(); //!< Makes scoreLimit configurable.
+            
+	    PlayerInfo* getLeftPlayer() const; //!< Get the left player.
             PlayerInfo* getRightPlayer() const; //!< Get the right player.
 
@@ -94,5 +95,6 @@
             WeakPtr<PongBall> ball_; //!< The Pong ball.
             WeakPtr<PongBat> bat_[2]; //!< The two bats.
-            Timer starttimer_; //!< A timer to delay the start of the game.
+	    Timer starttimer_; //!< A timer to delay the start of the game.
+            int scoreLimit_; //!< If a player scored that much points, the game is ended.
     };
 }
Index: code/trunk/src/modules/pong/PongAI.h
===================================================================
--- code/trunk/src/modules/pong/PongAI.h	(revision 8952)
+++ code/trunk/src/modules/pong/PongAI.h	(revision 9016)
@@ -80,5 +80,5 @@
             void delayedMove(); //!< Is called, when a delayed move takes effect.
 
-            PongBall* ball_; //!< A pointer to the ball.
+            WeakPtr<PongBall> ball_; //!< A weak pointer to the ball.
             Vector2 ballDirection_; //!< Vector to store the (x,z) direction in which the ball is flying.
             float ballEndPosition_; //!< The calculated end position of the ball.
Index: code/trunk/src/modules/pong/PongScore.cc
===================================================================
--- code/trunk/src/modules/pong/PongScore.cc	(revision 8952)
+++ code/trunk/src/modules/pong/PongScore.cc	(revision 9016)
@@ -60,4 +60,6 @@
         this->bShowLeftPlayer_ = false;
         this->bShowRightPlayer_ = false;
+        this->player1_ = NULL;
+	this->player2_ = NULL;
     }
 
@@ -98,42 +100,49 @@
         if (this->owner_ != NULL)
         {
-            // Get the two players.
-            PlayerInfo* player1 = this->owner_->getLeftPlayer();
-            PlayerInfo* player2 = this->owner_->getRightPlayer();
-
-            std::string name1;
-            std::string name2;
-
-            std::string score1("0");
-            std::string score2("0");
-
-            // Save the name and score of each player as a string.
-            if (player1 != NULL)
+	    if(!this->owner_->hasEnded())
             {
-                name1 = player1->getName();
-                score1 = multi_cast<std::string>(this->owner_->getScore(player1));
-            }
-            if (player2 != NULL)
-            {
-                name2 = player2->getName();
-                score2 = multi_cast<std::string>(this->owner_->getScore(player2));
+                //get the two players
+                player1_ = this->owner_->getLeftPlayer();
+                player2_ = this->owner_->getRightPlayer();
             }
 
-            // Assemble the strings, depending on what should all be displayed.
-            std::string output1;
-            if (this->bShowLeftPlayer_)
+            if(this->owner_->hasStarted())
             {
-                if (this->bShowName_ && this->bShowScore_ && player1 != NULL)
-                    output1 = name1 + " - " + score1;
-                else if (this->bShowScore_)
-                    output1 = score1;
-                else if (this->bShowName_)
-                    output1 = name1;
-            }
+                // Get the two players.
 
-            std::string output2;
-            if (this->bShowRightPlayer_)
-            {
-                if (this->bShowName_ && this->bShowScore_ && player2 != NULL)
+                std::string name1;
+                std::string name2;
+
+                std::string score1("0");
+                std::string score2("0");
+
+                // Save the name and score of each player as a string.
+                if (player1_ != NULL)
+                {
+                    name1 = player1_->getName();
+                    score1 = multi_cast<std::string>(this->owner_->getScore(player1_));
+                }
+                if (player2_ != NULL)
+                {
+                    name2 = player2_->getName();
+                    score2 = multi_cast<std::string>(this->owner_->getScore(player2_));
+                }
+
+                // Assemble the strings, depending on what should all be displayed.
+                std::string output1;
+                if (this->bShowLeftPlayer_)
+                {
+                    if (this->bShowName_ && this->bShowScore_ && player1_ != NULL)
+                         output1 = name1 + " - " + score1;
+                    else if (this->bShowScore_)
+                         output1 = score1;
+                    else if (this->bShowName_)
+                         output1 = name1;
+                }
+
+                std::string output2;
+                if (this->bShowRightPlayer_)
+                {
+                if (this->bShowName_ && this->bShowScore_ && player2_ != NULL)
                     output2 = score2 + " - " + name2;
                 else if (this->bShowScore_)
@@ -143,14 +152,14 @@
             }
 
-            std::string output("PONG");
-            if (this->bShowName_ || this->bShowScore_)
-            {
-                if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
-                    output = output1 + ':' + output2;
-                else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
-                    output = output1 + output2;
+                std::string output("PONG");
+                if (this->bShowName_ || this->bShowScore_)
+                {
+                    if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
+                        output = output1 + ':' + output2;
+                    else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
+                        output = output1 + output2;
+                }
+                this->setCaption(output);
             }
-
-            this->setCaption(output);
         }
     }
Index: code/trunk/src/modules/pong/PongScore.h
===================================================================
--- code/trunk/src/modules/pong/PongScore.h	(revision 8952)
+++ code/trunk/src/modules/pong/PongScore.h	(revision 9016)
@@ -122,4 +122,6 @@
             bool bShowLeftPlayer_; //!< Whether the left player is shown.
             bool bShowRightPlayer_; //!< Whether the right player is shown.
+            PlayerInfo* player1_; //!< Store information about left player permanently.
+            PlayerInfo* player2_; //!< Same for the right player. To end the game properly.
     };
 }
Index: code/trunk/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.cc	(revision 8952)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.cc	(revision 9016)
@@ -66,5 +66,4 @@
         this->localAngularVelocity_ = 0;
         this->lifetime_ = 100.0f;
-        this->bIsRocket_= true;
 
         if (GameMode::isMaster())
@@ -135,5 +134,4 @@
         if(this->isInitialized())
         {
-            this->bIsRocket_= false;
             if (GameMode::isMaster())
             {
@@ -163,5 +161,6 @@
         
         this->player_ = this->getShooter()->getPlayer();
-        this->getShooter()->getPlayer()->startTemporaryControl(this);
+        if(this->player_)
+            this->player_->startTemporaryControl(this);
 
         if( GameMode::isMaster() )
Index: code/trunk/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.h	(revision 8952)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.h	(revision 9016)
@@ -122,4 +122,5 @@
 
             WeakPtr<PlayerInfo> player_; //!< The player that controls the Rocket.
+            //WeakPtr<Pawn> pawn_; //!< The pawn that controls the Rocket. TODO
             Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
             float lifetime_; //!< The time the projectile exists.
Index: code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc	(revision 8952)
+++ code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc	(revision 9016)
@@ -52,5 +52,5 @@
         this->reloadTime_ = 1.0f;
         this->damage_ = 0.0f;
-        this->speed_ = 250.0f;
+        this->speed_ = 700.0f;
 
         this->setMunitionName("LaserMunition");
Index: code/trunk/src/orxonox/Level.cc
===================================================================
--- code/trunk/src/orxonox/Level.cc	(revision 8952)
+++ code/trunk/src/orxonox/Level.cc	(revision 9016)
@@ -71,5 +71,4 @@
         SUPER(Level, XMLPort, xmlelement, mode);
 
-        XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
         XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
 
@@ -82,5 +81,4 @@
         registerVariable(this->xmlfilename_,            VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
         registerVariable(this->name_,                   VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::changedName));
-        registerVariable(this->description_,            VariableDirection::ToClient);
         registerVariable(this->networkTemplateNames_,   VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkCallbackTemplatesChanged));
     }
Index: code/trunk/src/orxonox/Level.h
===================================================================
--- code/trunk/src/orxonox/Level.h	(revision 8952)
+++ code/trunk/src/orxonox/Level.h	(revision 9016)
@@ -49,9 +49,4 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            inline void setDescription(const std::string& description)
-                { this->description_ = description; }
-            inline const std::string& getDescription() const
-                { return this->description_; }
-
             void playerEntered(PlayerInfo* player);
             void playerLeft(PlayerInfo* player);
@@ -76,5 +71,4 @@
             void networkcallback_applyXMLFile();
 
-            std::string                    description_;
             std::string                    gametype_;
             std::string                    xmlfilename_;
Index: code/trunk/src/orxonox/LevelInfo.cc
===================================================================
--- code/trunk/src/orxonox/LevelInfo.cc	(revision 8952)
+++ code/trunk/src/orxonox/LevelInfo.cc	(revision 9016)
@@ -87,9 +87,10 @@
         {
             LevelInfoItem::possibleTags_s.insert("test");
-            LevelInfoItem::possibleTags_s.insert("singleplayer");
-            LevelInfoItem::possibleTags_s.insert("multiplayer");
             LevelInfoItem::possibleTags_s.insert("showcase");
             LevelInfoItem::possibleTags_s.insert("tutorial");
             LevelInfoItem::possibleTags_s.insert("presentation");
+            LevelInfoItem::possibleTags_s.insert("mission");
+            LevelInfoItem::possibleTags_s.insert("gametype");
+            LevelInfoItem::possibleTags_s.insert("minigame");
         }
     }
@@ -189,4 +190,5 @@
 
         XMLPortParam(LevelInfo, "description", setDescription, getDescription, xmlelement, mode);
+        XMLPortParam(LevelInfo, "screenshot", setScreenshot, getScreenshot, xmlelement, mode);
         XMLPortParam(LevelInfo, "tags", setTags, getTags, xmlelement, mode);
     }
@@ -203,4 +205,5 @@
         LevelInfoItem* info = new LevelInfoItem(this->BaseObject::getName(), this->getXMLFilename());
         info->setDescription(this->getDescription());
+        info->setScreenshot(this->getScreenshot());
         info->setTags(this->getTags());
         return info;
Index: code/trunk/src/orxonox/LevelInfo.h
===================================================================
--- code/trunk/src/orxonox/LevelInfo.h	(revision 8952)
+++ code/trunk/src/orxonox/LevelInfo.h	(revision 9016)
@@ -77,4 +77,15 @@
             */
             inline const std::string& getName(void) const { return this->name_; } // tolua_export
+        
+            /**
+            @brief Set the screenshot of the Level.
+            @param screenshot The screenshot to be set.
+            */
+            inline void setScreenshot(const std::string& screenshot) { this->screenshot_ = std::string(screenshot); }
+            /**
+            @brief Get the screenshot of the Level.
+            @return Returns the screenshot of the Level.
+            */
+            inline const std::string& getScreenshot() const { return this->screenshot_; } // tolua_export
 
             /**
@@ -138,4 +149,5 @@
             std::string name_; //!< The name of the Level.
             std::string description_; //!< The description of the Level.
+            std::string screenshot_; //!< The screenshot of the Level.
             std::set<std::string> tags_; //!< The set of tags the Level is tagged with.
             std::string tagsString_; //!< The comma-seperated string of all the tags the Level is tagged with.
@@ -148,4 +160,5 @@
         - @b name The name of the level.
         - @b description The description of the level.
+        - @b screenshot The screenshot of the level.
         - @b tags A comma-seperated string of tags. Allowed tags are: <em>test</em>, <em>singleplayer</em>, <em>multiplayer</em>, <em>showcase</em>, <em>tutorial</em>, <em>presentation</em>.
 
@@ -155,4 +168,5 @@
             name = "Levelname"lhs->compare(rhs) < 0
             description = "This is just some awesome level."
+            screenshot = "Screenshot.png"
             tags = "test, awesome"
         />
@@ -172,4 +186,15 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a LevelInfo object through XML.
+        
+            /**
+            @brief Set the screenshot of the Level.
+            @param screenshot The screenshot to be set.
+            */
+            inline void setScreenshot(const std::string& screenshot) { this->LevelInfoItem::setScreenshot(screenshot); }
+            /**
+            @brief Get the screenshot of the Level.
+            @return Returns the screenshot of the Level.
+            */
+            inline const std::string& getScreenshot() const { return this->LevelInfoItem::getScreenshot(); }
 
             /**
Index: code/trunk/src/orxonox/controllers/AIController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/AIController.cc	(revision 8952)
+++ code/trunk/src/orxonox/controllers/AIController.cc	(revision 9016)
@@ -59,7 +59,13 @@
         if (this->state_ == FREE)
         {
-
+            
             if (this->formationFlight_)
             {
+
+                //changed order -> searchNewMaster MUSTN'T be called in SLAVE-state (bugfix for internal-error messages at quit)
+                random = rnd(maxrand);
+                if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))
+                       this->searchNewMaster();
+
                 // return to Master after being forced free
                 if (this->freedomCount_ == 1)
@@ -68,74 +74,36 @@
                     this->freedomCount_ = 0;
                 }
-
-                random = rnd(maxrand);
-                if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))
-                    this->searchNewMaster();
-            }
-
+            }
+
+            this->defaultBehaviour(maxrand);
+
+        }
+
+        if (this->state_ == SLAVE && this->formationMode_ == ATTACK) 
+        {
             // search enemy
             random = rnd(maxrand);
-            if (random < (15 + botlevel_* 20) && (!this->target_))
+            if (random < (botlevel_*100) && (!this->target_))
                 this->searchNewTarget();
 
-            // forget enemy
-            random = rnd(maxrand);
-            if (random < ((1-botlevel_)*6) && (this->target_))
-                this->forgetTarget();
-
             // next enemy
             random = rnd(maxrand);
-            if (random < (botlevel_*20) && (this->target_))
+            if (random < (botlevel_*30) && (this->target_))
                 this->searchNewTarget();
 
-            // fly somewhere
-            random = rnd(maxrand);
-            if (random < 50 && (!this->bHasTargetPosition_ && !this->target_))
-                this->searchRandomTargetPosition();
-
-            // stop flying
-            random = rnd(maxrand);
-            if (random < 10 && (this->bHasTargetPosition_ && !this->target_))
-                this->bHasTargetPosition_ = false;
-
-            // fly somewhere else
-            random = rnd(maxrand);
-            if (random < 30 && (this->bHasTargetPosition_ && !this->target_))
-                this->searchRandomTargetPosition();
-
             // shoot
             random = rnd(maxrand);
-            if (!(this->passive_) && random < (75 + botlevel_*25) && (this->target_ && !this->bShooting_))
+            if (!(this->passive_) && random < (botlevel_*100) && (this->target_ && !this->bShooting_))
                 this->bShooting_ = true;
 
             // stop shooting
             random = rnd(maxrand);
-            if (random < ((1 - botlevel_)*25) && (this->bShooting_))
+            if (random < (1-botlevel_)*50 && (this->bShooting_))
                 this->bShooting_ = false;
 
-            // boost
-            random = rnd(maxrand);
-            if (random < botlevel_*100 )
-                this->boostControl();
-
-            // update Checkpoints
-            /*random = rnd(maxrand);
-            if (this->defaultWaypoint_ && random > (maxrand-10))
-                this->manageWaypoints();
-            else //if(random > maxrand-10) //CHECK USABILITY!!*/
-            if (this->waypoints_.size() == 0 )
-                this->manageWaypoints();
-
-        }
-
-        if (this->state_ == SLAVE)
-        {
-
         }
 
         if (this->state_ == MASTER)
         {
-
-
             this->commandSlaves();
 
@@ -155,9 +123,9 @@
                    this->spinInit();
 
-                // follow a randomly chosen human - a specific Master Action
+                /*// follow a randomly chosen human - a specific Master Action
                 random = rnd(1000.0f);
                 if (random < 1)
                    this->followRandomHumanInit();
-
+*/
                  // lose master status (only if less than 4 slaves in formation)
                 random = rnd(maxrand);
@@ -170,55 +138,6 @@
                     this->searchNewMaster();
 
-                // search enemy
-                random = rnd(maxrand);
-                if (random < (botlevel_)*25 && (!this->target_))
-                    this->searchNewTarget();
-
-                // forget enemy
-                random = rnd(maxrand);
-                if (random < (1-botlevel_)*6 && (this->target_))
-                    this->forgetTarget();
-
-                // next enemy
-                random = rnd(maxrand);
-                if (random < 10 && (this->target_))
-                    this->searchNewTarget();
-
-                // fly somewhere
-                random = rnd(maxrand);
-                if (random < 50 && (!this->bHasTargetPosition_ && !this->target_))
-                    this->searchRandomTargetPosition();
-
-
-                // fly somewhere else
-                random = rnd(maxrand);
-                if (random < 30 && (this->bHasTargetPosition_ && !this->target_))
-                    this->searchRandomTargetPosition();
-
-                // shoot
-                random = rnd(maxrand);
-                if (!(this->passive_) && random < 25*(botlevel_)+1 && (this->target_ && !this->bShooting_))
-                {
-                    this->bShooting_ = true;
-                    this->forceFreeSlaves();
-                }
-
-                // stop shooting
-                random = rnd(maxrand);
-                if (random < ( (1- botlevel_)*25 ) && (this->bShooting_))
-                    this->bShooting_ = false;
-
-                // boost
-                random = rnd(maxrand);
-                if (random < botlevel_*100 )
-                    this->boostControl();
-
-                // update Checkpoints
-                /*random = rnd(maxrand);
-                if (this->defaultWaypoint_ && random > (maxrand-10))
-                    this->manageWaypoints();
-                else //if(random > maxrand-10) //CHECK USABILITY!!*/
-                if (this->waypoints_.size() == 0 )
-                    this->manageWaypoints();
+                this->defaultBehaviour(maxrand);
+
             }
         }
@@ -234,5 +153,5 @@
         float maxrand = 100.0f / ACTION_INTERVAL;
         ControllableEntity* controllable = this->getControllableEntity();
-
+        //DOES: Either move to the waypoint or search for a Point of interest
         if (controllable && this->mode_ == DEFAULT)// bot is ready to move to a target
         {
@@ -256,6 +175,7 @@
             }
         }
-        if(this->mode_ == DEFAULT)
-	    {
+
+        if (this->mode_ == DEFAULT)
+        {
             if (this->state_ == MASTER)
             {
@@ -270,5 +190,5 @@
                             this->aimAtTarget();
                             random = rnd(maxrand);
-                            if(this->botlevel_*100 > random && !this->isCloseAtTarget(20))
+                            if(this->botlevel_*70 > random && !this->isCloseAtTarget(100))
                                 this->follow();  //If a bot is shooting a player, it shouldn't let him go away easily.
                         }
@@ -277,5 +197,4 @@
                     if (this->bHasTargetPosition_)
                         this->moveToTargetPosition();
-
                     this->doFire();
                 }
@@ -290,5 +209,5 @@
             }
 
-            if (this->state_ == SLAVE)
+            if (this->state_ == SLAVE && this->formationMode_ != ATTACK)
             {
                 if (this->bHasTargetPosition_)
@@ -296,5 +215,5 @@
             }
 
-            if (this->state_ == FREE)
+            if (this->state_ == FREE || (this->state_==SLAVE && this->formationMode_ == ATTACK) )
             {
                 if (this->target_)
@@ -302,12 +221,5 @@
                     if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
                         this->forgetTarget();
-                    else
-                    {
-                        this->aimAtTarget();
-                        random = rnd(maxrand);
-
-                        if(this->botlevel_*100 > random && !this->isCloseAtTarget(20))
-                            this->follow();//If a bot is shooting a player, it shouldn't let him go away easily.
-                     }
+                    else this->aimAtTarget();
                 }
 
@@ -315,12 +227,13 @@
                     this->moveToTargetPosition();
 
-                this->doFire();
-            }
-        }//END_OF DEFAULT MODE
+                    this->doFire();
+            }
+        }
         else if (this->mode_ == ROCKET)//Rockets do not belong to a group of bots -> bot states are not relevant.
         {   //Vector-implementation: mode_.back() == ROCKET;
             if(controllable)
-            {
-                if(controllable->getRocket())//Check wether the bot is controlling the rocket and if the timeout is over.
+            {//Check wether the bot is controlling the rocket and if the timeout is over.
+                if(controllable->getIdentifier() == ClassByString("Rocket"))
+
                 {
                     this->follow();
@@ -341,4 +254,72 @@
         SUPER(AIController, tick, dt);
     }
+//**********************************************NEW
+    void AIController::defaultBehaviour(float maxrand)
+    {       float random;
+            // search enemy
+            random = rnd(maxrand);
+            if (random < (botlevel_* 100) && (!this->target_))
+                this->searchNewTarget();
+
+            // forget enemy
+            random = rnd(maxrand);
+            if (random < ((1-botlevel_)*20) && (this->target_))
+                this->forgetTarget();
+
+            // next enemy
+            random = rnd(maxrand);
+            if (random < (botlevel_*30) && (this->target_))
+                this->searchNewTarget();
+
+            // fly somewhere
+            random = rnd(maxrand);
+            if (random < 50 && (!this->bHasTargetPosition_ && !this->target_))
+                this->searchRandomTargetPosition();
+
+            // stop flying
+            random = rnd(maxrand);
+            if (random < 10 && (this->bHasTargetPosition_ && !this->target_))
+                this->bHasTargetPosition_ = false;
+
+            // fly somewhere else
+            random = rnd(maxrand);
+            if (random < 30 && (this->bHasTargetPosition_ && !this->target_))
+                this->searchRandomTargetPosition();
+
+            if (this->state_ == MASTER) // master: shoot
+            {
+                random = rnd(maxrand);
+                if (!(this->passive_) && random < (100*botlevel_) && (this->target_ && !this->bShooting_))
+                {
+                    this->bShooting_ = true;
+                    this->forceFreeSlaves();
+                }
+            }
+            else
+            {
+                // shoot
+                random = rnd(maxrand);
+                if (!(this->passive_) && random < (botlevel_*100) && (this->target_ && !this->bShooting_))
+                    this->bShooting_ = true;
+            }
+
+            // stop shooting
+            random = rnd(maxrand);
+            if (random < ((1 - botlevel_)*50) && (this->bShooting_))
+                this->bShooting_ = false;
+
+            // boost
+            random = rnd(maxrand);
+            if (random < botlevel_*50 )
+                this->boostControl();
+
+            // update Checkpoints
+            /*random = rnd(maxrand);
+            if (this->defaultWaypoint_ && random > (maxrand-10))
+                this->manageWaypoints();
+            else //if(random > maxrand-10) //CHECK USABILITY!!*/
+            if (this->waypoints_.size() == 0 )
+                this->manageWaypoints();
+    }
 
 }
Index: code/trunk/src/orxonox/controllers/AIController.h
===================================================================
--- code/trunk/src/orxonox/controllers/AIController.h	(revision 8952)
+++ code/trunk/src/orxonox/controllers/AIController.h	(revision 9016)
@@ -44,13 +44,14 @@
             virtual ~AIController();
 
-            virtual void tick(float dt);
+            virtual void tick(float dt); //<! Carrying out the targets set in action().
 
         protected:
-            virtual void action();
+            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets.
+            void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot.
 
         private:
             static const float ACTION_INTERVAL;
 
-            Timer actionTimer_;
+            Timer actionTimer_; //<! Regularly calls action().
     };
 }
Index: code/trunk/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.cc	(revision 8952)
+++ code/trunk/src/orxonox/controllers/ArtificialController.cc	(revision 9016)
@@ -24,25 +24,13 @@
  *   Co-authors:
  *      Dominik Solenicki
- *
+ *      
  */
 
 #include "ArtificialController.h"
-
-#include <vector>
-#include <climits>
-
-#include "util/Math.h"
 #include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
 #include "core/command/ConsoleCommand.h"
-#include "worldentities/ControllableEntity.h"
 #include "worldentities/pawns/Pawn.h"
-#include "worldentities/pawns/TeamBaseMatchBase.h"
 #include "worldentities/pawns/SpaceShip.h"
-#include "gametypes/TeamDeathmatch.h"
-#include "gametypes/Dynamicmatch.h"
-#include "controllers/WaypointPatrolController.h"
-#include "controllers/NewHumanController.h"
-#include "controllers/DroneController.h"
+
 #include "weaponsystem/WeaponMode.h"
 #include "weaponsystem/WeaponPack.h"
@@ -51,51 +39,18 @@
 #include "weaponsystem/WeaponSlot.h"
 
+
 namespace orxonox
 {
-    SetConsoleCommand("ArtificialController", "formationflight",  &ArtificialController::formationflight);
-    SetConsoleCommand("ArtificialController", "masteraction",     &ArtificialController::masteraction);
-    SetConsoleCommand("ArtificialController", "followme",         &ArtificialController::followme);
-    SetConsoleCommand("ArtificialController", "passivebehaviour", &ArtificialController::passivebehaviour);
-    SetConsoleCommand("ArtificialController", "formationsize",    &ArtificialController::formationsize);
     SetConsoleCommand("ArtificialController", "setbotlevel",      &ArtificialController::setAllBotLevel);
 
-    static const unsigned int STANDARD_MAX_FORMATION_SIZE = 7;
-    static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;
-    static const int FORMATION_LENGTH =  130;
-    static const int FORMATION_WIDTH =  110;
-    static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy
-    static const float SPEED_MASTER = 0.6f;
-    static const float ROTATEFACTOR_MASTER = 0.2f;
-    static const float SPEED_FREE = 0.8f;
-    static const float ROTATEFACTOR_FREE = 0.8f;
-
-
-    ArtificialController::ArtificialController(BaseObject* creator) : Controller(creator)
-    {
-        RegisterObject(ArtificialController);
-
-        this->target_ = 0;
-        this->formationFlight_ = false;
-        this->passive_ = false;
-        this->maxFormationSize_ = STANDARD_MAX_FORMATION_SIZE;
-        this->myMaster_ = 0;
-        this->freedomCount_ = 0;
-        this->team_ = -1;
-        this->state_ = FREE;
-        this->specificMasterAction_ = NONE;
-        this->specificMasterActionHoldCount_  = 0;
-        this->bShooting_ = false;
-        this->bHasTargetPosition_ = false;
-        this->speedCounter_ = 0.2f;
-        this->targetPosition_ = Vector3::ZERO;
-
-        this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this));
+    ArtificialController::ArtificialController(BaseObject* creator) : FormationController(creator)
+    {
         this->bSetupWorked = false;
-        this->botlevel_ = 0.2f;
-        this->mode_ = DEFAULT;////Vector-implementation: mode_.push_back(DEFAULT);
+        this->botlevel_ = 0.5f;
         this->timeout_ = 0;
         this->currentWaypoint_ = 0;
         this->setAccuracy(5);
         this->defaultWaypoint_ = NULL;
+        this->mode_ = DEFAULT;//Vector-implementation: mode_.push_back(DEFAULT);
     }
 
@@ -105,211 +60,8 @@
         {//Vector-implementation: mode_.erase(mode_.begin(),mode_.end());
             this->waypoints_.clear();
-            this->removeFromFormation();
             this->weaponModes_.clear();
-            for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it; ++it)
-            {
-                if (*it != this)
-                {
-                    if (it->myMaster_ == this)
-                    {
-                        orxout(internal_error) << this << " is still master in " << (*it) << endl;
-                        it->myMaster_ = 0;
-                    }
-
-                    while (true)
-                    {
-                        std::vector<ArtificialController*>::iterator it2 = std::find(it->slaves_.begin(), it->slaves_.end(), this);
-                        if (it2 != it->slaves_.end())
-                        {
-                            orxout(internal_error) << this << " is still slave in " << (*it) << endl;
-                            it->slaves_.erase(it2);
-                        }
-                        else
-                            break;
-                    }
-                }
-            }
-        }
-    }
-
-    void ArtificialController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(ArtificialController, XMLPort, xmlelement, mode);
-
-        XMLPortParam(ArtificialController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
-        XMLPortParam(ArtificialController, "formationFlight", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(false);
-        XMLPortParam(ArtificialController, "formationSize", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE);
-        XMLPortParam(ArtificialController, "passive", setPassive, getPassive, xmlelement, mode).defaultValues(false);
-    }
-
-// Documentation only here to get a faster overview for creating a useful documentation...
-
-    /**
-        @brief Activates / deactivates formationflight behaviour
-        @param form activate formflight if form is true
-    */
-    void ArtificialController::formationflight(const bool form)
-    {
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            ArtificialController *aiController = orxonox_cast<ArtificialController*>(controller);
-
-            if (aiController)
-            {
-                aiController->formationFlight_ = form;
-                if (!form)
-                {
-                    aiController->removeFromFormation();
-                }
-            }
-        }
-    }
-
-    /**
-        @brief Get all masters to do a "specific master action"
-        @param action which action to perform (integer, so it can be called with a console command (tmp solution))
-    */
-    void ArtificialController::masteraction(const int action)
-    {
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            ArtificialController *aiController = orxonox_cast<ArtificialController*>(controller);
-
-            if(aiController && aiController->state_ == MASTER)
-            {
-                if (action == 1)
-                    aiController->spinInit();
-                if (action == 2)
-                    aiController->turn180Init();
-            }
-        }
-    }
-
-    /**
-        @brief A human player gets followed by its nearest master. Initiated by console command, so far intended for demonstration puproses (possible future pickup).
-    */
-    void ArtificialController::followme()
-    {
-
-        Pawn *humanPawn = NULL;
-        NewHumanController *currentHumanController = NULL;
-        std::vector<ArtificialController*> allMasters;
-
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            currentHumanController = orxonox_cast<NewHumanController*>(controller);
-
-            if(currentHumanController) humanPawn = *it;
-
-            ArtificialController *aiController = orxonox_cast<ArtificialController*>(controller);
-
-            if(aiController && aiController->state_ == MASTER)
-                allMasters.push_back(aiController);
-
-        }
-
-        if((humanPawn != NULL) && (allMasters.size() != 0))
-        {
-                float posHuman = humanPawn->getPosition().length();
-                float distance = 0.0f;
-                float minDistance = FLT_MAX;
-                int index = 0;
-                int i = 0;
-
-                for(std::vector<ArtificialController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++)
-                    {
-                        if (!ArtificialController::sameTeam((*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue;
-                        distance = posHuman - (*it)->getControllableEntity()->getPosition().length();
-                        if(distance < minDistance) index = i;
-                    }
-                allMasters[index]->followInit(humanPawn);
-            }
-
-    }
-
-    /**
-        @brief Sets shooting behaviour of pawns.
-        @param passive if true, bots won't shoot.
-    */
-    void ArtificialController::passivebehaviour(const bool passive)
-    {
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            ArtificialController *aiController = orxonox_cast<ArtificialController*>(controller);
-
-            if(aiController)
-            {
-                aiController->passive_ = passive;
-            }
-        }
-    }
-
-
-    /**
-        @brief Sets maximal formation size
-        @param size maximal formation size.
-    */
-    void ArtificialController::formationsize(const int size)
-    {
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            ArtificialController *aiController = orxonox_cast<ArtificialController*>(controller);
-
-            if(aiController)
-            {
-                aiController->maxFormationSize_ = size;
-            }
-        }
-    }
+        }
+    }
+
 
     /**
@@ -320,592 +72,6 @@
         if (!this->getControllableEntity())
             this->removeFromFormation();
-        this->bSetupWorked = false;        // reset weapon information
-        this->setupWeapons();
-    }
-
-    void ArtificialController::removeFromFormation()
-    {
-        if (this->state_ == SLAVE || this->myMaster_) // slaves can also be temporary free, so check if myMaster_ is set
-            this->unregisterSlave();
-        else if (this->state_ == MASTER)
-            this->setNewMasterWithinFormation();
-    }
-
-    void ArtificialController::moveToPosition(const Vector3& target)
-    {
-        if (!this->getControllableEntity())
-            return;
-
-        // Slave uses special movement if its master is in FOLLOW mode
-        if(this->state_ == SLAVE && this->myMaster_ && this->myMaster_->specificMasterAction_ == FOLLOW)
-        {
-//             this->followForSlaves(target);
-//             return;
-        }
-
-        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
-        float distance = (target - this->getControllableEntity()->getPosition()).length();
-
-
-        if(this->state_ == FREE)
-        {
-            if (this->target_ || distance > 10)
-            {
-                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
-                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
-                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
-            }
-
-            if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
-            {
-              this->getControllableEntity()->moveFrontBack(-0.05f); // They don't brake with full power to give the player a chance
-            } else this->getControllableEntity()->moveFrontBack(SPEED_FREE);
-        }
-
-
-
-        if(this->state_ == MASTER)
-        {
-            if (this->target_ || distance > 10)
-            {
-                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
-                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
-            }
-
-            if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
-            {
-                this->getControllableEntity()->moveFrontBack(-0.05f);
-            } else this->getControllableEntity()->moveFrontBack(SPEED_MASTER);
-        }
-
-
-
-        if(this->state_ == SLAVE)
-        {
-
-           this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
-           this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
-
-            if (distance < 300)
-            {
-                if (distance < 40)
-                {
-                    this->getControllableEntity()->moveFrontBack(0.8f*SPEED_MASTER);
-                } else this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER);
-
-            } else {
-                this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER + distance/300.0f);
-            }
-        }
-
-        if (distance < 10)
-        {
-            this->positionReached();
-        }
-    }
-
-    void ArtificialController::absoluteMoveToPosition(const Vector3& target)
-    {
-        float minDistance = 40.0f;
-        if (!this->getControllableEntity())
-            return;
-
-        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
-        float distance = (target - this->getControllableEntity()->getPosition()).length();
-
-            if (this->target_ || distance > minDistance)
-            {
-                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
-                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
-                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
-                this->getControllableEntity()->moveFrontBack(SPEED_FREE);
-            }
-
-
-        if (distance < minDistance)
-        {
-            this->positionReached();
-        }
-    }
-
-
-    void ArtificialController::moveToTargetPosition()
-    {
-        this->moveToPosition(this->targetPosition_);
-    }
-
-    /**
-        @brief Unregisters a slave from its master. Initiated by a slave.
-    */
-    void ArtificialController::unregisterSlave()
-    {
-        if (this->myMaster_)
-        {
-            std::vector<ArtificialController*>::iterator it = std::find(this->myMaster_->slaves_.begin(), this->myMaster_->slaves_.end(), this);
-            if (it != this->myMaster_->slaves_.end())
-                this->myMaster_->slaves_.erase(it);
-        }
-
-        this->myMaster_ = 0;
-        this->state_ = FREE;
-    }
-
-    void ArtificialController::searchNewMaster()
-    {
-
-        if (!this->getControllableEntity())
-            return;
-
-        this->targetPosition_ = this->getControllableEntity()->getPosition();
-        this->forgetTarget();
-        int teamSize = 0;
-        //go through all pawns
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            //same team?
-            if (!ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
-                continue;
-
-            //has it an ArtificialController?
-            Controller* controller = 0;
-
-            if (it->getController())
-                controller = it->getController();
-            else if (it->getXMLController())
-                controller = it->getXMLController();
-
-            if (!controller)
-                continue;
-
-            //is pawn oneself?
-            if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
-                continue;
-
-            teamSize++;
-
-            ArtificialController *newMaster = orxonox_cast<ArtificialController*>(controller);
-
-            //is it a master?
-            if (!newMaster || newMaster->state_ != MASTER)
-                continue;
-
-            float distance = (it->getPosition() - this->getControllableEntity()->getPosition()).length();
-
-            // is pawn in range?
-            if (distance < RADIUS_TO_SEARCH_FOR_MASTERS)
-            {
-                if(newMaster->slaves_.size() > this->maxFormationSize_) continue;
-
-                for(std::vector<ArtificialController*>::iterator itSlave = this->slaves_.begin(); itSlave != this->slaves_.end(); itSlave++)
-                {
-                    (*itSlave)->myMaster_ = newMaster;
-                    newMaster->slaves_.push_back(*itSlave);
-                }
-                this->slaves_.clear();
-                this->state_ = SLAVE;
-
-                this->myMaster_ = newMaster;
-                newMaster->slaves_.push_back(this);
-
-                break;
-            }
-        }
-
-        if (this->state_ != SLAVE  && teamSize != 0)
-        {
-            this->state_ = MASTER;
-            this->myMaster_ = 0;
-        }
-    }
-
-    /**
-        @brief Commands the slaves of a master into a formation. Sufficiently fast not to be called within tick. Initiated by a master.
-    */
-    void ArtificialController::commandSlaves()
-    {
-        if(this->state_ != MASTER) return;
-
-        Quaternion orient = this->getControllableEntity()->getOrientation();
-        Vector3 dest = this->getControllableEntity()->getPosition();
-
-        // 1 slave: follow
-        if (this->slaves_.size() == 1)
-        {
-            dest += 4*orient*WorldEntity::BACK;
-            this->slaves_.front()->setTargetPosition(dest);
-        }
-        else
-        {
-            dest += 1.0f*orient*WorldEntity::BACK;
-            Vector3 pos = Vector3::ZERO;
-            int i = 1;
-
-            for(std::vector<ArtificialController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-            {
-                pos = Vector3::ZERO;
-                if (i <= 1) pos += dest  + (float)FORMATION_WIDTH*(orient*WorldEntity::LEFT);
-                if (i == 2) pos += dest  + (float)FORMATION_WIDTH*(orient*WorldEntity::RIGHT);
-                if (i == 3) pos += dest  + (float)FORMATION_WIDTH*(orient*WorldEntity::UP);
-                if (i >= 4)
-                {
-                    pos += dest  + (float)FORMATION_WIDTH*(orient*WorldEntity::DOWN);
-                    i = 1;
-                    dest += (float)FORMATION_LENGTH*(orient*WorldEntity::BACK);
-                    (*it)->setTargetPosition(pos);
-                    continue;
-                }
-                i++;
-                (*it)->setTargetPosition(pos);
-            }
-        }
-    }
-
-    /**
-        @brief Sets a new master within the formation. Called by a master.
-    */
-    void ArtificialController::setNewMasterWithinFormation()
-    {
-        if(this->state_ != MASTER) return;
-
-        if (!this->slaves_.empty())
-        {
-            ArtificialController *newMaster = this->slaves_.back();
-            this->slaves_.pop_back();
-
-            newMaster->state_ = MASTER;
-            newMaster->slaves_ = this->slaves_;
-            newMaster->myMaster_ = 0;
-
-            for(std::vector<ArtificialController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)
-            {
-                (*it)->myMaster_ = newMaster;
-            }
-        }
-
-        this->slaves_.clear();
-        this->specificMasterAction_ = NONE;
-        this->state_ = FREE;
-    }
-
-    /**
-        @brief Frees all slaves form a master. Initiated by a master.
-    */
-    void ArtificialController::freeSlaves()
-    {
-        if(this->state_ != MASTER) return;
-
-        for(std::vector<ArtificialController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-        {
-            (*it)->state_ = FREE;
-            (*it)->myMaster_ = 0;
-        }
-        this->slaves_.clear();
-    }
-
-    /**
-        @brief Master sets its slaves free for @ref FREEDOM_COUNT seconds.
-    */
-    void ArtificialController::forceFreeSlaves()
-    {
-        if(this->state_ != MASTER) return;
-
-        for(std::vector<ArtificialController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-        {
-            (*it)->state_ = FREE;
-            (*it)->forceFreedom();
-            (*it)->targetPosition_ = this->targetPosition_;
-            (*it)->bShooting_ = true;
-//             (*it)->getControllableEntity()->fire(0);// fire once for fun
-        }
-    }
-
-    void ArtificialController::loseMasterState()
-    {
-        this->freeSlaves();
-        this->state_ = FREE;
-    }
-
-
-    void ArtificialController::forceFreedom()
-    {
-        this->freedomCount_ = FREEDOM_COUNT;
-    }
-
-    /**
-        @brief Checks wether caller has been forced free, decrements time to stay forced free.
-        @return true if forced free.
-    */
-    bool ArtificialController::forcedFree()
-    {
-        if(this->freedomCount_ > 0)
-        {
-            this->freedomCount_--;
-            return true;
-        } else return false;
-    }
-
-    /**
-        @brief Used to continue a "specific master action" for a certain time and resuming normal behaviour after.
-    */
-    void ArtificialController::specificMasterActionHold()
-    {
-        if(this->state_ != MASTER) return;
-
-        if (specificMasterActionHoldCount_ == 0)
-         {
-            this->specificMasterAction_ = NONE;
-            this->searchNewTarget();
-         }
-        else specificMasterActionHoldCount_--;
-    }
-
-    /**
-        @brief Master initializes a 180 degree turn. Leads to a "specific master action".
-    */
-    void ArtificialController::turn180Init()
-    {
-        if(this->state_ != MASTER) return;
-
-        Quaternion orient = this->getControllableEntity()->getOrientation();
-
-        this->setTargetPosition(this->getControllableEntity()->getPosition() + 1000.0f*orient*WorldEntity::BACK);
-
-        this->specificMasterActionHoldCount_ = 4;
-
-        this->specificMasterAction_ = TURN180;
-    }
-
-    /**
-        @brief Execute the 180 degree turn. Called within tick.
-    */
-    void ArtificialController::turn180()
-    {
-            Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, this->targetPosition_);
-
-            this->getControllableEntity()->rotateYaw(-2.0f * sgn(coord.x) * coord.x*coord.x);
-            this->getControllableEntity()->rotatePitch(2.0f * sgn(coord.y) * coord.y*coord.y);
-
-            this->getControllableEntity()->moveFrontBack(SPEED_MASTER);
-    }
-
-    /**
-        @brief Master initializes a spin around its looking direction axis. Leads to a "specific master action".
-    */
-    void ArtificialController::spinInit()
-    {
-        if(this->state_ != MASTER) return;
-        this->specificMasterAction_ = SPIN;
-        this->specificMasterActionHoldCount_ = 10;
-    }
-
-    /**
-        @brief Execute the spin. Called within tick.
-    */
-    void ArtificialController::spin()
-    {
-            this->moveToTargetPosition();
-            this->getControllableEntity()->rotateRoll(0.8f);
-    }
-
-    /**
-        @brief Master begins to follow a pawn. Is a "specific master action".
-        @param pawn pawn to follow.
-        @param always follows pawn forever if true (false if omitted).
-        @param secondsToFollow seconds to follow the pawn if always is false. Will follow pawn 100 seconds if omitted (set in header).
-    */
-    void ArtificialController::followInit(Pawn* pawn, const bool always, const int secondsToFollow)
-    {
-        if (pawn == NULL || this->state_ != MASTER)
-            return;
-        this->specificMasterAction_  =  FOLLOW;
-
-        this->setTarget(pawn);
-        if (!always)
-            this->specificMasterActionHoldCount_ = secondsToFollow;
-        else
-            this->specificMasterActionHoldCount_ = INT_MAX; //for now...
-
-    }
-
-
-    /**
-        @brief Master begins to follow a randomly chosen human player of the same team. Is a "specific master action".
-    */
-    void ArtificialController::followRandomHumanInit()
-    {
-
-        Pawn *humanPawn = NULL;
-        NewHumanController *currentHumanController = NULL;
-
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            if (!it->getController())
-                continue;
-
-            currentHumanController = orxonox_cast<NewHumanController*>(it->getController());
-            if(currentHumanController)
-            {
-                if (!ArtificialController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue;
-                humanPawn = *it;
-                break;
-            }
-        }
-
-        if((humanPawn != NULL))
-                this->followInit(humanPawn);
-    }
-
-    /**
-        @brief Master follows target with adjusted speed. Called within tick.
-    */
-    void ArtificialController::follow()
-    {
-        if (this->target_)
-            this->moveToPosition(this->target_->getPosition());
-        else
-            this->specificMasterActionHoldCount_ = 0;
-/*
-        if (!this->getControllableEntity())
-            return;
-
-        float distance = (this->target_->getPosition() - this->getControllableEntity()->getPosition()).length();
-
-        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, this->target_->getPosition());
-
-
-        this->getControllableEntity()->rotateYaw(-0.8f * sgn(coord.x) * coord.x*coord.x);
-        this->getControllableEntity()->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y);
-
-        float speedDiv = this->getControllableEntity()->getVelocity().squaredLength() - this->target_->getVelocity().squaredLength();
-
-orxout() << "~follow distance: " << distance << "SpeedCounter: " << this->speedCounter_ << "~speedDiv: " << speedDiv << endl;
-        if (distance < 800)
-        {
-            if (distance < 200)
-            {
-                this->speedCounter_ -= 0.5f;
-                if(this->speedCounter_ < 0) this->speedCounter_ = 0.0f;
-                this->getControllableEntity()->moveFrontBack(speedCounter_);
-            } else {
-                if(speedDiv < 0)
-                    this->speedCounter_ +=  0.01f;
-                else
-                    this->speedCounter_ -= 0.05f;
-                this->getControllableEntity()->moveFrontBack(speedCounter_);
-            }
-
-        } else {
-            this->speedCounter_ += 0.05f;
-            this->getControllableEntity()->moveFrontBack(speedCounter_ + distance/300.0f);
-        }
-//         if (this->getControllableEntity()->getVelocity().squaredLength() > 50.0f) this->speedCounter_ = 0;
-
-*/
-    }
-
-
-    /**
-        @brief Slave moving behaviour when master is following a pawn, gets redirected from moveToPosition(const Vector3& target)). Called within tick.
-    */
-    void ArtificialController::followForSlaves(const Vector3& target)
-    {
-
-/*
-        if (!this->getControllableEntity() && !this->myMaster_ && this->myMaster_->state_ != FOLLOW && !this->myMaster_->target_)
-            return;
-
-        float distance = (target - this->getControllableEntity()->getPosition()).length();
-
-        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
-
-
-        this->getControllableEntity()->rotateYaw(-0.8f * sgn(coord.x) * coord.x*coord.x);
-        this->getControllableEntity()->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y);
-
-
-        float speedDiv = this->getControllableEntity()->getVelocity().squaredLength() - this->myMaster_->target_->getVelocity().squaredLength();
-
-
-         if (distance < 800)
-        {
-            if (distance < 200)
-            {
-                this->speedCounter_ -= 5.0f;
-                if(this->speedCounter_ < 0) this->speedCounter_ = 0.0f;
-                this->getControllableEntity()->moveFrontBack(speedCounter_);
-            } else {
-                if(speedDiv < 0)
-                    this->speedCounter_ +=  0.01f;
-                else
-                    this->speedCounter_ -= 0.05f;
-                this->getControllableEntity()->moveFrontBack(speedCounter_);
-            }
-
-        } else {
-            this->speedCounter_ += 0.05f;
-            this->getControllableEntity()->moveFrontBack(speedCounter_ + distance/300.0f);
-        }
-//         if (this->getControllableEntity()->getVelocity().squaredLength() > 50.0f) this->speedCounter_ = 0;
-*/
-    }
-
-
-    void ArtificialController::setTargetPosition(const Vector3& target)
-    {
-        this->targetPosition_ = target;
-        this->bHasTargetPosition_ = true;
-    }
-
-    void ArtificialController::searchRandomTargetPosition()
-    {
-        this->targetPosition_ = Vector3(rnd(-2000,2000), rnd(-2000,2000), rnd(-2000,2000));
-        this->bHasTargetPosition_ = true;
-    }
-
-    void ArtificialController::setTarget(Pawn* target)
-    {
-        this->target_ = target;
-
-        if (target)
-            this->targetPosition_ = target->getPosition();
-    }
-
-    void ArtificialController::searchNewTarget()
-    {
-        if (!this->getControllableEntity())
-            return;
-
-        this->targetPosition_ = this->getControllableEntity()->getPosition();
-        this->forgetTarget();
-
-        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
-        {
-            if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
-                continue;
-
-            /* So AI won't choose invisible Spaceships as target */
-            if (!it->getRadarVisibility())
-                continue;
-
-            if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity())
-            {
-                float speed = this->getControllableEntity()->getVelocity().length();
-                Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition();
-                Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition();
-                if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi)
-                        < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250))
-                {
-                    this->target_ = (*it);
-                    this->targetPosition_ = it->getPosition();
-                }
-            }
-        }
-    }
-
-    void ArtificialController::forgetTarget()
-    {
-        this->target_ = 0;
-        this->bShooting_ = false;
-    }
+    }
+
 
     void ArtificialController::aimAtTarget()
@@ -947,120 +113,4 @@
         if (target == this->target_)
             this->targetDied();
-    }
-
-    void ArtificialController::targetDied()
-    {
-        this->forgetTarget();
-        this->searchRandomTargetPosition();
-    }
-
-    bool ArtificialController::sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
-    {
-        if(!entity1 || !entity2)
-            return true;
-        if (entity1 == entity2)
-            return true;
-
-        int team1 = -1;
-        int team2 = -1;
-
-        Controller* controller = 0;
-        if (entity1->getController())
-            controller = entity1->getController();
-        else
-            controller = entity1->getXMLController();
-        if (controller)
-        {
-            ArtificialController* ac = orxonox_cast<ArtificialController*>(controller);
-            if (ac)
-                team1 = ac->getTeam();
-        }
-
-        if (entity2->getController())
-            controller = entity2->getController();
-        else
-            controller = entity2->getXMLController();
-        if (controller)
-        {
-            ArtificialController* ac = orxonox_cast<ArtificialController*>(controller);
-            if (ac)
-                team2 = ac->getTeam();
-        }
-
-        TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch*>(gametype);
-        if (tdm)
-        {
-            if (entity1->getPlayer())
-                team1 = tdm->getTeam(entity1->getPlayer());
-
-            if (entity2->getPlayer())
-                team2 = tdm->getTeam(entity2->getPlayer());
-        }
-
-        TeamBaseMatchBase* base = 0;
-        base = orxonox_cast<TeamBaseMatchBase*>(entity1);
-        if (base)
-        {
-            switch (base->getState())
-            {
-                case BaseState::ControlTeam1:
-                    team1 = 0;
-                    break;
-                case BaseState::ControlTeam2:
-                    team1 = 1;
-                    break;
-                case BaseState::Uncontrolled:
-                default:
-                    team1 = -1;
-            }
-        }
-        base = orxonox_cast<TeamBaseMatchBase*>(entity2);
-        if (base)
-        {
-            switch (base->getState())
-            {
-                case BaseState::ControlTeam1:
-                    team2 = 0;
-                    break;
-                case BaseState::ControlTeam2:
-                    team2 = 1;
-                    break;
-                case BaseState::Uncontrolled:
-                default:
-                    team2 = -1;
-            }
-        }
-
-        DroneController* droneController = 0;
-        droneController = orxonox_cast<DroneController*>(entity1->getController());
-        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2)
-            return true;
-        droneController = orxonox_cast<DroneController*>(entity2->getController());
-        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity1)
-            return true;
-        DroneController* droneController1 = orxonox_cast<DroneController*>(entity1->getController());
-        DroneController* droneController2 = orxonox_cast<DroneController*>(entity2->getController());
-        if (droneController1 && droneController2 && droneController1->getOwner() == droneController2->getOwner())
-            return true;
-
-        Dynamicmatch* dynamic = orxonox_cast<Dynamicmatch*>(gametype);
-        if (dynamic)
-        {
-            if (dynamic->notEnoughPigs||dynamic->notEnoughKillers||dynamic->notEnoughChasers) {return false;}
-
-            if (entity1->getPlayer())
-                team1 = dynamic->getParty(entity1->getPlayer());
-
-            if (entity2->getPlayer())
-                team2 = dynamic->getParty(entity2->getPlayer());
-
-            if (team1 ==-1 ||team2 ==-1 ) {return false;}
-            else if (team1 == dynamic->chaser && team2 != dynamic->chaser) {return false;}
-            else if (team1 == dynamic->piggy && team2 == dynamic->chaser) {return false;}
-            else if (team1 == dynamic->killer && team2 == dynamic->chaser) {return false;}
-            else return true;
-        }
-
-        return (team1 == team2 && team1 != -1);
     }
 
@@ -1110,5 +160,5 @@
         {
             Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
-            if(pawn)
+            if(pawn && pawn->isA(Class(SpaceShip))) //fix for First Person Mode: check for SpaceShip
             {
                 this->weaponModes_.clear(); // reset previous weapon information
@@ -1217,5 +267,5 @@
 
     /**
-        @brief Adds point of interest depending on context. Further Possibilites: "ForceField", "PortalEndPoint", "MovableEntity", "Dock"
+        @brief Adds point of interest depending on context.  TODO: Further Possibilites: "ForceField", "PortalEndPoint", "MovableEntity", "Dock"
     */
     void ArtificialController::manageWaypoints()
@@ -1226,4 +276,4 @@
             this->updatePointsOfInterest("PickupSpawner", 20.0f); // take pickup en passant if there is a default waypoint
     }
-
+ 
 }
Index: code/trunk/src/orxonox/controllers/ArtificialController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.h	(revision 8952)
+++ code/trunk/src/orxonox/controllers/ArtificialController.h	(revision 9016)
@@ -31,15 +31,10 @@
 
 #include "OrxonoxPrereqs.h"
+#include "controllers/FormationController.h"
 
-#include <map>
-
-#include "util/Math.h"
-#include "Controller.h"
-#include "controllers/NewHumanController.h"
-#include "weaponsystem/WeaponSystem.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport ArtificialController : public Controller
+    class _OrxonoxExport ArtificialController : public FormationController
     {
         public:
@@ -47,35 +42,7 @@
             virtual ~ArtificialController();
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
             void abandonTarget(Pawn* target);
 
-            inline void setTeam(int team)
-                { this->team_ = team; }
-            inline int getTeam() const
-                { return this->team_; }
-
-            inline void setFormationFlight(bool formation)
-                { this->formationFlight_ = formation; }
-            inline bool getFormationFlight() const
-                { return this->formationFlight_; }
-
-            inline void setFormationSize(int size)
-                { this->maxFormationSize_ = size; }
-            inline int getFormationSize() const
-                { return this->maxFormationSize_; }
-
-            inline void setPassive(bool passive)
-                { this->passive_ = passive; }
-            inline bool getPassive() const
-                { return this->passive_; }
-
             virtual void changedControllableEntity();
-
-            static void formationflight(const bool form);
-            static void masteraction(const int action);
-            static void followme();
-            static void passivebehaviour(const bool passive);
-            static void formationsize(const int size);
 
             virtual void doFire();
@@ -95,68 +62,12 @@
             void manageWaypoints();
 
+            
+
         protected:
-
-            int team_;
-            bool formationFlight_;
-            bool passive_;
-            unsigned int maxFormationSize_;
-            int freedomCount_;
-            enum State {SLAVE, MASTER, FREE};
-            State state_;
-            std::vector<ArtificialController*> slaves_;
-            ArtificialController *myMaster_;
-            enum SpecificMasterAction {NONE, HOLD, SPIN, TURN180, FOLLOW};
-            SpecificMasterAction specificMasterAction_;
-            int specificMasterActionHoldCount_;
-            float speedCounter_; //for speed adjustment when following
-
-            void moveToPosition(const Vector3& target);
-            void moveToTargetPosition();
-            void absoluteMoveToPosition(const Vector3& target);
-
-            virtual void positionReached() {}
-
-            void removeFromFormation();
-            void unregisterSlave();
-            void searchNewMaster();
-            void commandSlaves();
-            void setNewMasterWithinFormation();
-
-            void freeSlaves();
-            void forceFreeSlaves();
-            void loseMasterState();
-            void forceFreedom();
-            bool forcedFree();
-
-            void specificMasterActionHold();
-            void turn180Init();
-            void turn180();
-            void spinInit();
-            void spin();
-            void followInit(Pawn* pawn, const bool always = false, const int secondsToFollow = 100);
-            void followRandomHumanInit();
-            void follow();
-            void followForSlaves(const Vector3& target);
-
-            void setTargetPosition(const Vector3& target);
-            void searchRandomTargetPosition();
-
-            void setTarget(Pawn* target);
-            void searchNewTarget();
-            void forgetTarget();
+            
             void aimAtTarget();
 
             bool isCloseAtTarget(float distance) const;
             bool isLookingAtTarget(float angle) const;
-
-            void targetDied();
-
-            static bool sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype); // hack
-            void boostControl(); //<! Sets and resets the boost parameter of the spaceship. Bots alternate between boosting and saving boost.
-
-            bool bHasTargetPosition_;
-            Vector3 targetPosition_;
-            WeakPtr<Pawn> target_;
-            bool bShooting_;
 
             float botlevel_; //<! Makes the level of a bot configurable.
@@ -165,6 +76,7 @@
             void setPreviousMode();
 
+
             //WEAPONSYSTEM DATA
-            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode- managed by setupWeapons()
+            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
             //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
             float timeout_; //<! Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
@@ -173,4 +85,5 @@
             int getFiremode(std::string name);
 
+
             //WAYPOINT DATA
             std::vector<WeakPtr<WorldEntity> > waypoints_;
@@ -178,4 +91,8 @@
             float squaredaccuracy_;
             WorldEntity* defaultWaypoint_;
+
+            void boostControl(); //<! Sets and resets the boost parameter of the spaceship. Bots alternate between boosting and saving boost.
+
+        private:
     };
 }
Index: code/trunk/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/controllers/CMakeLists.txt	(revision 8952)
+++ code/trunk/src/orxonox/controllers/CMakeLists.txt	(revision 9016)
@@ -9,3 +9,4 @@
   WaypointPatrolController.cc
   DroneController.cc
+  FormationController.cc
 )
Index: code/trunk/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.cc	(revision 9016)
+++ code/trunk/src/orxonox/controllers/FormationController.cc	(revision 9016)
@@ -0,0 +1,1066 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+
+#include <climits>
+#include "controllers/FormationController.h"
+
+#include "core/CoreIncludes.h"
+
+#include "core/XMLPort.h"
+#include "core/command/ConsoleCommand.h"
+
+#include "worldentities/ControllableEntity.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/TeamBaseMatchBase.h"
+#include "gametypes/TeamDeathmatch.h"
+#include "gametypes/Dynamicmatch.h"
+#include "gametypes/Mission.h"
+#include "gametypes/Gametype.h"
+#include "controllers/WaypointPatrolController.h"
+#include "controllers/NewHumanController.h"
+#include "controllers/DroneController.h"
+
+
+namespace orxonox
+{
+
+  SetConsoleCommand("FormationController", "formationflight",  &FormationController::formationflight);
+  SetConsoleCommand("FormationController", "masteraction",     &FormationController::masteraction);
+  SetConsoleCommand("FormationController", "followme",         &FormationController::followme);
+  SetConsoleCommand("FormationController", "passivebehaviour", &FormationController::passivebehaviour);
+  SetConsoleCommand("FormationController", "formationsize",    &FormationController::formationsize);
+
+
+
+
+  static const unsigned int STANDARD_MAX_FORMATION_SIZE = 9;
+  static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;
+  static const int FORMATION_LENGTH =  110;
+  static const int FORMATION_WIDTH =  110;
+  static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy
+  static const float SPEED_MASTER = 0.6f;
+  static const float ROTATEFACTOR_MASTER = 0.2f;
+  static const float SPEED_FREE = 0.8f;
+  static const float ROTATEFACTOR_FREE = 0.8f;
+
+  FormationController::FormationController(BaseObject* creator) : Controller(creator)
+  {
+        RegisterObject(FormationController);
+
+        this->target_ = 0;
+        this->formationFlight_ = false;
+        this->passive_ = false;
+        this->maxFormationSize_ = STANDARD_MAX_FORMATION_SIZE;
+        this->myMaster_ = 0;
+        this->freedomCount_ = 0;
+
+        this->state_ = FREE;
+        this->formationMode_ = NORMAL;
+        this->specificMasterAction_ = NONE;
+        this->specificMasterActionHoldCount_  = 0;
+        this->bShooting_ = false;
+        this->bHasTargetPosition_ = false;
+        this->bHasTargetOrientation_=false;
+        this->speedCounter_ = 0.2f;
+        this->targetPosition_ = Vector3::ZERO;
+        this->team_=-1;
+        this->target_.setCallback(createFunctor(&FormationController::targetDied, this));
+  }
+
+  FormationController::~FormationController()
+  {
+    if (this->isInitialized())
+        {
+            this->removeFromFormation();
+
+            for (ObjectList<FormationController>::iterator it = ObjectList<FormationController>::begin(); it; ++it)
+            {
+                if (*it != this)
+                {
+                    if (it->myMaster_ == this)
+                    {
+                        orxout(internal_error) << this << " is still master in " << (*it) << endl;
+                        it->myMaster_ = 0;
+                    }
+
+                    while (true)
+                    {
+                        std::vector<FormationController*>::iterator it2 = std::find(it->slaves_.begin(), it->slaves_.end(), this);
+                        if (it2 != it->slaves_.end())
+                        {
+                            orxout(internal_error) << this << " is still slave in " << (*it) << endl;
+                            it->slaves_.erase(it2);
+                        }
+                        else
+                            break;
+                    }
+                }
+            }
+        }
+  }
+
+  void FormationController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(FormationController, XMLPort, xmlelement, mode);
+
+        XMLPortParam(FormationController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
+        XMLPortParam(FormationController, "formationFlight", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(false);
+        XMLPortParam(FormationController, "formationSize", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE);
+        XMLPortParam(FormationController, "passive", setPassive, getPassive, xmlelement, mode).defaultValues(false);
+    }
+
+
+
+  /**
+        @brief Activates / deactivates formationflight behaviour
+        @param form activate formflight if form is true
+    */
+  void FormationController::formationflight(const bool form)
+    {
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            Controller* controller = 0;
+
+            if (it->getController())
+                controller = it->getController();
+            else if (it->getXMLController())
+                controller = it->getXMLController();
+
+            if (!controller)
+                continue;
+
+            FormationController *aiController = orxonox_cast<FormationController*>(controller);
+
+            if (aiController)
+            {
+                aiController->formationFlight_ = form;
+                if (!form)
+                {
+                    aiController->removeFromFormation();
+                }
+            }
+        }
+    }
+
+  /**
+        @brief Get all masters to do a "specific master action"
+        @param action which action to perform (integer, so it can be called with a console command (tmp solution))
+    */
+    void FormationController::masteraction(const int action)
+    {
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            Controller* controller = 0;
+
+            if (it->getController())
+                controller = it->getController();
+            else if (it->getXMLController())
+                controller = it->getXMLController();
+
+            if (!controller)
+                continue;
+
+            FormationController *aiController = orxonox_cast<FormationController*>(controller);
+
+            if(aiController && aiController->state_ == MASTER)
+            {
+                if (action == 1)
+                    aiController->spinInit();
+                if (action == 2)
+                    aiController->turn180Init();
+            }
+        }
+    }
+
+  /**
+        @brief Sets shooting behaviour of pawns.
+        @param passive if true, bots won't shoot.
+    */
+    void FormationController::passivebehaviour(const bool passive)
+    {
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            Controller* controller = 0;
+
+            if (it->getController())
+                controller = it->getController();
+            else if (it->getXMLController())
+                controller = it->getXMLController();
+
+            if (!controller)
+                continue;
+
+            FormationController *aiController = orxonox_cast<FormationController*>(controller);
+
+            if(aiController)
+            {
+                aiController->passive_ = passive;
+            }
+        }
+    }
+
+  /**
+        @brief Sets maximal formation size
+        @param size maximal formation size.
+    */
+    void FormationController::formationsize(const int size)
+    {
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            Controller* controller = 0;
+
+            if (it->getController())
+                controller = it->getController();
+            else if (it->getXMLController())
+                controller = it->getXMLController();
+
+            if (!controller)
+                continue;
+
+            FormationController *aiController = orxonox_cast<FormationController*>(controller);
+
+            if(aiController)
+            {
+                aiController->maxFormationSize_ = size;
+            }
+        }
+    }
+
+  void FormationController::removeFromFormation()
+    {
+        if (this->state_ == SLAVE || this->myMaster_) // slaves can also be temporary free, so check if myMaster_ is set
+            this->unregisterSlave();
+        else if (this->state_ == MASTER)
+            this->setNewMasterWithinFormation();
+    }
+
+    void FormationController::moveToPosition(const Vector3& target)
+    {
+        if (!this->getControllableEntity())
+            return;
+
+        // Slave uses special movement if its master is in FOLLOW mode
+        if(this->state_ == SLAVE && this->myMaster_ && this->myMaster_->specificMasterAction_ == FOLLOW)
+        {
+//             this->followForSlaves(target);
+//             return;
+        }
+
+        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+        float distance = (target - this->getControllableEntity()->getPosition()).length();
+
+
+        if(this->state_ == FREE)
+        {
+            if (this->target_ || distance > 10)
+            {
+                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
+                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
+                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
+            }
+
+            if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
+            {
+              this->getControllableEntity()->moveFrontBack(-0.05f); // They don't brake with full power to give the player a chance
+            } else this->getControllableEntity()->moveFrontBack(SPEED_FREE);
+        }
+
+
+
+        if(this->state_ == MASTER)
+        {
+            if (this->target_ || distance > 10)
+            {
+                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
+                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
+            }
+
+            if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
+            {
+                this->getControllableEntity()->moveFrontBack(-0.05f);
+            } else this->getControllableEntity()->moveFrontBack(SPEED_MASTER);
+        }
+
+
+
+        if(this->state_ == SLAVE)
+        {
+
+           this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
+           this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
+
+            if (distance < 300)
+            {
+		 if (bHasTargetOrientation_)
+		    {
+			copyTargetOrientation();
+		    }
+                if (distance < 100)
+                {   //linear speed reduction
+                    this->getControllableEntity()->moveFrontBack(distance/100.0f*0.4f*SPEED_MASTER);
+		   
+                } else this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER);
+
+            } else {
+                this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER + distance/300.0f);
+            }
+        }
+
+        if (distance < 10)
+        {
+            this->positionReached();
+	    bHasTargetOrientation_=false;
+        }
+    }
+
+
+
+  void FormationController::moveToTargetPosition()
+    {
+        this->moveToPosition(this->targetPosition_);
+    }
+
+  //copy the Roll orientation of given Quaternion.
+  void FormationController::copyOrientation(const Quaternion& orient)
+    {
+        //roll angle difference in radian
+        float diff=orient.getRoll(false).valueRadians()-(this->getControllableEntity()->getOrientation().getRoll(false).valueRadians());
+        while(diff>math::twoPi) diff-=math::twoPi;
+        while(diff<-math::twoPi) diff+=math::twoPi;
+        this->getControllableEntity()->rotateRoll(diff*ROTATEFACTOR_MASTER);
+    }
+
+    void FormationController::copyTargetOrientation()
+    {
+        if (bHasTargetOrientation_)
+        {
+            copyOrientation(targetOrientation_);
+        }
+    }
+
+
+   /**
+        @brief Unregisters a slave from its master. Initiated by a slave.
+    */
+    void FormationController::unregisterSlave()
+    {
+        if (this->myMaster_)
+        {
+            std::vector<FormationController*>::iterator it = std::find(this->myMaster_->slaves_.begin(), this->myMaster_->slaves_.end(), this);
+            if (it != this->myMaster_->slaves_.end())
+                this->myMaster_->slaves_.erase(it);
+        }
+
+        this->myMaster_ = 0;
+        this->state_ = FREE;
+    }
+
+    void FormationController::searchNewMaster()
+    {
+        if (this->state_==SLAVE) 
+           return;
+        if (!this->getControllableEntity())
+            return;
+
+        this->targetPosition_ = this->getControllableEntity()->getPosition();
+        this->forgetTarget();
+        int teamSize = 0;
+        //go through all pawns
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+           
+            //same team?
+            Gametype* gt=this->getGametype();
+            if (!gt)
+            {
+                gt=it->getGametype();
+            }
+            if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it),gt))
+                continue;
+
+            //has it an FormationController?
+            Controller* controller = 0;
+
+            if (it->getController())
+                controller = it->getController();
+            else if (it->getXMLController())
+                controller = it->getXMLController();
+
+            if (!controller)
+                continue;
+
+            //is pawn oneself?
+            if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
+                continue;
+
+            teamSize++;
+
+            FormationController *newMaster = orxonox_cast<FormationController*>(controller);
+
+            //is it a master?
+            if (!newMaster || newMaster->state_ != MASTER)
+                continue;
+
+            float distance = (it->getPosition() - this->getControllableEntity()->getPosition()).length();
+
+            // is pawn in range?
+            if (distance < RADIUS_TO_SEARCH_FOR_MASTERS)
+            {
+                if(newMaster->slaves_.size() > this->maxFormationSize_) continue;
+
+                for(std::vector<FormationController*>::iterator itSlave = this->slaves_.begin(); itSlave != this->slaves_.end(); itSlave++)
+                {
+                    (*itSlave)->myMaster_ = newMaster;
+                    newMaster->slaves_.push_back(*itSlave);
+                }
+                this->slaves_.clear();
+                this->state_ = SLAVE;
+
+                this->myMaster_ = newMaster;
+                newMaster->slaves_.push_back(this);
+
+                break;
+            }
+        }
+
+        if (this->state_ != SLAVE  && teamSize != 0)
+        {
+            this->state_ = MASTER;
+            this->myMaster_ = 0;
+        }
+    }
+ /**
+        @brief Commands the slaves of a master into a formation. Sufficiently fast not to be called within tick. Initiated by a master.
+    */
+
+void FormationController::commandSlaves()
+    {
+        if(this->state_ != MASTER) return;
+
+        Quaternion orient = this->getControllableEntity()->getOrientation();
+        Vector3 dest = this->getControllableEntity()->getPosition();
+
+        // 1 slave: follow
+        if (this->slaves_.size() == 1)
+        {
+            dest += 4*orient*WorldEntity::BACK;
+            this->slaves_.front()->setTargetPosition(dest);
+        }
+        else
+	// formation:
+        {
+            dest += 1.0f*orient*WorldEntity::BACK;
+            Vector3 pos = Vector3::ZERO;
+	         bool left=true;
+            int i = 1;
+	    
+            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
+            {
+                pos = Vector3::ZERO;
+                if (left)
+                {
+                    pos+=dest+i*FORMATION_WIDTH*(orient*WorldEntity::LEFT);
+                } else{
+                    pos+=dest+i*FORMATION_WIDTH*(orient*WorldEntity::RIGHT);
+                    i++;
+                    dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK);
+                }		
+                (*it)->setTargetOrientation(orient);
+                (*it)->setTargetPosition(pos);
+                left=!left;
+            }
+        }
+    }
+
+    /**
+        @brief Sets a new master within the formation. Called by a master.
+    */
+    void FormationController::setNewMasterWithinFormation()
+    {
+        if(this->state_ != MASTER) return;
+
+        if (!this->slaves_.empty())
+        {
+            FormationController *newMaster = this->slaves_.back();
+            this->slaves_.pop_back();
+
+            newMaster->state_ = MASTER;
+            newMaster->slaves_ = this->slaves_;
+            newMaster->myMaster_ = 0;
+
+            for(std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)
+            {
+                (*it)->myMaster_ = newMaster;
+            }
+        }
+
+        this->slaves_.clear();
+        this->specificMasterAction_ = NONE;
+        this->state_ = FREE;
+    }
+
+
+  /**
+        @brief Frees all slaves form a master. Initiated by a master.
+    */
+    void FormationController::freeSlaves()
+    {
+        if(this->state_ != MASTER) return;
+
+        for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
+        {
+            (*it)->state_ = FREE;
+            (*it)->myMaster_ = 0;
+        }
+        this->slaves_.clear();
+    }
+
+    /**
+        @brief Master sets its slaves free for @ref FREEDOM_COUNT seconds.
+    */
+    void FormationController::forceFreeSlaves()
+    {
+        if(this->state_ != MASTER) return;
+
+        for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
+        {
+            (*it)->state_ = FREE;
+            (*it)->forceFreedom();
+            (*it)->targetPosition_ = this->targetPosition_;
+            (*it)->bShooting_ = true;
+//             (*it)->getControllableEntity()->fire(0);// fire once for fun
+        }
+    }
+
+    void FormationController::loseMasterState()
+    {
+        this->freeSlaves();
+        this->state_ = FREE;
+    }
+
+
+    void FormationController::forceFreedom()
+    {
+        this->freedomCount_ = FREEDOM_COUNT;
+    }
+
+    /**
+        @brief Checks wether caller has been forced free, decrements time to stay forced free.
+        @return true if forced free.
+    */
+    bool FormationController::forcedFree()
+    {
+        if(this->freedomCount_ > 0)
+        {
+            this->freedomCount_--;
+            return true;
+        } else return false;
+    }
+
+
+    /**
+        @brief Call to take the lead of formation (if free, become slave of nearest formation, then, if Slave, become Master)
+    */
+    void FormationController::takeLeadOfFormation()
+    {
+        if (!this->getControllableEntity() || this->state_==MASTER)
+            return;
+
+        //search new Master, then take lead
+        if (this->state_==FREE && this->myMaster_==0)
+        {
+          searchNewMaster();
+        }
+
+        if (this->state_==SLAVE)  //become master of this formation
+        {   
+            this->slaves_=this->myMaster_->slaves_;
+            this->myMaster_->slaves_.clear();
+            this->myMaster_->state_=SLAVE;
+            this->myMaster_->myMaster_=this;
+            
+            //delete myself in slavelist
+            std::vector<FormationController*>::iterator it2 = std::find(this->slaves_.begin(), this->slaves_.end(), this);
+            if (it2 != this->slaves_.end())
+            {
+                 this->slaves_.erase(it2);
+            }
+            //add previous master
+            this->slaves_.push_back(this->myMaster_);
+            //set this as new master
+            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
+            {
+                 (*it)->myMaster_=this;
+            }
+            this->myMaster_=0;
+            this->state_=MASTER;
+        }
+        /*/debug
+        if (this->state_==SLAVE)
+           {orxout(debug_output) << this << " is slave "<< endl;}
+        else if (this->state_==MASTER)
+           {orxout(debug_output) << this << " is now a master of "<<this->slaves_.size()<<" slaves."<< endl;}
+        if (this->state_==FREE)
+           {orxout(debug_output) << this << " is free "<< endl;}*/
+    }
+    /**
+      @brief if called, half of the formation will attack the originator
+    */
+    void FormationController::masterAttacked(Pawn* originator)
+    {
+       if (this->state_!=MASTER) return;
+       unsigned int i=0;
+       for(std::vector<FormationController*>::reverse_iterator it = slaves_.rbegin(); it != slaves_.rend(); it++)
+       {
+           if ((*it)->state_!=FREE)
+           {
+               (*it)->state_=FREE;
+               (*it)->forceFreedom();
+               (*it)->target_=originator;
+           }
+           i++;
+           if (i>=slaves_.size()/2) break; //half the formation should attack.
+       }
+    }     
+
+
+    /**
+      @brief Sets the new mode. If master, set it for all slaves.
+    */
+    void FormationController::setFormationMode(FormationMode val)
+    {
+        this->formationMode_ = val;
+        if (this->state_ == MASTER)
+        {
+            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
+            {
+                 (*it)->formationMode_ = val;
+                 if (val == ATTACK)
+                     (*it)->forgetTarget();
+            }
+        }
+    }
+
+    /**
+        @brief Used to continue a "specific master action" for a certain time and resuming normal behaviour after.
+    */
+    void FormationController::specificMasterActionHold()
+    {
+        if(this->state_ != MASTER) return;
+
+        if (specificMasterActionHoldCount_ == 0)
+         {
+            this->specificMasterAction_ = NONE;
+            this->searchNewTarget();
+         }
+        else specificMasterActionHoldCount_--;
+    }
+
+    /**
+        @brief Master initializes a 180 degree turn. Leads to a "specific master action".
+    */
+    void FormationController::turn180Init()
+    {
+        if(this->state_ != MASTER) return;
+
+        Quaternion orient = this->getControllableEntity()->getOrientation();
+
+        this->setTargetPosition(this->getControllableEntity()->getPosition() + 1000.0f*orient*WorldEntity::BACK);
+
+        this->specificMasterActionHoldCount_ = 4;
+
+        this->specificMasterAction_ = TURN180;
+    }
+
+    /**
+        @brief Execute the 180 degree turn. Called within tick.
+    */
+    void FormationController::turn180()
+    {
+            Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, this->targetPosition_);
+
+            this->getControllableEntity()->rotateYaw(-2.0f * sgn(coord.x) * coord.x*coord.x);
+            this->getControllableEntity()->rotatePitch(2.0f * sgn(coord.y) * coord.y*coord.y);
+
+            this->getControllableEntity()->moveFrontBack(SPEED_MASTER);
+    }
+
+    /**
+        @brief Master initializes a spin around its looking direction axis. Leads to a "specific master action".
+    */
+    void FormationController::spinInit()
+    {
+        if(this->state_ != MASTER) return;
+        this->specificMasterAction_ = SPIN;
+        this->specificMasterActionHoldCount_ = 10;
+    }
+
+    /**
+        @brief Execute the spin. Called within tick.
+    */
+    void FormationController::spin()
+    {
+            this->moveToTargetPosition();
+            this->getControllableEntity()->rotateRoll(0.8f);
+    }
+
+  /**
+        @brief A human player gets followed by its nearest master. Initiated by console command, so far intended for demonstration puproses (possible future pickup).
+    */
+    void FormationController::followme()
+    {
+
+        Pawn *humanPawn = NULL;
+        NewHumanController *currentHumanController = NULL;
+        std::vector<FormationController*> allMasters;
+
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            Controller* controller = 0;
+
+            if (it->getController())
+                controller = it->getController();
+            else if (it->getXMLController())
+                controller = it->getXMLController();
+
+            if (!controller)
+                continue;
+
+            currentHumanController = orxonox_cast<NewHumanController*>(controller);
+
+            if(currentHumanController) humanPawn = *it;
+
+            FormationController *aiController = orxonox_cast<FormationController*>(controller);
+
+            if(aiController && aiController->state_ == MASTER)
+                allMasters.push_back(aiController);
+
+        }
+
+        if((humanPawn != NULL) && (allMasters.size() != 0))
+        {
+                float posHuman = humanPawn->getPosition().length();
+                float distance = 0.0f;
+                float minDistance = FLT_MAX;
+                int index = 0;
+                int i = 0;
+
+                for(std::vector<FormationController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++)
+                    {
+                        if (!FormationController::sameTeam((*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue;
+                        distance = posHuman - (*it)->getControllableEntity()->getPosition().length();
+                        if(distance < minDistance) index = i;
+                    }
+                allMasters[index]->followInit(humanPawn);
+            }
+
+    }
+
+
+
+
+
+    /**
+        @brief Master begins to follow a pawn. Is a "specific master action".
+        @param pawn pawn to follow.
+        @param always follows pawn forever if true (false if omitted).
+        @param secondsToFollow seconds to follow the pawn if always is false. Will follow pawn 100 seconds if omitted (set in header).
+    */
+    void FormationController::followInit(Pawn* pawn, const bool always, const int secondsToFollow)
+    {
+        if (pawn == NULL || this->state_ != MASTER)
+            return;
+        this->specificMasterAction_  =  FOLLOW;
+
+        this->setTarget(pawn);
+        if (!always)
+            this->specificMasterActionHoldCount_ = secondsToFollow;
+        else
+            this->specificMasterActionHoldCount_ = INT_MAX; //for now...
+
+    }
+
+   /**
+        @brief Master begins to follow a randomly chosen human player of the same team. Is a "specific master action".
+    */
+    void FormationController::followRandomHumanInit()
+    {
+
+        Pawn *humanPawn = NULL;
+        NewHumanController *currentHumanController = NULL;
+
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            if (!it->getController())
+                continue;
+
+            currentHumanController = orxonox_cast<NewHumanController*>(it->getController());
+            if(currentHumanController)
+            {
+                if (!FormationController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue;
+                humanPawn = *it;
+                break;
+            }
+        }
+
+        if((humanPawn != NULL))
+                this->followInit(humanPawn);
+    }
+
+
+  /**
+        @brief Master follows target with adjusted speed. Called within tick.
+    */
+    void FormationController::follow()
+    {
+        if (this->target_)
+            this->moveToPosition(this->target_->getPosition());
+        else
+            this->specificMasterActionHoldCount_ = 0;
+    }
+
+
+  void FormationController::setTargetPosition(const Vector3& target)
+    {
+        this->targetPosition_ = target;
+        this->bHasTargetPosition_ = true;
+    }
+
+    void FormationController::searchRandomTargetPosition()
+    {
+        this->targetPosition_ = Vector3(rnd(-2000,2000), rnd(-2000,2000), rnd(-2000,2000));
+        this->bHasTargetPosition_ = true;
+    }
+
+    void FormationController::setTargetOrientation(const Quaternion& orient)
+    {
+        this->targetOrientation_=orient;	
+        this->bHasTargetOrientation_=true;
+    }
+
+    void FormationController::setTargetOrientation(Pawn* target)
+    {
+        if (target)
+            setTargetOrientation(target->getOrientation());
+    }
+
+    void FormationController::setTarget(Pawn* target)
+    {
+        this->target_ = target;
+
+        if (target)
+            this->targetPosition_ = target->getPosition();
+    }
+
+    void FormationController::searchNewTarget()
+    {
+        if (!this->getControllableEntity())
+            return;
+
+        this->targetPosition_ = this->getControllableEntity()->getPosition();
+        this->forgetTarget();
+
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
+        {
+            if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
+                continue;
+
+            /* So AI won't choose invisible Spaceships as target */
+            if (!it->getRadarVisibility())
+                continue;
+
+            if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity())
+            {
+                float speed = this->getControllableEntity()->getVelocity().length();
+                Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition();
+                Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition();
+                if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi)
+                        < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250))
+                {
+                    this->target_ = (*it);
+                    this->targetPosition_ = it->getPosition();
+                }
+            }
+        }
+    }
+
+  void FormationController::forgetTarget()
+    {
+        this->target_ = 0;
+        this->bShooting_ = false;
+    }
+
+   void FormationController::targetDied()
+    {
+        this->forgetTarget();
+        this->searchRandomTargetPosition();
+    }
+
+  bool FormationController::sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
+    {
+        if (entity1 == entity2)
+            return true;
+
+        int team1 = -1;
+        int team2 = -1;
+
+        Controller* controller = 0;
+        if (entity1->getController())
+            controller = entity1->getController();
+        else
+            controller = entity1->getXMLController();
+        if (controller)
+        {
+            FormationController* ac = orxonox_cast<FormationController*>(controller);
+            if (ac)
+                team1 = ac->getTeam();
+        }
+
+        if (entity2->getController())
+            controller = entity2->getController();
+        else
+            controller = entity2->getXMLController();
+        if (controller)
+        {
+            FormationController* ac = orxonox_cast<FormationController*>(controller);
+            if (ac)
+                team2 = ac->getTeam();
+        }
+
+        TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch*>(gametype);
+        if (tdm)
+        {
+            if (entity1->getPlayer())
+                team1 = tdm->getTeam(entity1->getPlayer());
+
+            if (entity2->getPlayer())
+                team2 = tdm->getTeam(entity2->getPlayer());
+        }
+
+        Mission* miss = orxonox_cast<Mission*>(gametype);
+        if (miss)
+        {
+            if (entity1->getPlayer())
+                team1 = miss->getTeam(entity1->getPlayer());
+
+            if (entity2->getPlayer())
+                team2 = miss->getTeam(entity2->getPlayer());
+        }
+
+        TeamBaseMatchBase* base = 0;
+        base = orxonox_cast<TeamBaseMatchBase*>(entity1);
+        if (base)
+        {
+            switch (base->getState())
+            {
+                case BaseState::ControlTeam1:
+                    team1 = 0;
+                    break;
+                case BaseState::ControlTeam2:
+                    team1 = 1;
+                    break;
+                case BaseState::Uncontrolled:
+                default:
+                    team1 = -1;
+            }
+        }
+        base = orxonox_cast<TeamBaseMatchBase*>(entity2);
+        if (base)
+        {
+            switch (base->getState())
+            {
+                case BaseState::ControlTeam1:
+                    team2 = 0;
+                    break;
+                case BaseState::ControlTeam2:
+                    team2 = 1;
+                    break;
+                case BaseState::Uncontrolled:
+                default:
+                    team2 = -1;
+            }
+        }
+
+        DroneController* droneController = 0;
+        droneController = orxonox_cast<DroneController*>(entity1->getController());
+        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2)
+            return true;
+        droneController = orxonox_cast<DroneController*>(entity2->getController());
+        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity1)
+            return true;
+        DroneController* droneController1 = orxonox_cast<DroneController*>(entity1->getController());
+        DroneController* droneController2 = orxonox_cast<DroneController*>(entity2->getController());
+        if (droneController1 && droneController2 && droneController1->getOwner() == droneController2->getOwner())
+            return true;
+
+        Dynamicmatch* dynamic = orxonox_cast<Dynamicmatch*>(gametype);
+        if (dynamic)
+        {
+            if (dynamic->notEnoughPigs||dynamic->notEnoughKillers||dynamic->notEnoughChasers) {return false;}
+
+            if (entity1->getPlayer())
+                team1 = dynamic->getParty(entity1->getPlayer());
+
+            if (entity2->getPlayer())
+                team2 = dynamic->getParty(entity2->getPlayer());
+
+            if (team1 ==-1 ||team2 ==-1 ) {return false;}
+            else if (team1 == dynamic->chaser && team2 != dynamic->chaser) {return false;}
+            else if (team1 == dynamic->piggy && team2 == dynamic->chaser) {return false;}
+            else if (team1 == dynamic->killer && team2 == dynamic->chaser) {return false;}
+            else return true;
+        }
+
+        return (team1 == team2 && team1 != -1);
+    }
+
+    void FormationController::absoluteMoveToPosition(const Vector3& target)
+    {
+        float minDistance = 40.0f;
+        if (!this->getControllableEntity())
+            return;
+
+        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+        float distance = (target - this->getControllableEntity()->getPosition()).length();
+
+            if (this->target_ || distance > minDistance)
+            {
+                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
+                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
+                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
+                this->getControllableEntity()->moveFrontBack(SPEED_FREE);
+            }
+
+
+        if (distance < minDistance)
+        {
+            this->positionReached();
+        }
+    }
+
+}
Index: code/trunk/src/orxonox/controllers/FormationController.h
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.h	(revision 9016)
+++ code/trunk/src/orxonox/controllers/FormationController.h	(revision 9016)
@@ -0,0 +1,177 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _FormationController_h__
+#define _FormationController_h__
+
+#include "OrxonoxPrereqs.h"
+
+#include <vector>
+#include "core/Super.h"
+
+#include "util/Math.h"
+#include "core/OrxonoxClass.h"
+#include "controllers/Controller.h"
+#include "worldentities/ControllableEntity.h"
+
+
+namespace orxonox {
+
+  class _OrxonoxExport FormationController : public Controller
+  {
+
+      public:
+      FormationController(BaseObject* creator);
+
+      virtual ~FormationController();
+
+      virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+
+      static void formationflight(const bool form);
+      static void masteraction(const int action);
+      static void followme();
+      static void passivebehaviour(const bool passive);
+      static void formationsize(const int size);
+
+      inline void setFormationFlight(bool formation)
+           { this->formationFlight_ = formation; }
+      inline bool getFormationFlight() const
+           { return this->formationFlight_; }
+
+      inline void setFormationSize(int size)
+           { this->maxFormationSize_ = size; }
+      inline int getFormationSize() const
+           { return this->maxFormationSize_; }
+
+
+      inline void setPassive(bool passive)
+           { this->passive_ = passive; }
+      inline bool getPassive() const
+           { return this->passive_; }
+
+      inline void setTeam(int team)
+           { this->team_ = team; }
+      inline int getTeam() const
+           { return this->team_; }
+
+      /**
+        @brief Mode of the formation, behaviour of slaves
+               Normal-normal behaviour
+               Defend-just defend the master
+               Attack-leave formation, attack every target
+      */
+      enum FormationMode {NORMAL,DEFEND,ATTACK};
+
+      /**
+        @brief Sets the new mode. If master, set it for all slaves.
+      */
+      void setFormationMode(FormationMode val);
+      inline FormationMode getFormationMode() const
+           { return this->formationMode_; }
+
+    protected:
+      bool formationFlight_;
+      bool passive_;
+      int team_;
+      unsigned int maxFormationSize_;
+      int freedomCount_;
+      enum State {SLAVE, MASTER, FREE};
+
+      State state_;
+      std::vector<FormationController*> slaves_;
+      FormationController* myMaster_;
+
+      FormationMode formationMode_;
+
+      enum SpecificMasterAction {NONE, HOLD, SPIN, TURN180, FOLLOW};
+      SpecificMasterAction specificMasterAction_;
+      int specificMasterActionHoldCount_;
+      float speedCounter_; //for speed adjustment when following
+
+      void moveToPosition(const Vector3& target);
+      void moveToTargetPosition();
+      void absoluteMoveToPosition(const Vector3& target);
+      void copyOrientation(const Quaternion& orient);
+      void copyTargetOrientation();
+
+      void removeFromFormation();
+      void unregisterSlave();
+      void searchNewMaster();
+      void commandSlaves();
+      void setNewMasterWithinFormation();
+
+      void freeSlaves();
+      void forceFreeSlaves();
+      void loseMasterState();
+      void forceFreedom();
+      bool forcedFree();
+
+      void takeLeadOfFormation();
+      void masterAttacked(Pawn* originator);
+
+      void specificMasterActionHold();
+      void turn180Init();
+      void spinInit();
+      void spin();
+      void turn180();
+      void followInit(Pawn* pawn, const bool always = false, const int secondsToFollow = 100);
+      void followRandomHumanInit();
+      void follow();
+
+      void setTargetPosition(const Vector3& target);
+      void searchRandomTargetPosition();
+
+      void setTargetOrientation(const Quaternion& orient);
+      void setTargetOrientation(Pawn* target);
+
+      virtual void positionReached() {}
+
+      static bool sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype); // hack
+
+
+      void setTarget(Pawn* target);
+      void searchNewTarget();
+      void forgetTarget();
+
+      void targetDied();
+
+      bool bHasTargetPosition_;
+      Vector3 targetPosition_;
+      bool bHasTargetOrientation_;
+      Quaternion targetOrientation_;
+
+      WeakPtr<Pawn> target_;
+      bool bShooting_;
+  };
+
+
+}
+#endif /* _FormationController_h__ */
+
+
Index: code/trunk/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.cc	(revision 8952)
+++ code/trunk/src/orxonox/controllers/HumanController.cc	(revision 9016)
@@ -50,4 +50,6 @@
     SetConsoleCommand("HumanController", "rotatePitch",            &HumanController::rotatePitch   ).addShortcut().setAsInputCommand();
     SetConsoleCommand("HumanController", "rotateRoll",             &HumanController::rotateRoll    ).addShortcut().setAsInputCommand();
+    SetConsoleCommand("HumanController", "toggleFormationFlight",  &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress);
+    SetConsoleCommand("HumanController", "FFChangeMode",  &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress);
     SetConsoleCommand("HumanController", __CC_fire_name,           &HumanController::fire          ).addShortcut().keybindMode(KeybindMode::OnHold);
     SetConsoleCommand("HumanController", "reload",                 &HumanController::reload        ).addShortcut();
@@ -69,5 +71,5 @@
     /*static*/ const float HumanController::BOOSTING_TIME = 0.1f;
 
-    HumanController::HumanController(BaseObject* creator) : Controller(creator)
+    HumanController::HumanController(BaseObject* creator) : FormationController(creator)
     {
         RegisterObject(HumanController);
@@ -76,5 +78,4 @@
         this->boosting_ = false;
         this->boosting_ = false;
-
         HumanController::localController_s = this;
         this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this)));
@@ -84,4 +85,8 @@
     HumanController::~HumanController()
     {
+        if (HumanController::localController_s) 
+        {
+            HumanController::localController_s->removeFromFormation();
+        }
         HumanController::localController_s = 0;
     }
@@ -95,4 +100,11 @@
                 orxout(internal_warning) << "HumanController, Warning: Using a ControllableEntity without Camera" << endl;
         }
+
+        // commandslaves when Master of a formation
+        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER)
+        {
+            if (HumanController::localController_s->formationMode_ != ATTACK)
+                HumanController::localController_s->commandSlaves();
+        }
     }
 
@@ -160,5 +172,12 @@
     {
         if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
+        {
             HumanController::localController_s->controllableEntity_->fire(firemode);
+            //if human fires, set slaves free. See FormationController::forceFreeSlaves()
+            if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
+            {
+                HumanController::localController_s->forceFreeSlaves();
+            }
+        }
     }
 
@@ -195,6 +214,6 @@
             this->boosting_ = true;
             this->boostingTimeout_.startTimer();
-            
-            this->controllableEntity_->boost(this->boosting_);
+            if(this->controllableEntity_)
+                this->controllableEntity_->boost(this->boosting_);
 //            orxout() << "Start boosting" << endl;
         }
@@ -209,6 +228,6 @@
         this->boosting_ = false;
         this->boostingTimeout_.stopTimer();
-
-        this->controllableEntity_->boost(this->boosting_);
+        if(this->controllableEntity_)
+            this->controllableEntity_->boost(this->boosting_);
 //        orxout() << "Stop boosting" << endl;
     }
@@ -262,4 +281,63 @@
     }
 
+    /**
+    @brief
+       toggle the formation. Not usable, if formationflight is disabled generally (formationFlight_)
+    */
+    void HumanController::toggleFormationFlight()
+    {
+        if (HumanController::localController_s)
+        {
+            if (!HumanController::localController_s->formationFlight_)
+            {
+                return; //dont use when formationFlight is disabled
+            }
+            if (HumanController::localController_s->state_==MASTER)
+            {
+                HumanController::localController_s->loseMasterState();
+                orxout(message) <<"FormationFlight disabled "<< endl;
+            } else //SLAVE or FREE
+            {
+                HumanController::localController_s->takeLeadOfFormation();
+                orxout(message) <<"FormationFlight enabled "<< endl;
+            }
+            
+        }
+
+    }
+
+    /**
+    @brief
+       Switch through the different Modes of formationflight. You must be a master of a formation to use.
+    */
+    void HumanController::FFChangeMode()
+    {
+        if (HumanController::localController_s && HumanController::localController_s->state_==MASTER)
+        {
+            switch (HumanController::localController_s->getFormationMode()) {
+                case NORMAL:
+                    HumanController::localController_s->setFormationMode(DEFEND);
+                    orxout(message) <<"Mode: DEFEND "<< endl;
+                    break;
+                case DEFEND:
+                    HumanController::localController_s->setFormationMode(ATTACK);
+                    orxout(message) <<"Mode: ATTACK "<< endl;
+                    break;
+                case ATTACK:
+                    HumanController::localController_s->setFormationMode(NORMAL);
+                    orxout(message) <<"Mode: NORMAL "<< endl;
+                    break;
+            }
+        }
+    }
+
+
+    //used, when slaves are in DEFEND mode.
+    void HumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
+    {
+        if (!this->formationFlight_ || this->state_!=MASTER || this->formationMode_!=DEFEND) return;
+            this->masterAttacked(originator);
+    }
+
     void HumanController::addBots(unsigned int amount)
     {
Index: code/trunk/src/orxonox/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.h	(revision 8952)
+++ code/trunk/src/orxonox/controllers/HumanController.h	(revision 9016)
@@ -34,5 +34,5 @@
 #include "tools/Timer.h"
 #include "tools/interfaces/Tickable.h"
-#include "Controller.h"
+#include "FormationController.h"
 
 // tolua_begin
@@ -41,5 +41,5 @@
     class _OrxonoxExport HumanController
 // tolua_end
-        : public Controller, public Tickable
+        : public FormationController, public Tickable
     { // tolua_export
         public:
@@ -74,5 +74,6 @@
             void keepBoosting(void);
             void terminateBoosting(void);
-            
+                  
+
             static void greet();
             static void switchCamera();
@@ -84,4 +85,9 @@
             static void toggleGodMode();
             static void myposition();
+
+            static void toggleFormationFlight();
+            static void FFChangeMode();
+            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
+
 
             static void addBots(unsigned int amount);
Index: code/trunk/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.cc	(revision 8952)
+++ code/trunk/src/orxonox/controllers/NewHumanController.cc	(revision 9016)
@@ -291,10 +291,12 @@
         }
         else
-            HumanController::localController_s->getControllableEntity()->fire(firemode);
-
+            HumanController::doFire(firemode); //call for formationflight
     }
 
     void NewHumanController::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
     {
+        //Used in HumanController for formationFlight
+        HumanController::hit(originator,contactpoint,damage);
+        
         if (this->showDamageOverlay_ && !this->controlPaused_ && this->controllableEntity_ && !this->controllableEntity_->isInMouseLook())
         {
Index: code/trunk/src/orxonox/controllers/NewHumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.h	(revision 8952)
+++ code/trunk/src/orxonox/controllers/NewHumanController.h	(revision 9016)
@@ -69,4 +69,7 @@
             virtual void doResumeControl();
 
+            float getCurrentYaw(){ return this->currentYaw_; }
+            float getCurrentPitch(){ return this->currentPitch_; }
+
 
         protected:
Index: code/trunk/src/orxonox/controllers/WaypointPatrolController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/WaypointPatrolController.cc	(revision 8952)
+++ code/trunk/src/orxonox/controllers/WaypointPatrolController.cc	(revision 9016)
@@ -42,5 +42,4 @@
         RegisterObject(WaypointPatrolController);
 
-        //this->team_ = 0;
         this->alertnessradius_ = 500;
 
@@ -53,5 +52,4 @@
 
         XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f);
-//        XMLPortParam(WaypointPatrolController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(0);
     }
 
Index: code/trunk/src/orxonox/controllers/WaypointPatrolController.h
===================================================================
--- code/trunk/src/orxonox/controllers/WaypointPatrolController.h	(revision 8952)
+++ code/trunk/src/orxonox/controllers/WaypointPatrolController.h	(revision 9016)
@@ -46,9 +46,4 @@
             virtual void tick(float dt);
 
-           /* inline void setTeam(int team)
-                { this->team_ = team; }
-            inline int getTeam() const
-                { return this->team_; } */
-
             inline void setAlertnessRadius(float radius)
                 { this->alertnessradius_ = radius; }
@@ -59,5 +54,4 @@
             void searchEnemy();
 
-            //int team_;
             float alertnessradius_;
             Timer patrolTimer_;
Index: code/trunk/src/orxonox/gametypes/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/gametypes/CMakeLists.txt	(revision 8952)
+++ code/trunk/src/orxonox/gametypes/CMakeLists.txt	(revision 9016)
@@ -9,3 +9,5 @@
   LastManStanding.cc
   LastTeamStanding.cc
+  TeamGametype.cc
+  Mission.cc
 )
Index: code/trunk/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.cc	(revision 8952)
+++ code/trunk/src/orxonox/gametypes/Gametype.cc	(revision 9016)
@@ -123,5 +123,5 @@
         if (this->gtinfo_->isStartCountdownRunning() && !this->gtinfo_->hasStarted())
             this->gtinfo_->countdownStartCountdown(dt);
-
+			
         if (!this->gtinfo_->hasStarted())
         {
@@ -131,6 +131,7 @@
                 if(it->first->isHumanPlayer() && it->first->isReadyToSpawn())
                     this->gtinfo_->playerReadyToSpawn(it->first);
-            }
-                    
+                   
+                
+            }
             this->checkStart();
         }
@@ -143,4 +144,5 @@
     void Gametype::start()
     {
+         
         this->addBots(this->numberOfBots_);
 
@@ -148,4 +150,6 @@
 
         this->spawnPlayersIfRequested();
+        
+        
     }
 
@@ -376,5 +380,5 @@
                 {
                     this->gtinfo_->stopStartCountdown();
-                    this->gtinfo_->setStartCountdown(0.0f);;
+                    this->gtinfo_->setStartCountdown(0.0f);
                     this->start();
                 }
@@ -397,4 +401,5 @@
                             hashumanplayers = true;
                     }
+                         
                     if (allplayersready && hashumanplayers)
                     {
@@ -408,4 +413,5 @@
                 }
             }
+            
         }
     }
@@ -439,5 +445,5 @@
             if(player->isHumanPlayer())
                 this->gtinfo_->playerSpawned(player);
-            
+
             this->playerPostSpawn(player);
         }
Index: code/trunk/src/orxonox/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.h	(revision 8952)
+++ code/trunk/src/orxonox/gametypes/Gametype.h	(revision 9016)
@@ -123,9 +123,6 @@
                 { return this->gtinfo_->getHUDTemplate(); }
 
-            void addBots(unsigned int amount);
+            virtual void addBots(unsigned int amount);
             void killBots(unsigned int amount = 0);
-
-            inline unsigned int getNumberOfPlayers() const
-                { return this->players_.size(); }
 
             virtual void addTime(float t);
@@ -151,8 +148,12 @@
 
             //inline bool getForceSpawn()
-            //  { return this->bForceSpawn_; }       
+            //  { return this->bForceSpawn_; }
 
             virtual void resetTimer();
             virtual void resetTimer(float t);
+            inline unsigned int getNumberOfPlayers()
+              { return this->gtinfo_->getNumberOfPlayers(); }
+
+	
 
         protected:
@@ -192,4 +193,5 @@
             ConsoleCommand* dedicatedKillBots_;
             /* HACK HACK HACK */
+
     };
 }
Index: code/trunk/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Mission.cc	(revision 9016)
+++ code/trunk/src/orxonox/gametypes/Mission.cc	(revision 9016)
@@ -0,0 +1,99 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Mission.h"
+#include "items/Engine.h"
+#include "controllers/ArtificialController.h"
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(Mission);
+
+    Mission::Mission(BaseObject* creator) : TeamGametype(creator)
+    {
+        RegisterObject(Mission);
+        this->missionAccomplished_ = false;
+        this->lives_ = 10; // should be 1 as default value
+        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
+    }
+
+    void Mission::tick(float dt)
+    {
+        SUPER(Mission, tick, dt);
+
+        if (missionAccomplished_)
+        {
+            this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
+            this->end();
+        }
+    }
+
+    void Mission::pawnKilled(Pawn* victim, Pawn* killer)
+    {
+        if (victim && victim->getPlayer() && this->lives_ == 1)
+        {
+            this->missionAccomplished_ = false;
+	    this->end();
+        }
+    }
+
+    void Mission::start()
+    {
+        Gametype::start();
+        this->setTeams();
+
+        this->gtinfo_->sendAnnounceMessage("Your mission has started!");
+    }
+
+    void Mission::end()
+    {
+        Gametype::end();
+	/*if (this->missionAccomplished_) 
+            this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
+	else
+            this->gtinfo_->sendAnnounceMessage("Mission failed!");
+	 * */
+    }
+
+    void Mission::setTeams()
+    {//Set pawn-colours
+        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
+        {
+            Pawn* pawn = static_cast<Pawn*>(*it);
+            if(!pawn) continue;
+                this->setDefaultObjectColour(pawn);
+        }
+    }
+
+
+
+}
Index: code/trunk/src/orxonox/gametypes/Mission.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Mission.h	(revision 9016)
+++ code/trunk/src/orxonox/gametypes/Mission.h	(revision 9016)
@@ -0,0 +1,64 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Mission_H__
+#define _Mission_H__
+
+#include "OrxonoxPrereqs.h"
+//#include "Gametype.h"
+#include "TeamGametype.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Mission : public TeamGametype
+    {
+        public:
+            Mission(BaseObject* creator);
+            virtual ~Mission() {}
+
+            virtual void tick(float dt);
+
+            virtual void start();
+            virtual void end();
+            virtual void setTeams();
+            virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
+            inline void setLives(unsigned int amount)
+                {this->lives_ = amount;}
+            inline unsigned int getLives()
+                {return this->lives_;}
+
+        protected:
+            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
+            bool missionAccomplished_; //<! indicates if player successfully finsihed the mission;
+            int lives_; //<! amount of player's lives <-> nr. of retries
+
+    };
+}
+
+#endif /* _Mission_H__ */
+
Index: code/trunk/src/orxonox/gametypes/TeamDeathmatch.h
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamDeathmatch.h	(revision 8952)
+++ code/trunk/src/orxonox/gametypes/TeamDeathmatch.h	(revision 9016)
@@ -56,5 +56,4 @@
 
             int getTeam(PlayerInfo* player);
-
             inline const ColourValue& getTeamColour(int teamnr) const
                 { return this->teamcolours_[teamnr]; }
Index: code/trunk/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamGametype.cc	(revision 9016)
+++ code/trunk/src/orxonox/gametypes/TeamGametype.cc	(revision 9016)
@@ -0,0 +1,334 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "TeamGametype.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "infos/PlayerInfo.h"
+#include "interfaces/TeamColourable.h"
+#include "worldentities/TeamSpawnPoint.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/ControllableEntity.h"
+#include "controllers/ArtificialController.h"
+
+namespace orxonox
+{
+    CreateUnloadableFactory(TeamGametype);
+
+    TeamGametype::TeamGametype(BaseObject* creator) : Gametype(creator)
+    {
+        RegisterObject(TeamGametype);
+
+        this->teams_ = 2; //most team gametypes use two different teams
+        this->allowFriendlyFire_ = false;
+        //this->playersPerTeam_ = 0;
+        this->maxPlayers_ = 0; //Value "0": no limit is set.
+        this->setConfigValues();
+    }
+
+    void TeamGametype::setConfigValues()
+    {
+        SetConfigValue(teams_, 2);
+
+        static ColourValue colours[] =
+        {
+            ColourValue(0.2f, 0.2f, 1.0f),
+            ColourValue(1.0f, 0.1f, 0.1f),
+            ColourValue(0.3f, 1.0f, 0.3f),
+            ColourValue(1.0f, 1.0f, 0.0f),
+            ColourValue(0.0f, 1.0f, 1.0f),
+            ColourValue(1.0f, 0.0f, 1.0f),
+            ColourValue(7.0f, 7.0f, 7.0f),
+            ColourValue(2.0f, 2.0f, 2.0f)
+        };
+        static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue));
+
+        SetConfigValue(teamcolours_, defaultcolours);
+    }
+
+    void TeamGametype::playerEntered(PlayerInfo* player)
+    {
+        if(player == NULL) return; // catch null pointers
+        Gametype::playerEntered(player);
+        this->findAndSetTeam(player);
+        if( this->players_.size() <= maxPlayers_ || maxPlayers_  ==  0)
+        {
+            this->allowedInGame_[player]= true;
+        }
+        else
+        {
+            this->allowedInGame_[player]= false;
+            orxout() << "not allowed in game: players = " << this->players_.size() << " > maximum: " << maxPlayers_ << endl;
+        }
+    }
+
+    void TeamGametype::findAndSetTeam(PlayerInfo* player)
+    {
+        if(player == NULL) return; // catch null pointers
+        std::vector<unsigned int> playersperteam(this->teams_, 0);
+
+        for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)
+            if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
+                playersperteam[it->second]++;
+
+        unsigned int minplayers = static_cast<unsigned int>(-1);
+        size_t minplayersteam = 0;
+        for (size_t i = 0; i < this->teams_; ++i)
+        {
+            if (playersperteam[i] < minplayers)
+            {
+                minplayers = playersperteam[i];
+                minplayersteam = i;
+            }
+        }
+
+        this->teamnumbers_[player] = minplayersteam;
+
+    }
+
+    bool TeamGametype::playerLeft(PlayerInfo* player)
+    {
+        bool valid_player = Gametype::playerLeft(player);
+        if( (this->players_.size() >= maxPlayers_) && (allowedInGame_[player] == true) ) // if there's a "waiting list"
+        {
+            for (std::map<PlayerInfo*, bool>::iterator it = this->allowedInGame_.begin(); it != this->allowedInGame_.end(); ++it)
+            {
+                 if(it->second == false) // waiting player found
+                 {it->second = true; break;} // allow player to enter
+            }
+        }
+
+        if (valid_player)
+        {   // clean up the maps
+            this->teamnumbers_.erase(player);
+            this->allowedInGame_.erase(player);
+        }
+
+
+        return valid_player;
+    }
+
+    void TeamGametype::spawnDeadPlayersIfRequested()
+    {
+        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\
+        {
+            if(allowedInGame_[it->first] == false)//check if dead player is allowed to enter
+            {
+                continue;
+            }
+            if (it->second.state_ == PlayerState::Dead)
+            {
+                if ((it->first->isReadyToSpawn() || this->bForceSpawn_))
+                {
+                   this->spawnPlayer(it->first);
+                }
+            }
+        }
+    }
+
+
+    bool TeamGametype::allowPawnHit(Pawn* victim, Pawn* originator)
+    {// hit allowed: if victim & originator are foes or if originator doesnot exist or if friendlyfire is allowed
+        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator || this->allowFriendlyFire_);
+    }
+
+    bool TeamGametype::allowPawnDamage(Pawn* victim, Pawn* originator)
+    {
+        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator || this->allowFriendlyFire_);
+    }
+
+    bool TeamGametype::allowPawnDeath(Pawn* victim, Pawn* originator)
+    {
+        return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator || this->allowFriendlyFire_);
+    }
+
+    SpawnPoint* TeamGametype::getBestSpawnPoint(PlayerInfo* player) const
+    {
+        int desiredTeamNr = -1;
+        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
+        if (it_player != this->teamnumbers_.end())
+            desiredTeamNr = it_player->second;
+
+        // Only use spawnpoints of the own team (or non-team-spawnpoints)
+        std::set<SpawnPoint*> teamSpawnPoints = this->spawnpoints_;
+        for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
+        {
+            if ((*it)->isA(Class(TeamSpawnPoint)))
+            {
+                TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint*>(*it);
+                if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr)
+                {
+                    teamSpawnPoints.erase(it++);
+                    continue;
+                }
+            }
+
+            ++it;
+        }
+
+        SpawnPoint* fallbackSpawnPoint = NULL;
+        if (teamSpawnPoints.size() > 0)
+        {
+            unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
+            unsigned int index = 0;
+            // Get random fallback spawnpoint in case there is no active SpawnPoint.
+            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
+            {
+                if (index == randomspawn)
+                {
+                    fallbackSpawnPoint = (*it);
+                    break;
+                }
+
+                ++index;
+            }
+
+            // Remove all inactive SpawnPoints from the list.
+            for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); )
+            {
+                if(!(*it)->isActive())
+                {
+                    teamSpawnPoints.erase(it++);
+                    continue;
+                }
+
+                ++it;
+            }
+
+            randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size())));
+            index = 0;
+            for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)
+            {
+                if (index == randomspawn)
+                    return (*it);
+
+                ++index;
+            }
+
+            return fallbackSpawnPoint;
+        }
+
+        return 0;
+    }
+
+    void TeamGametype::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
+    {
+        if (!player)
+            return;
+
+        this->setTeamColour(player,pawn);
+    }
+
+    bool TeamGametype::pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2)
+    {
+        if (pawn1 && pawn2)
+        {
+            std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer());
+            std::map<PlayerInfo*, int>::const_iterator it2 = this->teamnumbers_.find(pawn2->getPlayer());
+
+            if (it1 != this->teamnumbers_.end() && it2 != this->teamnumbers_.end())
+                return (it1->second == it2->second);
+        }
+        return false;
+    }
+
+    int TeamGametype::getTeam(PlayerInfo* player)
+    {
+        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
+        if (it_player != this->teamnumbers_.end())
+            return it_player->second;
+        else
+            return -1;
+    }
+
+    void TeamGametype::setTeamColour(PlayerInfo* player, Pawn* pawn)
+    {
+        // Set the team colour
+        std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
+        if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size()))
+        {
+            this->colourPawn(pawn, it_player->second);
+        }
+    }
+
+    /**
+    @brief
+        Colours a pawn depending on the team values set in XML.
+        A pawn is coloured depending on it's team set via XML.
+        If there is a controller the pawn is coloured depending on its team which also can be set via XML.
+    */
+    void TeamGametype::setDefaultObjectColour(Pawn* pawn)
+    {
+        if(pawn == NULL)
+            return;
+
+        int teamnumber = pawn->getTeam();
+
+        if(teamnumber >= 0)
+        {
+            this->colourPawn(pawn, teamnumber); return;
+        }
+        //get Pawn's controller
+        ControllableEntity* entity = orxonox_cast<ControllableEntity*>(pawn);
+
+        Controller* controller = 0;
+        if (entity->getController())
+            controller = entity->getController();
+        else if (entity->getXMLController())
+            controller = entity->getXMLController();
+        else
+            return;
+
+        ArtificialController* artificial =  orxonox_cast<ArtificialController*>(controller);
+        //get Teamnumber - get the data
+        if(artificial == NULL)
+            return;
+        teamnumber= artificial->getTeam();
+
+        //set ObjectColour
+        this->colourPawn(pawn, teamnumber);
+    }
+
+    void TeamGametype::colourPawn(Pawn* pawn, int teamNr)
+    {// catch: no-colouring-case and wrong input
+        if(teamNr < 0 || teamNr+1 > this->teamcolours_.size() ||pawn == NULL) return;
+        pawn->setRadarObjectColour(this->teamcolours_[teamNr]);
+
+        std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
+        for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
+        {
+            if ((*it)->isA(Class(TeamColourable)))
+            {
+                TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
+                tc->setTeamColour(this->teamcolours_[teamNr]);
+            }
+         }
+    }
+
+}
Index: code/trunk/src/orxonox/gametypes/TeamGametype.h
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamGametype.h	(revision 9016)
+++ code/trunk/src/orxonox/gametypes/TeamGametype.h	(revision 9016)
@@ -0,0 +1,82 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Johannes Ritz
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _TeamGametype_H__
+#define _TeamGametype_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <map>
+#include <vector>
+#include "Gametype.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport TeamGametype : public Gametype
+    {
+        public:
+            TeamGametype(BaseObject* creator);
+            virtual ~TeamGametype() {}
+
+            void setConfigValues();
+
+            virtual void playerEntered(PlayerInfo* player);
+            virtual void findAndSetTeam(PlayerInfo* player);
+            virtual bool playerLeft(PlayerInfo* player);
+            virtual void spawnDeadPlayersIfRequested(); //!< Prevents players to respawn.
+
+            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);
+            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);
+            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
+
+            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);
+
+
+            int getTeam(PlayerInfo* player);
+
+            inline const ColourValue& getTeamColour(int teamnr) const
+                { return this->teamcolours_[teamnr]; }
+
+        protected:
+            virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
+            bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
+
+            bool allowFriendlyFire_; //!< friendlyfire is per default switched off: friendlyFire_ = false;
+            std::map<PlayerInfo*, int> teamnumbers_;
+            std::vector<ColourValue> teamcolours_;
+            unsigned int teams_; //!< Number  of teams. Value 0 : no teams!
+            //unsigned int playersPerTeam_; //!< Defines Maximum for players per team. Value 0: no maximum!
+            unsigned int maxPlayers_; //!< Defines Maximum for number of players. Value 0 : no maximum!
+            std::map<PlayerInfo*, bool> allowedInGame_; //!< Only those players are allowed to spawn which are listed here as 'true'.
+            void setTeamColour(PlayerInfo* player, Pawn* pawn);
+            void setDefaultObjectColour(Pawn* pawn);
+            void colourPawn(Pawn* pawn, int teamNr);
+    };
+}
+
+#endif /* _TeamGametype_H__ */
Index: code/trunk/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/UnderAttack.cc	(revision 8952)
+++ code/trunk/src/orxonox/gametypes/UnderAttack.cc	(revision 9016)
@@ -49,6 +49,6 @@
         this->gameEnded_ = false;
 
-        this->setHUDTemplate("UnderAttackHUD");
-
+        //this->setHUDTemplate("UnderAttackHUD"); 
+        //This HUD is in conflict with the HUDEnemyHealthBar
         this->setConfigValues();
         this->timesequence_ = static_cast<int>(this->gameTime_);
Index: code/trunk/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.cc	(revision 8952)
+++ code/trunk/src/orxonox/infos/GametypeInfo.cc	(revision 9016)
@@ -71,7 +71,7 @@
         this->bStarted_ = false;
         this->bEnded_ = false;
-        this->startCountdown_ = 0.0f;
+        this->startCountdown_ = 10.0f;
         this->bStartCountdownRunning_ = false;
-        this->counter_ = 0;
+        this->counter_ = 10;
         this->spawned_ = false;
         this->readyToSpawn_ = false;
@@ -164,8 +164,10 @@
     {
         if(this->bStarted_)
-            return;
+           { return;}
         
         this->bStarted_ = true;
         this->changedStarted();
+        
+       
     }
 
Index: code/trunk/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.h	(revision 8952)
+++ code/trunk/src/orxonox/infos/GametypeInfo.h	(revision 9016)
@@ -119,4 +119,7 @@
             inline const std::string& getHUDTemplate() const
                 { return this->hudtemplate_; }
+            
+            inline unsigned int getNumberOfPlayers() const
+                {  return this->spawnedPlayers_.size(); }
 
             void sendAnnounceMessage(const std::string& message);
Index: code/trunk/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/PlayerInfo.cc	(revision 8952)
+++ code/trunk/src/orxonox/infos/PlayerInfo.cc	(revision 9016)
@@ -36,4 +36,5 @@
 #include "worldentities/ControllableEntity.h"
 #include "controllers/Controller.h"
+#include "worldentities/pawns/SpaceShip.h"
 
 namespace orxonox
@@ -57,4 +58,5 @@
 
         this->registerVariables();
+        
     }
 
@@ -170,4 +172,9 @@
 
         this->changedControllableEntity();
+		SpaceShip* spaceship = dynamic_cast<SpaceShip*>(entity);
+        if (spaceship != NULL)
+        {
+            spaceship->setRVName(this->getName());
+        }
     }
 
Index: code/trunk/src/orxonox/interfaces/RadarViewable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarViewable.cc	(revision 8952)
+++ code/trunk/src/orxonox/interfaces/RadarViewable.cc	(revision 9016)
@@ -51,4 +51,5 @@
         , radarObjectDescription_("staticObject")
         , scale_(1.0f)
+		, RVName("")
     {
         RegisterRootObject(RadarViewable);
Index: code/trunk/src/orxonox/interfaces/RadarViewable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarViewable.h	(revision 8952)
+++ code/trunk/src/orxonox/interfaces/RadarViewable.h	(revision 9016)
@@ -60,4 +60,15 @@
         RadarViewable(BaseObject* creator, const WorldEntity* wePtr);
         virtual ~RadarViewable();
+
+		virtual void setRVName(std::string name)
+			{
+				if (this->RVName != name)
+				{
+					this->RVName = name;
+					this->settingsChanged();
+				}
+			}
+		std::string getRVName() const
+			{ return this->RVName; }
 
         inline void setRadarObjectCamouflage(float camouflage)
@@ -152,4 +163,5 @@
         ColourValue radarObjectColour_;
         float scale_;
+		std::string RVName;
     };
 }
Index: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc	(revision 8952)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc	(revision 9016)
@@ -74,5 +74,4 @@
         this->bMouseLook_ = false;
         this->mouseLookSpeed_ = 200;
-        this->bIsRocket_ = false;
 
         this->server_position_         = Vector3::ZERO;
@@ -88,4 +87,5 @@
         this->setPriority( Priority::VeryHigh );
         this->registerVariables();
+	this->team_ = -1;
     }
 
@@ -120,4 +120,5 @@
         SUPER(ControllableEntity, XMLPort, xmlelement, mode);
 
+        XMLPortParam(ControllableEntity, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
         XMLPortParam(ControllableEntity, "hudtemplate", setHudTemplate, getHudTemplate, xmlelement, mode);
         XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemplate, xmlelement, mode);
Index: code/trunk/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.h	(revision 8952)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.h	(revision 9016)
@@ -163,6 +163,9 @@
                 { return this->target_.get(); }
             void setTargetInternal( uint32_t targetID );
-            inline bool getRocket() const
-                { return this-> bIsRocket_; }
+
+	    inline void setTeam(int team)
+	        { this->team_ = team; }
+	    inline float getTeam() const
+	        { return this->team_; }
 
         protected:
@@ -183,5 +186,4 @@
 
             Ogre::SceneNode* cameraPositionRootNode_;
-            bool bIsRocket_; //Workaround to see, if the controllable entity is a Rocket.
 
         private:
@@ -240,4 +242,6 @@
             CameraPosition* reverseCamera_;
             WeakPtr<WorldEntity> target_;
+
+	    int team_ ; //<! teamnumber
     };
 }
Index: code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc	(revision 8952)
+++ code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc	(revision 9016)
@@ -270,5 +270,5 @@
     }
 
-    void FpsPlayer::boost() //acctually jump
+    void FpsPlayer::boost(bool bBoost) //acctually jump
     {
         if (this->isFloor_)
Index: code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h	(revision 8952)
+++ code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h	(revision 9016)
@@ -65,5 +65,5 @@
                 { return this->meshSrc_; }
 
-            void boost(); //acctually jump
+            void boost(bool bBoost); //acctually jump
 
             virtual void fire();
Index: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	(revision 8952)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc	(revision 9016)
@@ -129,4 +129,6 @@
         XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
         XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
+   
+        XMLPortParam ( RadarViewable, "RVName", setRVName, getRVName, xmlelement, mode );
     }
 
@@ -455,5 +457,5 @@
         SUPER(Pawn, changedActivity);
 
-        this->setRadarVisibility(this->isActive());
+        this->setRadarVisibility(this->isVisible());
     }
 
Index: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h	(revision 8952)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h	(revision 9016)
@@ -53,4 +53,5 @@
             inline bool isAlive() const
                 { return this->bAlive_; }
+
 
             virtual void setHealth(float health);
@@ -194,4 +195,5 @@
                 { return NULL; }
 
+
             float health_;
             float maxHealth_;
